Version Description
(2018-08-17) = * Checked : WordPress version 4.9.8 operation check. * Added : Speakable structured markup is implemented in "Article", "BlogPosting", "NewsArticle". * Added : Added function to compress output data.
Download this release
Release Info
Developer | miiitaka |
Plugin | Markup (JSON-LD) structured in schema.org |
Version | 4.5.0 |
Comparing to | |
See all releases |
Code changes from version 4.4.0 to 4.5.0
- includes/admin/wp-structuring-admin-config.php +151 -0
- includes/admin/wp-structuring-admin-db.php +33 -4
- includes/admin/wp-structuring-admin-type-article.php +46 -9
- includes/admin/wp-structuring-admin-type-blog-posting.php +40 -3
- includes/admin/wp-structuring-admin-type-news-article.php +40 -3
- includes/admin/wp-structuring-admin-type-website.php +7 -7
- includes/meta/wp-structuring-meta-article.php +18 -2
- includes/meta/wp-structuring-meta-blog-posting.php +18 -2
- includes/meta/wp-structuring-meta-news-article.php +18 -2
- includes/meta/wp-structuring-meta-website.php +9 -9
- includes/wp-structuring-display.php +32 -10
- readme.txt +8 -2
- uninstall.php +8 -7
- wp-structuring-markup.php +40 -12
includes/admin/wp-structuring-admin-config.php
ADDED
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Admin Config
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.5.0
|
7 |
+
* @since 4.5.0
|
8 |
+
*/
|
9 |
+
class Structuring_Markup_Admin_Config {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Variable definition.
|
13 |
+
*
|
14 |
+
* @version 4.5.0
|
15 |
+
* @since 4.5.0
|
16 |
+
*/
|
17 |
+
private $text_domain;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Defined nonce.
|
21 |
+
*
|
22 |
+
* @version 4.5.0
|
23 |
+
* @since 4.5.0
|
24 |
+
*/
|
25 |
+
private $nonce_name;
|
26 |
+
private $nonce_action;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Constructor Define.
|
30 |
+
*
|
31 |
+
* @version 4.5.0
|
32 |
+
* @since 4.5.0
|
33 |
+
* @param String $text_domain
|
34 |
+
*/
|
35 |
+
public function __construct ( $text_domain ) {
|
36 |
+
$this->text_domain = $text_domain;
|
37 |
+
$this->nonce_name = "_wpnonce_" . $text_domain;
|
38 |
+
$this->nonce_action = "config-" . $text_domain;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Update Status
|
42 |
+
*
|
43 |
+
* "ok" : Successful update
|
44 |
+
* "output" : Output No Check
|
45 |
+
*/
|
46 |
+
$status = "";
|
47 |
+
|
48 |
+
/** DataBase Update & Insert Mode */
|
49 |
+
if ( ! empty( $_POST ) && check_admin_referer( $this->nonce_action, $this->nonce_name ) ) {
|
50 |
+
$db = new Structuring_Markup_Admin_Db();
|
51 |
+
if ( $db->update_config( $_POST, $this->text_domain ) ) {
|
52 |
+
$status = "ok";
|
53 |
+
} else {
|
54 |
+
$status = "error";
|
55 |
+
}
|
56 |
+
}
|
57 |
+
$options = get_option( $text_domain );
|
58 |
+
|
59 |
+
$this->page_render( $options, $status );
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Setting Page of the Admin Screen.
|
64 |
+
*
|
65 |
+
* @version 4.5.0
|
66 |
+
* @since 4.5.0
|
67 |
+
* @param array $options
|
68 |
+
* @param string $status
|
69 |
+
*/
|
70 |
+
private function page_render ( array $options, $status ) {
|
71 |
+
$html = '';
|
72 |
+
$html .= '<div class="wrap">';
|
73 |
+
$html .= '<h1>' . esc_html__( 'Schema.org Config', $this->text_domain ) . '</h1>';
|
74 |
+
switch ( $status ) {
|
75 |
+
case "ok":
|
76 |
+
$html .= $this->information_render();
|
77 |
+
break;
|
78 |
+
case "error":
|
79 |
+
$html .= $this->error_render();
|
80 |
+
break;
|
81 |
+
default:
|
82 |
+
break;
|
83 |
+
}
|
84 |
+
echo $html;
|
85 |
+
|
86 |
+
/** Output Page Select */
|
87 |
+
$html = '<hr>';
|
88 |
+
$html .= '<form method="post" action="">';
|
89 |
+
echo $html;
|
90 |
+
|
91 |
+
wp_nonce_field( $this->nonce_action, $this->nonce_name );
|
92 |
+
|
93 |
+
$html = '<table class="schema-admin-table">';
|
94 |
+
|
95 |
+
$html .= '<tr><th>' . esc_html__( 'Plug-in version' ) . ' : </th>';
|
96 |
+
$html .= '<td>';
|
97 |
+
$html .= isset( $options['version'] ) ? esc_html( $options['version'] ) : '';
|
98 |
+
$html .= '</td></tr>';
|
99 |
+
|
100 |
+
$html .= '<tr><th><label for="compress">Enabled : </label></th>';
|
101 |
+
$html .= '<td><label><input type="checkbox" name="compress" id="compress" value="on"';
|
102 |
+
$html .= ( isset( $options['compress'] ) && $options['compress'] === "on" ) ? ' checked' : '';
|
103 |
+
$html .= '><label for="compress">' . esc_html__( 'Compress output data', $this->text_domain ) . '</label></td></tr>';
|
104 |
+
|
105 |
+
$html .= '</table>';
|
106 |
+
|
107 |
+
echo $html;
|
108 |
+
|
109 |
+
submit_button();
|
110 |
+
|
111 |
+
$html = '</form>';
|
112 |
+
$html .= '</div>';
|
113 |
+
echo $html;
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Information Message Render
|
118 |
+
*
|
119 |
+
* @version 4.5.0
|
120 |
+
* @since 4.5.0
|
121 |
+
* @return string $html
|
122 |
+
*/
|
123 |
+
private function information_render () {
|
124 |
+
$html = '<div id="message" class="updated notice notice-success is-dismissible below-h2">';
|
125 |
+
$html .= '<p>Schema.org Config Update.</p>';
|
126 |
+
$html .= '<button type="button" class="notice-dismiss">';
|
127 |
+
$html .= '<span class="screen-reader-text">Dismiss this notice.</span>';
|
128 |
+
$html .= '</button>';
|
129 |
+
$html .= '</div>';
|
130 |
+
|
131 |
+
return (string) $html;
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Error Message Render
|
136 |
+
*
|
137 |
+
* @version 4.5.0
|
138 |
+
* @since 4.5.0
|
139 |
+
* @return string $html
|
140 |
+
*/
|
141 |
+
private function error_render () {
|
142 |
+
$html = '<div id="notice" class="notice notice-error is-dismissible below-h2">';
|
143 |
+
$html .= '<p>Update Error.</p>';
|
144 |
+
$html .= '<button type="button" class="notice-dismiss">';
|
145 |
+
$html .= '<span class="screen-reader-text">Dismiss this notice.</span>';
|
146 |
+
$html .= '</button>';
|
147 |
+
$html .= '</div>';
|
148 |
+
|
149 |
+
return (string) $html;
|
150 |
+
}
|
151 |
+
}
|
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.
|
7 |
* @since 1.0.0
|
8 |
*/
|
9 |
class Structuring_Markup_Admin_Db {
|
@@ -127,7 +127,7 @@ class Structuring_Markup_Admin_Db {
|
|
127 |
/**
|
128 |
* Create table execute
|
129 |
*
|
130 |
-
* @version
|
131 |
* @since 2.0.0
|
132 |
* @param string $charset_collate
|
133 |
* @param string $text_domain
|
@@ -146,8 +146,13 @@ class Structuring_Markup_Admin_Db {
|
|
146 |
|
147 |
dbDelta( $query );
|
148 |
|
149 |
-
$
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
151 |
}
|
152 |
|
153 |
/**
|
@@ -258,4 +263,28 @@ class Structuring_Markup_Admin_Db {
|
|
258 |
|
259 |
return (integer) $post['id'];
|
260 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
}
|
3 |
* Schema.org Admin DB Connection.
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 4.5.0
|
7 |
* @since 1.0.0
|
8 |
*/
|
9 |
class Structuring_Markup_Admin_Db {
|
127 |
/**
|
128 |
* Create table execute
|
129 |
*
|
130 |
+
* @version 4.5.0
|
131 |
* @since 2.0.0
|
132 |
* @param string $charset_collate
|
133 |
* @param string $text_domain
|
146 |
|
147 |
dbDelta( $query );
|
148 |
|
149 |
+
$args = array( 'version' => $version );
|
150 |
+
$options = get_option( $text_domain );
|
151 |
+
|
152 |
+
if ( $options ) {
|
153 |
+
$options = array_merge( $options, $args );
|
154 |
+
}
|
155 |
+
update_option( $text_domain, $options );
|
156 |
}
|
157 |
|
158 |
/**
|
263 |
|
264 |
return (integer) $post['id'];
|
265 |
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Update Config Data.
|
269 |
+
*
|
270 |
+
* @version 4.5.0
|
271 |
+
* @since 4.5.0
|
272 |
+
* @param array $post
|
273 |
+
* @param string $text_domain
|
274 |
+
* @return boolean
|
275 |
+
*/
|
276 |
+
public function update_config ( array $post, $text_domain ) {
|
277 |
+
$options = get_option( $text_domain );
|
278 |
+
|
279 |
+
if ( !$options ) {
|
280 |
+
return __return_false();
|
281 |
+
} else {
|
282 |
+
$args = array(
|
283 |
+
'compress' => isset( $post['compress'] ) ? $post['compress'] : ''
|
284 |
+
);
|
285 |
+
$options = array_merge( $options, $args );
|
286 |
+
update_option( $text_domain, $options );
|
287 |
+
return __return_true();
|
288 |
+
}
|
289 |
+
}
|
290 |
}
|
includes/admin/wp-structuring-admin-type-article.php
CHANGED
@@ -3,11 +3,12 @@
|
|
3 |
* Schema.org Type Article
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version 4.
|
7 |
* @since 1.1.0
|
8 |
* @see wp-structuring-admin-db.php
|
9 |
* @link http://schema.org/Article
|
10 |
* @link https://developers.google.com/search/docs/data-types/articles
|
|
|
11 |
*/
|
12 |
class Structuring_Markup_Type_Article {
|
13 |
|
@@ -32,7 +33,7 @@ class Structuring_Markup_Type_Article {
|
|
32 |
/**
|
33 |
* Form Layout Render
|
34 |
*
|
35 |
-
* @version 4.
|
36 |
* @since 1.1.0
|
37 |
* @param array $option
|
38 |
*/
|
@@ -107,6 +108,38 @@ class Structuring_Markup_Type_Article {
|
|
107 |
$html .= '</table>';
|
108 |
echo $html;
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/data-types/articles" target="_blank">https://developers.google.com/search/docs/data-types/articles</a></p>';
|
111 |
submit_button();
|
112 |
}
|
@@ -114,17 +147,21 @@ class Structuring_Markup_Type_Article {
|
|
114 |
/**
|
115 |
* Return the default options array
|
116 |
*
|
117 |
-
* @since 4.
|
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']
|
127 |
-
$args['logo-width']
|
|
|
|
|
|
|
|
|
128 |
|
129 |
return (array) $args;
|
130 |
}
|
3 |
* Schema.org Type Article
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 4.5.0
|
7 |
* @since 1.1.0
|
8 |
* @see wp-structuring-admin-db.php
|
9 |
* @link http://schema.org/Article
|
10 |
* @link https://developers.google.com/search/docs/data-types/articles
|
11 |
+
* @link https://developers.google.com/search/docs/data-types/speakable
|
12 |
*/
|
13 |
class Structuring_Markup_Type_Article {
|
14 |
|
33 |
/**
|
34 |
* Form Layout Render
|
35 |
*
|
36 |
+
* @version 4.5.0
|
37 |
* @since 1.1.0
|
38 |
* @param array $option
|
39 |
*/
|
108 |
$html .= '</table>';
|
109 |
echo $html;
|
110 |
|
111 |
+
$html = '<table class="schema-admin-table">';
|
112 |
+
$html .= '<caption>Speakable</caption>';
|
113 |
+
$html .= '<tr><th><label for="speakable_action">speakable Active :</label></th><td>';
|
114 |
+
$html .= '<label><input type="checkbox" name="option[' . "speakable_action" . ']" id="speakable_action" value="on"';
|
115 |
+
|
116 |
+
if ( isset( $option['speakable_action'] ) && $option['speakable_action'] === 'on' ) {
|
117 |
+
$html .= ' checked="checked"';
|
118 |
+
}
|
119 |
+
$html .= '>Enabled</label>';
|
120 |
+
$html .= '</td></tr>';
|
121 |
+
$html .= '<tr><th><label for="speakable_type_css">cssSelector OR xpath :</label></th><td>';
|
122 |
+
|
123 |
+
if( $option['speakable_type'] !== 'xpath' ) {
|
124 |
+
$checked['css'] = ' checked';
|
125 |
+
$checked['xpath'] = '';
|
126 |
+
} else {
|
127 |
+
$checked['css'] = '';
|
128 |
+
$checked['xpath'] = ' checked';
|
129 |
+
}
|
130 |
+
|
131 |
+
$html .= '<label><input type="radio" name="option[' . "speakable_type" . ']" id="speakable_type_css" value="cssSelector"' . $checked['css'] . '>CSS selectors </label>';
|
132 |
+
$html .= '<label><input type="radio" name="option[' . "speakable_type" . ']" id="speakable_type_xpath" value="xpath"' . $checked['xpath'] . '>xPaths</label>';
|
133 |
+
$html .= '</td></tr>';
|
134 |
+
$html .= '<tr><th><label for="speakable_headline">headline :</label></th><td>';
|
135 |
+
$html .= '<input type="text" name="option[' . "speakable_headline" . ']" id="speakable_headline" class="regular-text" value="' . esc_attr( stripslashes( $option['speakable_headline'] ) ) . '">';
|
136 |
+
$html .= '</td></tr>';
|
137 |
+
$html .= '<tr><th><label for="speakable_summary">summary :</label></th><td>';
|
138 |
+
$html .= '<input type="text" name="option[' . "speakable_summary" . ']" id="speakable_summary" class="regular-text" value="' . esc_attr( stripslashes( $option['speakable_summary'] ) ) . '">';
|
139 |
+
$html .= '</td></tr>';
|
140 |
+
$html .= '</table>';
|
141 |
+
echo $html;
|
142 |
+
|
143 |
echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/data-types/articles" target="_blank">https://developers.google.com/search/docs/data-types/articles</a></p>';
|
144 |
submit_button();
|
145 |
}
|
147 |
/**
|
148 |
* Return the default options array
|
149 |
*
|
150 |
+
* @since 4.5.0
|
151 |
* @version 2.2.0
|
152 |
* @return array $args
|
153 |
*/
|
154 |
private function get_default_options () {
|
155 |
+
$args['name'] = '';
|
156 |
+
$args['content_image'] = '';
|
157 |
+
$args['default_image'] = '';
|
158 |
+
$args['logo'] = '';
|
159 |
+
$args['logo-height'] = 0;
|
160 |
+
$args['logo-width'] = 0;
|
161 |
+
$args['speakable_action'] = '';
|
162 |
+
$args['speakable_type'] = '';
|
163 |
+
$args['speakable_headline'] = '';
|
164 |
+
$args['speakable_summary'] = '';
|
165 |
|
166 |
return (array) $args;
|
167 |
}
|
includes/admin/wp-structuring-admin-type-blog-posting.php
CHANGED
@@ -3,11 +3,12 @@
|
|
3 |
* Schema.org Type BlogPosting
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version 4.
|
7 |
* @since 1.2.0
|
8 |
* @see wp-structuring-admin-db.php
|
9 |
* @link http://schema.org/BlogPosting
|
10 |
* @link https://developers.google.com/search/docs/data-types/articles
|
|
|
11 |
*/
|
12 |
class Structuring_Markup_Type_Blog_Posting {
|
13 |
|
@@ -32,7 +33,7 @@ class Structuring_Markup_Type_Blog_Posting {
|
|
32 |
/**
|
33 |
* Form Layout Render
|
34 |
*
|
35 |
-
* @version 4.
|
36 |
* @since 1.2.0
|
37 |
* @param array $option
|
38 |
*/
|
@@ -107,6 +108,38 @@ class Structuring_Markup_Type_Blog_Posting {
|
|
107 |
$html .= '</table>';
|
108 |
echo $html;
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/data-types/articles" target="_blank">https://developers.google.com/search/docs/data-types/articles</a></p>';
|
111 |
submit_button();
|
112 |
}
|
@@ -114,7 +147,7 @@ class Structuring_Markup_Type_Blog_Posting {
|
|
114 |
/**
|
115 |
* Return the default options array
|
116 |
*
|
117 |
-
* @version 4.
|
118 |
* @since 2.2.0
|
119 |
* @return array $args
|
120 |
*/
|
@@ -125,6 +158,10 @@ class Structuring_Markup_Type_Blog_Posting {
|
|
125 |
$args['logo'] = '';
|
126 |
$args['logo-height'] = 0;
|
127 |
$args['logo-width'] = 0;
|
|
|
|
|
|
|
|
|
128 |
|
129 |
return (array) $args;
|
130 |
}
|
3 |
* Schema.org Type BlogPosting
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 4.5.0
|
7 |
* @since 1.2.0
|
8 |
* @see wp-structuring-admin-db.php
|
9 |
* @link http://schema.org/BlogPosting
|
10 |
* @link https://developers.google.com/search/docs/data-types/articles
|
11 |
+
* @link https://developers.google.com/search/docs/data-types/speakable
|
12 |
*/
|
13 |
class Structuring_Markup_Type_Blog_Posting {
|
14 |
|
33 |
/**
|
34 |
* Form Layout Render
|
35 |
*
|
36 |
+
* @version 4.5.0
|
37 |
* @since 1.2.0
|
38 |
* @param array $option
|
39 |
*/
|
108 |
$html .= '</table>';
|
109 |
echo $html;
|
110 |
|
111 |
+
$html = '<table class="schema-admin-table">';
|
112 |
+
$html .= '<caption>Speakable</caption>';
|
113 |
+
$html .= '<tr><th><label for="speakable_action">speakable Active :</label></th><td>';
|
114 |
+
$html .= '<label><input type="checkbox" name="option[' . "speakable_action" . ']" id="speakable_action" value="on"';
|
115 |
+
|
116 |
+
if ( isset( $option['speakable_action'] ) && $option['speakable_action'] === 'on' ) {
|
117 |
+
$html .= ' checked="checked"';
|
118 |
+
}
|
119 |
+
$html .= '>Enabled</label>';
|
120 |
+
$html .= '</td></tr>';
|
121 |
+
$html .= '<tr><th><label for="speakable_type_css">cssSelector OR xpath :</label></th><td>';
|
122 |
+
|
123 |
+
if( $option['speakable_type'] !== 'xpath' ) {
|
124 |
+
$checked['css'] = ' checked';
|
125 |
+
$checked['xpath'] = '';
|
126 |
+
} else {
|
127 |
+
$checked['css'] = '';
|
128 |
+
$checked['xpath'] = ' checked';
|
129 |
+
}
|
130 |
+
|
131 |
+
$html .= '<label><input type="radio" name="option[' . "speakable_type" . ']" id="speakable_type_css" value="cssSelector"' . $checked['css'] . '>CSS selectors </label>';
|
132 |
+
$html .= '<label><input type="radio" name="option[' . "speakable_type" . ']" id="speakable_type_xpath" value="xpath"' . $checked['xpath'] . '>xPaths</label>';
|
133 |
+
$html .= '</td></tr>';
|
134 |
+
$html .= '<tr><th><label for="speakable_headline">headline :</label></th><td>';
|
135 |
+
$html .= '<input type="text" name="option[' . "speakable_headline" . ']" id="speakable_headline" class="regular-text" value="' . esc_attr( stripslashes( $option['speakable_headline'] ) ) . '">';
|
136 |
+
$html .= '</td></tr>';
|
137 |
+
$html .= '<tr><th><label for="speakable_summary">summary :</label></th><td>';
|
138 |
+
$html .= '<input type="text" name="option[' . "speakable_summary" . ']" id="speakable_summary" class="regular-text" value="' . esc_attr( stripslashes( $option['speakable_summary'] ) ) . '">';
|
139 |
+
$html .= '</td></tr>';
|
140 |
+
$html .= '</table>';
|
141 |
+
echo $html;
|
142 |
+
|
143 |
echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/data-types/articles" target="_blank">https://developers.google.com/search/docs/data-types/articles</a></p>';
|
144 |
submit_button();
|
145 |
}
|
147 |
/**
|
148 |
* Return the default options array
|
149 |
*
|
150 |
+
* @version 4.5.0
|
151 |
* @since 2.2.0
|
152 |
* @return array $args
|
153 |
*/
|
158 |
$args['logo'] = '';
|
159 |
$args['logo-height'] = 0;
|
160 |
$args['logo-width'] = 0;
|
161 |
+
$args['speakable_action'] = '';
|
162 |
+
$args['speakable_type'] = '';
|
163 |
+
$args['speakable_headline'] = '';
|
164 |
+
$args['speakable_summary'] = '';
|
165 |
|
166 |
return (array) $args;
|
167 |
}
|
includes/admin/wp-structuring-admin-type-news-article.php
CHANGED
@@ -3,11 +3,12 @@
|
|
3 |
* Schema.org Type News Article
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version 4.
|
7 |
* @since 1.0.0
|
8 |
* @see wp-structuring-admin-db.php
|
9 |
* @link http://schema.org/NewsArticle
|
10 |
* @link https://developers.google.com/search/docs/data-types/articles
|
|
|
11 |
*/
|
12 |
class Structuring_Markup_Type_NewsArticle {
|
13 |
|
@@ -32,7 +33,7 @@ class Structuring_Markup_Type_NewsArticle {
|
|
32 |
/**
|
33 |
* Form Layout Render
|
34 |
*
|
35 |
-
* @version 4.
|
36 |
* @since 1.0.0
|
37 |
* @param array $option
|
38 |
*/
|
@@ -107,6 +108,38 @@ class Structuring_Markup_Type_NewsArticle {
|
|
107 |
$html .= '</table>';
|
108 |
echo $html;
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/data-types/articles" target="_blank">https://developers.google.com/search/docs/data-types/articles</a></p>';
|
111 |
submit_button();
|
112 |
}
|
@@ -114,7 +147,7 @@ class Structuring_Markup_Type_NewsArticle {
|
|
114 |
/**
|
115 |
* Return the default options array
|
116 |
*
|
117 |
-
* @since 4.
|
118 |
* @version 2.2.0
|
119 |
* @return array $args
|
120 |
*/
|
@@ -125,6 +158,10 @@ class Structuring_Markup_Type_NewsArticle {
|
|
125 |
$args['logo'] = '';
|
126 |
$args['logo-height'] = 0;
|
127 |
$args['logo-width'] = 0;
|
|
|
|
|
|
|
|
|
128 |
|
129 |
return (array) $args;
|
130 |
}
|
3 |
* Schema.org Type News Article
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 4.5.0
|
7 |
* @since 1.0.0
|
8 |
* @see wp-structuring-admin-db.php
|
9 |
* @link http://schema.org/NewsArticle
|
10 |
* @link https://developers.google.com/search/docs/data-types/articles
|
11 |
+
* @link https://developers.google.com/search/docs/data-types/speakable
|
12 |
*/
|
13 |
class Structuring_Markup_Type_NewsArticle {
|
14 |
|
33 |
/**
|
34 |
* Form Layout Render
|
35 |
*
|
36 |
+
* @version 4.5.0
|
37 |
* @since 1.0.0
|
38 |
* @param array $option
|
39 |
*/
|
108 |
$html .= '</table>';
|
109 |
echo $html;
|
110 |
|
111 |
+
$html = '<table class="schema-admin-table">';
|
112 |
+
$html .= '<caption>Speakable</caption>';
|
113 |
+
$html .= '<tr><th><label for="speakable_action">speakable Active :</label></th><td>';
|
114 |
+
$html .= '<label><input type="checkbox" name="option[' . "speakable_action" . ']" id="speakable_action" value="on"';
|
115 |
+
|
116 |
+
if ( isset( $option['speakable_action'] ) && $option['speakable_action'] === 'on' ) {
|
117 |
+
$html .= ' checked="checked"';
|
118 |
+
}
|
119 |
+
$html .= '>Enabled</label>';
|
120 |
+
$html .= '</td></tr>';
|
121 |
+
$html .= '<tr><th><label for="speakable_type_css">cssSelector OR xpath :</label></th><td>';
|
122 |
+
|
123 |
+
if( $option['speakable_type'] !== 'xpath' ) {
|
124 |
+
$checked['css'] = ' checked';
|
125 |
+
$checked['xpath'] = '';
|
126 |
+
} else {
|
127 |
+
$checked['css'] = '';
|
128 |
+
$checked['xpath'] = ' checked';
|
129 |
+
}
|
130 |
+
|
131 |
+
$html .= '<label><input type="radio" name="option[' . "speakable_type" . ']" id="speakable_type_css" value="cssSelector"' . $checked['css'] . '>CSS selectors </label>';
|
132 |
+
$html .= '<label><input type="radio" name="option[' . "speakable_type" . ']" id="speakable_type_xpath" value="xpath"' . $checked['xpath'] . '>xPaths</label>';
|
133 |
+
$html .= '</td></tr>';
|
134 |
+
$html .= '<tr><th><label for="speakable_headline">headline :</label></th><td>';
|
135 |
+
$html .= '<input type="text" name="option[' . "speakable_headline" . ']" id="speakable_headline" class="regular-text" value="' . esc_attr( stripslashes( $option['speakable_headline'] ) ) . '">';
|
136 |
+
$html .= '</td></tr>';
|
137 |
+
$html .= '<tr><th><label for="speakable_summary">summary :</label></th><td>';
|
138 |
+
$html .= '<input type="text" name="option[' . "speakable_summary" . ']" id="speakable_summary" class="regular-text" value="' . esc_attr( stripslashes( $option['speakable_summary'] ) ) . '">';
|
139 |
+
$html .= '</td></tr>';
|
140 |
+
$html .= '</table>';
|
141 |
+
echo $html;
|
142 |
+
|
143 |
echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/data-types/articles" target="_blank">https://developers.google.com/search/docs/data-types/articles</a></p>';
|
144 |
submit_button();
|
145 |
}
|
147 |
/**
|
148 |
* Return the default options array
|
149 |
*
|
150 |
+
* @since 4.5.0
|
151 |
* @version 2.2.0
|
152 |
* @return array $args
|
153 |
*/
|
158 |
$args['logo'] = '';
|
159 |
$args['logo-height'] = 0;
|
160 |
$args['logo-width'] = 0;
|
161 |
+
$args['speakable_action'] = '';
|
162 |
+
$args['speakable_type'] = '';
|
163 |
+
$args['speakable_headline'] = '';
|
164 |
+
$args['speakable_summary'] = '';
|
165 |
|
166 |
return (array) $args;
|
167 |
}
|
includes/admin/wp-structuring-admin-type-website.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Schema.org Type WebSite
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version 4.
|
7 |
* @since 1.0.0
|
8 |
* @see wp-structuring-admin-db.php
|
9 |
* @link https://schema.org/WebSite
|
@@ -33,7 +33,7 @@ class Structuring_Markup_Type_Website {
|
|
33 |
/**
|
34 |
* Form Layout Render
|
35 |
*
|
36 |
-
* @version 4.
|
37 |
* @since 2.3.3
|
38 |
* @param array $option
|
39 |
*/
|
@@ -55,11 +55,11 @@ class Structuring_Markup_Type_Website {
|
|
55 |
$html = '<table class="schema-admin-table">';
|
56 |
$html .= '<caption>Sitelink Search Box [ Site ]</caption>';
|
57 |
$html .= '<tr><th><label for="potential_action">potentialAction Active :</label></th><td>';
|
58 |
-
$html .= '<input type="checkbox" name="option[' . "potential_action" . ']" id="potential_action" value="on"';
|
59 |
if ( isset( $option['potential_action'] ) && $option['potential_action'] === 'on' ) {
|
60 |
$html .= ' checked="checked"';
|
61 |
}
|
62 |
-
$html .= '>Enabled';
|
63 |
$html .= '</td></tr>';
|
64 |
$html .= '<tr><th><label for="target">target :</label></th><td>';
|
65 |
$html .= '<input type="text" name="option[' . "target" . ']" id="target" class="regular-text" value="' . esc_attr( $option['target'] ) . '">';
|
@@ -70,11 +70,11 @@ class Structuring_Markup_Type_Website {
|
|
70 |
$html = '<table class="schema-admin-table">';
|
71 |
$html .= '<caption>Sitelink Search Box [ App ] *required Sitelink Search Box [ Site ]</caption>';
|
72 |
$html .= '<tr><th><label for="potential_action_app">potentialAction Active :</label></th><td>';
|
73 |
-
$html .= '<input type="checkbox" name="option[' . "potential_action_app" . ']" id="potential_action_app" value="on"';
|
74 |
if ( isset( $option['potential_action_app'] ) && $option['potential_action_app'] === 'on' ) {
|
75 |
$html .= ' checked="checked"';
|
76 |
}
|
77 |
-
$html .= '>Enabled';
|
78 |
$html .= '</td></tr>';
|
79 |
$html .= '<tr><th><label for="target_app">target :</label></th><td>';
|
80 |
$html .= '<input type="text" name="option[' . "target_app" . ']" id="target_app" class="regular-text" value="' . esc_attr( $option['target_app'] ) . '">';
|
@@ -89,7 +89,7 @@ class Structuring_Markup_Type_Website {
|
|
89 |
/**
|
90 |
* Return the default options array
|
91 |
*
|
92 |
-
* @version 4.
|
93 |
* @since 1.0.0
|
94 |
* @return array $args
|
95 |
*/
|
3 |
* Schema.org Type WebSite
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 4.5.0
|
7 |
* @since 1.0.0
|
8 |
* @see wp-structuring-admin-db.php
|
9 |
* @link https://schema.org/WebSite
|
33 |
/**
|
34 |
* Form Layout Render
|
35 |
*
|
36 |
+
* @version 4.5.0
|
37 |
* @since 2.3.3
|
38 |
* @param array $option
|
39 |
*/
|
55 |
$html = '<table class="schema-admin-table">';
|
56 |
$html .= '<caption>Sitelink Search Box [ Site ]</caption>';
|
57 |
$html .= '<tr><th><label for="potential_action">potentialAction Active :</label></th><td>';
|
58 |
+
$html .= '<label><input type="checkbox" name="option[' . "potential_action" . ']" id="potential_action" value="on"';
|
59 |
if ( isset( $option['potential_action'] ) && $option['potential_action'] === 'on' ) {
|
60 |
$html .= ' checked="checked"';
|
61 |
}
|
62 |
+
$html .= '>Enabled</label>';
|
63 |
$html .= '</td></tr>';
|
64 |
$html .= '<tr><th><label for="target">target :</label></th><td>';
|
65 |
$html .= '<input type="text" name="option[' . "target" . ']" id="target" class="regular-text" value="' . esc_attr( $option['target'] ) . '">';
|
70 |
$html = '<table class="schema-admin-table">';
|
71 |
$html .= '<caption>Sitelink Search Box [ App ] *required Sitelink Search Box [ Site ]</caption>';
|
72 |
$html .= '<tr><th><label for="potential_action_app">potentialAction Active :</label></th><td>';
|
73 |
+
$html .= '<label><input type="checkbox" name="option[' . "potential_action_app" . ']" id="potential_action_app" value="on"';
|
74 |
if ( isset( $option['potential_action_app'] ) && $option['potential_action_app'] === 'on' ) {
|
75 |
$html .= ' checked="checked"';
|
76 |
}
|
77 |
+
$html .= '>Enabled</label>';
|
78 |
$html .= '</td></tr>';
|
79 |
$html .= '<tr><th><label for="target_app">target :</label></th><td>';
|
80 |
$html .= '<input type="text" name="option[' . "target_app" . ']" id="target_app" class="regular-text" value="' . esc_attr( $option['target_app'] ) . '">';
|
89 |
/**
|
90 |
* Return the default options array
|
91 |
*
|
92 |
+
* @version 4.5.0
|
93 |
* @since 1.0.0
|
94 |
* @return array $args
|
95 |
*/
|
includes/meta/wp-structuring-meta-article.php
CHANGED
@@ -3,10 +3,11 @@
|
|
3 |
* Schema.org Type Article
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version 4.
|
7 |
* @since 4.0.0
|
8 |
* @link http://schema.org/Article
|
9 |
* @link https://developers.google.com/search/docs/data-types/articles
|
|
|
10 |
*/
|
11 |
class Structuring_Markup_Meta_Article {
|
12 |
|
@@ -32,7 +33,7 @@ class Structuring_Markup_Meta_Article {
|
|
32 |
/**
|
33 |
* Setting schema.org Article
|
34 |
*
|
35 |
-
* @version 4.
|
36 |
* @since 4.0.0
|
37 |
* @param array $options
|
38 |
* @return array $args
|
@@ -127,6 +128,21 @@ class Structuring_Markup_Meta_Article {
|
|
127 |
$args = array_merge( $args, $publisher_args );
|
128 |
}
|
129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
return (array) $args;
|
131 |
}
|
132 |
}
|
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 |
|
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
|
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
@@ -3,10 +3,11 @@
|
|
3 |
* Schema.org Type BlogPosting
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version 4.
|
7 |
* @since 4.0.0
|
8 |
* @link http://schema.org/BlogPosting
|
9 |
* @link https://developers.google.com/search/docs/data-types/articles
|
|
|
10 |
*/
|
11 |
class Structuring_Markup_Meta_Blog_Posting {
|
12 |
|
@@ -21,7 +22,7 @@ class Structuring_Markup_Meta_Blog_Posting {
|
|
21 |
/**
|
22 |
* Constructor Define.
|
23 |
*
|
24 |
-
* @version 4.
|
25 |
* @since 4.0.0
|
26 |
* @param Structuring_Markup_Utility $utility
|
27 |
*/
|
@@ -128,6 +129,21 @@ class Structuring_Markup_Meta_Blog_Posting {
|
|
128 |
$args = array_merge( $args, $publisher_args );
|
129 |
}
|
130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
return (array) $args;
|
132 |
}
|
133 |
}
|
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 |
|
22 |
/**
|
23 |
* Constructor Define.
|
24 |
*
|
25 |
+
* @version 4.5.0
|
26 |
* @since 4.0.0
|
27 |
* @param Structuring_Markup_Utility $utility
|
28 |
*/
|
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 |
}
|
includes/meta/wp-structuring-meta-news-article.php
CHANGED
@@ -3,10 +3,11 @@
|
|
3 |
* Schema.org Type News Article
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version 4.
|
7 |
* @since 4.0.0
|
8 |
* @link http://schema.org/NewsArticle
|
9 |
* @link https://developers.google.com/search/docs/data-types/articles
|
|
|
10 |
*/
|
11 |
class Structuring_Markup_Meta_NewsArticle {
|
12 |
|
@@ -32,7 +33,7 @@ class Structuring_Markup_Meta_NewsArticle {
|
|
32 |
/**
|
33 |
* Setting schema.org NewsArticle
|
34 |
*
|
35 |
-
* @version 4.
|
36 |
* @since 4.0.0
|
37 |
* @param array $options
|
38 |
* @return array $args
|
@@ -128,6 +129,21 @@ class Structuring_Markup_Meta_NewsArticle {
|
|
128 |
$args = array_merge( $args, $publisher_args );
|
129 |
}
|
130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
return (array) $args;
|
132 |
}
|
133 |
}
|
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 |
|
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
|
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 |
}
|
includes/meta/wp-structuring-meta-website.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Schema.org Type WebSite
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version 4.
|
7 |
* @since 4.0.0
|
8 |
* @link https://schema.org/WebSite
|
9 |
* @link https://developers.google.com/search/docs/guides/enhance-site#add-a-sitelinks-searchbox-for-your-site
|
@@ -14,7 +14,7 @@ class Structuring_Markup_Meta_WebSite {
|
|
14 |
/**
|
15 |
* Setting schema.org WebSite
|
16 |
*
|
17 |
-
* @version 4.
|
18 |
* @since 4.0.0
|
19 |
* @param array $options
|
20 |
* @return array $args
|
@@ -23,9 +23,9 @@ class Structuring_Markup_Meta_WebSite {
|
|
23 |
$args = array(
|
24 |
"@context" => "http://schema.org",
|
25 |
"@type" => "WebSite",
|
26 |
-
"name" => isset( $options['name'] ) ? esc_html( $options['name'] ) :
|
27 |
-
"alternateName" => isset( $options['alternateName'] ) ? esc_html( $options['alternateName'] ) :
|
28 |
-
"url" => isset( $options['url'] ) ? esc_url( $options['url'] ) :
|
29 |
);
|
30 |
|
31 |
$search_array = array();
|
@@ -33,8 +33,8 @@ class Structuring_Markup_Meta_WebSite {
|
|
33 |
if ( isset( $options['potential_action'] ) && $options['potential_action'] === 'on' ) {
|
34 |
$action_array = array(
|
35 |
"@type" => "SearchAction",
|
36 |
-
"target" => isset( $options['target'] ) ? esc_url( $options['target'] ) . "{search_term_string}" :
|
37 |
-
"query-input" => isset( $options['target'] ) ? "required name=search_term_string" :
|
38 |
);
|
39 |
$search_array[] = $action_array;
|
40 |
}
|
@@ -43,8 +43,8 @@ class Structuring_Markup_Meta_WebSite {
|
|
43 |
if ( isset( $options['potential_action_app'] ) && $options['potential_action_app'] === 'on' ) {
|
44 |
$action_array = array(
|
45 |
"@type" => "SearchAction",
|
46 |
-
"target" => isset( $options['target_app'] ) ? $options['target_app'] . "{search_term_string}" :
|
47 |
-
"query-input" => isset( $options['target_app'] ) ? "required name=search_term_string" :
|
48 |
);
|
49 |
$search_array[] = $action_array;
|
50 |
}
|
3 |
* Schema.org Type WebSite
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 4.5.0
|
7 |
* @since 4.0.0
|
8 |
* @link https://schema.org/WebSite
|
9 |
* @link https://developers.google.com/search/docs/guides/enhance-site#add-a-sitelinks-searchbox-for-your-site
|
14 |
/**
|
15 |
* Setting schema.org WebSite
|
16 |
*
|
17 |
+
* @version 4.5.0
|
18 |
* @since 4.0.0
|
19 |
* @param array $options
|
20 |
* @return array $args
|
23 |
$args = array(
|
24 |
"@context" => "http://schema.org",
|
25 |
"@type" => "WebSite",
|
26 |
+
"name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : '',
|
27 |
+
"alternateName" => isset( $options['alternateName'] ) ? esc_html( $options['alternateName'] ) : '',
|
28 |
+
"url" => isset( $options['url'] ) ? esc_url( $options['url'] ) : ''
|
29 |
);
|
30 |
|
31 |
$search_array = array();
|
33 |
if ( isset( $options['potential_action'] ) && $options['potential_action'] === 'on' ) {
|
34 |
$action_array = array(
|
35 |
"@type" => "SearchAction",
|
36 |
+
"target" => isset( $options['target'] ) ? esc_url( $options['target'] ) . "{search_term_string}" : '',
|
37 |
+
"query-input" => isset( $options['target'] ) ? "required name=search_term_string" : ''
|
38 |
);
|
39 |
$search_array[] = $action_array;
|
40 |
}
|
43 |
if ( isset( $options['potential_action_app'] ) && $options['potential_action_app'] === 'on' ) {
|
44 |
$action_array = array(
|
45 |
"@type" => "SearchAction",
|
46 |
+
"target" => isset( $options['target_app'] ) ? $options['target_app'] . "{search_term_string}" : '',
|
47 |
+
"query-input" => isset( $options['target_app'] ) ? "required name=search_term_string" : ''
|
48 |
);
|
49 |
$search_array[] = $action_array;
|
50 |
}
|
includes/wp-structuring-display.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
* @author Justin Frydman
|
7 |
-
* @version 4.0
|
8 |
* @since 1.0.0
|
9 |
*/
|
10 |
class Structuring_Markup_Display {
|
@@ -17,17 +17,28 @@ class Structuring_Markup_Display {
|
|
17 |
*/
|
18 |
private $utility;
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
/**
|
21 |
* Constructor Define.
|
22 |
*
|
23 |
-
* @version 4.
|
24 |
* @since 1.0.0
|
25 |
* @param string $version
|
|
|
26 |
*/
|
27 |
-
public function __construct ( $version ) {
|
28 |
require_once( plugin_dir_path( __FILE__ ) . 'wp-structuring-utility.php' );
|
29 |
$this->utility = new Structuring_Markup_Utility();
|
30 |
|
|
|
|
|
31 |
$db = new Structuring_Markup_Admin_Db();
|
32 |
$this->set_schema( $db, $version );
|
33 |
}
|
@@ -35,7 +46,7 @@ class Structuring_Markup_Display {
|
|
35 |
/**
|
36 |
* Setting schema.org
|
37 |
*
|
38 |
-
* @version
|
39 |
* @since 1.0.0
|
40 |
* @param Structuring_Markup_Admin_Db $db
|
41 |
* @param string $version
|
@@ -43,7 +54,9 @@ class Structuring_Markup_Display {
|
|
43 |
private function set_schema ( Structuring_Markup_Admin_Db $db, $version ) {
|
44 |
$structuring_markup_args = $db->get_list_options();
|
45 |
|
46 |
-
|
|
|
|
|
47 |
|
48 |
$this->get_schema_data( 'all', $structuring_markup_args );
|
49 |
if ( is_home() || is_front_page() ) {
|
@@ -75,7 +88,10 @@ class Structuring_Markup_Display {
|
|
75 |
$this->get_schema_data( $post_type->name, $structuring_markup_args );
|
76 |
}
|
77 |
}
|
78 |
-
|
|
|
|
|
|
|
79 |
}
|
80 |
|
81 |
/**
|
@@ -180,7 +196,7 @@ class Structuring_Markup_Display {
|
|
180 |
/**
|
181 |
* Setting JSON-LD Template
|
182 |
*
|
183 |
-
* @since 4.0
|
184 |
* @since 1.0.0
|
185 |
* @param array $args
|
186 |
* @param boolean $error
|
@@ -195,9 +211,15 @@ class Structuring_Markup_Display {
|
|
195 |
}
|
196 |
} else {
|
197 |
if ( is_array( $args ) ) {
|
198 |
-
|
199 |
-
|
200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
}
|
202 |
}
|
203 |
}
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
* @author Justin Frydman
|
7 |
+
* @version 4.5.0
|
8 |
* @since 1.0.0
|
9 |
*/
|
10 |
class Structuring_Markup_Display {
|
17 |
*/
|
18 |
private $utility;
|
19 |
|
20 |
+
/**
|
21 |
+
* wp_options data
|
22 |
+
*
|
23 |
+
* @version 4.5.0
|
24 |
+
* @since 4.5.0
|
25 |
+
*/
|
26 |
+
private $options;
|
27 |
+
|
28 |
/**
|
29 |
* Constructor Define.
|
30 |
*
|
31 |
+
* @version 4.5.0
|
32 |
* @since 1.0.0
|
33 |
* @param string $version
|
34 |
+
* @param string $text_domain
|
35 |
*/
|
36 |
+
public function __construct ( $version, $text_domain ) {
|
37 |
require_once( plugin_dir_path( __FILE__ ) . 'wp-structuring-utility.php' );
|
38 |
$this->utility = new Structuring_Markup_Utility();
|
39 |
|
40 |
+
$this->options = get_option( $text_domain );
|
41 |
+
|
42 |
$db = new Structuring_Markup_Admin_Db();
|
43 |
$this->set_schema( $db, $version );
|
44 |
}
|
46 |
/**
|
47 |
* Setting schema.org
|
48 |
*
|
49 |
+
* @version 4.5.0
|
50 |
* @since 1.0.0
|
51 |
* @param Structuring_Markup_Admin_Db $db
|
52 |
* @param string $version
|
54 |
private function set_schema ( Structuring_Markup_Admin_Db $db, $version ) {
|
55 |
$structuring_markup_args = $db->get_list_options();
|
56 |
|
57 |
+
if ( !isset( $this->options['compress'] ) || $this->options['compress'] !== 'on' ) {
|
58 |
+
echo '<!-- Markup (JSON-LD) structured in schema.org ver.' . $version . ' START -->' . PHP_EOL;
|
59 |
+
}
|
60 |
|
61 |
$this->get_schema_data( 'all', $structuring_markup_args );
|
62 |
if ( is_home() || is_front_page() ) {
|
88 |
$this->get_schema_data( $post_type->name, $structuring_markup_args );
|
89 |
}
|
90 |
}
|
91 |
+
|
92 |
+
if ( !isset( $this->options['compress'] ) || $this->options['compress'] !== 'on' ) {
|
93 |
+
echo '<!-- Markup (JSON-LD) structured in schema.org END -->' . PHP_EOL;
|
94 |
+
}
|
95 |
}
|
96 |
|
97 |
/**
|
196 |
/**
|
197 |
* Setting JSON-LD Template
|
198 |
*
|
199 |
+
* @since 4.5.0
|
200 |
* @since 1.0.0
|
201 |
* @param array $args
|
202 |
* @param boolean $error
|
211 |
}
|
212 |
} else {
|
213 |
if ( is_array( $args ) ) {
|
214 |
+
if ( isset( $this->options['compress'] ) && $this->options['compress'] === 'on' ) {
|
215 |
+
echo '<script type="application/ld+json">';
|
216 |
+
echo json_encode( $args, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES );
|
217 |
+
echo '</script>';
|
218 |
+
} else {
|
219 |
+
echo '<script type="application/ld+json">', PHP_EOL;
|
220 |
+
echo json_encode( $args, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ), PHP_EOL;
|
221 |
+
echo '</script>', PHP_EOL;
|
222 |
+
}
|
223 |
}
|
224 |
}
|
225 |
}
|
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 |
-
Stable tag: 4.
|
7 |
|
8 |
Allows you to include schema.org JSON-LD syntax markup on your website
|
9 |
|
@@ -23,6 +23,7 @@ Base knowledge is "https://schema.org/" and "https://developers.google.com/struc
|
|
23 |
* Organization: https://schema.org/Organization
|
24 |
* Person: https://schema.org/Person
|
25 |
* SiteNavigation: https://schema.org/SiteNavigationElement
|
|
|
26 |
* Video: https://schema.org/Video
|
27 |
* Website: https://schema.org/WebSite
|
28 |
|
@@ -54,6 +55,11 @@ if ( shortcode_exists( 'wp-structuring-markup-breadcrumb' ) ) {
|
|
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.
|
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.8
|
6 |
+
Stable tag: 4.5.0
|
7 |
|
8 |
Allows you to include schema.org JSON-LD syntax markup on your website
|
9 |
|
23 |
* Organization: https://schema.org/Organization
|
24 |
* Person: https://schema.org/Person
|
25 |
* SiteNavigation: https://schema.org/SiteNavigationElement
|
26 |
+
* Speakable: https://pending.schema.org/speakable
|
27 |
* Video: https://schema.org/Video
|
28 |
* Website: https://schema.org/WebSite
|
29 |
|
55 |
|
56 |
== Changelog ==
|
57 |
|
58 |
+
= 4.5.0 (2018-08-17) =
|
59 |
+
* Checked : WordPress version 4.9.8 operation check.
|
60 |
+
* Added : Speakable structured markup is implemented in "Article", "BlogPosting", "NewsArticle".
|
61 |
+
* Added : Added function to compress output data.
|
62 |
+
|
63 |
= 4.4.0 (2018-07-10) =
|
64 |
* Checked : WordPress version 4.9.7 operation check.
|
65 |
* Updated : Schema.ory Type "Image", "BlogPosting", "NewsArticle" image property added so that default image URL can be set.
|
uninstall.php
CHANGED
@@ -8,7 +8,7 @@ new Structuring_Markup_Uninstall();
|
|
8 |
* Schema.org Plugin Uninstall
|
9 |
*
|
10 |
* @author Kazuya Takami
|
11 |
-
* @version
|
12 |
* @since 1.0.0
|
13 |
*/
|
14 |
class Structuring_Markup_Uninstall {
|
@@ -16,17 +16,18 @@ class Structuring_Markup_Uninstall {
|
|
16 |
/**
|
17 |
* Variable definition.
|
18 |
*
|
|
|
19 |
* @since 2.1.0
|
20 |
-
* @version 3.0.0
|
21 |
*/
|
|
|
22 |
private $custom_type_event = 'schema_event_post';
|
23 |
private $custom_type_video = 'schema_video_post';
|
24 |
|
25 |
/**
|
26 |
* Constructor Define.
|
27 |
*
|
|
|
28 |
* @since 1.0.0
|
29 |
-
* @version 3.0.0
|
30 |
*/
|
31 |
public function __construct () {
|
32 |
$this->drop_table( 'structuring_markup' );
|
@@ -34,14 +35,14 @@ class Structuring_Markup_Uninstall {
|
|
34 |
$this->delete_post_meta( $this->custom_type_event );
|
35 |
$this->delete_custom_post( $this->custom_type_video );
|
36 |
$this->delete_post_meta( $this->custom_type_video );
|
37 |
-
delete_option(
|
38 |
}
|
39 |
|
40 |
/**
|
41 |
* Drop Table.
|
42 |
*
|
43 |
-
* @since 1.0.0
|
44 |
* @version 2.1.0
|
|
|
45 |
* @param string $table_name
|
46 |
*/
|
47 |
private function drop_table ( $table_name = null ) {
|
@@ -53,8 +54,8 @@ class Structuring_Markup_Uninstall {
|
|
53 |
/**
|
54 |
* Delete custom post.
|
55 |
*
|
56 |
-
* @since 2.1.0
|
57 |
* @version 2.1.0
|
|
|
58 |
* @param string $custom_type
|
59 |
*/
|
60 |
private function delete_custom_post ( $custom_type = null ) {
|
@@ -70,8 +71,8 @@ class Structuring_Markup_Uninstall {
|
|
70 |
/**
|
71 |
* Delete post meta.
|
72 |
*
|
73 |
-
* @since 2.1.0
|
74 |
* @version 2.1.0
|
|
|
75 |
* @param string $custom_type
|
76 |
*/
|
77 |
private function delete_post_meta ( $custom_type = null ) {
|
8 |
* Schema.org Plugin Uninstall
|
9 |
*
|
10 |
* @author Kazuya Takami
|
11 |
+
* @version 4.5.0
|
12 |
* @since 1.0.0
|
13 |
*/
|
14 |
class Structuring_Markup_Uninstall {
|
16 |
/**
|
17 |
* Variable definition.
|
18 |
*
|
19 |
+
* @version 4.5.0
|
20 |
* @since 2.1.0
|
|
|
21 |
*/
|
22 |
+
private $text_domain = 'wp-structuring-markup';
|
23 |
private $custom_type_event = 'schema_event_post';
|
24 |
private $custom_type_video = 'schema_video_post';
|
25 |
|
26 |
/**
|
27 |
* Constructor Define.
|
28 |
*
|
29 |
+
* @version 4.5.0
|
30 |
* @since 1.0.0
|
|
|
31 |
*/
|
32 |
public function __construct () {
|
33 |
$this->drop_table( 'structuring_markup' );
|
35 |
$this->delete_post_meta( $this->custom_type_event );
|
36 |
$this->delete_custom_post( $this->custom_type_video );
|
37 |
$this->delete_post_meta( $this->custom_type_video );
|
38 |
+
delete_option( $this->text_domain );
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
* Drop Table.
|
43 |
*
|
|
|
44 |
* @version 2.1.0
|
45 |
+
* @since 1.0.0
|
46 |
* @param string $table_name
|
47 |
*/
|
48 |
private function drop_table ( $table_name = null ) {
|
54 |
/**
|
55 |
* Delete custom post.
|
56 |
*
|
|
|
57 |
* @version 2.1.0
|
58 |
+
* @since 2.1.0
|
59 |
* @param string $custom_type
|
60 |
*/
|
61 |
private function delete_custom_post ( $custom_type = null ) {
|
71 |
/**
|
72 |
* Delete post meta.
|
73 |
*
|
|
|
74 |
* @version 2.1.0
|
75 |
+
* @since 2.1.0
|
76 |
* @param string $custom_type
|
77 |
*/
|
78 |
private function delete_post_meta ( $custom_type = null ) {
|
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.
|
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.
|
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.
|
30 |
* @since 1.3.0
|
31 |
*/
|
32 |
-
private $version = '4.
|
33 |
|
34 |
/**
|
35 |
* Variable definition Text Domain.
|
@@ -140,17 +140,25 @@ class Structuring_Markup {
|
|
140 |
/**
|
141 |
* Add Menu to the Admin Screen.
|
142 |
*
|
143 |
-
* @version 4.
|
144 |
* @since 1.0.0
|
145 |
*/
|
146 |
public function admin_menu () {
|
147 |
-
|
148 |
esc_html__( 'Schema.org Settings', $this->text_domain ),
|
149 |
esc_html__( 'Schema.org Settings', $this->text_domain ),
|
150 |
'manage_options',
|
151 |
plugin_basename( __FILE__ ),
|
152 |
array( $this, 'list_page_render' )
|
153 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
$post_page = add_submenu_page(
|
155 |
$this->text_domain . '-post',
|
156 |
esc_html__( 'Schema.org Setting Edit', $this->text_domain ),
|
@@ -159,12 +167,21 @@ class Structuring_Markup {
|
|
159 |
$this->text_domain . '-post',
|
160 |
array( $this, 'post_page_render' )
|
161 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
|
163 |
/** Using registered $page handle to hook stylesheet loading */
|
164 |
-
add_action( 'admin_print_styles-post.php',
|
165 |
-
add_action( 'admin_print_styles-' . $list_page,
|
166 |
-
add_action( 'admin_print_styles-' . $post_page,
|
167 |
-
add_action( '
|
|
|
168 |
}
|
169 |
|
170 |
/**
|
@@ -249,15 +266,26 @@ class Structuring_Markup {
|
|
249 |
new Structuring_Markup_Admin_Post( $this->text_domain );
|
250 |
}
|
251 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
/**
|
253 |
* Display Page Template Require.
|
254 |
*
|
255 |
-
* @version 4.
|
256 |
* @since 1.3.0
|
257 |
*/
|
258 |
public function wp_head () {
|
259 |
require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-display.php' );
|
260 |
-
new Structuring_Markup_Display( $this->version );
|
261 |
}
|
262 |
|
263 |
/**
|
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.5.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.5.0
|
22 |
* @since 1.0.0
|
23 |
*/
|
24 |
class Structuring_Markup {
|
26 |
/**
|
27 |
* Variable definition version.
|
28 |
*
|
29 |
+
* @version 4.5.0
|
30 |
* @since 1.3.0
|
31 |
*/
|
32 |
+
private $version = '4.5.0';
|
33 |
|
34 |
/**
|
35 |
* Variable definition Text Domain.
|
140 |
/**
|
141 |
* Add Menu to the Admin Screen.
|
142 |
*
|
143 |
+
* @version 4.5.0
|
144 |
* @since 1.0.0
|
145 |
*/
|
146 |
public function admin_menu () {
|
147 |
+
add_menu_page(
|
148 |
esc_html__( 'Schema.org Settings', $this->text_domain ),
|
149 |
esc_html__( 'Schema.org Settings', $this->text_domain ),
|
150 |
'manage_options',
|
151 |
plugin_basename( __FILE__ ),
|
152 |
array( $this, 'list_page_render' )
|
153 |
);
|
154 |
+
$list_page = add_submenu_page(
|
155 |
+
__FILE__,
|
156 |
+
esc_html__( 'Schema.org List', $this->text_domain ),
|
157 |
+
esc_html__( 'Schema.org List', $this->text_domain ),
|
158 |
+
'manage_options',
|
159 |
+
plugin_basename( __FILE__ ),
|
160 |
+
array( $this, 'list_page_render' )
|
161 |
+
);
|
162 |
$post_page = add_submenu_page(
|
163 |
$this->text_domain . '-post',
|
164 |
esc_html__( 'Schema.org Setting Edit', $this->text_domain ),
|
167 |
$this->text_domain . '-post',
|
168 |
array( $this, 'post_page_render' )
|
169 |
);
|
170 |
+
$config_page = add_submenu_page(
|
171 |
+
__FILE__,
|
172 |
+
esc_html__( 'Schema.org Config', $this->text_domain ),
|
173 |
+
esc_html__( 'Schema.org Config', $this->text_domain ),
|
174 |
+
'manage_options',
|
175 |
+
$this->text_domain . '-config',
|
176 |
+
array( $this, 'config_page_render' )
|
177 |
+
);
|
178 |
|
179 |
/** Using registered $page handle to hook stylesheet loading */
|
180 |
+
add_action( 'admin_print_styles-post.php', array( $this, 'add_style_post' ) );
|
181 |
+
add_action( 'admin_print_styles-' . $list_page, array( $this, 'add_style' ) );
|
182 |
+
add_action( 'admin_print_styles-' . $post_page, array( $this, 'add_style' ) );
|
183 |
+
add_action( 'admin_print_styles-' . $config_page, array( $this, 'add_style' ) );
|
184 |
+
add_action( 'admin_print_scripts-' . $post_page, array( $this, 'admin_scripts' ) );
|
185 |
}
|
186 |
|
187 |
/**
|
266 |
new Structuring_Markup_Admin_Post( $this->text_domain );
|
267 |
}
|
268 |
|
269 |
+
/**
|
270 |
+
* POST Page Template Require.
|
271 |
+
*
|
272 |
+
* @version 4.5.0
|
273 |
+
* @since 1.0.0
|
274 |
+
*/
|
275 |
+
public function config_page_render () {
|
276 |
+
require_once( plugin_dir_path( __FILE__ ) . 'includes/admin/wp-structuring-admin-config.php' );
|
277 |
+
new Structuring_Markup_Admin_Config( $this->text_domain );
|
278 |
+
}
|
279 |
+
|
280 |
/**
|
281 |
* Display Page Template Require.
|
282 |
*
|
283 |
+
* @version 4.5.0
|
284 |
* @since 1.3.0
|
285 |
*/
|
286 |
public function wp_head () {
|
287 |
require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-display.php' );
|
288 |
+
new Structuring_Markup_Display( $this->version, $this->text_domain );
|
289 |
}
|
290 |
|
291 |
/**
|