Version Description
(2016-12-16) = * Updated : Change ImageObject attribute of Schema.org type "Article", "BlogPosting", "NewsArticle" from "required" to "recommended". * Fixed : Custom post menu control.
Download this release
Release Info
Developer | miiitaka |
Plugin | Markup (JSON-LD) structured in schema.org |
Version | 3.1.6 |
Comparing to | |
See all releases |
Code changes from version 3.1.5 to 3.1.6
- includes/wp-structuring-admin-type-article.php +16 -17
- includes/wp-structuring-admin-type-blog-posting.php +16 -17
- includes/wp-structuring-admin-type-news-article.php +16 -17
- includes/wp-structuring-cache.php +8 -7
- includes/wp-structuring-custom-post-event.php +21 -5
- includes/wp-structuring-custom-post-video.php +21 -5
- includes/wp-structuring-display.php +97 -99
- readme.txt +5 -1
- wp-structuring-markup.php +5 -32
includes/wp-structuring-admin-type-article.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Schema.org Type Article
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version 3.1.
|
7 |
* @since 1.1.0
|
8 |
* @see wp-structuring-admin-db.php
|
9 |
* @link http://schema.org/Article
|
@@ -29,15 +29,15 @@ class Structuring_Markup_Type_Article {
|
|
29 |
/**
|
30 |
* Form Layout Render
|
31 |
*
|
32 |
-
* @version 3.1.
|
33 |
* @since 1.1.0
|
34 |
* @param array $option
|
35 |
*/
|
36 |
private function page_render ( array $option ) {
|
37 |
$html = '<table class="schema-admin-table">';
|
38 |
$html .= '<caption>Basic Setting</caption>';
|
39 |
-
$html .= '<tr><th
|
40 |
-
$html .= '<tr><th
|
41 |
$html .= '<tr><th>dateModified :</th><td><small>Default : get_the_modified_time( DATE_ISO8601, false, ID )</small></td></tr>';
|
42 |
$html .= '<tr><th>description :</th><td><small>Default : post_excerpt</small></td></tr>';
|
43 |
$html .= '</table>';
|
@@ -53,16 +53,16 @@ class Structuring_Markup_Type_Article {
|
|
53 |
$html = '<table class="schema-admin-table">';
|
54 |
$html .= '<caption>image</caption>';
|
55 |
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
56 |
-
$html .= '<tr><th
|
57 |
-
$html .= '<tr><th
|
58 |
-
$html .= '<tr><th
|
59 |
$html .= '</table>';
|
60 |
echo $html;
|
61 |
|
62 |
$html = '<table class="schema-admin-table">';
|
63 |
$html .= '<caption>author</caption>';
|
64 |
$html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
|
65 |
-
$html .= '<tr><th
|
66 |
$html .= '</td></tr>';
|
67 |
$html .= '</table>';
|
68 |
echo $html;
|
@@ -70,8 +70,8 @@ class Structuring_Markup_Type_Article {
|
|
70 |
$html = '<table class="schema-admin-table">';
|
71 |
$html .= '<caption>publisher</caption>';
|
72 |
$html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
|
73 |
-
$html .= '<tr><th
|
74 |
-
$html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text"
|
75 |
$html .= '<small>Default : bloginfo("name")</small>';
|
76 |
$html .= '</td></tr>';
|
77 |
$html .= '</table>';
|
@@ -80,13 +80,12 @@ class Structuring_Markup_Type_Article {
|
|
80 |
$html = '<table class="schema-admin-table">';
|
81 |
$html .= '<caption>publisher.logo</caption>';
|
82 |
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
83 |
-
$html .= '<tr><th
|
84 |
-
$html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text"
|
85 |
-
$html .= '<small>Default : bloginfo("logo") + "/images/logo.png"</small>';
|
86 |
$html .= '<small>Logos should be no wider than 600px, and no taller than 60px.</small>';
|
87 |
$html .= '</td></tr>';
|
88 |
-
$html .= '<tr><th
|
89 |
-
$html .= '<tr><th
|
90 |
$html .= '</table>';
|
91 |
echo $html;
|
92 |
|
@@ -97,14 +96,14 @@ class Structuring_Markup_Type_Article {
|
|
97 |
/**
|
98 |
* Return the default options array
|
99 |
*
|
100 |
-
* @since
|
101 |
* @version 2.2.0
|
102 |
* @param array $args
|
103 |
* @return array $args
|
104 |
*/
|
105 |
private function get_default_options ( array $args ) {
|
106 |
$args['name'] = get_bloginfo('name');
|
107 |
-
$args['logo'] =
|
108 |
|
109 |
return (array) $args;
|
110 |
}
|
3 |
* Schema.org Type Article
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 3.1.6
|
7 |
* @since 1.1.0
|
8 |
* @see wp-structuring-admin-db.php
|
9 |
* @link http://schema.org/Article
|
29 |
/**
|
30 |
* Form Layout Render
|
31 |
*
|
32 |
+
* @version 3.1.6
|
33 |
* @since 1.1.0
|
34 |
* @param array $option
|
35 |
*/
|
36 |
private function page_render ( array $option ) {
|
37 |
$html = '<table class="schema-admin-table">';
|
38 |
$html .= '<caption>Basic Setting</caption>';
|
39 |
+
$html .= '<tr><th>headline :</th><td><small>Default : post_title</small></td></tr>';
|
40 |
+
$html .= '<tr><th>datePublished :</th><td><small>Default : get_the_time( DATE_ISO8601, ID )</small></td></tr>';
|
41 |
$html .= '<tr><th>dateModified :</th><td><small>Default : get_the_modified_time( DATE_ISO8601, false, ID )</small></td></tr>';
|
42 |
$html .= '<tr><th>description :</th><td><small>Default : post_excerpt</small></td></tr>';
|
43 |
$html .= '</table>';
|
53 |
$html = '<table class="schema-admin-table">';
|
54 |
$html .= '<caption>image</caption>';
|
55 |
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
56 |
+
$html .= '<tr><th>url :</th><td><small>Default : thumbnail</small></td></tr>';
|
57 |
+
$html .= '<tr><th>height :</th><td><small>Auto : The height of the image, in pixels.</small></td></tr>';
|
58 |
+
$html .= '<tr><th>width :</th><td><small>Auto : The width of the image, in pixels. Images should be at least 696 pixels wide.</small></td></tr>';
|
59 |
$html .= '</table>';
|
60 |
echo $html;
|
61 |
|
62 |
$html = '<table class="schema-admin-table">';
|
63 |
$html .= '<caption>author</caption>';
|
64 |
$html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
|
65 |
+
$html .= '<tr><th>name :</th><td><small>Default : get_the_author_meta( "display_name", author )</small>';
|
66 |
$html .= '</td></tr>';
|
67 |
$html .= '</table>';
|
68 |
echo $html;
|
70 |
$html = '<table class="schema-admin-table">';
|
71 |
$html .= '<caption>publisher</caption>';
|
72 |
$html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
|
73 |
+
$html .= '<tr><th><label for="name">Organization Name :</label></th><td>';
|
74 |
+
$html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" value="' . esc_attr( $option['name'] ) . '">';
|
75 |
$html .= '<small>Default : bloginfo("name")</small>';
|
76 |
$html .= '</td></tr>';
|
77 |
$html .= '</table>';
|
80 |
$html = '<table class="schema-admin-table">';
|
81 |
$html .= '<caption>publisher.logo</caption>';
|
82 |
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
83 |
+
$html .= '<tr><th><label for="logo">url :</label></th><td>';
|
84 |
+
$html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
|
|
|
85 |
$html .= '<small>Logos should be no wider than 600px, and no taller than 60px.</small>';
|
86 |
$html .= '</td></tr>';
|
87 |
+
$html .= '<tr><th>height :</th><td><small>Auto : height <= 60px.</small></td></tr>';
|
88 |
+
$html .= '<tr><th>width :</th><td><small>Auto : width <= 600px.</small></td></tr>';
|
89 |
$html .= '</table>';
|
90 |
echo $html;
|
91 |
|
96 |
/**
|
97 |
* Return the default options array
|
98 |
*
|
99 |
+
* @since 3.1.6
|
100 |
* @version 2.2.0
|
101 |
* @param array $args
|
102 |
* @return array $args
|
103 |
*/
|
104 |
private function get_default_options ( array $args ) {
|
105 |
$args['name'] = get_bloginfo('name');
|
106 |
+
$args['logo'] = "";
|
107 |
|
108 |
return (array) $args;
|
109 |
}
|
includes/wp-structuring-admin-type-blog-posting.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Schema.org Type BlogPosting
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version 3.1.
|
7 |
* @since 1.2.0
|
8 |
* @see wp-structuring-admin-db.php
|
9 |
* @link http://schema.org/BlogPosting
|
@@ -29,15 +29,15 @@ class Structuring_Markup_Type_Blog_Posting {
|
|
29 |
/**
|
30 |
* Form Layout Render
|
31 |
*
|
32 |
-
* @version 3.1.
|
33 |
* @since 1.2.0
|
34 |
* @param array $option
|
35 |
*/
|
36 |
private function page_render ( array $option ) {
|
37 |
$html = '<table class="schema-admin-table">';
|
38 |
$html .= '<caption>Basic Setting</caption>';
|
39 |
-
$html .= '<tr><th
|
40 |
-
$html .= '<tr><th
|
41 |
$html .= '<tr><th>dateModified :</th><td><small>Default : get_the_modified_time( DATE_ISO8601, false, ID )</small></td></tr>';
|
42 |
$html .= '<tr><th>description :</th><td><small>Default : post_excerpt</small></td></tr>';
|
43 |
$html .= '</table>';
|
@@ -53,16 +53,16 @@ class Structuring_Markup_Type_Blog_Posting {
|
|
53 |
$html = '<table class="schema-admin-table">';
|
54 |
$html .= '<caption>image</caption>';
|
55 |
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
56 |
-
$html .= '<tr><th
|
57 |
-
$html .= '<tr><th
|
58 |
-
$html .= '<tr><th
|
59 |
$html .= '</table>';
|
60 |
echo $html;
|
61 |
|
62 |
$html = '<table class="schema-admin-table">';
|
63 |
$html .= '<caption>author</caption>';
|
64 |
$html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
|
65 |
-
$html .= '<tr><th
|
66 |
$html .= '</td></tr>';
|
67 |
$html .= '</table>';
|
68 |
echo $html;
|
@@ -70,8 +70,8 @@ class Structuring_Markup_Type_Blog_Posting {
|
|
70 |
$html = '<table class="schema-admin-table">';
|
71 |
$html .= '<caption>publisher</caption>';
|
72 |
$html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
|
73 |
-
$html .= '<tr><th
|
74 |
-
$html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text"
|
75 |
$html .= '<small>Default : bloginfo("name")</small>';
|
76 |
$html .= '</td></tr>';
|
77 |
$html .= '</table>';
|
@@ -80,13 +80,12 @@ class Structuring_Markup_Type_Blog_Posting {
|
|
80 |
$html = '<table class="schema-admin-table">';
|
81 |
$html .= '<caption>publisher.logo</caption>';
|
82 |
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
83 |
-
$html .= '<tr><th
|
84 |
-
$html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text"
|
85 |
-
$html .= '<small>Default : bloginfo("logo") + "/images/logo.png"</small>';
|
86 |
$html .= '<small>Logos should be no wider than 600px, and no taller than 60px.</small>';
|
87 |
$html .= '</td></tr>';
|
88 |
-
$html .= '<tr><th
|
89 |
-
$html .= '<tr><th
|
90 |
$html .= '</table>';
|
91 |
echo $html;
|
92 |
|
@@ -97,14 +96,14 @@ class Structuring_Markup_Type_Blog_Posting {
|
|
97 |
/**
|
98 |
* Return the default options array
|
99 |
*
|
100 |
-
* @version
|
101 |
* @since 2.2.0
|
102 |
* @param array $args
|
103 |
* @return array $args
|
104 |
*/
|
105 |
private function get_default_options ( array $args ) {
|
106 |
$args['name'] = get_bloginfo('name');
|
107 |
-
$args['logo'] =
|
108 |
|
109 |
return (array) $args;
|
110 |
}
|
3 |
* Schema.org Type BlogPosting
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 3.1.6
|
7 |
* @since 1.2.0
|
8 |
* @see wp-structuring-admin-db.php
|
9 |
* @link http://schema.org/BlogPosting
|
29 |
/**
|
30 |
* Form Layout Render
|
31 |
*
|
32 |
+
* @version 3.1.6
|
33 |
* @since 1.2.0
|
34 |
* @param array $option
|
35 |
*/
|
36 |
private function page_render ( array $option ) {
|
37 |
$html = '<table class="schema-admin-table">';
|
38 |
$html .= '<caption>Basic Setting</caption>';
|
39 |
+
$html .= '<tr><th>headline :</th><td><small>Default : post_title</small></td></tr>';
|
40 |
+
$html .= '<tr><th>datePublished :</th><td><small>Default : get_the_time( DATE_ISO8601, ID )</small></td></tr>';
|
41 |
$html .= '<tr><th>dateModified :</th><td><small>Default : get_the_modified_time( DATE_ISO8601, false, ID )</small></td></tr>';
|
42 |
$html .= '<tr><th>description :</th><td><small>Default : post_excerpt</small></td></tr>';
|
43 |
$html .= '</table>';
|
53 |
$html = '<table class="schema-admin-table">';
|
54 |
$html .= '<caption>image</caption>';
|
55 |
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
56 |
+
$html .= '<tr><th>url :</th><td><small>Default : thumbnail</small></td></tr>';
|
57 |
+
$html .= '<tr><th>height :</th><td><small>Auto : The height of the image, in pixels.</small></td></tr>';
|
58 |
+
$html .= '<tr><th>width :</th><td><small>Auto : The width of the image, in pixels. Images should be at least 696 pixels wide.</small></td></tr>';
|
59 |
$html .= '</table>';
|
60 |
echo $html;
|
61 |
|
62 |
$html = '<table class="schema-admin-table">';
|
63 |
$html .= '<caption>author</caption>';
|
64 |
$html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
|
65 |
+
$html .= '<tr><th>name :</th><td><small>Default : get_the_author_meta( "display_name", author )</small>';
|
66 |
$html .= '</td></tr>';
|
67 |
$html .= '</table>';
|
68 |
echo $html;
|
70 |
$html = '<table class="schema-admin-table">';
|
71 |
$html .= '<caption>publisher</caption>';
|
72 |
$html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
|
73 |
+
$html .= '<tr><th><label for="name">Organization Name :</label></th><td>';
|
74 |
+
$html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" value="' . esc_attr( $option['name'] ) . '">';
|
75 |
$html .= '<small>Default : bloginfo("name")</small>';
|
76 |
$html .= '</td></tr>';
|
77 |
$html .= '</table>';
|
80 |
$html = '<table class="schema-admin-table">';
|
81 |
$html .= '<caption>publisher.logo</caption>';
|
82 |
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
83 |
+
$html .= '<tr><th><label for="logo">url :</label></th><td>';
|
84 |
+
$html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
|
|
|
85 |
$html .= '<small>Logos should be no wider than 600px, and no taller than 60px.</small>';
|
86 |
$html .= '</td></tr>';
|
87 |
+
$html .= '<tr><th>height :</th><td><small>Auto : height <= 60px.</small></td></tr>';
|
88 |
+
$html .= '<tr><th>width :</th><td><small>Auto : width <= 600px.</small></td></tr>';
|
89 |
$html .= '</table>';
|
90 |
echo $html;
|
91 |
|
96 |
/**
|
97 |
* Return the default options array
|
98 |
*
|
99 |
+
* @version 3.1.6
|
100 |
* @since 2.2.0
|
101 |
* @param array $args
|
102 |
* @return array $args
|
103 |
*/
|
104 |
private function get_default_options ( array $args ) {
|
105 |
$args['name'] = get_bloginfo('name');
|
106 |
+
$args['logo'] = "";
|
107 |
|
108 |
return (array) $args;
|
109 |
}
|
includes/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 3.1.
|
7 |
* @since 1.0.0
|
8 |
* @see wp-structuring-admin-db.php
|
9 |
* @link http://schema.org/NewsArticle
|
@@ -29,15 +29,15 @@ class Structuring_Markup_Type_NewsArticle {
|
|
29 |
/**
|
30 |
* Form Layout Render
|
31 |
*
|
32 |
-
* @version 3.1.
|
33 |
* @since 1.0.0
|
34 |
* @param array $option
|
35 |
*/
|
36 |
private function page_render ( array $option ) {
|
37 |
$html = '<table class="schema-admin-table">';
|
38 |
$html .= '<caption>Basic Setting</caption>';
|
39 |
-
$html .= '<tr><th
|
40 |
-
$html .= '<tr><th
|
41 |
$html .= '<tr><th>dateModified :</th><td><small>Default : get_the_modified_time( DATE_ISO8601, false, ID )</small></td></tr>';
|
42 |
$html .= '<tr><th>description :</th><td><small>Default : post_excerpt</small></td></tr>';
|
43 |
$html .= '</table>';
|
@@ -53,16 +53,16 @@ class Structuring_Markup_Type_NewsArticle {
|
|
53 |
$html = '<table class="schema-admin-table">';
|
54 |
$html .= '<caption>image</caption>';
|
55 |
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
56 |
-
$html .= '<tr><th
|
57 |
-
$html .= '<tr><th
|
58 |
-
$html .= '<tr><th
|
59 |
$html .= '</table>';
|
60 |
echo $html;
|
61 |
|
62 |
$html = '<table class="schema-admin-table">';
|
63 |
$html .= '<caption>author</caption>';
|
64 |
$html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
|
65 |
-
$html .= '<tr><th
|
66 |
$html .= '</td></tr>';
|
67 |
$html .= '</table>';
|
68 |
echo $html;
|
@@ -70,8 +70,8 @@ class Structuring_Markup_Type_NewsArticle {
|
|
70 |
$html = '<table class="schema-admin-table">';
|
71 |
$html .= '<caption>publisher</caption>';
|
72 |
$html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
|
73 |
-
$html .= '<tr><th
|
74 |
-
$html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text"
|
75 |
$html .= '<small>Default : bloginfo("name")</small>';
|
76 |
$html .= '</td></tr>';
|
77 |
$html .= '</table>';
|
@@ -80,13 +80,12 @@ class Structuring_Markup_Type_NewsArticle {
|
|
80 |
$html = '<table class="schema-admin-table">';
|
81 |
$html .= '<caption>publisher.logo</caption>';
|
82 |
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
83 |
-
$html .= '<tr><th
|
84 |
-
$html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text"
|
85 |
-
$html .= '<small>Default : bloginfo("logo") + "/images/logo.png"</small>';
|
86 |
$html .= '<small>Logos should be no wider than 600px, and no taller than 60px.</small>';
|
87 |
$html .= '</td></tr>';
|
88 |
-
$html .= '<tr><th
|
89 |
-
$html .= '<tr><th
|
90 |
$html .= '</table>';
|
91 |
echo $html;
|
92 |
|
@@ -97,14 +96,14 @@ class Structuring_Markup_Type_NewsArticle {
|
|
97 |
/**
|
98 |
* Return the default options array
|
99 |
*
|
100 |
-
* @since
|
101 |
* @version 2.2.0
|
102 |
* @param array $args
|
103 |
* @return array $args
|
104 |
*/
|
105 |
private function get_default_options ( array $args ) {
|
106 |
$args['name'] = get_bloginfo('name');
|
107 |
-
$args['logo'] =
|
108 |
|
109 |
return (array) $args;
|
110 |
}
|
3 |
* Schema.org Type News Article
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 3.1.6
|
7 |
* @since 1.0.0
|
8 |
* @see wp-structuring-admin-db.php
|
9 |
* @link http://schema.org/NewsArticle
|
29 |
/**
|
30 |
* Form Layout Render
|
31 |
*
|
32 |
+
* @version 3.1.6
|
33 |
* @since 1.0.0
|
34 |
* @param array $option
|
35 |
*/
|
36 |
private function page_render ( array $option ) {
|
37 |
$html = '<table class="schema-admin-table">';
|
38 |
$html .= '<caption>Basic Setting</caption>';
|
39 |
+
$html .= '<tr><th>headline :</th><td><small>Default : post_title</small></td></tr>';
|
40 |
+
$html .= '<tr><th>datePublished :</th><td><small>Default : get_the_time( DATE_ISO8601, ID )</small></td></tr>';
|
41 |
$html .= '<tr><th>dateModified :</th><td><small>Default : get_the_modified_time( DATE_ISO8601, false, ID )</small></td></tr>';
|
42 |
$html .= '<tr><th>description :</th><td><small>Default : post_excerpt</small></td></tr>';
|
43 |
$html .= '</table>';
|
53 |
$html = '<table class="schema-admin-table">';
|
54 |
$html .= '<caption>image</caption>';
|
55 |
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
56 |
+
$html .= '<tr><th>url :</th><td><small>Default : thumbnail</small></td></tr>';
|
57 |
+
$html .= '<tr><th>height :</th><td><small>Auto : The height of the image, in pixels.</small></td></tr>';
|
58 |
+
$html .= '<tr><th>width :</th><td><small>Auto : The width of the image, in pixels. Images should be at least 696 pixels wide.</small></td></tr>';
|
59 |
$html .= '</table>';
|
60 |
echo $html;
|
61 |
|
62 |
$html = '<table class="schema-admin-table">';
|
63 |
$html .= '<caption>author</caption>';
|
64 |
$html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
|
65 |
+
$html .= '<tr><th>name :</th><td><small>Default : get_the_author_meta( "display_name", author )</small>';
|
66 |
$html .= '</td></tr>';
|
67 |
$html .= '</table>';
|
68 |
echo $html;
|
70 |
$html = '<table class="schema-admin-table">';
|
71 |
$html .= '<caption>publisher</caption>';
|
72 |
$html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
|
73 |
+
$html .= '<tr><th><label for="name">Organization Name :</label></th><td>';
|
74 |
+
$html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" value="' . esc_attr( $option['name'] ) . '">';
|
75 |
$html .= '<small>Default : bloginfo("name")</small>';
|
76 |
$html .= '</td></tr>';
|
77 |
$html .= '</table>';
|
80 |
$html = '<table class="schema-admin-table">';
|
81 |
$html .= '<caption>publisher.logo</caption>';
|
82 |
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
83 |
+
$html .= '<tr><th><label for="logo">url :</label></th><td>';
|
84 |
+
$html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
|
|
|
85 |
$html .= '<small>Logos should be no wider than 600px, and no taller than 60px.</small>';
|
86 |
$html .= '</td></tr>';
|
87 |
+
$html .= '<tr><th>height :</th><td><small>Auto : height <= 60px.</small></td></tr>';
|
88 |
+
$html .= '<tr><th>width :</th><td><small>Auto : width <= 600px.</small></td></tr>';
|
89 |
$html .= '</table>';
|
90 |
echo $html;
|
91 |
|
96 |
/**
|
97 |
* Return the default options array
|
98 |
*
|
99 |
+
* @since 3.1.6
|
100 |
* @version 2.2.0
|
101 |
* @param array $args
|
102 |
* @return array $args
|
103 |
*/
|
104 |
private function get_default_options ( array $args ) {
|
105 |
$args['name'] = get_bloginfo('name');
|
106 |
+
$args['logo'] = "";
|
107 |
|
108 |
return (array) $args;
|
109 |
}
|
includes/wp-structuring-cache.php
CHANGED
@@ -3,7 +3,8 @@
|
|
3 |
* WP Structuring Markup Transient Cache
|
4 |
*
|
5 |
* @author Justin Frydman
|
6 |
-
* @
|
|
|
7 |
* @version 2.4.2
|
8 |
*/
|
9 |
class Structuring_Markup_Cache {
|
@@ -28,20 +29,20 @@ class Structuring_Markup_Cache {
|
|
28 |
/**
|
29 |
* Constructor Define.
|
30 |
*
|
31 |
-
* @since
|
32 |
* @version 2.4.2
|
33 |
* @param string $key Unique key for this transient
|
34 |
*/
|
35 |
public function __construct ( $key ) {
|
36 |
-
assert( !empty( $key ) );
|
37 |
-
|
38 |
$this->key = (string) $key;
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
* Store a transient
|
43 |
*
|
44 |
-
* @since
|
45 |
* @version 2.4.2
|
46 |
* @see https://codex.wordpress.org/Easier_Expression_of_Time_Constants
|
47 |
* @param string $value - The value to be stored in the cache
|
@@ -49,8 +50,8 @@ class Structuring_Markup_Cache {
|
|
49 |
* @return bool - If the transient was set properly
|
50 |
*/
|
51 |
public function set( $value, $ttl ) {
|
52 |
-
assert( !empty( $value ) );
|
53 |
-
assert( !empty( $ttl ) );
|
54 |
|
55 |
return set_transient( $this->prepared_key(), $value, $ttl );
|
56 |
}
|
3 |
* WP Structuring Markup Transient Cache
|
4 |
*
|
5 |
* @author Justin Frydman
|
6 |
+
* @author Kazuya Takami
|
7 |
+
* @since 3.1.6
|
8 |
* @version 2.4.2
|
9 |
*/
|
10 |
class Structuring_Markup_Cache {
|
29 |
/**
|
30 |
* Constructor Define.
|
31 |
*
|
32 |
+
* @since 3.1.6
|
33 |
* @version 2.4.2
|
34 |
* @param string $key Unique key for this transient
|
35 |
*/
|
36 |
public function __construct ( $key ) {
|
37 |
+
@assert( !empty( $key ) );
|
38 |
+
|
39 |
$this->key = (string) $key;
|
40 |
}
|
41 |
|
42 |
/**
|
43 |
* Store a transient
|
44 |
*
|
45 |
+
* @since 3.1.6
|
46 |
* @version 2.4.2
|
47 |
* @see https://codex.wordpress.org/Easier_Expression_of_Time_Constants
|
48 |
* @param string $value - The value to be stored in the cache
|
50 |
* @return bool - If the transient was set properly
|
51 |
*/
|
52 |
public function set( $value, $ttl ) {
|
53 |
+
@assert( !empty( $value ) );
|
54 |
+
@assert( !empty( $ttl ) );
|
55 |
|
56 |
return set_transient( $this->prepared_key(), $value, $ttl );
|
57 |
}
|
includes/wp-structuring-custom-post-event.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Schema.org Custom Post "Event"
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version 3.1.
|
7 |
* @since 2.1.0
|
8 |
*/
|
9 |
class Structuring_Markup_Custom_Post_Event {
|
@@ -48,13 +48,29 @@ class Structuring_Markup_Custom_Post_Event {
|
|
48 |
/**
|
49 |
* Constructor Define.
|
50 |
*
|
51 |
-
* @version 3.
|
52 |
* @since 2.1.0
|
53 |
* @param String $text_domain
|
54 |
*/
|
55 |
public function __construct ( $text_domain ) {
|
56 |
$this->text_domain = $text_domain;
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
register_post_type(
|
59 |
$this->custom_type,
|
60 |
array(
|
@@ -67,11 +83,11 @@ class Structuring_Markup_Custom_Post_Event {
|
|
67 |
'has_archive' => true,
|
68 |
'hierarchical' => false,
|
69 |
'menu_position' => 5,
|
70 |
-
'public' =>
|
71 |
'query_var' => false,
|
72 |
'rewrite' => array( 'with_front' => true, 'slug' => 'events' ),
|
73 |
-
'show_in_menu' =>
|
74 |
-
'show_ui' =>
|
75 |
'supports' => array( 'title', 'editor', 'author', 'thumbnail' )
|
76 |
)
|
77 |
);
|
3 |
* Schema.org Custom Post "Event"
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 3.1.6
|
7 |
* @since 2.1.0
|
8 |
*/
|
9 |
class Structuring_Markup_Custom_Post_Event {
|
48 |
/**
|
49 |
* Constructor Define.
|
50 |
*
|
51 |
+
* @version 3.1.6
|
52 |
* @since 2.1.0
|
53 |
* @param String $text_domain
|
54 |
*/
|
55 |
public function __construct ( $text_domain ) {
|
56 |
$this->text_domain = $text_domain;
|
57 |
|
58 |
+
/** Custom post menu controls */
|
59 |
+
$show_flag = __return_false();
|
60 |
+
if ( isset( $_POST['type'] ) && $_POST['type'] === 'event' ) {
|
61 |
+
if ( isset( $_POST['activate'] ) && $_POST['activate'] === 'on' ) {
|
62 |
+
$show_flag = __return_true();
|
63 |
+
}
|
64 |
+
} else {
|
65 |
+
/** DB Connect */
|
66 |
+
$db = new Structuring_Markup_Admin_Db();
|
67 |
+
$results = $db->get_type_options('event');
|
68 |
+
|
69 |
+
if ( isset( $results['activate'] ) && $results['activate'] == 'on' ) {
|
70 |
+
$show_flag = __return_true();
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
register_post_type(
|
75 |
$this->custom_type,
|
76 |
array(
|
83 |
'has_archive' => true,
|
84 |
'hierarchical' => false,
|
85 |
'menu_position' => 5,
|
86 |
+
'public' => $show_flag,
|
87 |
'query_var' => false,
|
88 |
'rewrite' => array( 'with_front' => true, 'slug' => 'events' ),
|
89 |
+
'show_in_menu' => $show_flag,
|
90 |
+
'show_ui' => $show_flag,
|
91 |
'supports' => array( 'title', 'editor', 'author', 'thumbnail' )
|
92 |
)
|
93 |
);
|
includes/wp-structuring-custom-post-video.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Schema.org Custom Post "Video"
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @since 3.
|
7 |
* @version 3.0.0
|
8 |
*/
|
9 |
class Structuring_Markup_Custom_Post_Video {
|
@@ -20,13 +20,29 @@ class Structuring_Markup_Custom_Post_Video {
|
|
20 |
/**
|
21 |
* Constructor Define.
|
22 |
*
|
23 |
-
* @since 3.
|
24 |
* @version 3.0.0
|
25 |
* @param String $text_domain
|
26 |
*/
|
27 |
public function __construct ( $text_domain ) {
|
28 |
$this->text_domain = $text_domain;
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
register_post_type(
|
31 |
$this->custom_type,
|
32 |
array(
|
@@ -39,11 +55,11 @@ class Structuring_Markup_Custom_Post_Video {
|
|
39 |
'has_archive' => true,
|
40 |
'hierarchical' => false,
|
41 |
'menu_position' => 5,
|
42 |
-
'public' =>
|
43 |
'query_var' => false,
|
44 |
'rewrite' => array( 'with_front' => true, 'slug' => 'videos' ),
|
45 |
-
'show_in_menu' =>
|
46 |
-
'show_ui' =>
|
47 |
'supports' => array( 'title', 'editor', 'author', 'thumbnail' )
|
48 |
)
|
49 |
);
|
3 |
* Schema.org Custom Post "Video"
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @since 3.1.6
|
7 |
* @version 3.0.0
|
8 |
*/
|
9 |
class Structuring_Markup_Custom_Post_Video {
|
20 |
/**
|
21 |
* Constructor Define.
|
22 |
*
|
23 |
+
* @since 3.1.6
|
24 |
* @version 3.0.0
|
25 |
* @param String $text_domain
|
26 |
*/
|
27 |
public function __construct ( $text_domain ) {
|
28 |
$this->text_domain = $text_domain;
|
29 |
|
30 |
+
/** Custom post menu controls */
|
31 |
+
$show_flag = __return_false();
|
32 |
+
if ( isset( $_POST['type'] ) && $_POST['type'] === 'video' ) {
|
33 |
+
if ( isset( $_POST['activate'] ) && $_POST['activate'] === 'on' ) {
|
34 |
+
$show_flag = __return_true();
|
35 |
+
}
|
36 |
+
} else {
|
37 |
+
/** DB Connect */
|
38 |
+
$db = new Structuring_Markup_Admin_Db();
|
39 |
+
$results = $db->get_type_options('video');
|
40 |
+
|
41 |
+
if ( isset( $results['activate'] ) && $results['activate'] == 'on' ) {
|
42 |
+
$show_flag = __return_true();
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
register_post_type(
|
47 |
$this->custom_type,
|
48 |
array(
|
55 |
'has_archive' => true,
|
56 |
'hierarchical' => false,
|
57 |
'menu_position' => 5,
|
58 |
+
'public' => $show_flag,
|
59 |
'query_var' => false,
|
60 |
'rewrite' => array( 'with_front' => true, 'slug' => 'videos' ),
|
61 |
+
'show_in_menu' => $show_flag,
|
62 |
+
'show_ui' => $show_flag,
|
63 |
'supports' => array( 'title', 'editor', 'author', 'thumbnail' )
|
64 |
)
|
65 |
);
|
includes/wp-structuring-display.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
* @author Justin Frydman
|
7 |
-
* @version 3.1.
|
8 |
* @since 1.0.0
|
9 |
*/
|
10 |
class Structuring_Markup_Display {
|
@@ -192,16 +192,16 @@ class Structuring_Markup_Display {
|
|
192 |
/**
|
193 |
* Return image dimensions
|
194 |
*
|
195 |
-
* @version
|
196 |
* @since 2.3.3
|
197 |
* @author Justin Frydman
|
|
|
198 |
* @param string $url
|
199 |
-
* @return array
|
200 |
*/
|
201 |
private function get_image_dimensions ( $url ) {
|
202 |
-
$cache = new Structuring_Markup_Cache( $url );
|
203 |
-
|
204 |
/** check for cached dimensions */
|
|
|
205 |
if ( $cache->get() !== false ) {
|
206 |
return $cache->get();
|
207 |
}
|
@@ -260,48 +260,55 @@ class Structuring_Markup_Display {
|
|
260 |
return $dimensions;
|
261 |
}
|
262 |
|
263 |
-
return
|
264 |
}
|
265 |
|
266 |
/**
|
267 |
* Setting schema.org Article
|
268 |
*
|
269 |
-
* @version 3.1.
|
270 |
* @since 1.1.0
|
271 |
* @param array $options
|
272 |
*/
|
273 |
private function set_schema_article ( array $options ) {
|
274 |
global $post;
|
275 |
|
276 |
-
$
|
|
|
|
|
277 |
$args = array(
|
278 |
"@context" => "http://schema.org",
|
279 |
-
"@type" => "Article"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
);
|
281 |
|
282 |
-
if ( has_post_thumbnail( $post->ID )
|
283 |
$images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
|
284 |
-
$
|
285 |
-
|
286 |
-
|
287 |
-
$schema_args = array(
|
288 |
-
"mainEntityOfPage" => array(
|
289 |
-
"@type" => "WebPage",
|
290 |
-
"@id" => get_permalink( $post->ID )
|
291 |
-
),
|
292 |
-
"headline" => esc_html( $post->post_title ),
|
293 |
-
"image" => array(
|
294 |
"@type" => "ImageObject",
|
295 |
"url" => $images[0],
|
296 |
"width" => $images[1],
|
297 |
"height" => $images[2]
|
298 |
-
)
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
|
|
305 |
"publisher" => array(
|
306 |
"@type" => "Organization",
|
307 |
"name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
|
@@ -312,60 +319,60 @@ class Structuring_Markup_Display {
|
|
312 |
"height" => $logo[1]
|
313 |
)
|
314 |
),
|
315 |
-
"description" => $content
|
316 |
);
|
317 |
-
$args = array_merge( $args, $
|
318 |
-
$this->set_schema_json( $args );
|
319 |
-
} else {
|
320 |
-
if ( !has_post_thumbnail( $post->ID ) ) {
|
321 |
-
$args["message"][] = __( "Featured Image not set.", $this->text_domain );
|
322 |
-
}
|
323 |
-
if ( !$this->get_image_dimensions( $options['logo'] ) ) {
|
324 |
-
$args["message"][] = __( "Logo Image not set.", $this->text_domain );
|
325 |
-
}
|
326 |
-
$this->set_schema_json( $args, __return_true() );
|
327 |
}
|
|
|
|
|
328 |
}
|
329 |
|
330 |
/**
|
331 |
* Setting schema.org BlogPosting
|
332 |
*
|
333 |
-
* @version 3.1.
|
334 |
* @since 1.2.0
|
335 |
* @param array $options
|
336 |
*/
|
337 |
private function set_schema_blog_posting ( array $options ) {
|
338 |
global $post;
|
339 |
|
340 |
-
$
|
|
|
|
|
341 |
$args = array(
|
342 |
"@context" => "http://schema.org",
|
343 |
-
"@type" => "BlogPosting"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
);
|
345 |
|
346 |
-
if ( has_post_thumbnail( $post->ID )
|
347 |
$images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
|
348 |
-
$excerpt = $this->escape_text( $post->post_excerpt );
|
349 |
-
$content = $excerpt === "" ? mb_substr( $this->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
|
350 |
|
351 |
-
$
|
352 |
-
"
|
353 |
-
"@type" => "WebPage",
|
354 |
-
"@id" => get_permalink( $post->ID )
|
355 |
-
),
|
356 |
-
"headline" => esc_html( $post->post_title ),
|
357 |
-
"image" => array(
|
358 |
"@type" => "ImageObject",
|
359 |
"url" => $images[0],
|
360 |
"width" => $images[1],
|
361 |
"height" => $images[2]
|
362 |
-
)
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
|
|
369 |
"publisher" => array(
|
370 |
"@type" => "Organization",
|
371 |
"name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
|
@@ -376,19 +383,11 @@ class Structuring_Markup_Display {
|
|
376 |
"height" => $logo[1]
|
377 |
)
|
378 |
),
|
379 |
-
"description" => $content
|
380 |
);
|
381 |
-
$args = array_merge( $args, $
|
382 |
-
$this->set_schema_json( $args );
|
383 |
-
} else {
|
384 |
-
if ( !has_post_thumbnail( $post->ID ) ) {
|
385 |
-
$args["message"][] = __( "Featured Image not set.", $this->text_domain );
|
386 |
-
}
|
387 |
-
if ( !$this->get_image_dimensions( $options['logo'] ) ) {
|
388 |
-
$args["message"][] = __( "Logo Image not set.", $this->text_domain );
|
389 |
-
}
|
390 |
-
$this->set_schema_json( $args, __return_true() );
|
391 |
}
|
|
|
|
|
392 |
}
|
393 |
|
394 |
/**
|
@@ -598,42 +597,50 @@ class Structuring_Markup_Display {
|
|
598 |
/**
|
599 |
* Setting schema.org NewsArticle
|
600 |
*
|
601 |
-
* @version 3.1.
|
602 |
* @since 1.0.0
|
603 |
* @param array $options
|
604 |
*/
|
605 |
private function set_schema_news_article ( array $options ) {
|
606 |
global $post;
|
607 |
|
608 |
-
$
|
|
|
|
|
609 |
$args = array(
|
610 |
"@context" => "http://schema.org",
|
611 |
-
"@type" => "NewsArticle"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
612 |
);
|
613 |
|
614 |
-
if ( has_post_thumbnail( $post->ID )
|
615 |
$images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
|
616 |
-
$excerpt = $this->escape_text( $post->post_excerpt );
|
617 |
-
$content = $excerpt === "" ? mb_substr( $this->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
|
618 |
|
619 |
-
$
|
620 |
-
"mainEntityOfPage" => array(
|
621 |
-
"@type" => "WebPage",
|
622 |
-
"@id" => get_permalink( $post->ID )
|
623 |
-
),
|
624 |
-
"headline" => esc_html( $post->post_title ),
|
625 |
"image" => array(
|
626 |
"@type" => "ImageObject",
|
627 |
"url" => $images[0],
|
628 |
"width" => $images[1],
|
629 |
"height" => $images[2]
|
630 |
-
)
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
|
|
637 |
"publisher" => array(
|
638 |
"@type" => "Organization",
|
639 |
"name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
|
@@ -644,19 +651,10 @@ class Structuring_Markup_Display {
|
|
644 |
"height" => $logo[1]
|
645 |
)
|
646 |
),
|
647 |
-
"description" => $content
|
648 |
);
|
649 |
-
$args = array_merge( $args, $
|
650 |
-
$this->set_schema_json( $args );
|
651 |
-
} else {
|
652 |
-
if ( !has_post_thumbnail( $post->ID ) ) {
|
653 |
-
$args["message"][] = __( "Featured Image not set.", $this->text_domain );
|
654 |
-
}
|
655 |
-
if ( !$this->get_image_dimensions( $options['logo'] ) ) {
|
656 |
-
$args["message"][] = __( "Logo Image not set.", $this->text_domain );
|
657 |
-
}
|
658 |
-
$this->set_schema_json( $args, __return_true() );
|
659 |
}
|
|
|
660 |
}
|
661 |
|
662 |
/**
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
* @author Justin Frydman
|
7 |
+
* @version 3.1.6
|
8 |
* @since 1.0.0
|
9 |
*/
|
10 |
class Structuring_Markup_Display {
|
192 |
/**
|
193 |
* Return image dimensions
|
194 |
*
|
195 |
+
* @version 3.1.5
|
196 |
* @since 2.3.3
|
197 |
* @author Justin Frydman
|
198 |
+
* @author Kazuya Takami
|
199 |
* @param string $url
|
200 |
+
* @return array | boolean $dimensions
|
201 |
*/
|
202 |
private function get_image_dimensions ( $url ) {
|
|
|
|
|
203 |
/** check for cached dimensions */
|
204 |
+
$cache = new Structuring_Markup_Cache( $url );
|
205 |
if ( $cache->get() !== false ) {
|
206 |
return $cache->get();
|
207 |
}
|
260 |
return $dimensions;
|
261 |
}
|
262 |
|
263 |
+
return __return_false();
|
264 |
}
|
265 |
|
266 |
/**
|
267 |
* Setting schema.org Article
|
268 |
*
|
269 |
+
* @version 3.1.6
|
270 |
* @since 1.1.0
|
271 |
* @param array $options
|
272 |
*/
|
273 |
private function set_schema_article ( array $options ) {
|
274 |
global $post;
|
275 |
|
276 |
+
$excerpt = $this->escape_text( $post->post_excerpt );
|
277 |
+
$content = $excerpt === "" ? mb_substr( $this->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
|
278 |
+
|
279 |
$args = array(
|
280 |
"@context" => "http://schema.org",
|
281 |
+
"@type" => "Article",
|
282 |
+
"mainEntityOfPage" => array(
|
283 |
+
"@type" => "WebPage",
|
284 |
+
"@id" => get_permalink( $post->ID )
|
285 |
+
),
|
286 |
+
"headline" => esc_html( $post->post_title ),
|
287 |
+
"datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
|
288 |
+
"dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
|
289 |
+
"author" => array(
|
290 |
+
"@type" => "Person",
|
291 |
+
"name" => esc_html( get_the_author_meta( 'display_name', $post->post_author ) )
|
292 |
+
),
|
293 |
+
"description" => $content
|
294 |
);
|
295 |
|
296 |
+
if ( has_post_thumbnail( $post->ID ) ) {
|
297 |
$images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
|
298 |
+
$images_args = array(
|
299 |
+
"image" => array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
300 |
"@type" => "ImageObject",
|
301 |
"url" => $images[0],
|
302 |
"width" => $images[1],
|
303 |
"height" => $images[2]
|
304 |
+
)
|
305 |
+
);
|
306 |
+
$args = array_merge( $args, $images_args );
|
307 |
+
}
|
308 |
+
|
309 |
+
$options['logo'] = isset( $options['logo'] ) ? esc_url( $options['logo'] ) : "";
|
310 |
+
if ( $logo = $this->get_image_dimensions( $options['logo'] ) ) {
|
311 |
+
$publisher_args = array(
|
312 |
"publisher" => array(
|
313 |
"@type" => "Organization",
|
314 |
"name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
|
319 |
"height" => $logo[1]
|
320 |
)
|
321 |
),
|
|
|
322 |
);
|
323 |
+
$args = array_merge( $args, $publisher_args );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
}
|
325 |
+
|
326 |
+
$this->set_schema_json( $args );
|
327 |
}
|
328 |
|
329 |
/**
|
330 |
* Setting schema.org BlogPosting
|
331 |
*
|
332 |
+
* @version 3.1.6
|
333 |
* @since 1.2.0
|
334 |
* @param array $options
|
335 |
*/
|
336 |
private function set_schema_blog_posting ( array $options ) {
|
337 |
global $post;
|
338 |
|
339 |
+
$excerpt = $this->escape_text( $post->post_excerpt );
|
340 |
+
$content = $excerpt === "" ? mb_substr( $this->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
|
341 |
+
|
342 |
$args = array(
|
343 |
"@context" => "http://schema.org",
|
344 |
+
"@type" => "BlogPosting",
|
345 |
+
"mainEntityOfPage" => array(
|
346 |
+
"@type" => "WebPage",
|
347 |
+
"@id" => get_permalink( $post->ID )
|
348 |
+
),
|
349 |
+
"headline" => esc_html( $post->post_title ),
|
350 |
+
"datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
|
351 |
+
"dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
|
352 |
+
"author" => array(
|
353 |
+
"@type" => "Person",
|
354 |
+
"name" => esc_html( get_the_author_meta( 'display_name', $post->post_author ) )
|
355 |
+
),
|
356 |
+
"description" => $content
|
357 |
);
|
358 |
|
359 |
+
if ( has_post_thumbnail( $post->ID ) ) {
|
360 |
$images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
|
|
|
|
|
361 |
|
362 |
+
$images_args = array(
|
363 |
+
"image" => array(
|
|
|
|
|
|
|
|
|
|
|
364 |
"@type" => "ImageObject",
|
365 |
"url" => $images[0],
|
366 |
"width" => $images[1],
|
367 |
"height" => $images[2]
|
368 |
+
)
|
369 |
+
);
|
370 |
+
$args = array_merge( $args, $images_args );
|
371 |
+
}
|
372 |
+
|
373 |
+
$options['logo'] = isset( $options['logo'] ) ? esc_url( $options['logo'] ) : "";
|
374 |
+
if ( $logo = $this->get_image_dimensions( $options['logo'] ) ) {
|
375 |
+
$publisher_args = array(
|
376 |
"publisher" => array(
|
377 |
"@type" => "Organization",
|
378 |
"name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
|
383 |
"height" => $logo[1]
|
384 |
)
|
385 |
),
|
|
|
386 |
);
|
387 |
+
$args = array_merge( $args, $publisher_args );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
388 |
}
|
389 |
+
|
390 |
+
$this->set_schema_json( $args );
|
391 |
}
|
392 |
|
393 |
/**
|
597 |
/**
|
598 |
* Setting schema.org NewsArticle
|
599 |
*
|
600 |
+
* @version 3.1.6
|
601 |
* @since 1.0.0
|
602 |
* @param array $options
|
603 |
*/
|
604 |
private function set_schema_news_article ( array $options ) {
|
605 |
global $post;
|
606 |
|
607 |
+
$excerpt = $this->escape_text( $post->post_excerpt );
|
608 |
+
$content = $excerpt === "" ? mb_substr( $this->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
|
609 |
+
|
610 |
$args = array(
|
611 |
"@context" => "http://schema.org",
|
612 |
+
"@type" => "NewsArticle",
|
613 |
+
"mainEntityOfPage" => array(
|
614 |
+
"@type" => "WebPage",
|
615 |
+
"@id" => get_permalink( $post->ID )
|
616 |
+
),
|
617 |
+
"headline" => esc_html( $post->post_title ),
|
618 |
+
"datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
|
619 |
+
"dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
|
620 |
+
"author" => array(
|
621 |
+
"@type" => "Person",
|
622 |
+
"name" => esc_html( get_the_author_meta( 'display_name', $post->post_author ) )
|
623 |
+
),
|
624 |
+
"description" => $content
|
625 |
);
|
626 |
|
627 |
+
if ( has_post_thumbnail( $post->ID ) ) {
|
628 |
$images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
|
|
|
|
|
629 |
|
630 |
+
$images_args = array(
|
|
|
|
|
|
|
|
|
|
|
631 |
"image" => array(
|
632 |
"@type" => "ImageObject",
|
633 |
"url" => $images[0],
|
634 |
"width" => $images[1],
|
635 |
"height" => $images[2]
|
636 |
+
)
|
637 |
+
);
|
638 |
+
$args = array_merge( $args, $images_args );
|
639 |
+
}
|
640 |
+
|
641 |
+
$options['logo'] = isset( $options['logo'] ) ? esc_url( $options['logo'] ) : "";
|
642 |
+
if ( $logo = $this->get_image_dimensions( $options['logo'] ) ) {
|
643 |
+
$publisher_args = array(
|
644 |
"publisher" => array(
|
645 |
"@type" => "Organization",
|
646 |
"name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
|
651 |
"height" => $logo[1]
|
652 |
)
|
653 |
),
|
|
|
654 |
);
|
655 |
+
$args = array_merge( $args, $publisher_args );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
656 |
}
|
657 |
+
$this->set_schema_json( $args );
|
658 |
}
|
659 |
|
660 |
/**
|
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: 4.7.0
|
6 |
-
Stable tag: 3.1.
|
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 |
= 3.1.5 (2016-12-08) =
|
58 |
* Checked : WordPress version 4.7.0 operation check.
|
59 |
|
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.7.0
|
6 |
+
Stable tag: 3.1.6
|
7 |
|
8 |
Allows you to include schema.org JSON-LD syntax markup on your website
|
9 |
|
54 |
|
55 |
== Changelog ==
|
56 |
|
57 |
+
= 3.1.6 (2016-12-16) =
|
58 |
+
* Updated : Change ImageObject attribute of Schema.org type "Article", "BlogPosting", "NewsArticle" from "required" to "recommended".
|
59 |
+
* Fixed : Custom post menu control.
|
60 |
+
|
61 |
= 3.1.5 (2016-12-08) =
|
62 |
* Checked : WordPress version 4.7.0 operation check.
|
63 |
|
wp-structuring-markup.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Markup (JSON-LD) structured in schema.org
|
4 |
Plugin URI: https://wordpress.org/plugins/wp-structuring-markup/
|
5 |
Description: Allows you to include schema.org JSON-LD syntax markup on your website
|
6 |
-
Version: 3.1.
|
7 |
Author: Kazuya Takami
|
8 |
Author URI: http://programp.com/
|
9 |
License: GPLv2 or later
|
@@ -18,7 +18,7 @@ new Structuring_Markup();
|
|
18 |
* Schema.org Basic Class
|
19 |
*
|
20 |
* @author Kazuya Takami
|
21 |
-
* @version 3.1.
|
22 |
* @since 1.0.0
|
23 |
*/
|
24 |
class Structuring_Markup {
|
@@ -26,11 +26,11 @@ class Structuring_Markup {
|
|
26 |
/**
|
27 |
* Variable definition.
|
28 |
*
|
29 |
-
* @version 3.1.
|
30 |
* @since 1.3.0
|
31 |
*/
|
32 |
private $text_domain = 'wp-structuring-markup';
|
33 |
-
private $version = '3.1.
|
34 |
|
35 |
/**
|
36 |
* Constructor Define.
|
@@ -144,7 +144,7 @@ class Structuring_Markup {
|
|
144 |
/**
|
145 |
* Add Menu to the Admin Screen.
|
146 |
*
|
147 |
-
* @version 3.
|
148 |
* @since 1.0.0
|
149 |
*/
|
150 |
public function admin_menu () {
|
@@ -168,33 +168,6 @@ class Structuring_Markup {
|
|
168 |
add_action( 'admin_print_styles-' . $list_page, array( $this, 'add_style' ) );
|
169 |
add_action( 'admin_print_styles-' . $post_page, array( $this, 'add_style' ) );
|
170 |
add_action( 'admin_print_scripts-' . $post_page, array( $this, 'admin_scripts' ) );
|
171 |
-
|
172 |
-
/** Custom post menu controls */
|
173 |
-
if ( isset( $_GET['page'] ) && $_GET['page'] === $this->text_domain . '-post' && !empty( $_POST ) ) {
|
174 |
-
if ( isset( $_POST['activate'] ) && $_POST['activate'] === 'on' ) {
|
175 |
-
flush_rewrite_rules();
|
176 |
-
}
|
177 |
-
if ( !isset( $_POST['activate'] ) && isset( $_GET['type'] ) && $_GET['type'] === 'event' ) {
|
178 |
-
remove_menu_page('edit.php?post_type=schema_event_post');
|
179 |
-
}
|
180 |
-
if ( !isset( $_POST['activate'] ) && isset( $_GET['type'] ) && $_GET['type'] === 'video' ) {
|
181 |
-
remove_menu_page('edit.php?post_type=schema_video_post');
|
182 |
-
}
|
183 |
-
} else {
|
184 |
-
/** DB Connect */
|
185 |
-
$db = new Structuring_Markup_Admin_Db();
|
186 |
-
$results = $db->get_type_options('event');
|
187 |
-
|
188 |
-
if ( !isset( $results['activate'] ) || $results['activate'] !== 'on' ) {
|
189 |
-
remove_menu_page( 'edit.php?post_type=schema_event_post' );
|
190 |
-
}
|
191 |
-
|
192 |
-
$results = $db->get_type_options('video');
|
193 |
-
|
194 |
-
if ( !isset( $results['activate'] ) || $results['activate'] !== 'on' ) {
|
195 |
-
remove_menu_page( 'edit.php?post_type=schema_video_post' );
|
196 |
-
}
|
197 |
-
}
|
198 |
}
|
199 |
|
200 |
/**
|
3 |
Plugin Name: Markup (JSON-LD) structured in schema.org
|
4 |
Plugin URI: https://wordpress.org/plugins/wp-structuring-markup/
|
5 |
Description: Allows you to include schema.org JSON-LD syntax markup on your website
|
6 |
+
Version: 3.1.6
|
7 |
Author: Kazuya Takami
|
8 |
Author URI: http://programp.com/
|
9 |
License: GPLv2 or later
|
18 |
* Schema.org Basic Class
|
19 |
*
|
20 |
* @author Kazuya Takami
|
21 |
+
* @version 3.1.6
|
22 |
* @since 1.0.0
|
23 |
*/
|
24 |
class Structuring_Markup {
|
26 |
/**
|
27 |
* Variable definition.
|
28 |
*
|
29 |
+
* @version 3.1.6
|
30 |
* @since 1.3.0
|
31 |
*/
|
32 |
private $text_domain = 'wp-structuring-markup';
|
33 |
+
private $version = '3.1.6';
|
34 |
|
35 |
/**
|
36 |
* Constructor Define.
|
144 |
/**
|
145 |
* Add Menu to the Admin Screen.
|
146 |
*
|
147 |
+
* @version 3.1.6
|
148 |
* @since 1.0.0
|
149 |
*/
|
150 |
public function admin_menu () {
|
168 |
add_action( 'admin_print_styles-' . $list_page, array( $this, 'add_style' ) );
|
169 |
add_action( 'admin_print_styles-' . $post_page, array( $this, 'add_style' ) );
|
170 |
add_action( 'admin_print_scripts-' . $post_page, array( $this, 'admin_scripts' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
}
|
172 |
|
173 |
/**
|