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

Version Description

(2019-03-11) = * Fixed : A bug where the modification date is fixed to GMT time.

Download this release

Release Info

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

Code changes from version 4.6.4 to 4.6.5

includes/meta/wp-structuring-meta-article.php CHANGED
@@ -1,148 +1,148 @@
1
- <?php
2
- /**
3
- * Schema.org Type Article
4
- *
5
- * @author Kazuya Takami
6
- * @version 4.5.0
7
- * @since 4.0.0
8
- * @link http://schema.org/Article
9
- * @link https://developers.google.com/search/docs/data-types/articles
10
- * @link https://developers.google.com/search/docs/data-types/speakable
11
- */
12
- class Structuring_Markup_Meta_Article {
13
-
14
- /**
15
- * Utility
16
- *
17
- * @version 4.0.0
18
- * @since 4.0.0
19
- */
20
- private $utility;
21
-
22
- /**
23
- * Constructor Define.
24
- *
25
- * @version 4.0.0
26
- * @since 4.0.0
27
- * @param Structuring_Markup_Utility $utility
28
- */
29
- public function __construct ( Structuring_Markup_Utility $utility ) {
30
- $this->utility = $utility;
31
- }
32
-
33
- /**
34
- * Setting schema.org Article
35
- *
36
- * @version 4.5.0
37
- * @since 4.0.0
38
- * @param array $options
39
- * @return array $args
40
- */
41
- public function set_meta ( array $options ) {
42
- global $post;
43
-
44
- $excerpt = $this->utility->escape_text( $post->post_excerpt );
45
- $content = $excerpt === "" ? mb_substr( $this->utility->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
46
-
47
- $args = array(
48
- "@context" => "http://schema.org",
49
- "@type" => "Article",
50
- "mainEntityOfPage" => array(
51
- "@type" => "WebPage",
52
- "@id" => get_permalink( $post->ID )
53
- ),
54
- "headline" => mb_substr( esc_html( $post->post_title ), 0, 110 ),
55
- "datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
56
- "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
57
- "author" => array(
58
- "@type" => "Person",
59
- "name" => esc_html( get_the_author_meta( 'display_name', $post->post_author ) )
60
- ),
61
- "description" => $content
62
- );
63
-
64
- if ( has_post_thumbnail( $post->ID ) ) {
65
- $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
66
- $images_args = array(
67
- "image" => array(
68
- "@type" => "ImageObject",
69
- "url" => $images[0],
70
- "width" => $images[1],
71
- "height" => $images[2]
72
- )
73
- );
74
- $args = array_merge( $args, $images_args );
75
- } elseif ( isset( $options['content_image'] ) && $options['content_image'] === 'on' ) {
76
- if ( $images = $this->utility->get_content_image( $post->post_content ) ) {
77
- if ( $size = $this->utility->get_image_dimensions( $images ) ) {
78
- $images_args = array(
79
- "image" => array(
80
- "@type" => "ImageObject",
81
- "url" => $images,
82
- "width" => $size['width'],
83
- "height" => $size['height']
84
- )
85
- );
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'] ) ) {
104
- $publisher_args = array(
105
- "publisher" => array(
106
- "@type" => "Organization",
107
- "name" => esc_html( $options['name'] ),
108
- )
109
- );
110
-
111
- $options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
112
-
113
- if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
114
- $publisher_args['publisher']['logo'] = array(
115
- "@type" => "ImageObject",
116
- "url" => $options['logo'],
117
- "width" => $logo['width'],
118
- "height" => $logo['height']
119
- );
120
- } else if ( !empty( $options['logo'] ) ) {
121
- $publisher_args['publisher']['logo'] = array(
122
- "@type" => "ImageObject",
123
- "url" => $options['logo'],
124
- "width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
125
- "height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
126
- );
127
- }
128
- $args = array_merge( $args, $publisher_args );
129
- }
130
-
131
- if ( isset( $options['speakable_action'] ) && $options['speakable_action'] === 'on' ) {
132
- $speakable_type = isset( $options['speakable_type'] ) ? $options['speakable_type'] : '';
133
-
134
- if ( !empty( $speakable_type ) ) {
135
- $action_array = array(
136
- "@type" => "SpeakableSpecification"
137
- );
138
- $action_array[$speakable_type] = array(
139
- isset( $options['speakable_headline'] ) ? stripslashes( $options['speakable_headline'] ) : '',
140
- isset( $options['speakable_summary'] ) ? stripslashes( $options['speakable_summary'] ) : ''
141
- );
142
- $args['speakable'] = $action_array;
143
- }
144
- }
145
-
146
- return (array) $args;
147
- }
148
  }
1
+ <?php
2
+ /**
3
+ * Schema.org Type Article
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.6.5
7
+ * @since 4.0.0
8
+ * @link http://schema.org/Article
9
+ * @link https://developers.google.com/search/docs/data-types/articles
10
+ * @link https://developers.google.com/search/docs/data-types/speakable
11
+ */
12
+ class Structuring_Markup_Meta_Article {
13
+
14
+ /**
15
+ * Utility
16
+ *
17
+ * @version 4.0.0
18
+ * @since 4.0.0
19
+ */
20
+ private $utility;
21
+
22
+ /**
23
+ * Constructor Define.
24
+ *
25
+ * @version 4.0.0
26
+ * @since 4.0.0
27
+ * @param Structuring_Markup_Utility $utility
28
+ */
29
+ public function __construct ( Structuring_Markup_Utility $utility ) {
30
+ $this->utility = $utility;
31
+ }
32
+
33
+ /**
34
+ * Setting schema.org Article
35
+ *
36
+ * @version 4.6.5
37
+ * @since 4.0.0
38
+ * @param array $options
39
+ * @return array $args
40
+ */
41
+ public function set_meta ( array $options ) {
42
+ global $post;
43
+
44
+ $excerpt = $this->utility->escape_text( $post->post_excerpt );
45
+ $content = $excerpt === "" ? mb_substr( $this->utility->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
46
+
47
+ $args = array(
48
+ "@context" => "http://schema.org",
49
+ "@type" => "Article",
50
+ "mainEntityOfPage" => array(
51
+ "@type" => "WebPage",
52
+ "@id" => get_permalink( $post->ID )
53
+ ),
54
+ "headline" => mb_substr( esc_html( $post->post_title ), 0, 110 ),
55
+ "datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
56
+ "dateModified" => get_the_modified_time( DATE_ISO8601, $post->ID ),
57
+ "author" => array(
58
+ "@type" => "Person",
59
+ "name" => esc_html( get_the_author_meta( 'display_name', $post->post_author ) )
60
+ ),
61
+ "description" => $content
62
+ );
63
+
64
+ if ( has_post_thumbnail( $post->ID ) ) {
65
+ $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
66
+ $images_args = array(
67
+ "image" => array(
68
+ "@type" => "ImageObject",
69
+ "url" => $images[0],
70
+ "width" => $images[1],
71
+ "height" => $images[2]
72
+ )
73
+ );
74
+ $args = array_merge( $args, $images_args );
75
+ } elseif ( isset( $options['content_image'] ) && $options['content_image'] === 'on' ) {
76
+ if ( $images = $this->utility->get_content_image( $post->post_content ) ) {
77
+ if ( $size = $this->utility->get_image_dimensions( $images ) ) {
78
+ $images_args = array(
79
+ "image" => array(
80
+ "@type" => "ImageObject",
81
+ "url" => $images,
82
+ "width" => $size['width'],
83
+ "height" => $size['height']
84
+ )
85
+ );
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'] ) ) {
104
+ $publisher_args = array(
105
+ "publisher" => array(
106
+ "@type" => "Organization",
107
+ "name" => esc_html( $options['name'] ),
108
+ )
109
+ );
110
+
111
+ $options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
112
+
113
+ if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
114
+ $publisher_args['publisher']['logo'] = array(
115
+ "@type" => "ImageObject",
116
+ "url" => $options['logo'],
117
+ "width" => $logo['width'],
118
+ "height" => $logo['height']
119
+ );
120
+ } else if ( !empty( $options['logo'] ) ) {
121
+ $publisher_args['publisher']['logo'] = array(
122
+ "@type" => "ImageObject",
123
+ "url" => $options['logo'],
124
+ "width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
125
+ "height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
126
+ );
127
+ }
128
+ $args = array_merge( $args, $publisher_args );
129
+ }
130
+
131
+ if ( isset( $options['speakable_action'] ) && $options['speakable_action'] === 'on' ) {
132
+ $speakable_type = isset( $options['speakable_type'] ) ? $options['speakable_type'] : '';
133
+
134
+ if ( !empty( $speakable_type ) ) {
135
+ $action_array = array(
136
+ "@type" => "SpeakableSpecification"
137
+ );
138
+ $action_array[$speakable_type] = array(
139
+ isset( $options['speakable_headline'] ) ? stripslashes( $options['speakable_headline'] ) : '',
140
+ isset( $options['speakable_summary'] ) ? stripslashes( $options['speakable_summary'] ) : ''
141
+ );
142
+ $args['speakable'] = $action_array;
143
+ }
144
+ }
145
+
146
+ return (array) $args;
147
+ }
148
  }
includes/meta/wp-structuring-meta-blog-posting.php CHANGED
@@ -1,149 +1,148 @@
1
- <?php
2
- /**
3
- * Schema.org Type BlogPosting
4
- *
5
- * @author Kazuya Takami
6
- * @version 4.5.0
7
- * @since 4.0.0
8
- * @link http://schema.org/BlogPosting
9
- * @link https://developers.google.com/search/docs/data-types/articles
10
- * @link https://developers.google.com/search/docs/data-types/speakable
11
- */
12
- class Structuring_Markup_Meta_Blog_Posting {
13
-
14
- /**
15
- * Utility
16
- *
17
- * @version 4.0.0
18
- * @since 4.0.0
19
- */
20
- private $utility;
21
-
22
- /**
23
- * Constructor Define.
24
- *
25
- * @version 4.5.0
26
- * @since 4.0.0
27
- * @param Structuring_Markup_Utility $utility
28
- */
29
- public function __construct ( Structuring_Markup_Utility $utility ) {
30
- $this->utility = $utility;
31
- }
32
-
33
- /**
34
- * Setting schema.org BlogPosting
35
- *
36
- * @version 4.4.0
37
- * @since 4.0.0
38
- * @param array $options
39
- * @return array $args
40
- */
41
- public function set_meta ( array $options ) {
42
- global $post;
43
-
44
- $excerpt = $this->utility->escape_text( $post->post_excerpt );
45
- $content = $excerpt === "" ? mb_substr( $this->utility->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
46
-
47
- $args = array(
48
- "@context" => "http://schema.org",
49
- "@type" => "BlogPosting",
50
- "mainEntityOfPage" => array(
51
- "@type" => "WebPage",
52
- "@id" => get_permalink( $post->ID )
53
- ),
54
- "headline" => mb_substr( esc_html( $post->post_title ), 0, 110 ),
55
- "datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
56
- "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
57
- "author" => array(
58
- "@type" => "Person",
59
- "name" => esc_html( get_the_author_meta( 'display_name', $post->post_author ) )
60
- ),
61
- "description" => $content
62
- );
63
-
64
- if ( has_post_thumbnail( $post->ID ) ) {
65
- $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
66
-
67
- $images_args = array(
68
- "image" => array(
69
- "@type" => "ImageObject",
70
- "url" => $images[0],
71
- "width" => $images[1],
72
- "height" => $images[2]
73
- )
74
- );
75
- $args = array_merge( $args, $images_args );
76
- } elseif ( isset( $options['content_image'] ) && $options['content_image'] === 'on' ) {
77
- if ( $images = $this->utility->get_content_image( $post->post_content ) ) {
78
- if ( $size = $this->utility->get_image_dimensions( $images ) ) {
79
- $images_args = array(
80
- "image" => array(
81
- "@type" => "ImageObject",
82
- "url" => $images,
83
- "width" => $size['width'],
84
- "height" => $size['height']
85
- )
86
- );
87
- $args = array_merge( $args, $images_args );
88
- }
89
- }
90
- } elseif ( isset( $options['default_image'] ) ) {
91
- if ( $size = $this->utility->get_image_dimensions( $options['default_image'] ) ) {
92
- $images_args = array(
93
- "image" => array(
94
- "@type" => "ImageObject",
95
- "url" => esc_html( $options['default_image'] ),
96
- "width" => $size['width'],
97
- "height" => $size['height']
98
- )
99
- );
100
- $args = array_merge( $args, $images_args );
101
- }
102
- }
103
-
104
- if ( isset( $options['name'] ) ) {
105
- $publisher_args = array(
106
- "publisher" => array(
107
- "@type" => "Organization",
108
- "name" => esc_html( $options['name'] ),
109
- )
110
- );
111
-
112
- $options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
113
-
114
- if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
115
- $publisher_args['publisher']['logo'] = array(
116
- "@type" => "ImageObject",
117
- "url" => $options['logo'],
118
- "width" => $logo['width'],
119
- "height" => $logo['height']
120
- );
121
- } else if ( !empty( $options['logo'] ) ) {
122
- $publisher_args['publisher']['logo'] = array(
123
- "@type" => "ImageObject",
124
- "url" => $options['logo'],
125
- "width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
126
- "height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
127
- );
128
- }
129
- $args = array_merge( $args, $publisher_args );
130
- }
131
-
132
- if ( isset( $options['speakable_action'] ) && $options['speakable_action'] === 'on' ) {
133
- $speakable_type = isset( $options['speakable_type'] ) ? $options['speakable_type'] : '';
134
-
135
- if ( !empty( $speakable_type ) ) {
136
- $action_array = array(
137
- "@type" => "SpeakableSpecification"
138
- );
139
- $action_array[$speakable_type] = array(
140
- isset( $options['speakable_headline'] ) ? stripslashes( $options['speakable_headline'] ) : '',
141
- isset( $options['speakable_summary'] ) ? stripslashes( $options['speakable_summary'] ) : ''
142
- );
143
- $args['speakable'] = $action_array;
144
- }
145
- }
146
-
147
- return (array) $args;
148
- }
149
  }
1
+ <?php
2
+ /**
3
+ * Schema.org Type BlogPosting
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.6.5
7
+ * @since 4.0.0
8
+ * @link http://schema.org/BlogPosting
9
+ * @link https://developers.google.com/search/docs/data-types/articles
10
+ * @link https://developers.google.com/search/docs/data-types/speakable
11
+ */
12
+ class Structuring_Markup_Meta_Blog_Posting {
13
+
14
+ /**
15
+ * Utility
16
+ *
17
+ * @version 4.0.0
18
+ * @since 4.0.0
19
+ */
20
+ private $utility;
21
+
22
+ /**
23
+ * Constructor Define.
24
+ *
25
+ * @version 4.5.0
26
+ * @since 4.0.0
27
+ * @param Structuring_Markup_Utility $utility
28
+ */
29
+ public function __construct ( Structuring_Markup_Utility $utility ) {
30
+ $this->utility = $utility;
31
+ }
32
+
33
+ /**
34
+ * Setting schema.org BlogPosting
35
+ *
36
+ * @version 4.6.5
37
+ * @since 4.0.0
38
+ * @param array $options
39
+ * @return array $args
40
+ */
41
+ public function set_meta ( array $options ) {
42
+ global $post;
43
+
44
+ $excerpt = $this->utility->escape_text( $post->post_excerpt );
45
+ $content = $excerpt === "" ? mb_substr( $this->utility->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
46
+
47
+ $args = array(
48
+ "@context" => "http://schema.org",
49
+ "@type" => "BlogPosting",
50
+ "mainEntityOfPage" => array(
51
+ "@type" => "WebPage",
52
+ "@id" => get_permalink( $post->ID )
53
+ ),
54
+ "headline" => mb_substr( esc_html( $post->post_title ), 0, 110 ),
55
+ "datePublished" => get_the_time( DATE_ISO8601, $post->ID ), "dateModified" => get_the_modified_time( DATE_ISO8601, $post->ID ),
56
+ "author" => array(
57
+ "@type" => "Person",
58
+ "name" => esc_html( get_the_author_meta( 'display_name', $post->post_author ) )
59
+ ),
60
+ "description" => $content
61
+ );
62
+
63
+ if ( has_post_thumbnail( $post->ID ) ) {
64
+ $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
65
+
66
+ $images_args = array(
67
+ "image" => array(
68
+ "@type" => "ImageObject",
69
+ "url" => $images[0],
70
+ "width" => $images[1],
71
+ "height" => $images[2]
72
+ )
73
+ );
74
+ $args = array_merge( $args, $images_args );
75
+ } elseif ( isset( $options['content_image'] ) && $options['content_image'] === 'on' ) {
76
+ if ( $images = $this->utility->get_content_image( $post->post_content ) ) {
77
+ if ( $size = $this->utility->get_image_dimensions( $images ) ) {
78
+ $images_args = array(
79
+ "image" => array(
80
+ "@type" => "ImageObject",
81
+ "url" => $images,
82
+ "width" => $size['width'],
83
+ "height" => $size['height']
84
+ )
85
+ );
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'] ) ) {
104
+ $publisher_args = array(
105
+ "publisher" => array(
106
+ "@type" => "Organization",
107
+ "name" => esc_html( $options['name'] ),
108
+ )
109
+ );
110
+
111
+ $options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
112
+
113
+ if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
114
+ $publisher_args['publisher']['logo'] = array(
115
+ "@type" => "ImageObject",
116
+ "url" => $options['logo'],
117
+ "width" => $logo['width'],
118
+ "height" => $logo['height']
119
+ );
120
+ } else if ( !empty( $options['logo'] ) ) {
121
+ $publisher_args['publisher']['logo'] = array(
122
+ "@type" => "ImageObject",
123
+ "url" => $options['logo'],
124
+ "width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
125
+ "height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
126
+ );
127
+ }
128
+ $args = array_merge( $args, $publisher_args );
129
+ }
130
+
131
+ if ( isset( $options['speakable_action'] ) && $options['speakable_action'] === 'on' ) {
132
+ $speakable_type = isset( $options['speakable_type'] ) ? $options['speakable_type'] : '';
133
+
134
+ if ( !empty( $speakable_type ) ) {
135
+ $action_array = array(
136
+ "@type" => "SpeakableSpecification"
137
+ );
138
+ $action_array[$speakable_type] = array(
139
+ isset( $options['speakable_headline'] ) ? stripslashes( $options['speakable_headline'] ) : '',
140
+ isset( $options['speakable_summary'] ) ? stripslashes( $options['speakable_summary'] ) : ''
141
+ );
142
+ $args['speakable'] = $action_array;
143
+ }
144
+ }
145
+
146
+ return (array) $args;
147
+ }
 
148
  }
includes/meta/wp-structuring-meta-news-article.php CHANGED
@@ -1,149 +1,149 @@
1
- <?php
2
- /**
3
- * Schema.org Type News Article
4
- *
5
- * @author Kazuya Takami
6
- * @version 4.5.0
7
- * @since 4.0.0
8
- * @link http://schema.org/NewsArticle
9
- * @link https://developers.google.com/search/docs/data-types/articles
10
- * @link https://developers.google.com/search/docs/data-types/speakable
11
- */
12
- class Structuring_Markup_Meta_NewsArticle {
13
-
14
- /**
15
- * Utility
16
- *
17
- * @version 4.0.0
18
- * @since 4.0.0
19
- */
20
- private $utility;
21
-
22
- /**
23
- * Constructor Define.
24
- *
25
- * @version 4.0.0
26
- * @since 4.0.0
27
- * @param Structuring_Markup_Utility $utility
28
- */
29
- public function __construct ( Structuring_Markup_Utility $utility ) {
30
- $this->utility = $utility;
31
- }
32
-
33
- /**
34
- * Setting schema.org NewsArticle
35
- *
36
- * @version 4.5.0
37
- * @since 4.0.0
38
- * @param array $options
39
- * @return array $args
40
- */
41
- public function set_meta ( array $options ) {
42
- global $post;
43
-
44
- $excerpt = $this->utility->escape_text( $post->post_excerpt );
45
- $content = $excerpt === "" ? mb_substr( $this->utility->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
46
-
47
- $args = array(
48
- "@context" => "http://schema.org",
49
- "@type" => "NewsArticle",
50
- "mainEntityOfPage" => array(
51
- "@type" => "WebPage",
52
- "@id" => get_permalink( $post->ID )
53
- ),
54
- "headline" => mb_substr( esc_html( $post->post_title ), 0, 110 ),
55
- "datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
56
- "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
57
- "author" => array(
58
- "@type" => "Person",
59
- "name" => esc_html( get_the_author_meta( 'display_name', $post->post_author ) )
60
- ),
61
- "description" => $content
62
- );
63
-
64
- if ( has_post_thumbnail( $post->ID ) ) {
65
- $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
66
-
67
- $images_args = array(
68
- "image" => array(
69
- "@type" => "ImageObject",
70
- "url" => $images[0],
71
- "width" => $images[1],
72
- "height" => $images[2]
73
- )
74
- );
75
- $args = array_merge( $args, $images_args );
76
- } elseif ( isset( $options['content_image'] ) && $options['content_image'] === 'on' ) {
77
- if ( $images = $this->utility->get_content_image( $post->post_content ) ) {
78
- if ( $size = $this->utility->get_image_dimensions( $images ) ) {
79
- $images_args = array(
80
- "image" => array(
81
- "@type" => "ImageObject",
82
- "url" => $images,
83
- "width" => $size['width'],
84
- "height" => $size['height']
85
- )
86
- );
87
- $args = array_merge( $args, $images_args );
88
- }
89
- }
90
- } elseif ( isset( $options['default_image'] ) ) {
91
- if ( $size = $this->utility->get_image_dimensions( $options['default_image'] ) ) {
92
- $images_args = array(
93
- "image" => array(
94
- "@type" => "ImageObject",
95
- "url" => esc_html( $options['default_image'] ),
96
- "width" => $size['width'],
97
- "height" => $size['height']
98
- )
99
- );
100
- $args = array_merge( $args, $images_args );
101
- }
102
- }
103
-
104
- if ( isset( $options['name'] ) ) {
105
- $publisher_args = array(
106
- "publisher" => array(
107
- "@type" => "Organization",
108
- "name" => esc_html( $options['name'] ),
109
- )
110
- );
111
-
112
- $options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
113
-
114
- if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
115
- $publisher_args['publisher']['logo'] = array(
116
- "@type" => "ImageObject",
117
- "url" => $options['logo'],
118
- "width" => $logo['width'],
119
- "height" => $logo['height']
120
- );
121
- } else if ( !empty( $options['logo'] ) ) {
122
- $publisher_args['publisher']['logo'] = array(
123
- "@type" => "ImageObject",
124
- "url" => $options['logo'],
125
- "width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
126
- "height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
127
- );
128
- }
129
- $args = array_merge( $args, $publisher_args );
130
- }
131
-
132
- if ( isset( $options['speakable_action'] ) && $options['speakable_action'] === 'on' ) {
133
- $speakable_type = isset( $options['speakable_type'] ) ? $options['speakable_type'] : '';
134
-
135
- if ( !empty( $speakable_type ) ) {
136
- $action_array = array(
137
- "@type" => "SpeakableSpecification"
138
- );
139
- $action_array[$speakable_type] = array(
140
- isset( $options['speakable_headline'] ) ? stripslashes( $options['speakable_headline'] ) : '',
141
- isset( $options['speakable_summary'] ) ? stripslashes( $options['speakable_summary'] ) : ''
142
- );
143
- $args['speakable'] = $action_array;
144
- }
145
- }
146
-
147
- return (array) $args;
148
- }
149
  }
1
+ <?php
2
+ /**
3
+ * Schema.org Type News Article
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.6.5
7
+ * @since 4.0.0
8
+ * @link http://schema.org/NewsArticle
9
+ * @link https://developers.google.com/search/docs/data-types/articles
10
+ * @link https://developers.google.com/search/docs/data-types/speakable
11
+ */
12
+ class Structuring_Markup_Meta_NewsArticle {
13
+
14
+ /**
15
+ * Utility
16
+ *
17
+ * @version 4.0.0
18
+ * @since 4.0.0
19
+ */
20
+ private $utility;
21
+
22
+ /**
23
+ * Constructor Define.
24
+ *
25
+ * @version 4.0.0
26
+ * @since 4.0.0
27
+ * @param Structuring_Markup_Utility $utility
28
+ */
29
+ public function __construct ( Structuring_Markup_Utility $utility ) {
30
+ $this->utility = $utility;
31
+ }
32
+
33
+ /**
34
+ * Setting schema.org NewsArticle
35
+ *
36
+ * @version 4.6.5
37
+ * @since 4.0.0
38
+ * @param array $options
39
+ * @return array $args
40
+ */
41
+ public function set_meta ( array $options ) {
42
+ global $post;
43
+
44
+ $excerpt = $this->utility->escape_text( $post->post_excerpt );
45
+ $content = $excerpt === "" ? mb_substr( $this->utility->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
46
+
47
+ $args = array(
48
+ "@context" => "http://schema.org",
49
+ "@type" => "NewsArticle",
50
+ "mainEntityOfPage" => array(
51
+ "@type" => "WebPage",
52
+ "@id" => get_permalink( $post->ID )
53
+ ),
54
+ "headline" => mb_substr( esc_html( $post->post_title ), 0, 110 ),
55
+ "datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
56
+ "dateModified" => get_the_modified_time( DATE_ISO8601, $post->ID ),
57
+ "author" => array(
58
+ "@type" => "Person",
59
+ "name" => esc_html( get_the_author_meta( 'display_name', $post->post_author ) )
60
+ ),
61
+ "description" => $content
62
+ );
63
+
64
+ if ( has_post_thumbnail( $post->ID ) ) {
65
+ $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
66
+
67
+ $images_args = array(
68
+ "image" => array(
69
+ "@type" => "ImageObject",
70
+ "url" => $images[0],
71
+ "width" => $images[1],
72
+ "height" => $images[2]
73
+ )
74
+ );
75
+ $args = array_merge( $args, $images_args );
76
+ } elseif ( isset( $options['content_image'] ) && $options['content_image'] === 'on' ) {
77
+ if ( $images = $this->utility->get_content_image( $post->post_content ) ) {
78
+ if ( $size = $this->utility->get_image_dimensions( $images ) ) {
79
+ $images_args = array(
80
+ "image" => array(
81
+ "@type" => "ImageObject",
82
+ "url" => $images,
83
+ "width" => $size['width'],
84
+ "height" => $size['height']
85
+ )
86
+ );
87
+ $args = array_merge( $args, $images_args );
88
+ }
89
+ }
90
+ } elseif ( isset( $options['default_image'] ) ) {
91
+ if ( $size = $this->utility->get_image_dimensions( $options['default_image'] ) ) {
92
+ $images_args = array(
93
+ "image" => array(
94
+ "@type" => "ImageObject",
95
+ "url" => esc_html( $options['default_image'] ),
96
+ "width" => $size['width'],
97
+ "height" => $size['height']
98
+ )
99
+ );
100
+ $args = array_merge( $args, $images_args );
101
+ }
102
+ }
103
+
104
+ if ( isset( $options['name'] ) ) {
105
+ $publisher_args = array(
106
+ "publisher" => array(
107
+ "@type" => "Organization",
108
+ "name" => esc_html( $options['name'] ),
109
+ )
110
+ );
111
+
112
+ $options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
113
+
114
+ if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
115
+ $publisher_args['publisher']['logo'] = array(
116
+ "@type" => "ImageObject",
117
+ "url" => $options['logo'],
118
+ "width" => $logo['width'],
119
+ "height" => $logo['height']
120
+ );
121
+ } else if ( !empty( $options['logo'] ) ) {
122
+ $publisher_args['publisher']['logo'] = array(
123
+ "@type" => "ImageObject",
124
+ "url" => $options['logo'],
125
+ "width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
126
+ "height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
127
+ );
128
+ }
129
+ $args = array_merge( $args, $publisher_args );
130
+ }
131
+
132
+ if ( isset( $options['speakable_action'] ) && $options['speakable_action'] === 'on' ) {
133
+ $speakable_type = isset( $options['speakable_type'] ) ? $options['speakable_type'] : '';
134
+
135
+ if ( !empty( $speakable_type ) ) {
136
+ $action_array = array(
137
+ "@type" => "SpeakableSpecification"
138
+ );
139
+ $action_array[$speakable_type] = array(
140
+ isset( $options['speakable_headline'] ) ? stripslashes( $options['speakable_headline'] ) : '',
141
+ isset( $options['speakable_summary'] ) ? stripslashes( $options['speakable_summary'] ) : ''
142
+ );
143
+ $args['speakable'] = $action_array;
144
+ }
145
+ }
146
+
147
+ return (array) $args;
148
+ }
149
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ 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: 5.1.0
6
- Stable tag: 4.6.4
7
 
8
  Allows you to include schema.org JSON-LD syntax markup on your website
9
 
@@ -68,6 +68,9 @@ if ( shortcode_exists( 'wp-structuring-markup-breadcrumb' ) ) {
68
 
69
  == Changelog ==
70
 
 
 
 
71
  = 4.6.4 (2019-02-26) =
72
  * Checked : WordPress version 5.1.0 operation check.
73
  * Fixed : Notice Error.
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: 5.1.0
6
+ Stable tag: 4.6.5
7
 
8
  Allows you to include schema.org JSON-LD syntax markup on your website
9
 
68
 
69
  == Changelog ==
70
 
71
+ = 4.6.5 (2019-03-11) =
72
+ * Fixed : A bug where the modification date is fixed to GMT time.
73
+
74
  = 4.6.4 (2019-02-26) =
75
  * Checked : WordPress version 5.1.0 operation check.
76
  * Fixed : Notice Error.
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.6.4
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.6.4
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.6.4
30
  * @since 1.3.0
31
  */
32
- private $version = '4.6.4';
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.6.5
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.6.5
22
  * @since 1.0.0
23
  */
24
  class Structuring_Markup {
26
  /**
27
  * Variable definition version.
28
  *
29
+ * @version 4.6.5
30
  * @since 1.3.0
31
  */
32
+ private $version = '4.6.5';
33
 
34
  /**
35
  * Variable definition Text Domain.