WP SEO Structured Data Schema - Version 2.6.17.1

Version Description

  • Fix post save issue

=

Download this release

Release Info

Developer kcseopro
Plugin Icon 128x128 WP SEO Structured Data Schema
Version 2.6.17.1
Comparing to
See all releases

Code changes from version 2.6.17 to 2.6.17.1

README.txt CHANGED
@@ -4,7 +4,7 @@ Donate link:
4
  Tags: seo, schema, structured data, rich snippets, microdata, json-ld, search engine optimization, local seo, google, sitelinks, schema.org, microformat, serp
5
  Requires at least: 4.5
6
  Tested up to: 5.7
7
- Stable tag: 2.6.17
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -114,8 +114,11 @@ You'll find the [FAQ on WPSEMPlugins.com](https://wpsemplugins.com/wordpress-seo
114
 
115
  == Changelog ==
116
 
 
 
 
117
  == 2.6.17 =
118
- * Update description issue at expoert
119
 
120
  == 2.6.16 =
121
  * Add WordPress 5.7 compatibility
4
  Tags: seo, schema, structured data, rich snippets, microdata, json-ld, search engine optimization, local seo, google, sitelinks, schema.org, microformat, serp
5
  Requires at least: 4.5
6
  Tested up to: 5.7
7
+ Stable tag: 2.6.17.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
114
 
115
  == Changelog ==
116
 
117
+ == 2.6.17.1 =
118
+ * Fix post save issue
119
+
120
  == 2.6.17 =
121
+ * Update description issue at export
122
 
123
  == 2.6.16 =
124
  * Add WordPress 5.7 compatibility
languages/wp-seo-structured-data-schema.pot CHANGED
@@ -97,11 +97,11 @@ msgstr ""
97
  msgid "Settings"
98
  msgstr ""
99
 
100
- #: ../lib/classes/KcSeoMetaData.php:62, ../lib/views/schema-options.php:26
101
  msgid "For more detailed information on how to configure this plugin, please visit:"
102
  msgstr ""
103
 
104
- #: ../lib/classes/KcSeoMetaData.php:63
105
  msgid "Once you save these structured data schema settings, validate this page url here:"
106
  msgstr ""
107
 
97
  msgid "Settings"
98
  msgstr ""
99
 
100
+ #: ../lib/classes/KcSeoMetaData.php:63, ../lib/views/schema-options.php:26
101
  msgid "For more detailed information on how to configure this plugin, please visit:"
102
  msgstr ""
103
 
104
+ #: ../lib/classes/KcSeoMetaData.php:64
105
  msgid "Once you save these structured data schema settings, validate this page url here:"
106
  msgstr ""
107
 
lib/classes/KcSeoMetaData.php CHANGED
@@ -1,89 +1,90 @@
1
  <?php
2
 
3
- if ( ! class_exists( 'KcSeoMetaData' ) ):
4
-
5
- class KcSeoMetaData {
6
-
7
- function __construct() {
8
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
9
- add_action( 'save_post', array( $this, 'save_KcSeo_schema_data' ), 10, 3 );
10
- }
11
-
12
- function admin_enqueue_scripts() {
13
- global $pagenow, $typenow, $KcSeoWPSchema;
14
- // validate page
15
- $pt = $KcSeoWPSchema->kcSeoPostTypes();
16
- if ( ! in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) {
17
- return;
18
- }
19
- if ( ! in_array( $typenow, $pt ) ) {
20
- return;
21
- }
22
-
23
- // scripts
24
- wp_enqueue_script( array(
25
- 'jquery',
26
- 'kcseo-select2-js',
27
- 'kcseo-admin-js',
28
- ) );
29
-
30
- // styles
31
- wp_enqueue_style( array(
32
- 'kcseo-select2-css',
33
- 'kcseo-admin-css',
34
- ) );
35
-
36
- add_action( 'admin_head', array( $this, 'admin_head' ) );
37
- }
38
-
39
- function admin_head() {
40
- global $KcSeoWPSchema;
41
- $pt = $KcSeoWPSchema->kcSeoPostTypes();
42
- foreach ( $pt as $postType ) {
43
- add_meta_box(
44
- 'kcseo-wordpres-seo-structured-data-schema-meta-box',
45
- __( 'WP SEO Structured Data Schema by <a href="https://wpsemplugins.com/">WPSEMPlugins.com</a>', KCSEO_WP_SCHEMA_SLUG ),
46
- array( $this, 'meta_box_wp_schema' ),
47
- $postType,
48
- 'normal',
49
- 'high'
50
- );
51
- }
52
-
53
- }
54
-
55
- function meta_box_wp_schema( $post ) {
56
- global $KcSeoWPSchema;
57
- wp_nonce_field( $KcSeoWPSchema->nonceText(), '_kcseo_nonce' );
58
- $_kcseo_ative_tab = get_post_meta( $post->ID, '_kcseo_ative_tab', true );
59
- $schemas = new KcSeoSchemaModel();
60
- $html = null;
61
- $html .= "<div class='schema-tips'>";
62
- $html .= "<p><span>Tip:</span> " . __( "For more detailed information on how to configure this plugin, please visit:", "wp-seo-structured-data-schema" ) . " <a href='https://wpsemplugins.com/wordpress-seo-structured-data-schema-plugin/'>https://wpsemplugins.com/wordpress-seo-structured-data-schema-plugin/</a></p>";
63
- $html .= "<p><span>Tip:</span> " . __( "Once you save these structured data schema settings, validate this page url here:", "wp-seo-structured-data-schema" ) . " <a href='https://developers.google.com/structured-data/testing-tool/'>https://developers.google.com/structured-data/testing-tool/</a></p>";
64
- $html .= "</div>";
65
- $html .= "<div class='schema-holder'>";
66
- $html .= '<div id="meta-tab-holder" class="rt-tab-container">';
67
- $htmlMenu = null;
68
- $htmlCont = null;
69
- $htmlMenu .= "<ul class='rt-tab-nav'>";
70
- $schemaFields = KcSeoOptions::getSchemaTypes();
71
- $i = 0;
72
- foreach ( $schemaFields as $schemaID => $schema ) {
73
- $tabId = $KcSeoWPSchema->KcSeoPrefix . $schemaID;
74
- $activeClass = ( ( ! $_kcseo_ative_tab && $i === 0 ) || $tabId === $_kcseo_ative_tab ) ? ' active' : null;
75
- $i ++;
76
- $htmlMenu .= '<li data-id="' . $tabId . '" class="' . $activeClass . '"><a href="#' . $tabId . '">' . $schema['title'] . '</a></li>';
77
- $htmlCont .= "<div id='{$tabId}' class='rt-tab-content{$activeClass}'>";
78
- $htmlCont .= "<div class='kc-top-toolbar'><span class='disabled button button-primary'>" . __( "Auto Fill", "wp-seo-structured-data-schema-pro" ) . "</span><span class='kcseo-pro-label'>" . __( "PRO", "wp-seo-structured-data-schema-pro" ) . "</span></div>";
79
- $metaData = get_post_meta( $post->ID, $tabId, true );
80
- $metaData = ( is_array( $metaData ) ? $metaData : array() );
81
- if ( ! empty( $schema['fields'] ) ) {
82
- foreach ( $schema['fields'] as $fieldId => $data ) {
83
- $data['fieldId'] = $fieldId;
84
- $data['id'] = $tabId . "_" . $fieldId;
85
- $data['name'] = $tabId . "[{$fieldId}]";
86
- $data['value'] = ( ! empty( $metaData[ $fieldId ] ) ? $metaData[ $fieldId ] : null );
 
87
  if ($data['type'] === 'group' && !empty($data['fields'])) {
88
  $groupMetaData = isset($metaData[$fieldId]) && !empty($metaData[$fieldId]) ? $metaData[$fieldId] : array(array());
89
  $html_g = null;
@@ -112,71 +113,71 @@ if ( ! class_exists( 'KcSeoMetaData' ) ):
112
  $html_g
113
  );
114
 
115
- }else {
116
  $htmlCont .= $schemas->get_field($data);
117
  }
118
- }
119
- }
120
- if ( ! empty( $schema['pro'] ) && $schema['pro'] ) {
121
- $htmlCont .= "<div class='kcseo-pro-feature'>" . __( "This is a Pro version feature.", "wp-seo-structured-data-schema-pro" ) . "<a href='https://wpsemplugins.com/downloads/wordpress-schema-plugin/' target='_blank'>(more info)</a></div>";
122
- }
123
- $htmlCont .= "</div>";
124
- }
125
- $htmlMenu .= "</ul>";
126
- $html .= $htmlMenu . $htmlCont;
127
- $html .= '<input type="hidden" id="_kcseo_ative_tab" name="_kcseo_ative_tab" value="' . $_kcseo_ative_tab . '" />';
128
- $html .= "</div>";
129
- $html .= "</div>";
130
- echo $html;
131
- }
132
-
133
- function save_KcSeo_schema_data( $post_id, $post, $update ) {
134
- if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
135
- return $post_id;
136
- }
137
- global $KcSeoWPSchema;
138
- $nonce = ! empty( $_REQUEST['_kcseo_nonce'] ) ? $_REQUEST['_kcseo_nonce'] : null;
139
- if ( ! wp_verify_nonce( $nonce, $KcSeoWPSchema->nonceText() ) ) {
140
- return $post_id;
141
- }
142
-
143
- // Check permissions
144
- if ( ! empty( $_GET['post_type'] ) ) {
145
- if ( ! current_user_can( 'edit_' . $_GET['post_type'], $post_id ) ) {
146
- return $post_id;
147
- }
148
- }
149
- $pt = $KcSeoWPSchema->kcSeoPostTypes();
150
- if ( ! in_array( $post->post_type, $pt ) ) {
151
- return $post_id;
152
- }
153
-
154
- $meta = array();
155
- $schemaModel = new KcSeoSchemaModel;
156
- $schemaFields = KcSeoOptions::getSchemaTypes();
157
- foreach ( $schemaFields as $schemaID => $schema ) {
158
- $schemaMetaId = $KcSeoWPSchema->KcSeoPrefix . $schemaID;
159
- $data = array();
160
- if ( ! empty( $schema['fields'] ) ) {
161
- foreach ( $schema['fields'] as $fieldId => $fieldData ) {
162
- $value = ( ! empty( $_REQUEST[ $schemaMetaId ][ $fieldId ] ) ? $_REQUEST[ $schemaMetaId ][ $fieldId ] : null );
163
- $value = $KcSeoWPSchema->sanitize( $fieldData, $value );
164
- $data[ $fieldId ] = $value;
165
- }
166
- }
167
- $meta[ $schemaMetaId ] = $data;
168
- }
169
- /* _kcseo_ative_tab */
170
- if ( isset( $_POST['_kcseo_ative_tab'] ) ) {
171
- $meta['_kcseo_ative_tab'] = sanitize_text_field( $_POST['_kcseo_ative_tab'] );
172
- }
173
- if ( count( $meta ) > 0 ) {
174
- foreach ( $meta as $mKey => $mValue ) {
175
- update_post_meta( $post_id, $mKey, $mValue );
176
- }
177
- }
178
- }
179
-
180
- }
181
 
182
  endif;
1
  <?php
2
 
3
+ if (!class_exists('KcSeoMetaData')):
4
+
5
+ class KcSeoMetaData
6
+ {
7
+
8
+ function __construct() {
9
+ add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
10
+ add_action('save_post', array($this, 'save_KcSeo_schema_data'), 10, 3);
11
+ }
12
+
13
+ function admin_enqueue_scripts() {
14
+ global $pagenow, $typenow, $KcSeoWPSchema;
15
+ // validate page
16
+ $pt = $KcSeoWPSchema->kcSeoPostTypes();
17
+ if (!in_array($pagenow, array('post.php', 'post-new.php'))) {
18
+ return;
19
+ }
20
+ if (!in_array($typenow, $pt)) {
21
+ return;
22
+ }
23
+
24
+ // scripts
25
+ wp_enqueue_script(array(
26
+ 'jquery',
27
+ 'kcseo-select2-js',
28
+ 'kcseo-admin-js',
29
+ ));
30
+
31
+ // styles
32
+ wp_enqueue_style(array(
33
+ 'kcseo-select2-css',
34
+ 'kcseo-admin-css',
35
+ ));
36
+
37
+ add_action('admin_head', array($this, 'admin_head'));
38
+ }
39
+
40
+ function admin_head() {
41
+ global $KcSeoWPSchema;
42
+ $pt = $KcSeoWPSchema->kcSeoPostTypes();
43
+ foreach ($pt as $postType) {
44
+ add_meta_box(
45
+ 'kcseo-wordpres-seo-structured-data-schema-meta-box',
46
+ __('WP SEO Structured Data Schema by <a href="https://wpsemplugins.com/">WPSEMPlugins.com</a>', KCSEO_WP_SCHEMA_SLUG),
47
+ array($this, 'meta_box_wp_schema'),
48
+ $postType,
49
+ 'normal',
50
+ 'high'
51
+ );
52
+ }
53
+
54
+ }
55
+
56
+ function meta_box_wp_schema($post) {
57
+ global $KcSeoWPSchema;
58
+ wp_nonce_field($KcSeoWPSchema->nonceText(), '_kcseo_nonce');
59
+ $_kcseo_ative_tab = get_post_meta($post->ID, '_kcseo_ative_tab', true);
60
+ $schemas = new KcSeoSchemaModel();
61
+ $html = null;
62
+ $html .= "<div class='schema-tips'>";
63
+ $html .= "<p><span>Tip:</span> " . __("For more detailed information on how to configure this plugin, please visit:", "wp-seo-structured-data-schema") . " <a href='https://wpsemplugins.com/wordpress-seo-structured-data-schema-plugin/'>https://wpsemplugins.com/wordpress-seo-structured-data-schema-plugin/</a></p>";
64
+ $html .= "<p><span>Tip:</span> " . __("Once you save these structured data schema settings, validate this page url here:", "wp-seo-structured-data-schema") . " <a href='https://developers.google.com/structured-data/testing-tool/'>https://developers.google.com/structured-data/testing-tool/</a></p>";
65
+ $html .= "</div>";
66
+ $html .= "<div class='schema-holder'>";
67
+ $html .= '<div id="meta-tab-holder" class="rt-tab-container">';
68
+ $htmlMenu = null;
69
+ $htmlCont = null;
70
+ $htmlMenu .= "<ul class='rt-tab-nav'>";
71
+ $schemaFields = KcSeoOptions::getSchemaTypes();
72
+ $i = 0;
73
+ foreach ($schemaFields as $schemaID => $schema) {
74
+ $tabId = $KcSeoWPSchema->KcSeoPrefix . $schemaID;
75
+ $activeClass = ((!$_kcseo_ative_tab && $i === 0) || $tabId === $_kcseo_ative_tab) ? ' active' : null;
76
+ $i++;
77
+ $htmlMenu .= '<li data-id="' . $tabId . '" class="' . $activeClass . '"><a href="#' . $tabId . '">' . $schema['title'] . '</a></li>';
78
+ $htmlCont .= "<div id='{$tabId}' class='rt-tab-content{$activeClass}'>";
79
+ $htmlCont .= "<div class='kc-top-toolbar'><span class='disabled button button-primary'>" . __("Auto Fill", "wp-seo-structured-data-schema-pro") . "</span><span class='kcseo-pro-label'>" . __("PRO", "wp-seo-structured-data-schema-pro") . "</span></div>";
80
+ $metaData = get_post_meta($post->ID, $tabId, true);
81
+ $metaData = (is_array($metaData) ? $metaData : array());
82
+ if (!empty($schema['fields'])) {
83
+ foreach ($schema['fields'] as $fieldId => $data) {
84
+ $data['fieldId'] = $fieldId;
85
+ $data['id'] = $tabId . "_" . $fieldId;
86
+ $data['name'] = $tabId . "[{$fieldId}]";
87
+ $data['value'] = (!empty($metaData[$fieldId]) ? $metaData[$fieldId] : null);
88
  if ($data['type'] === 'group' && !empty($data['fields'])) {
89
  $groupMetaData = isset($metaData[$fieldId]) && !empty($metaData[$fieldId]) ? $metaData[$fieldId] : array(array());
90
  $html_g = null;
113
  $html_g
114
  );
115
 
116
+ } else {
117
  $htmlCont .= $schemas->get_field($data);
118
  }
119
+ }
120
+ }
121
+ if (!empty($schema['pro']) && $schema['pro']) {
122
+ $htmlCont .= "<div class='kcseo-pro-feature'>" . __("This is a Pro version feature.", "wp-seo-structured-data-schema-pro") . "<a href='https://wpsemplugins.com/downloads/wordpress-schema-plugin/' target='_blank'>(more info)</a></div>";
123
+ }
124
+ $htmlCont .= "</div>";
125
+ }
126
+ $htmlMenu .= "</ul>";
127
+ $html .= $htmlMenu . $htmlCont;
128
+ $html .= '<input type="hidden" id="_kcseo_ative_tab" name="_kcseo_ative_tab" value="' . $_kcseo_ative_tab . '" />';
129
+ $html .= "</div>";
130
+ $html .= "</div>";
131
+ echo $html;
132
+ }
133
+
134
+ function save_KcSeo_schema_data($post_id, $post, $update) {
135
+ if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
136
+ return $post_id;
137
+ }
138
+ global $KcSeoWPSchema;
139
+ $nonce = !empty($_REQUEST['_kcseo_nonce']) ? $_REQUEST['_kcseo_nonce'] : null;
140
+ if (!wp_verify_nonce($nonce, $KcSeoWPSchema->nonceText())) {
141
+ return $post_id;
142
+ }
143
+
144
+ // Check permissions
145
+ if (!empty($_GET['post_type'])) {
146
+ if (!current_user_can('edit_' . $_GET['post_type'], $post_id)) {
147
+ return $post_id;
148
+ }
149
+ }
150
+ $pt = $KcSeoWPSchema->kcSeoPostTypes();
151
+ if (!in_array($post->post_type, $pt)) {
152
+ return $post_id;
153
+ }
154
+
155
+ $meta = array();
156
+ $schemaModel = new KcSeoSchemaModel;
157
+ $schemaFields = KcSeoOptions::getSchemaTypes();
158
+ foreach ($schemaFields as $schemaID => $schema) {
159
+ $schemaMetaId = $KcSeoWPSchema->KcSeoPrefix . $schemaID;
160
+ $data = array();
161
+ if (!empty($schema['fields'])) {
162
+ foreach ($schema['fields'] as $fieldId => $fieldData) {
163
+ $value = (!empty($_REQUEST[$schemaMetaId][$fieldId]) ? $_REQUEST[$schemaMetaId][$fieldId] : null);
164
+ $value = $KcSeoWPSchema->sanitize($fieldId, $fieldData, $value);
165
+ $data[$fieldId] = $value;
166
+ }
167
+ }
168
+ $meta[$schemaMetaId] = $data;
169
+ }
170
+ /* _kcseo_ative_tab */
171
+ if (isset($_POST['_kcseo_ative_tab'])) {
172
+ $meta['_kcseo_ative_tab'] = sanitize_text_field($_POST['_kcseo_ative_tab']);
173
+ }
174
+ if (count($meta) > 0) {
175
+ foreach ($meta as $mKey => $mValue) {
176
+ update_post_meta($post_id, $mKey, $mValue);
177
+ }
178
+ }
179
+ }
180
+
181
+ }
182
 
183
  endif;
wp-seo-structured-data-schema.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WP SEO Structured Data Schema
4
  * Plugin URI: https://wpsemplugins.com/
5
  * Description: Comprehensive JSON-LD based Structured Data solution for WordPress for adding schema for organizations, businesses, blog posts, ratings & more.
6
- * Version: 2.6.17
7
  * Author: WPSEMPlugins
8
  * Author URI: https://wpsemplugins.com/
9
  * Text Domain: wp-seo-structured-data-schema
3
  * Plugin Name: WP SEO Structured Data Schema
4
  * Plugin URI: https://wpsemplugins.com/
5
  * Description: Comprehensive JSON-LD based Structured Data solution for WordPress for adding schema for organizations, businesses, blog posts, ratings & more.
6
+ * Version: 2.6.17.1
7
  * Author: WPSEMPlugins
8
  * Author URI: https://wpsemplugins.com/
9
  * Text Domain: wp-seo-structured-data-schema