Markup (JSON-LD) structured in schema.org - Version 4.4.0

Version Description

(2018-07-10) = * Checked : WordPress version 4.9.7 operation check. * Updated : Schema.ory Type "Image", "BlogPosting", "NewsArticle" image property added so that default image URL can be set.

Download this release

Release Info

Developer miiitaka
Plugin Icon 128x128 Markup (JSON-LD) structured in schema.org
Version 4.4.0
Comparing to
See all releases

Code changes from version 4.3.0 to 4.4.0

includes/admin/wp-structuring-admin-db.php CHANGED
@@ -3,7 +3,7 @@
3
  * Schema.org Admin DB Connection.
4
  *
5
  * @author Kazuya Takami
6
- * @version 4.3.0
7
  * @since 1.0.0
8
  */
9
  class Structuring_Markup_Admin_Db {
@@ -77,7 +77,7 @@ class Structuring_Markup_Admin_Db {
77
  /**
78
  * version up process.
79
  *
80
- * @version 4.3.0
81
  * @since 2.0.0
82
  * */
83
  $options = get_option( $text_domain );
@@ -102,7 +102,7 @@ class Structuring_Markup_Admin_Db {
102
  $activate = isset( $list->activate ) ? $list->activate : "";
103
 
104
  // version up default value setting.
105
- if ( $version === '4.3.0' && $key === 'breadcrumb' ) {
106
  $works = unserialize( $list->options );
107
  $works['current_link'] = 'on';
108
  $list->options = serialize( $works );
3
  * Schema.org Admin DB Connection.
4
  *
5
  * @author Kazuya Takami
6
+ * @version 4.4.0
7
  * @since 1.0.0
8
  */
9
  class Structuring_Markup_Admin_Db {
77
  /**
78
  * version up process.
79
  *
80
+ * @version 4.4.0
81
  * @since 2.0.0
82
  * */
83
  $options = get_option( $text_domain );
102
  $activate = isset( $list->activate ) ? $list->activate : "";
103
 
104
  // version up default value setting.
105
+ if ( $version >= '4.3.0' && $key === 'breadcrumb' ) {
106
  $works = unserialize( $list->options );
107
  $works['current_link'] = 'on';
108
  $list->options = serialize( $works );
includes/admin/wp-structuring-admin-type-article.php CHANGED
@@ -3,7 +3,7 @@
3
  * Schema.org Type Article
4
  *
5
  * @author Kazuya Takami
6
- * @version 4.1.3
7
  * @since 1.1.0
8
  * @see wp-structuring-admin-db.php
9
  * @link http://schema.org/Article
@@ -32,7 +32,7 @@ class Structuring_Markup_Type_Article {
32
  /**
33
  * Form Layout Render
34
  *
35
- * @version 4.1.3
36
  * @since 1.1.0
37
  * @param array $option
38
  */
@@ -66,6 +66,11 @@ class Structuring_Markup_Type_Article {
66
  }
67
  $html .= '>Set the first image in the content.<br><small>Pattern without feature image set (feature image takes precedence)</small>';
68
  $html .= '</td></tr>';
 
 
 
 
 
69
  $html .= '</table>';
70
  echo $html;
71
 
@@ -109,13 +114,14 @@ class Structuring_Markup_Type_Article {
109
  /**
110
  * Return the default options array
111
  *
112
- * @since 4.1.3
113
  * @version 2.2.0
114
  * @return array $args
115
  */
116
  private function get_default_options () {
117
  $args['name'] = '';
118
  $args['content_image'] = '';
 
119
  $args['logo'] = '';
120
  $args['logo-height'] = 0;
121
  $args['logo-width'] = 0;
3
  * Schema.org Type Article
4
  *
5
  * @author Kazuya Takami
6
+ * @version 4.4.0
7
  * @since 1.1.0
8
  * @see wp-structuring-admin-db.php
9
  * @link http://schema.org/Article
32
  /**
33
  * Form Layout Render
34
  *
35
+ * @version 4.4.0
36
  * @since 1.1.0
37
  * @param array $option
38
  */
66
  }
67
  $html .= '>Set the first image in the content.<br><small>Pattern without feature image set (feature image takes precedence)</small>';
68
  $html .= '</td></tr>';
69
+ $html .= '<tr><th><label for="default_image">Default image url :</label></th><td>';
70
+ $html .= '<input type="text" name="option[' . "default_image" . ']" id="default_image" class="regular-text" value="' . esc_attr( $option['default_image'] ) . '">';
71
+ $html .= '<button id="media-upload-default" class="dashicons-before dashicons-admin-media schema-admin-media-button"></button><br>';
72
+ $html .= '<small>Image output when feature image or content image check is not set.</small>';
73
+ $html .= '</td></tr>';
74
  $html .= '</table>';
75
  echo $html;
76
 
114
  /**
115
  * Return the default options array
116
  *
117
+ * @since 4.4.0
118
  * @version 2.2.0
119
  * @return array $args
120
  */
121
  private function get_default_options () {
122
  $args['name'] = '';
123
  $args['content_image'] = '';
124
+ $args['default_image'] = '';
125
  $args['logo'] = '';
126
  $args['logo-height'] = 0;
127
  $args['logo-width'] = 0;
includes/admin/wp-structuring-admin-type-blog-posting.php CHANGED
@@ -3,7 +3,7 @@
3
  * Schema.org Type BlogPosting
4
  *
5
  * @author Kazuya Takami
6
- * @version 4.1.3
7
  * @since 1.2.0
8
  * @see wp-structuring-admin-db.php
9
  * @link http://schema.org/BlogPosting
@@ -32,7 +32,7 @@ class Structuring_Markup_Type_Blog_Posting {
32
  /**
33
  * Form Layout Render
34
  *
35
- * @version 4.1.3
36
  * @since 1.2.0
37
  * @param array $option
38
  */
@@ -66,6 +66,11 @@ class Structuring_Markup_Type_Blog_Posting {
66
  }
67
  $html .= '>Set the first image in the content.<br><small>Pattern without feature image set (feature image takes precedence)</small>';
68
  $html .= '</td></tr>';
 
 
 
 
 
69
  $html .= '</table>';
70
  echo $html;
71
 
@@ -109,13 +114,14 @@ class Structuring_Markup_Type_Blog_Posting {
109
  /**
110
  * Return the default options array
111
  *
112
- * @version 4.1.3
113
  * @since 2.2.0
114
  * @return array $args
115
  */
116
  private function get_default_options () {
117
  $args['name'] = '';
118
  $args['content_image'] = '';
 
119
  $args['logo'] = '';
120
  $args['logo-height'] = 0;
121
  $args['logo-width'] = 0;
3
  * Schema.org Type BlogPosting
4
  *
5
  * @author Kazuya Takami
6
+ * @version 4.4.0
7
  * @since 1.2.0
8
  * @see wp-structuring-admin-db.php
9
  * @link http://schema.org/BlogPosting
32
  /**
33
  * Form Layout Render
34
  *
35
+ * @version 4.4.0
36
  * @since 1.2.0
37
  * @param array $option
38
  */
66
  }
67
  $html .= '>Set the first image in the content.<br><small>Pattern without feature image set (feature image takes precedence)</small>';
68
  $html .= '</td></tr>';
69
+ $html .= '<tr><th><label for="default_image">Default image url :</label></th><td>';
70
+ $html .= '<input type="text" name="option[' . "default_image" . ']" id="default_image" class="regular-text" value="' . esc_attr( $option['default_image'] ) . '">';
71
+ $html .= '<button id="media-upload-default" class="dashicons-before dashicons-admin-media schema-admin-media-button"></button><br>';
72
+ $html .= '<small>Image output when feature image or content image check is not set.</small>';
73
+ $html .= '</td></tr>';
74
  $html .= '</table>';
75
  echo $html;
76
 
114
  /**
115
  * Return the default options array
116
  *
117
+ * @version 4.4.0
118
  * @since 2.2.0
119
  * @return array $args
120
  */
121
  private function get_default_options () {
122
  $args['name'] = '';
123
  $args['content_image'] = '';
124
+ $args['default_image'] = '';
125
  $args['logo'] = '';
126
  $args['logo-height'] = 0;
127
  $args['logo-width'] = 0;
includes/admin/wp-structuring-admin-type-news-article.php CHANGED
@@ -3,7 +3,7 @@
3
  * Schema.org Type News Article
4
  *
5
  * @author Kazuya Takami
6
- * @version 4.1.3
7
  * @since 1.0.0
8
  * @see wp-structuring-admin-db.php
9
  * @link http://schema.org/NewsArticle
@@ -32,7 +32,7 @@ class Structuring_Markup_Type_NewsArticle {
32
  /**
33
  * Form Layout Render
34
  *
35
- * @version 4.1.3
36
  * @since 1.0.0
37
  * @param array $option
38
  */
@@ -66,6 +66,11 @@ class Structuring_Markup_Type_NewsArticle {
66
  }
67
  $html .= '>Set the first image in the content.<br><small>Pattern without feature image set (feature image takes precedence)</small>';
68
  $html .= '</td></tr>';
 
 
 
 
 
69
  $html .= '</table>';
70
  echo $html;
71
 
@@ -109,13 +114,14 @@ class Structuring_Markup_Type_NewsArticle {
109
  /**
110
  * Return the default options array
111
  *
112
- * @since 4.1.3
113
  * @version 2.2.0
114
  * @return array $args
115
  */
116
  private function get_default_options () {
117
  $args['name'] = '';
118
  $args['content_image'] = '';
 
119
  $args['logo'] = '';
120
  $args['logo-height'] = 0;
121
  $args['logo-width'] = 0;
3
  * Schema.org Type News Article
4
  *
5
  * @author Kazuya Takami
6
+ * @version 4.4.0
7
  * @since 1.0.0
8
  * @see wp-structuring-admin-db.php
9
  * @link http://schema.org/NewsArticle
32
  /**
33
  * Form Layout Render
34
  *
35
+ * @version 4.4.0
36
  * @since 1.0.0
37
  * @param array $option
38
  */
66
  }
67
  $html .= '>Set the first image in the content.<br><small>Pattern without feature image set (feature image takes precedence)</small>';
68
  $html .= '</td></tr>';
69
+ $html .= '<tr><th><label for="default_image">Default image url :</label></th><td>';
70
+ $html .= '<input type="text" name="option[' . "default_image" . ']" id="default_image" class="regular-text" value="' . esc_attr( $option['default_image'] ) . '">';
71
+ $html .= '<button id="media-upload-default" class="dashicons-before dashicons-admin-media schema-admin-media-button"></button><br>';
72
+ $html .= '<small>Image output when feature image or content image check is not set.</small>';
73
+ $html .= '</td></tr>';
74
  $html .= '</table>';
75
  echo $html;
76
 
114
  /**
115
  * Return the default options array
116
  *
117
+ * @since 4.4.0
118
  * @version 2.2.0
119
  * @return array $args
120
  */
121
  private function get_default_options () {
122
  $args['name'] = '';
123
  $args['content_image'] = '';
124
+ $args['default_image'] = '';
125
  $args['logo'] = '';
126
  $args['logo-height'] = 0;
127
  $args['logo-width'] = 0;
includes/meta/wp-structuring-meta-article.php CHANGED
@@ -3,7 +3,7 @@
3
  * Schema.org Type Article
4
  *
5
  * @author Kazuya Takami
6
- * @version 4.1.0
7
  * @since 4.0.0
8
  * @link http://schema.org/Article
9
  * @link https://developers.google.com/search/docs/data-types/articles
@@ -32,7 +32,7 @@ class Structuring_Markup_Meta_Article {
32
  /**
33
  * Setting schema.org Article
34
  *
35
- * @version 4.1.0
36
  * @since 4.0.0
37
  * @param array $options
38
  * @return array $args
@@ -85,6 +85,18 @@ class Structuring_Markup_Meta_Article {
85
  $args = array_merge( $args, $images_args );
86
  }
87
  }
 
 
 
 
 
 
 
 
 
 
 
 
88
  }
89
 
90
  if ( isset( $options['name'] ) ) {
3
  * Schema.org Type Article
4
  *
5
  * @author Kazuya Takami
6
+ * @version 4.4.0
7
  * @since 4.0.0
8
  * @link http://schema.org/Article
9
  * @link https://developers.google.com/search/docs/data-types/articles
32
  /**
33
  * Setting schema.org Article
34
  *
35
+ * @version 4.4.0
36
  * @since 4.0.0
37
  * @param array $options
38
  * @return array $args
85
  $args = array_merge( $args, $images_args );
86
  }
87
  }
88
+ } elseif ( isset( $options['default_image'] ) ) {
89
+ if ( $size = $this->utility->get_image_dimensions( $options['default_image'] ) ) {
90
+ $images_args = array(
91
+ "image" => array(
92
+ "@type" => "ImageObject",
93
+ "url" => esc_html( $options['default_image'] ),
94
+ "width" => $size['width'],
95
+ "height" => $size['height']
96
+ )
97
+ );
98
+ $args = array_merge( $args, $images_args );
99
+ }
100
  }
101
 
102
  if ( isset( $options['name'] ) ) {
includes/meta/wp-structuring-meta-blog-posting.php CHANGED
@@ -3,7 +3,7 @@
3
  * Schema.org Type BlogPosting
4
  *
5
  * @author Kazuya Takami
6
- * @version 4.1.0
7
  * @since 4.0.0
8
  * @link http://schema.org/BlogPosting
9
  * @link https://developers.google.com/search/docs/data-types/articles
@@ -32,7 +32,7 @@ class Structuring_Markup_Meta_Blog_Posting {
32
  /**
33
  * Setting schema.org BlogPosting
34
  *
35
- * @version 4.1.0
36
  * @since 4.0.0
37
  * @param array $options
38
  * @return array $args
@@ -86,6 +86,18 @@ class Structuring_Markup_Meta_Blog_Posting {
86
  $args = array_merge( $args, $images_args );
87
  }
88
  }
 
 
 
 
 
 
 
 
 
 
 
 
89
  }
90
 
91
  if ( isset( $options['name'] ) ) {
3
  * Schema.org Type BlogPosting
4
  *
5
  * @author Kazuya Takami
6
+ * @version 4.4.0
7
  * @since 4.0.0
8
  * @link http://schema.org/BlogPosting
9
  * @link https://developers.google.com/search/docs/data-types/articles
32
  /**
33
  * Setting schema.org BlogPosting
34
  *
35
+ * @version 4.4.0
36
  * @since 4.0.0
37
  * @param array $options
38
  * @return array $args
86
  $args = array_merge( $args, $images_args );
87
  }
88
  }
89
+ } elseif ( isset( $options['default_image'] ) ) {
90
+ if ( $size = $this->utility->get_image_dimensions( $options['default_image'] ) ) {
91
+ $images_args = array(
92
+ "image" => array(
93
+ "@type" => "ImageObject",
94
+ "url" => esc_html( $options['default_image'] ),
95
+ "width" => $size['width'],
96
+ "height" => $size['height']
97
+ )
98
+ );
99
+ $args = array_merge( $args, $images_args );
100
+ }
101
  }
102
 
103
  if ( isset( $options['name'] ) ) {
includes/meta/wp-structuring-meta-news-article.php CHANGED
@@ -3,7 +3,7 @@
3
  * Schema.org Type News Article
4
  *
5
  * @author Kazuya Takami
6
- * @version 4.1.0
7
  * @since 4.0.0
8
  * @link http://schema.org/NewsArticle
9
  * @link https://developers.google.com/search/docs/data-types/articles
@@ -32,7 +32,7 @@ class Structuring_Markup_Meta_NewsArticle {
32
  /**
33
  * Setting schema.org NewsArticle
34
  *
35
- * @version 4.1.0
36
  * @since 4.0.0
37
  * @param array $options
38
  * @return array $args
@@ -86,6 +86,18 @@ class Structuring_Markup_Meta_NewsArticle {
86
  $args = array_merge( $args, $images_args );
87
  }
88
  }
 
 
 
 
 
 
 
 
 
 
 
 
89
  }
90
 
91
  if ( isset( $options['name'] ) ) {
3
  * Schema.org Type News Article
4
  *
5
  * @author Kazuya Takami
6
+ * @version 4.4.0
7
  * @since 4.0.0
8
  * @link http://schema.org/NewsArticle
9
  * @link https://developers.google.com/search/docs/data-types/articles
32
  /**
33
  * Setting schema.org NewsArticle
34
  *
35
+ * @version 4.4.0
36
  * @since 4.0.0
37
  * @param array $options
38
  * @return array $args
86
  $args = array_merge( $args, $images_args );
87
  }
88
  }
89
+ } elseif ( isset( $options['default_image'] ) ) {
90
+ if ( $size = $this->utility->get_image_dimensions( $options['default_image'] ) ) {
91
+ $images_args = array(
92
+ "image" => array(
93
+ "@type" => "ImageObject",
94
+ "url" => esc_html( $options['default_image'] ),
95
+ "width" => $size['width'],
96
+ "height" => $size['height']
97
+ )
98
+ );
99
+ $args = array_merge( $args, $images_args );
100
+ }
101
  }
102
 
103
  if ( isset( $options['name'] ) ) {
js/media-uploader-main.js CHANGED
@@ -1,27 +1,37 @@
1
  (function($) {
2
  $(function() {
3
- var custom_uploader = wp.media({
4
- title: 'Choose Image',
5
- library: {
6
- type: 'image'
7
- },
8
- button: {
9
- text: 'Choose Image'
10
- },
11
- multiple: false
12
- });
 
 
13
 
14
  custom_uploader.on("select", function () {
15
- var images = custom_uploader.state().get('selection');
16
 
17
  images.each(function(file) {
18
- $("#logo").val(file.toJSON().url);
19
- $("#logo-width").val(file.toJSON().width);
20
- $("#logo-height").val(file.toJSON().height);
 
 
 
 
 
 
 
21
  });
22
  });
23
 
24
- $("#media-upload").on("click", function(e) {
 
25
  e.preventDefault();
26
  custom_uploader.open();
27
  });
1
  (function($) {
2
  $(function() {
3
+ var
4
+ custom_uploader = wp.media({
5
+ title: "Choose Image",
6
+ library: {
7
+ type: "image"
8
+ },
9
+ button: {
10
+ text: "Choose Image"
11
+ },
12
+ multiple: false
13
+ }),
14
+ media_id = "";
15
 
16
  custom_uploader.on("select", function () {
17
+ var images = custom_uploader.state().get("selection");
18
 
19
  images.each(function(file) {
20
+ switch (media_id) {
21
+ case "media-upload":
22
+ $("#logo").val(file.toJSON().url);
23
+ $("#logo-width").val(file.toJSON().width);
24
+ $("#logo-height").val(file.toJSON().height);
25
+ break;
26
+ case "media-upload-default":
27
+ $("#default_image").val(file.toJSON().url);
28
+ break;
29
+ }
30
  });
31
  });
32
 
33
+ $("#media-upload, #media-upload-default").on("click", function(e) {
34
+ media_id = e.target.id;
35
  e.preventDefault();
36
  custom_uploader.open();
37
  });
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: miiitaka
3
  Tags: schema, schema.org, json, json-ld, seo, post, posts, google, shortcode, breadcrumb
4
  Requires at least: 4.3.1
5
- Tested up to: 4.9.6
6
- Stable tag: 4.3.0
7
 
8
  Allows you to include schema.org JSON-LD syntax markup on your website
9
 
@@ -54,6 +54,10 @@ if ( shortcode_exists( 'wp-structuring-markup-breadcrumb' ) ) {
54
 
55
  == Changelog ==
56
 
 
 
 
 
57
  = 4.3.0 (2018-06-16) =
58
  * Checked : WordPress version 4.9.6 operation check.
59
  * Updated : Enable / disable function of link setting of current page of breadcrumbs.
2
  Contributors: miiitaka
3
  Tags: schema, schema.org, json, json-ld, seo, post, posts, google, shortcode, breadcrumb
4
  Requires at least: 4.3.1
5
+ Tested up to: 4.9.7
6
+ Stable tag: 4.4.0
7
 
8
  Allows you to include schema.org JSON-LD syntax markup on your website
9
 
54
 
55
  == Changelog ==
56
 
57
+ = 4.4.0 (2018-07-10) =
58
+ * Checked : WordPress version 4.9.7 operation check.
59
+ * Updated : Schema.ory Type "Image", "BlogPosting", "NewsArticle" image property added so that default image URL can be set.
60
+
61
  = 4.3.0 (2018-06-16) =
62
  * Checked : WordPress version 4.9.6 operation check.
63
  * Updated : Enable / disable function of link setting of current page of breadcrumbs.
wp-structuring-markup.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Markup (JSON-LD) structured in schema.org
4
  Plugin URI: https://github.com/miiitaka/wp-structuring-markup
5
  Description: Allows you to include schema.org JSON-LD syntax markup on your website
6
- Version: 4.3.0
7
  Author: Kazuya Takami
8
  Author URI: https://www.terakoya.work/
9
  License: GPLv2 or later
@@ -18,7 +18,7 @@ new Structuring_Markup();
18
  * Schema.org Basic Class
19
  *
20
  * @author Kazuya Takami
21
- * @version 4.3.0
22
  * @since 1.0.0
23
  */
24
  class Structuring_Markup {
@@ -26,10 +26,10 @@ class Structuring_Markup {
26
  /**
27
  * Variable definition version.
28
  *
29
- * @version 4.3.0
30
  * @since 1.3.0
31
  */
32
- private $version = '4.3.0';
33
 
34
  /**
35
  * Variable definition Text Domain.
3
  Plugin Name: Markup (JSON-LD) structured in schema.org
4
  Plugin URI: https://github.com/miiitaka/wp-structuring-markup
5
  Description: Allows you to include schema.org JSON-LD syntax markup on your website
6
+ Version: 4.4.0
7
  Author: Kazuya Takami
8
  Author URI: https://www.terakoya.work/
9
  License: GPLv2 or later
18
  * Schema.org Basic Class
19
  *
20
  * @author Kazuya Takami
21
+ * @version 4.4.0
22
  * @since 1.0.0
23
  */
24
  class Structuring_Markup {
26
  /**
27
  * Variable definition version.
28
  *
29
+ * @version 4.4.0
30
  * @since 1.3.0
31
  */
32
+ private $version = '4.4.0';
33
 
34
  /**
35
  * Variable definition Text Domain.