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

Version Description

(2018-03-23) = * Fixed : Taxonomy name of custom posting is not displayed.

Download this release

Release Info

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

Code changes from version 4.1.8 to 4.2.0

Files changed (47) hide show
  1. includes/wp-structuring-short-code-breadcrumb.php +6 -5
  2. readme.txt +4 -1
  3. trunk/css/schema-custom-post.css +21 -0
  4. trunk/css/style.css +163 -0
  5. trunk/includes/admin/wp-structuring-admin-db.php +261 -0
  6. trunk/includes/admin/wp-structuring-admin-list.php +99 -0
  7. trunk/includes/admin/wp-structuring-admin-post.php +373 -0
  8. trunk/includes/admin/wp-structuring-admin-type-article.php +125 -0
  9. trunk/includes/admin/wp-structuring-admin-type-blog-posting.php +125 -0
  10. trunk/includes/admin/wp-structuring-admin-type-breadcrumb.php +92 -0
  11. trunk/includes/admin/wp-structuring-admin-type-event.php +73 -0
  12. trunk/includes/admin/wp-structuring-admin-type-local-business.php +528 -0
  13. trunk/includes/admin/wp-structuring-admin-type-news-article.php +125 -0
  14. trunk/includes/admin/wp-structuring-admin-type-organization.php +180 -0
  15. trunk/includes/admin/wp-structuring-admin-type-person.php +114 -0
  16. trunk/includes/admin/wp-structuring-admin-type-site-navigation.php +79 -0
  17. trunk/includes/admin/wp-structuring-admin-type-video.php +50 -0
  18. trunk/includes/admin/wp-structuring-admin-type-website.php +109 -0
  19. trunk/includes/custom/wp-structuring-custom-post-event.php +299 -0
  20. trunk/includes/custom/wp-structuring-custom-post-video.php +204 -0
  21. trunk/includes/meta/wp-structuring-meta-article.php +120 -0
  22. trunk/includes/meta/wp-structuring-meta-blog-posting.php +121 -0
  23. trunk/includes/meta/wp-structuring-meta-breadcrumb.php +50 -0
  24. trunk/includes/meta/wp-structuring-meta-event.php +95 -0
  25. trunk/includes/meta/wp-structuring-meta-local-business.php +143 -0
  26. trunk/includes/meta/wp-structuring-meta-news-article.php +121 -0
  27. trunk/includes/meta/wp-structuring-meta-organization.php +80 -0
  28. trunk/includes/meta/wp-structuring-meta-person.php +57 -0
  29. trunk/includes/meta/wp-structuring-meta-site-navigation.php +42 -0
  30. trunk/includes/meta/wp-structuring-meta-video.php +90 -0
  31. trunk/includes/meta/wp-structuring-meta-website.php +58 -0
  32. trunk/includes/wp-structuring-display-amp.php +100 -0
  33. trunk/includes/wp-structuring-display.php +204 -0
  34. trunk/includes/wp-structuring-opening-hours.php +224 -0
  35. trunk/includes/wp-structuring-short-code-breadcrumb.php +243 -0
  36. trunk/includes/wp-structuring-utility.php +68 -0
  37. trunk/js/main.js +30 -0
  38. trunk/js/main.min.js +1 -0
  39. trunk/js/media-uploader-main.js +29 -0
  40. trunk/languages/wp-structuring-markup-ja.mo +0 -0
  41. trunk/languages/wp-structuring-markup-ja.po +217 -0
  42. trunk/languages/wp-structuring-markup-tr_TR.mo +0 -0
  43. trunk/languages/wp-structuring-markup-tr_TR.po +163 -0
  44. trunk/languages/wp-structuring-markup.pot +217 -0
  45. trunk/readme.txt +325 -0
  46. trunk/uninstall.php +86 -0
  47. trunk/wp-structuring-markup.php +280 -0
includes/wp-structuring-short-code-breadcrumb.php CHANGED
@@ -3,7 +3,7 @@
3
  * Breadcrumb ShortCode Settings
4
  *
5
  * @author Kazuya Takami
6
- * @version 4.1.1
7
  * @since 2.0.0
8
  */
9
  class Structuring_Markup_ShortCode_Breadcrumb {
@@ -11,8 +11,8 @@ class Structuring_Markup_ShortCode_Breadcrumb {
11
  /**
12
  * ShortCode Display.
13
  *
14
- * @since 2.0.0
15
  * @version 2.3.1
 
16
  * @access public
17
  * @param array $options
18
  * @param string $args
@@ -186,8 +186,8 @@ class Structuring_Markup_ShortCode_Breadcrumb {
186
  /**
187
  * taxonomy item settings
188
  *
 
189
  * @since 4.0.0
190
- * @version 4.0.0
191
  * @param int $id
192
  * @param string $taxonomy
193
  * @return array $args
@@ -217,7 +217,8 @@ class Structuring_Markup_ShortCode_Breadcrumb {
217
  $ancestors[] = $term_bottom[0];
218
 
219
  foreach ( $ancestors as $ancestor ) {
220
- $args[] = $this->set_schema_breadcrumb_item( get_category_link( $ancestor ), get_cat_name( $ancestor ) );
 
221
  }
222
  }
223
  return (array) $args;
@@ -226,8 +227,8 @@ class Structuring_Markup_ShortCode_Breadcrumb {
226
  /**
227
  * Breadcrumb item settings
228
  *
229
- * @since 2.0.0
230
  * @version 2.0.0
 
231
  * @param string $id
232
  * @param string $name
233
  * @return array $args
3
  * Breadcrumb ShortCode Settings
4
  *
5
  * @author Kazuya Takami
6
+ * @version 4.2.0
7
  * @since 2.0.0
8
  */
9
  class Structuring_Markup_ShortCode_Breadcrumb {
11
  /**
12
  * ShortCode Display.
13
  *
 
14
  * @version 2.3.1
15
+ * @since 2.0.0
16
  * @access public
17
  * @param array $options
18
  * @param string $args
186
  /**
187
  * taxonomy item settings
188
  *
189
+ * @version 4.2.0
190
  * @since 4.0.0
 
191
  * @param int $id
192
  * @param string $taxonomy
193
  * @return array $args
217
  $ancestors[] = $term_bottom[0];
218
 
219
  foreach ( $ancestors as $ancestor ) {
220
+ $term = get_term( $ancestor, $taxonomy );
221
+ $args[] = $this->set_schema_breadcrumb_item( esc_url( get_term_link( $ancestor ) ), esc_html( $term->name ) );
222
  }
223
  }
224
  return (array) $args;
227
  /**
228
  * Breadcrumb item settings
229
  *
 
230
  * @version 2.0.0
231
+ * @since 2.0.0
232
  * @param string $id
233
  * @param string $name
234
  * @return array $args
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.9.4
6
- Stable tag: 4.1.8
7
 
8
  Allows you to include schema.org JSON-LD syntax markup on your website
9
 
@@ -54,6 +54,9 @@ if ( shortcode_exists( 'wp-structuring-markup-breadcrumb' ) ) {
54
 
55
  == Changelog ==
56
 
 
 
 
57
  = 4.1.8 (2018-02-16) =
58
  * Checked : WordPress version 4.9.4 operation check.
59
  * Checked : WordPress version 4.9.3 operation check.
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.4
6
+ Stable tag: 4.2.0
7
 
8
  Allows you to include schema.org JSON-LD syntax markup on your website
9
 
54
 
55
  == Changelog ==
56
 
57
+ = 4.2.0 (2018-03-23) =
58
+ * Fixed : Taxonomy name of custom posting is not displayed.
59
+
60
  = 4.1.8 (2018-02-16) =
61
  * Checked : WordPress version 4.9.4 operation check.
62
  * Checked : WordPress version 4.9.3 operation check.
trunk/css/schema-custom-post.css ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /** Event & Video Style */
2
+ .schema-admin-custom-post label:before {
3
+ border-radius: 2px;
4
+ box-shadow: inset 0 -1px 0 rgba(27,31,35,0.12);
5
+ line-height: 1;
6
+ margin: 0 5px 0 0;
7
+ }
8
+
9
+ .schema-admin-required:before {
10
+ background: #efefef;
11
+ color: #a00;
12
+ content: 'required';
13
+ padding: 3px 41px 3px 5px;
14
+ }
15
+
16
+ .schema-admin-recommended:before {
17
+ background: #efefef;
18
+ color: #0073aa;
19
+ content: 'recommended';
20
+ padding: 3px 5px;
21
+ }
trunk/css/style.css ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /** List Setting */
2
+ .schema-admin-table-list {
3
+ border-collapse: collapse;
4
+ }
5
+ .schema-admin-table-list .schema-admin-table-list-type {
6
+ width: 15%;
7
+ }
8
+
9
+ .schema-admin-table-list .schema-admin-table-list-output {
10
+ width: 30%;
11
+ }
12
+
13
+ .schema-admin-table-list tr {
14
+ border-bottom: solid 1px #ddd;
15
+ }
16
+
17
+ .schema-admin-table-list tr:last-child {
18
+ border-bottom: none;
19
+ }
20
+
21
+ .schema-admin-table-list td {
22
+ vertical-align: middle;
23
+ }
24
+
25
+ .schema-admin-table-list td:nth-child(1) > span {
26
+ float: left;
27
+ height: 2em;
28
+ }
29
+
30
+ .schema-admin-table-list td:nth-child(1) > span span {
31
+ display: inline-block;
32
+ margin: 0 10px 0 0;
33
+ padding: 0 1em 0 1em;
34
+ text-align: center;
35
+ width: 8em;
36
+ }
37
+
38
+ .schema-admin-table-list td:nth-child(1) > span span.active {
39
+ background: #00a0d2;
40
+ color: #fff;
41
+ }
42
+
43
+ .schema-admin-table-list tr.active {
44
+ background: #ffffff;
45
+ }
46
+
47
+ .schema-admin-table-list tr.stop {
48
+ background: #efefef;
49
+ }
50
+
51
+ .schema-admin-table-list td:nth-child(1) > span span.stop {
52
+ background: #ddd;
53
+ }
54
+
55
+ /** Posts page */
56
+ .schema-admin-h1-span {
57
+ display: inline-block;
58
+ font-size: 80%;
59
+ margin: 0 0 0 10px;
60
+ }
61
+
62
+ .schema-admin-require::before {
63
+ color: #a00;
64
+ content: "*";
65
+ margin: 0 3px 0 0;
66
+ }
67
+
68
+ .schema-admin-table {
69
+ margin: 15px 0 15px 0;
70
+ }
71
+
72
+ .schema-admin-table caption {
73
+ border-left: solid 4px #00a0d2;
74
+ margin: 0 0 5px 0;
75
+ padding: 3px 0 3px 7px;
76
+ text-align: left;
77
+ }
78
+
79
+ .schema-admin-table th {
80
+ height: 2em;
81
+ padding: 0 5px 0 0;
82
+ text-align: right;
83
+ vertical-align: middle;
84
+ width: 200px;
85
+ }
86
+
87
+ .schema-admin-table th.require::before {
88
+ color: #a00;
89
+ content: "*";
90
+ margin: 0 3px 0 0;
91
+ }
92
+
93
+ .schema-admin-table td {
94
+ vertical-align: middle;
95
+ }
96
+
97
+ .schema-admin-table td label {
98
+ margin: 0 10px 0 0;
99
+ }
100
+
101
+ .schema-admin-table small {
102
+ display: block;
103
+ margin: 2px 0 2px 1px;
104
+ background: #ddd;
105
+ padding: 0 5px;
106
+ }
107
+
108
+ .schema-admin-table input[type="checkbox"] {
109
+ margin: 0 5px 0 0;
110
+ }
111
+
112
+ .schema-admin-table input:invalid {
113
+ border: solid 1px #d8000c;
114
+ background: #ffbaba;
115
+ }
116
+
117
+ /** LocalBusiness */
118
+ .markup-time {
119
+ color: #999;
120
+ cursor: pointer;
121
+ width: 18px;
122
+ height: 18px;
123
+ line-height: 20px;
124
+ font-size: 14px;
125
+ border: solid 1px #bbb;
126
+ background-color: #fff;
127
+ border-radius: 100%;
128
+ margin-top: 5px;
129
+ }
130
+
131
+ .markup-time:hover {
132
+ color: #fff;
133
+ border-color: transparent;
134
+ }
135
+
136
+ .markup-time .plus:hover {
137
+ background-color: #00a0d2;
138
+ }
139
+
140
+ .markup-time .minus {
141
+ line-height: 18px;
142
+ }
143
+
144
+ .markup-time .minus:hover {
145
+ background-color: #f55e4f;
146
+ }
147
+
148
+ /** Media Uploader */
149
+ .schema-admin-media-button {
150
+ border: 0;
151
+ font-size: 12px;
152
+ padding: 6px 8px 2px 8px;
153
+ }
154
+
155
+ .schema-admin-media-button:before {
156
+ font-size: 16px;
157
+ height: 16px;
158
+ width: 16px;
159
+ }
160
+
161
+ .schema-admin-media-button:hover {
162
+ cursor: pointer;
163
+ }
trunk/includes/admin/wp-structuring-admin-db.php ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Admin DB Connection.
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.1.1
7
+ * @since 1.0.0
8
+ */
9
+ class Structuring_Markup_Admin_Db {
10
+
11
+ /**
12
+ * Variable definition.
13
+ *
14
+ * @version 3.1.0
15
+ * @since 1.0.0
16
+ */
17
+ private $table_name;
18
+
19
+ /** Schema.org Type defined. */
20
+ public $type_array = array(
21
+ "article" => "Article",
22
+ "blog_posting" => "Blog Posting",
23
+ "breadcrumb" => "Breadcrumb",
24
+ "event" => "Event",
25
+ "local_business" => "Local Business",
26
+ "news_article" => "News Article",
27
+ "organization" => "Organization",
28
+ "person" => "Person",
29
+ "site_navigation"=> "Site Navigation",
30
+ "video" => "Video",
31
+ "website" => "Web Site"
32
+ );
33
+
34
+ /**
35
+ * Constructor Define.
36
+ *
37
+ * @version 1.3.2
38
+ * @since 1.0.0
39
+ */
40
+ public function __construct () {
41
+ global $wpdb;
42
+ $this->table_name = $wpdb->prefix . 'structuring_markup';
43
+ }
44
+
45
+ /**
46
+ * Create Table.
47
+ *
48
+ * @version 4.1.1
49
+ * @since 1.0.0
50
+ * @param string $text_domain
51
+ * @param string $version
52
+ */
53
+ public function create_table ( $text_domain, $version ) {
54
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
55
+
56
+ global $wpdb;
57
+
58
+ $prepared = $wpdb->prepare( "SHOW TABLES LIKE %s", $this->table_name );
59
+ $is_db_exists = $wpdb->get_var( $prepared );
60
+ $charset_collate = $wpdb->get_charset_collate();
61
+
62
+ if ( is_null( $is_db_exists ) ) {
63
+ $this->create_table_execute( $charset_collate, $text_domain, $version );
64
+
65
+ foreach ( $this->type_array as $key => $value ) {
66
+ $args = array(
67
+ 'type' => $key,
68
+ 'activate' => "",
69
+ 'output' => serialize( array() ),
70
+ 'options' => serialize( array() ),
71
+ 'register_date' => date( "Y-m-d H:i:s" ),
72
+ 'update_date' => date( "Y-m-d H:i:s" )
73
+ );
74
+ $this->insert_options( $args );
75
+ }
76
+ } else {
77
+ /**
78
+ * version up process.
79
+ *
80
+ * @version 4.1.1
81
+ * @since 2.0.0
82
+ * */
83
+ $options = get_option( $text_domain );
84
+
85
+ if ( !isset( $options['version'] ) || $options['version'] !== $version ) {
86
+ $lists = $this->get_list_options();
87
+
88
+ $wpdb->query( "DROP TABLE " . $this->table_name );
89
+ $this->create_table_execute( $charset_collate, $text_domain, $version );
90
+
91
+ foreach ( $this->type_array as $key => $value ) {
92
+ $args = array(
93
+ 'type' => $key,
94
+ 'activate' => "",
95
+ 'output' => serialize( array() ),
96
+ 'options' => serialize( array() ),
97
+ 'register_date' => date( "Y-m-d H:i:s" ),
98
+ 'update_date' => date( "Y-m-d H:i:s" )
99
+ );
100
+ foreach ( $lists as $list ) {
101
+ if ( $list->type === $key ) {
102
+ $activate = isset( $list->activate ) ? $list->activate : "";
103
+
104
+ // version up default value setting.
105
+ if ( $version >= '4.1.1' && $key === 'breadcrumb' ) {
106
+ $works = unserialize( $list->options );
107
+ $works['current_on'] = 'on';
108
+ $list->options = serialize( $works );
109
+ }
110
+
111
+ $args = array(
112
+ 'type' => $key,
113
+ 'activate' => $activate,
114
+ 'output' => $list->output,
115
+ 'options' => $list->options,
116
+ 'register_date' => date( "Y-m-d H:i:s" ),
117
+ 'update_date' => date( "Y-m-d H:i:s" )
118
+ );
119
+ }
120
+ }
121
+ $this->insert_options( $args );
122
+ }
123
+ }
124
+ }
125
+ }
126
+
127
+ /**
128
+ * Create table execute
129
+ *
130
+ * @version 2.1.1
131
+ * @since 2.0.0
132
+ * @param string $charset_collate
133
+ * @param string $text_domain
134
+ * @param string $version
135
+ */
136
+ private function create_table_execute ( $charset_collate, $text_domain, $version ) {
137
+ $query = " CREATE TABLE " . $this->table_name;
138
+ $query .= " (id MEDIUMINT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY";
139
+ $query .= ",type TINYTEXT NOT NULL";
140
+ $query .= ",activate TINYTEXT NOT NULL";
141
+ $query .= ",output TEXT NOT NULL";
142
+ $query .= ",options TEXT NOT NULL";
143
+ $query .= ",register_date DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL";
144
+ $query .= ",update_date DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL";
145
+ $query .= ",UNIQUE KEY id (id)) " . $charset_collate;
146
+
147
+ dbDelta( $query );
148
+
149
+ $options = array( 'version' => $version );
150
+ update_option( $text_domain, $options, 'yes' );
151
+ }
152
+
153
+ /**
154
+ * Get Data.
155
+ *
156
+ * @version 2.1.0
157
+ * @since 1.0.0
158
+ * @param integer $id
159
+ * @return array $results
160
+ */
161
+ public function get_options ( $id ) {
162
+ global $wpdb;
163
+
164
+ $query = "SELECT * FROM " . $this->table_name . " WHERE id = %d";
165
+ $data = array( esc_html( $id ) );
166
+ $prepared = $wpdb->prepare( $query, $data );
167
+ $args = $wpdb->get_row( $prepared );
168
+ $results = array();
169
+
170
+ if ( $args ) {
171
+ $results['id'] = $args->id;
172
+ $results['activate'] = isset( $args->activate ) ? $args->activate : "";
173
+ $results['type'] = $args->type;
174
+ $results['output'] = unserialize( $args->output );
175
+ $results['option'] = unserialize( $args->options );
176
+ }
177
+ return (array) $results;
178
+ }
179
+
180
+ /**
181
+ * Get All Data.
182
+ *
183
+ * @since 1.0.0
184
+ * @return array $results
185
+ */
186
+ public function get_list_options () {
187
+ global $wpdb;
188
+
189
+ $query = "SELECT * FROM " . $this->table_name . " ORDER BY type ASC";
190
+
191
+ return (array) $wpdb->get_results( $query );
192
+ }
193
+
194
+ /**
195
+ * Get Type Data.
196
+ *
197
+ * @version 2.1.0
198
+ * @since 2.0.0
199
+ * @param string $type
200
+ * @return array $results
201
+ */
202
+ public function get_type_options ( $type ) {
203
+ global $wpdb;
204
+
205
+ $query = "SELECT * FROM " . $this->table_name . " WHERE type = %s";
206
+ $data = array( esc_html( $type ) );
207
+ $prepared = $wpdb->prepare( $query, $data );
208
+ $args = $wpdb->get_row( $prepared );
209
+ $results = array();
210
+
211
+ if ( $args ) {
212
+ $results['id'] = $args->id;
213
+ $results['activate'] = isset( $args->activate ) ? $args->activate : "";
214
+ $results['type'] = $args->type;
215
+ $results['output'] = unserialize( $args->output );
216
+ $results['option'] = unserialize( $args->options );
217
+ }
218
+ return (array) $results;
219
+ }
220
+
221
+ /**
222
+ * Insert Data.
223
+ *
224
+ * @version 2.0.0
225
+ * @since 1.0.0
226
+ * @param array $args
227
+ */
228
+ private function insert_options ( array $args ) {
229
+ global $wpdb;
230
+
231
+ $prepared = array( '%s', '%s', '%s', '%s', '%s', '%s' );
232
+ $wpdb->insert( $this->table_name, $args, $prepared );
233
+ }
234
+
235
+ /**
236
+ * Update Data.
237
+ *
238
+ * @version 2.0.0
239
+ * @since 1.0.0
240
+ * @param array $post($_POST)
241
+ * @return integer $post['id']
242
+ */
243
+ public function update_options ( array $post ) {
244
+ global $wpdb;
245
+
246
+ $data = array(
247
+ 'type' => $post['type'],
248
+ 'activate' => isset( $post['activate'] ) ? $post['activate'] : "",
249
+ 'output' => serialize( $post['output'] ),
250
+ 'options' => isset( $post['option'] ) ? serialize( $post['option'] ) : "",
251
+ 'update_date' => date( "Y-m-d H:i:s" )
252
+ );
253
+ $key = array( 'id' => esc_html( $post['id'] ) );
254
+ $prepared = array( '%s', '%s', '%s', '%s', '%s' );
255
+ $key_prepared = array( '%d' );
256
+
257
+ $wpdb->update( $this->table_name, $data, $key, $prepared, $key_prepared );
258
+
259
+ return (integer) $post['id'];
260
+ }
261
+ }
trunk/includes/admin/wp-structuring-admin-list.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Admin List
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.1.4
7
+ * @since 1.0.0
8
+ * @see wp-structuring-admin-db.php
9
+ */
10
+ class Structuring_Markup_Admin_List {
11
+
12
+ /**
13
+ * Variable definition.
14
+ *
15
+ * @version 2.0.0
16
+ * @since 1.3.0
17
+ */
18
+ private $text_domain;
19
+
20
+ /**
21
+ * Constructor Define.
22
+ *
23
+ * @version 2.0.0
24
+ * @since 1.0.0
25
+ * @param String $text_domain
26
+ */
27
+ public function __construct ( $text_domain ) {
28
+ $this->text_domain = $text_domain;
29
+ $this->page_render();
30
+ }
31
+
32
+ /**
33
+ * LIST Page HTML Render.
34
+ *
35
+ * @version 4.1.4
36
+ * @since 1.0.0
37
+ */
38
+ private function page_render () {
39
+ $post_url = 'admin.php?page=' . $this->text_domain . '-post';
40
+
41
+ $html = '';
42
+ $html .= '<div class="wrap">';
43
+ $html .= '<h1>' . esc_html__( 'Schema.org Settings List', $this->text_domain );
44
+ $html .= '</h1>';
45
+ echo $html;
46
+
47
+ $html = '<hr>';
48
+ $html .= '<table class="wp-list-table widefat fixed striped posts schema-admin-table-list">';
49
+ $html .= '<tr>';
50
+ $html .= '<th scope="row" class="schema-admin-table-list-type column-primary">' . esc_html__( 'Status', $this->text_domain ) . '&nbsp;&nbsp;/&nbsp;&nbsp;' . esc_html__( 'Schema.org Type', $this->text_domain ) . '</th>';
51
+ $html .= '<th scope="row" class="schema-admin-table-list-output">' . esc_html__( 'Output On', $this->text_domain ) . '</th>';
52
+ $html .= '</tr>';
53
+ echo $html;
54
+
55
+ $db = new Structuring_Markup_Admin_Db();
56
+ $results = $db->get_list_options();
57
+ $type_array = $db->type_array;
58
+
59
+ if ( $results ) {
60
+ foreach ( $results as $row ) {
61
+ if ( $row->activate === 'on' ) {
62
+ $html = '<tr class="active"><td class="column-primary"><span><span class="active">Enabled';
63
+ } else {
64
+ $html = '<tr class="stop"><td class="column-primary"><span><span class="stop">Disabled';
65
+ }
66
+ $html .= '</span></span>';
67
+ $html .= '<strong><a href="';
68
+ $html .= admin_url( $post_url . '&type=' . esc_html( $row->type ) . '&schema_post_id=' . esc_html( $row->id ) ) . '">' . $type_array[esc_html( $row->type )];
69
+ $html .= '</a></strong>';
70
+ $html .= '<div class="row-actions"><span class="edit"><a href="';
71
+ $html .= admin_url( $post_url . '&type=' . esc_html( $row->type ) . '&schema_post_id=' . esc_html( $row->id ) ) . '" class="edit" aria-label="' . esc_html__( 'Edit', $this->text_domain ) . '">' . esc_html__( 'Edit', $this->text_domain );
72
+ $html .= '</a></span></div>';
73
+ $html .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details', $this->text_domain ) . '</span></button>';
74
+ $html .= '</td>';
75
+ $html .= '<td data-colname="' . esc_html__( 'Output On', $this->text_domain ) . '">' . $this->unserialize_output( $row->output ) . '</td>';
76
+ $html .= '</tr>';
77
+ echo $html;
78
+ }
79
+ } else {
80
+ echo '<td colspan="2">' . esc_html__( 'Without registration.', $this->text_domain ) . '</td>';
81
+ }
82
+ $html = '</table>';
83
+ $html .= '</div>';
84
+ echo $html;
85
+ }
86
+
87
+ /**
88
+ * LIST Page HTML Render.
89
+ *
90
+ * @version 2.0.0
91
+ * @since 1.0.0
92
+ * @param string $obj
93
+ * @return string $output
94
+ */
95
+ private function unserialize_output ( $obj ) {
96
+ $output = implode( ",", unserialize( $obj ) );
97
+ return (string) $output;
98
+ }
99
+ }
trunk/includes/admin/wp-structuring-admin-post.php ADDED
@@ -0,0 +1,373 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Admin Post
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.1.0
7
+ * @since 1.0.0
8
+ */
9
+ class Structuring_Markup_Admin_Post {
10
+
11
+ /**
12
+ * Variable definition.
13
+ *
14
+ * @version 2.0.0
15
+ * @since 1.3.0
16
+ */
17
+ private $text_domain;
18
+
19
+ /**
20
+ * Variable definition.
21
+ *
22
+ * @version 2.0.0
23
+ * @since 1.3.0
24
+ */
25
+ private $type_array;
26
+
27
+ /**
28
+ * Variable definition.
29
+ *
30
+ * @version 2.5.0
31
+ * @since 2.5.0
32
+ */
33
+ private $post_args = array();
34
+
35
+ /**
36
+ * Defined nonce.
37
+ *
38
+ * @version 3.0.2
39
+ * @since 3.0.2
40
+ */
41
+ private $nonce_name;
42
+ private $nonce_action;
43
+
44
+ /**
45
+ * Constructor Define.
46
+ *
47
+ * @version 4.1.0
48
+ * @since 1.0.0
49
+ * @param String $text_domain
50
+ */
51
+ public function __construct ( $text_domain ) {
52
+ $args = array(
53
+ 'public' => true,
54
+ '_builtin' => false
55
+ );
56
+ $post_types = get_post_types( $args, 'objects' );
57
+
58
+ foreach ( $post_types as $post_type ) {
59
+ $this->post_args[] = array(
60
+ 'label' => esc_html( $post_type->label ),
61
+ 'value' => esc_html( $post_type->name )
62
+ );
63
+ }
64
+ $this->text_domain = $text_domain;
65
+ $this->nonce_name = "_wpnonce_" . $text_domain;
66
+ $this->nonce_action = "edit-" . $text_domain;
67
+
68
+ /**
69
+ * Update Status
70
+ *
71
+ * "ok" : Successful update
72
+ * "output" : Output No Check
73
+ */
74
+ $status = "";
75
+
76
+ /** DB Connect */
77
+ $db = new Structuring_Markup_Admin_Db();
78
+ $this->type_array = $db->type_array;
79
+
80
+ /** Set Default Parameter for Array */
81
+ $options = array(
82
+ "id" => "",
83
+ "type" => "",
84
+ "activate" => "",
85
+ "output" => array(),
86
+ "option" => array()
87
+ );
88
+
89
+ /** DataBase Update & Insert Mode */
90
+ if ( ! empty( $_POST ) && check_admin_referer( $this->nonce_action, $this->nonce_name ) ) {
91
+ if ( isset( $_POST['id'] ) && is_numeric( $_POST['id'] ) ) {
92
+ if ( isset( $_POST['output'] ) ) {
93
+ $options['id'] = $db->update_options( $_POST );
94
+ $status = "ok";
95
+ } else {
96
+ $status = "output";
97
+ }
98
+ }
99
+ }
100
+
101
+ /** Key Set */
102
+ if ( isset( $_GET['schema_post_id'] ) && is_numeric( $_GET['schema_post_id'] ) ) {
103
+ $options['id'] = esc_html( $_GET['schema_post_id'] );
104
+ }
105
+
106
+ /** Type Set */
107
+ if ( isset( $_GET['type'] ) && array_key_exists( $_GET['type'], $this->type_array) ) {
108
+ $options['type'] = esc_html( $_GET['type'] );
109
+ }
110
+
111
+ $options = $db->get_options( $options['id'] );
112
+ if ( $options['option'] === false ) {
113
+ $options['option'] = array();
114
+ }
115
+
116
+ $this->page_render( $options, $status );
117
+ }
118
+
119
+ /**
120
+ * Setting Page of the Admin Screen.
121
+ *
122
+ * @version 4.0.0
123
+ * @since 1.0.0
124
+ * @param array $options
125
+ * @param string $status
126
+ */
127
+ private function page_render ( array $options, $status ) {
128
+ $html = '';
129
+ $html .= '<div class="wrap">';
130
+ $html .= '<h1>' . esc_html__( 'Schema.org Register', $this->text_domain );
131
+ $html .= '<span class="schema-admin-h1-span">[ Schema Type : ' . esc_html( $this->type_array[$options['type']] ) . ' ]</span>';
132
+ $html .= '</h1>';
133
+ switch ( $status ) {
134
+ case "ok":
135
+ $html .= $this->information_render();
136
+ break;
137
+ case "output":
138
+ $html .= $this->output_error_render();
139
+ break;
140
+ default:
141
+ break;
142
+ }
143
+ echo $html;
144
+
145
+ /** Output Page Select */
146
+ $html = '<hr>';
147
+ $html .= '<p class="schema-admin-require">';
148
+ $html .= esc_html__( 'Please note that all fields followed by an asterisk must be filled in.', $this->text_domain );
149
+ $html .= '</p>';
150
+ $html .= '<form method="post" action="">';
151
+ echo $html;
152
+
153
+ wp_nonce_field( $this->nonce_action, $this->nonce_name );
154
+
155
+ $html = '<input type="hidden" name="id" value="' . esc_attr( $options['id'] ) . '">';
156
+ $html .= '<input type="hidden" name="type" value="' . esc_attr( $options['type'] ) . '">';
157
+ $html .= '<table class="schema-admin-table">';
158
+ $html .= '<tr><th class="require">Enabled : </th><td>';
159
+ $html .= '<input type="checkbox" name="activate" value="on"';
160
+ $html .= ( isset( $options['activate'] ) && $options['activate'] === "on" ) ? ' checked' : '';
161
+ $html .= '></td></tr>';
162
+ $html .= '<tr><th class="require">' . esc_html__( 'Output On', $this->text_domain ) . ' : </th><td>';
163
+ echo $html;
164
+
165
+ switch ( $options['type'] ) {
166
+ case 'article':
167
+ $html = $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
168
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
169
+ $html .= $this->output_checkbox_render( $options['output'], "amp", esc_html__( 'Posts(AMP)', $this->text_domain ) );
170
+ $html .= '</td></tr>';
171
+ $html .= $this->output_custom_posts_render( $options['output'] );
172
+ $html .= '</table><hr>';
173
+ echo $html;
174
+
175
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-article.php' );
176
+ new Structuring_Markup_Type_Article( $options['option'] );
177
+ break;
178
+ case 'blog_posting':
179
+ $html = $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
180
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
181
+ $html .= $this->output_checkbox_render( $options['output'], "amp", esc_html__( 'Posts(AMP)', $this->text_domain ) );
182
+ $html .= '</td></tr>';
183
+ $html .= $this->output_custom_posts_render( $options['output'] );
184
+ $html .= '</table><hr>';
185
+ echo $html;
186
+
187
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-blog-posting.php' );
188
+ new Structuring_Markup_Type_Blog_Posting( $options['option'] );
189
+ break;
190
+ case 'breadcrumb':
191
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
192
+ $html .= '</td></tr></table><hr>';
193
+ echo $html;
194
+
195
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-breadcrumb.php' );
196
+ new Structuring_Markup_Type_Breadcrumb( $options['option'] );
197
+ break;
198
+ case 'event':
199
+ $html = $this->output_checkbox_render( $options['output'], "event", esc_html__( 'Event Post Page', $this->text_domain ) );
200
+ $html .= '</td></tr></table><hr>';
201
+ echo $html;
202
+
203
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-event.php' );
204
+ new Structuring_Markup_Type_Event();
205
+ break;
206
+ case 'local_business':
207
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
208
+ $html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
209
+ $html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
210
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
211
+ $html .= '</td></tr>';
212
+ $html .= $this->output_custom_posts_render( $options['output'] );
213
+ $html .= '</table><hr>';
214
+
215
+ echo $html;
216
+
217
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-local-business.php' );
218
+ new Structuring_Markup_Type_LocalBusiness( $options['option'] );
219
+ break;
220
+ case 'news_article':
221
+ $html = $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
222
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
223
+ $html .= $this->output_checkbox_render( $options['output'], "amp", esc_html__( 'Posts(AMP)', $this->text_domain ) );
224
+ $html .= '</td></tr>';
225
+ $html .= $this->output_custom_posts_render( $options['output'] );
226
+ $html .= '</table><hr>';
227
+
228
+ echo $html;
229
+
230
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-news-article.php' );
231
+ new Structuring_Markup_Type_NewsArticle( $options['option'] );
232
+ break;
233
+ case 'organization':
234
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
235
+ $html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
236
+ $html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
237
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
238
+ $html .= '</td></tr>';
239
+ $html .= $this->output_custom_posts_render( $options['output'] );
240
+ $html .= '</table><hr>';
241
+
242
+ echo $html;
243
+
244
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-organization.php' );
245
+ new Structuring_Markup_Type_Organization( $options['option'] );
246
+ break;
247
+ case 'person':
248
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
249
+ $html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
250
+ $html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
251
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
252
+ $html .= '</td></tr>';
253
+ $html .= $this->output_custom_posts_render( $options['output'] );
254
+ $html .= '</table><hr>';
255
+
256
+ echo $html;
257
+
258
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-person.php' );
259
+ new Structuring_Markup_Type_Person( $options['option'] );
260
+ break;
261
+ case 'site_navigation':
262
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
263
+ $html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
264
+ $html .= '</td></tr></table><hr>';
265
+ echo $html;
266
+
267
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-site-navigation.php' );
268
+ new Structuring_Markup_Type_Site_Navigation( $options['option'] );
269
+ break;
270
+ case 'video':
271
+ $html = $this->output_checkbox_render( $options['output'], "video", esc_html__( 'Video Post Page', $this->text_domain ) );
272
+ $html .= '</td></tr></table><hr>';
273
+ echo $html;
274
+
275
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-video.php' );
276
+ new Structuring_Markup_Type_Videos();
277
+ break;
278
+ case 'website':
279
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
280
+ $html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
281
+ $html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
282
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
283
+ $html .= '</td></tr>';
284
+ $html .= $this->output_custom_posts_render( $options['output'] );
285
+ $html .= '</table><hr>';
286
+
287
+ echo $html;
288
+
289
+ require_once( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-website.php' );
290
+ new Structuring_Markup_Type_Website( $options['option'] );
291
+ break;
292
+ }
293
+
294
+ $html = '</form>';
295
+ $html .= '</div>';
296
+ echo $html;
297
+ }
298
+
299
+ /**
300
+ * CheckBox Build Render
301
+ *
302
+ * @version 2.5.0
303
+ * @since 1.0.0
304
+ * @param array $option['output']
305
+ * @param string $output
306
+ * @param string $value
307
+ * @return string $html
308
+ */
309
+ private function output_checkbox_render ( array $option, $output, $value ) {
310
+ $html = '<label>';
311
+ $html .= '<input type="checkbox" name="output[' . $output . ']" value="' . $value . '""';
312
+ $html .= isset( $option[$output] ) ? ' checked' : '';
313
+ $html .= '>' . $value . '</label>';
314
+
315
+ return (string) $html;
316
+ }
317
+
318
+ /**
319
+ * Custom Posts Build Render
320
+ *
321
+ * @version 4.0.2
322
+ * @since 2.5.0
323
+ * @param array $option['output']
324
+ * @return string $html
325
+ */
326
+ private function output_custom_posts_render ( array $option ) {
327
+ $html = '';
328
+ if ( count( $this->post_args ) > 0 ) {
329
+ $html .= '<tr><th>' . esc_html__( 'Output On(Custom Posts)', $this->text_domain ) . ' : </th><td>';
330
+ foreach ( $this->post_args as $post_type ) {
331
+ $html .= $this->output_checkbox_render( $option, $post_type['value'], $post_type['label'] );
332
+ }
333
+ $html .= '</td></tr>';
334
+ }
335
+ return (string) $html;
336
+ }
337
+
338
+ /**
339
+ * Information Message Render
340
+ *
341
+ * @version 2.0.0
342
+ * @since 1.0.0
343
+ * @return string $html
344
+ */
345
+ private function information_render () {
346
+ $html = '<div id="message" class="updated notice notice-success is-dismissible below-h2">';
347
+ $html .= '<p>Schema.org Information Update.</p>';
348
+ $html .= '<button type="button" class="notice-dismiss">';
349
+ $html .= '<span class="screen-reader-text">Dismiss this notice.</span>';
350
+ $html .= '</button>';
351
+ $html .= '</div>';
352
+
353
+ return (string) $html;
354
+ }
355
+
356
+ /**
357
+ * Error Message Render
358
+ *
359
+ * @version 2.0.0
360
+ * @since 1.0.0
361
+ * @return string $html
362
+ */
363
+ private function output_error_render () {
364
+ $html = '<div id="notice" class="notice notice-error is-dismissible below-h2">';
365
+ $html .= '<p>Output No Select.</p>';
366
+ $html .= '<button type="button" class="notice-dismiss">';
367
+ $html .= '<span class="screen-reader-text">Dismiss this notice.</span>';
368
+ $html .= '</button>';
369
+ $html .= '</div>';
370
+
371
+ return (string) $html;
372
+ }
373
+ }
trunk/includes/admin/wp-structuring-admin-type-article.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Article
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.1.3
7
+ * @since 1.1.0
8
+ * @see wp-structuring-admin-db.php
9
+ * @link http://schema.org/Article
10
+ * @link https://developers.google.com/search/docs/data-types/articles
11
+ */
12
+ class Structuring_Markup_Type_Article {
13
+
14
+ /**
15
+ * Constructor Define.
16
+ *
17
+ * @version 3.2.2
18
+ * @since 1.0.0
19
+ * @param array $option
20
+ */
21
+ public function __construct ( array $option ) {
22
+ /** Default Value Set */
23
+ $option_array = $this->get_default_options();
24
+
25
+ if ( !empty( $option ) ) {
26
+ $option_array = array_merge( $option_array, $option );
27
+ }
28
+
29
+ $this->page_render( $option_array );
30
+ }
31
+
32
+ /**
33
+ * Form Layout Render
34
+ *
35
+ * @version 4.1.3
36
+ * @since 1.1.0
37
+ * @param array $option
38
+ */
39
+ private function page_render ( array $option ) {
40
+ $html = '<table class="schema-admin-table">';
41
+ $html .= '<caption>Basic Setting</caption>';
42
+ $html .= '<tr><th>headline :</th><td><small>Default : post_title</small></td></tr>';
43
+ $html .= '<tr><th>datePublished :</th><td><small>Default : get_the_time( DATE_ISO8601, ID )</small></td></tr>';
44
+ $html .= '<tr><th>dateModified :</th><td><small>Default : get_the_modified_time( DATE_ISO8601, false, ID )</small></td></tr>';
45
+ $html .= '<tr><th>description :</th><td><small>Default : post_excerpt</small></td></tr>';
46
+ $html .= '</table>';
47
+ echo $html;
48
+
49
+ $html = '<table class="schema-admin-table">';
50
+ $html .= '<caption>mainEntityOfPage</caption>';
51
+ $html .= '<tr><th>@type :</th><td><small>"WebPage"</small></td></tr>';
52
+ $html .= '<tr><th>@id :</th><td><small>Default : get_permalink( ID )</small></td></tr>';
53
+ $html .= '</table>';
54
+ echo $html;
55
+
56
+ $html = '<table class="schema-admin-table">';
57
+ $html .= '<caption>image</caption>';
58
+ $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
59
+ $html .= '<tr><th>url :</th><td><small>Default : Featured Image</small></td></tr>';
60
+ $html .= '<tr><th>height :</th><td><small>Auto : The height of the image, in pixels.</small></td></tr>';
61
+ $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>';
62
+ $html .= '<tr><th><label for="content_image">Setting image url :</label></th><td>';
63
+ $html .= '<input type="checkbox" name="option[' . "content_image" . ']" id="content_image" value="on"';
64
+ if ( isset( $option['content_image'] ) && $option['content_image'] === 'on' ) {
65
+ $html .= ' checked="checked"';
66
+ }
67
+ $html .= '>Set the first image in the content.<br><small>Pattern without feature image set (feature image takes precedence)</small>';
68
+ $html .= '</td></tr>';
69
+ $html .= '</table>';
70
+ echo $html;
71
+
72
+ $html = '<table class="schema-admin-table">';
73
+ $html .= '<caption>author</caption>';
74
+ $html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
75
+ $html .= '<tr><th>name :</th><td><small>Default : get_the_author_meta( "display_name", author )</small>';
76
+ $html .= '</td></tr>';
77
+ $html .= '</table>';
78
+ echo $html;
79
+
80
+ $html = '<table class="schema-admin-table">';
81
+ $html .= '<caption>publisher</caption>';
82
+ $html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
83
+ $html .= '<tr><th><label for="name">Organization Name :</label></th><td>';
84
+ $html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" value="' . esc_attr( $option['name'] ) . '">';
85
+ $html .= '</td></tr>';
86
+ $html .= '</table>';
87
+ echo $html;
88
+
89
+ $html = '<table class="schema-admin-table">';
90
+ $html .= '<caption>publisher.logo</caption>';
91
+ $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
92
+ $html .= '<tr><th><label for="logo">url :</label></th><td>';
93
+ $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
94
+ $html .= '<button id="media-upload" class="dashicons-before dashicons-admin-media schema-admin-media-button"></button>';
95
+ $html .= '</td></tr>';
96
+ $html .= '<tr><th><label for="logo-width">width :</label></th><td>';
97
+ $html .= '<input type="number" name="option[' . "logo-width" . ']" id="logo-width" min="0" value="' . esc_attr( $option['logo-width'] ) . '" placeholder="width <= 600px.">px';
98
+ $html .= '</td></tr>';
99
+ $html .= '<tr><th><label for="logo-height">height :</label></th><td>';
100
+ $html .= '<input type="number" name="option[' . "logo-height" . ']" id="logo-height" min="0" value="' . esc_attr( $option['logo-height'] ) . '" placeholder="height <= 60px.">px';
101
+ $html .= '</td></tr>';
102
+ $html .= '</table>';
103
+ echo $html;
104
+
105
+ 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>';
106
+ submit_button();
107
+ }
108
+
109
+ /**
110
+ * Return the default options array
111
+ *
112
+ * @since 4.1.3
113
+ * @version 2.2.0
114
+ * @return array $args
115
+ */
116
+ private function get_default_options () {
117
+ $args['name'] = '';
118
+ $args['content_image'] = '';
119
+ $args['logo'] = '';
120
+ $args['logo-height'] = 0;
121
+ $args['logo-width'] = 0;
122
+
123
+ return (array) $args;
124
+ }
125
+ }
trunk/includes/admin/wp-structuring-admin-type-blog-posting.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type BlogPosting
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.1.3
7
+ * @since 1.2.0
8
+ * @see wp-structuring-admin-db.php
9
+ * @link http://schema.org/BlogPosting
10
+ * @link https://developers.google.com/search/docs/data-types/articles
11
+ */
12
+ class Structuring_Markup_Type_Blog_Posting {
13
+
14
+ /**
15
+ * Constructor Define.
16
+ *
17
+ * @version 3.2.2
18
+ * @since 1.0.0
19
+ * @param array $option
20
+ */
21
+ public function __construct ( array $option ) {
22
+ /** Default Value Set */
23
+ $option_array = $this->get_default_options();
24
+
25
+ if ( !empty( $option ) ) {
26
+ $option_array = array_merge( $option_array, $option );
27
+ }
28
+
29
+ $this->page_render( $option_array );
30
+ }
31
+
32
+ /**
33
+ * Form Layout Render
34
+ *
35
+ * @version 4.1.3
36
+ * @since 1.2.0
37
+ * @param array $option
38
+ */
39
+ private function page_render ( array $option ) {
40
+ $html = '<table class="schema-admin-table">';
41
+ $html .= '<caption>Basic Setting</caption>';
42
+ $html .= '<tr><th>headline :</th><td><small>Default : post_title</small></td></tr>';
43
+ $html .= '<tr><th>datePublished :</th><td><small>Default : get_the_time( DATE_ISO8601, ID )</small></td></tr>';
44
+ $html .= '<tr><th>dateModified :</th><td><small>Default : get_the_modified_time( DATE_ISO8601, false, ID )</small></td></tr>';
45
+ $html .= '<tr><th>description :</th><td><small>Default : post_excerpt</small></td></tr>';
46
+ $html .= '</table>';
47
+ echo $html;
48
+
49
+ $html = '<table class="schema-admin-table">';
50
+ $html .= '<caption>mainEntityOfPage</caption>';
51
+ $html .= '<tr><th>@type :</th><td><small>"WebPage"</small></td></tr>';
52
+ $html .= '<tr><th>@id :</th><td><small>Default : get_permalink( ID )</small></td></tr>';
53
+ $html .= '</table>';
54
+ echo $html;
55
+
56
+ $html = '<table class="schema-admin-table">';
57
+ $html .= '<caption>image</caption>';
58
+ $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
59
+ $html .= '<tr><th>url :</th><td><small>Default : Featured Image</small></td></tr>';
60
+ $html .= '<tr><th>height :</th><td><small>Auto : The height of the image, in pixels.</small></td></tr>';
61
+ $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>';
62
+ $html .= '<tr><th><label for="content_image">Setting image url :</label></th><td>';
63
+ $html .= '<input type="checkbox" name="option[' . "content_image" . ']" id="content_image" value="on"';
64
+ if ( isset( $option['content_image'] ) && $option['content_image'] === 'on' ) {
65
+ $html .= ' checked="checked"';
66
+ }
67
+ $html .= '>Set the first image in the content.<br><small>Pattern without feature image set (feature image takes precedence)</small>';
68
+ $html .= '</td></tr>';
69
+ $html .= '</table>';
70
+ echo $html;
71
+
72
+ $html = '<table class="schema-admin-table">';
73
+ $html .= '<caption>author</caption>';
74
+ $html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
75
+ $html .= '<tr><th>name :</th><td><small>Default : get_the_author_meta( "display_name", author )</small>';
76
+ $html .= '</td></tr>';
77
+ $html .= '</table>';
78
+ echo $html;
79
+
80
+ $html = '<table class="schema-admin-table">';
81
+ $html .= '<caption>publisher</caption>';
82
+ $html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
83
+ $html .= '<tr><th><label for="name">Organization Name :</label></th><td>';
84
+ $html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" value="' . esc_attr( $option['name'] ) . '">';
85
+ $html .= '</td></tr>';
86
+ $html .= '</table>';
87
+ echo $html;
88
+
89
+ $html = '<table class="schema-admin-table">';
90
+ $html .= '<caption>publisher.logo</caption>';
91
+ $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
92
+ $html .= '<tr><th><label for="logo">url :</label></th><td>';
93
+ $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
94
+ $html .= '<button id="media-upload" class="dashicons-before dashicons-admin-media schema-admin-media-button"></button>';
95
+ $html .= '</td></tr>';
96
+ $html .= '<tr><th><label for="logo-width">width :</label></th><td>';
97
+ $html .= '<input type="number" name="option[' . "logo-width" . ']" id="logo-width" min="0" value="' . esc_attr( $option['logo-width'] ) . '" placeholder="width <= 600px.">px';
98
+ $html .= '</td></tr>';
99
+ $html .= '<tr><th><label for="logo-height">height :</label></th><td>';
100
+ $html .= '<input type="number" name="option[' . "logo-height" . ']" id="logo-height" min="0" value="' . esc_attr( $option['logo-height'] ) . '" placeholder="height <= 60px.">px';
101
+ $html .= '</td></tr>';
102
+ $html .= '</table>';
103
+ echo $html;
104
+
105
+ 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>';
106
+ submit_button();
107
+ }
108
+
109
+ /**
110
+ * Return the default options array
111
+ *
112
+ * @version 4.1.3
113
+ * @since 2.2.0
114
+ * @return array $args
115
+ */
116
+ private function get_default_options () {
117
+ $args['name'] = '';
118
+ $args['content_image'] = '';
119
+ $args['logo'] = '';
120
+ $args['logo-height'] = 0;
121
+ $args['logo-width'] = 0;
122
+
123
+ return (array) $args;
124
+ }
125
+ }
trunk/includes/admin/wp-structuring-admin-type-breadcrumb.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Breadcrumb
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.1.1
7
+ * @since 2.0.0
8
+ * @see wp-structuring-admin-db.php
9
+ * @link https://schema.org/BreadcrumbList
10
+ * @link https://developers.google.com/search/docs/data-types/breadcrumbs
11
+ */
12
+ class Structuring_Markup_Type_Breadcrumb {
13
+
14
+ /**
15
+ * Constructor Define.
16
+ *
17
+ * @version 4.1.1
18
+ * @since 2.0.0
19
+ * @param array $option
20
+ */
21
+ public function __construct ( array $option ) {
22
+ /** Default Value Set */
23
+ $option_array = $this->get_default_options();
24
+
25
+ if ( !empty( $option ) ) {
26
+ $option_array = array_merge( $option_array, $option );
27
+ }
28
+
29
+ $this->page_render( $option_array );
30
+ }
31
+
32
+ /**
33
+ * Form Layout Render
34
+ *
35
+ * @version 4.1.1
36
+ * @since 2.3.3
37
+ * @param array $option
38
+ */
39
+ private function page_render ( array $option ) {
40
+ $html = '<table class="schema-admin-table">';
41
+ $html .= '<caption>Basic Setting</caption>';
42
+ $html .= '<tr><th><label for="home_on">Display Home Page :</label></th><td>';
43
+ $html .= '<input type="checkbox" name="option[' . "home_on" . ']" id="home_on" value="on"';
44
+ if ( isset( $option['home_on'] ) && $option['home_on'] === 'on' ) {
45
+ $html .= ' checked="checked"';
46
+ }
47
+ $html .= '>Enabled';
48
+ $html .= '<small>Installed the HOME to breadcrumbs.</small>';
49
+ $html .= '</td></tr>';
50
+ $html .= '<tr><th><label for="home_name">Home Name :</label></th><td>';
51
+ $html .= '<input type="text" name="option[' . "home_name" . ']" id="home_name" class="regular-text" value="' . esc_attr( $option['home_name'] ) . '">';
52
+ $html .= '<small>Default : bloginfo("name")<br>* In the case of the pattern set for the static page on the front page its title is the default value.</small>';
53
+ $html .= '</td></tr>';
54
+ $html .= '<tr><th><label for="current_on">Display Current Page :</label></th><td>';
55
+ $html .= '<input type="checkbox" name="option[' . "current_on" . ']" id="current_on" value="on"';
56
+ if ( isset( $option['current_on'] ) && $option['current_on'] === 'on' ) {
57
+ $html .= ' checked="checked"';
58
+ }
59
+ $html .= '>Enabled';
60
+ $html .= '<small>Installed the Current Page to breadcrumbs.</small>';
61
+ $html .= '</td></tr>';
62
+ $html .= '</table>';
63
+ echo $html;
64
+
65
+ $html = '<table class="schema-admin-table">';
66
+ $html .= '<caption>Short Code</caption>';
67
+ $html .= '<tr><th><label for="home_on">Short Code Copy :</label></th><td>';
68
+ $html .= '<input type="text" onfocus="this.select();" readonly="readonly" value="[wp-structuring-markup-breadcrumb]" class="large-text code">';
69
+ $html .= '<small>Option : id="id_name" and class="class_name" attribute additional ol element.</small>';
70
+ $html .= '</td></tr>';
71
+ $html .= '</table>';
72
+ echo $html;
73
+
74
+ echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/data-types/breadcrumbs" target="_blank">https://developers.google.com/search/docs/data-types/breadcrumbs</a></p>';
75
+ submit_button();
76
+ }
77
+
78
+ /**
79
+ * Return the default options array
80
+ *
81
+ * @version 4.1.1
82
+ * @since 2.0.0
83
+ * @return array $args
84
+ */
85
+ private function get_default_options () {
86
+ $args['home_on'] = '';
87
+ $args['home_name'] = '';
88
+ $args['current_on'] = '';
89
+
90
+ return (array) $args;
91
+ }
92
+ }
trunk/includes/admin/wp-structuring-admin-type-event.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Event
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.2
7
+ * @since 2.1.0
8
+ * @see wp-structuring-admin-db.php
9
+ * @link http://schema.org/Event
10
+ * @link http://schema.org/Place
11
+ * @link http://schema.org/Offer
12
+ * @link https://developers.google.com/search/docs/data-types/events
13
+ */
14
+ class Structuring_Markup_Type_Event {
15
+
16
+ /**
17
+ * Constructor Define.
18
+ *
19
+ * @since 2.1.0
20
+ */
21
+ public function __construct () {
22
+ $this->page_render();
23
+ }
24
+
25
+ /**
26
+ * Form Layout Render
27
+ *
28
+ * @version 4.0.2
29
+ * @since 2.1.0
30
+ */
31
+ private function page_render () {
32
+ $html = '<table class="schema-admin-table">';
33
+ $html .= '<caption>Basic Setting</caption>';
34
+ $html .= '<tr><th class="require">type :</th><td><small>Select a event type: field name "schema_event_type"</small></td></tr>';
35
+ $html .= '<tr><th class="require">name :</th><td><small>Input a custom post: field name "schema_event_name"</small></td></tr>';
36
+ $html .= '<tr><th class="require">description :</th><td><small>Input a custom post: field name "schema_event_description"</small></td></tr>';
37
+ $html .= '<tr><th class="require">image :</th><td><small>Input a custom post: field name "schema_event_image"</small></td></tr>';
38
+ $html .= '<tr><th class="require">startDate :</th><td><small>Input a custom post: field name "schema_event_date" & "schema_event_time"</small></td></tr>';
39
+ $html .= '<tr><th class="require">endtDate :</th><td><small>Input a custom post: field name "schema_event_date_end" & "schema_event_time_end"</small></td></tr>';
40
+ $html .= '<tr><th>url :</th><td><small>Input a custom post: field name "schema_event_url"</small></td></tr>';
41
+ $html .= '</table>';
42
+ echo $html;
43
+
44
+ $html = '<table class="schema-admin-table">';
45
+ $html .= '<caption>Location Type "Place" Setting</caption>';
46
+ $html .= '<tr><th class="require">name :</th><td><small>Input a custom post: field name "schema_event_place_name"</small></td></tr>';
47
+ $html .= '<tr><th>url(sameAs) :</th><td><small>Input a custom post: field name "schema_event_url"</small></td></tr>';
48
+ $html .= '<tr><th class="require">address :</th><td><small>Input a custom post: field name "schema_event_place_address"</small></td></tr>';
49
+ $html .= '</table>';
50
+ echo $html;
51
+
52
+ $html = '<table class="schema-admin-table">';
53
+ $html .= '<caption>Location Type "Offers" Setting</caption>';
54
+ $html .= '<tr><th>price :</th><td><small>Input a custom post: field name "schema_event_offers_price"</small></td></tr>';
55
+ $html .= '<tr><th class="require">priceCurrency :</th><td><small>Input a custom post: field name "schema_event_offers_currency"</small></td></tr>';
56
+ $html .= '<tr><th>url :</th><td><small>Input a custom post: field name "schema_event_place_url"</small></td></tr>';
57
+ $html .= '<tr><th>validFrom :</th><td><small>Input a custom post: field name "schema_event_offers_date" & "schema_event_offers_time"</small></td></tr>';
58
+ $html .= '</table>';
59
+ echo $html;
60
+
61
+ $html = '<table class="schema-admin-table">';
62
+ $html .= '<caption>Location Type "PerformingGroup" Setting</caption>';
63
+ $html .= '<tr><th>name :</th><td><small>Input a custom post: field name "schema_event_performer_name"</small></td></tr>';
64
+ $html .= '</table>';
65
+ echo $html;
66
+
67
+ echo '<p>Custom post name "schema_event_post"</p>';
68
+ echo '<p>Archive rewrite name "events"</p>';
69
+ echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/data-types/events" target="_blank">https://developers.google.com/search/docs/data-types/events</a></p>';
70
+
71
+ submit_button();
72
+ }
73
+ }
trunk/includes/admin/wp-structuring-admin-type-local-business.php ADDED
@@ -0,0 +1,528 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type LocalBusiness
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.1.3
7
+ * @since 2.3.3
8
+ * @see wp-structuring-admin-db.php
9
+ * @link http://schema.org/LocalBusiness
10
+ * @link https://schema.org/GeoCircle
11
+ * @link https://developers.google.com/search/docs/data-types/local-businesses
12
+ */
13
+ class Structuring_Markup_Type_LocalBusiness {
14
+
15
+ /**
16
+ * Variable definition.
17
+ *
18
+ * @version 2.3.0
19
+ * @since 2.3.0
20
+ */
21
+ /** LocalBusiness Type defined. */
22
+ private $business_type_array = array(
23
+ array( "type" => "LocalBusiness", "display" => "LocalBusiness" ),
24
+
25
+ array( "type" => "AnimalShelter", "display" => "- AnimalShelter" ),
26
+
27
+ array( "type" => "AutomotiveBusiness", "display" => "- AutomotiveBusiness" ),
28
+ array( "type" => "AutoBodyShop", "display" => "-- AutoBodyShop" ),
29
+ array( "type" => "AutoDealer", "display" => "-- AutoDealer" ),
30
+ array( "type" => "AutoPartsStore", "display" => "-- AutoPartsStore" ),
31
+ array( "type" => "AutoRental", "display" => "-- AutoRental" ),
32
+ array( "type" => "AutoRepair", "display" => "-- AutoRepair" ),
33
+ array( "type" => "AutoWash", "display" => "-- AutoWash" ),
34
+ array( "type" => "GasStation", "display" => "-- GasStation" ),
35
+ array( "type" => "MotorcycleDealer", "display" => "-- MotorcycleDealer" ),
36
+ array( "type" => "MotorcycleRepair", "display" => "-- MotorcycleRepair" ),
37
+
38
+ array( "type" => "ChildCare", "display" => "- ChildCare" ),
39
+
40
+ array( "type" => "DryCleaningOrLaundry", "display" => "- DryCleaningOrLaundry" ),
41
+
42
+ array( "type" => "EmergencyService", "display" => "- EmergencyService" ),
43
+ array( "type" => "FireStation", "display" => "-- FireStation" ),
44
+ array( "type" => "Hospital", "display" => "-- Hospital" ),
45
+ array( "type" => "PoliceStation", "display" => "-- PoliceStation" ),
46
+
47
+ array( "type" => "EmploymentAgency", "display" => "- EmploymentAgency" ),
48
+
49
+ array( "type" => "EntertainmentBusiness", "display" => "- EntertainmentBusiness" ),
50
+ array( "type" => "AdultEntertainment", "display" => "-- AdultEntertainment" ),
51
+ array( "type" => "AmusementPark", "display" => "-- AmusementPark" ),
52
+ array( "type" => "ArtGallery", "display" => "-- ArtGallery" ),
53
+ array( "type" => "Casino", "display" => "-- Casino" ),
54
+ array( "type" => "ComedyClub", "display" => "-- ComedyClub" ),
55
+ array( "type" => "MovieTheater", "display" => "-- MovieTheater" ),
56
+ array( "type" => "NightClub", "display" => "-- NightClub" ),
57
+
58
+ array( "type" => "FinancialService", "display" => "- FinancialService" ),
59
+ array( "type" => "AccountingService", "display" => "-- AccountingService" ),
60
+ array( "type" => "AutomatedTeller", "display" => "-- AutomatedTeller" ),
61
+ array( "type" => "BankOrCreditUnion", "display" => "-- BankOrCreditUnion" ),
62
+ array( "type" => "InsuranceAgency", "display" => "-- InsuranceAgency" ),
63
+
64
+ array( "type" => "FoodEstablishment", "display" => "- FoodEstablishment" ),
65
+ array( "type" => "Bakery", "display" => "-- Bakery" ),
66
+ array( "type" => "BarOrPub", "display" => "-- BarOrPub" ),
67
+ array( "type" => "Brewery", "display" => "-- Brewery" ),
68
+ array( "type" => "CafeOrCoffeeShop", "display" => "-- CafeOrCoffeeShop" ),
69
+ array( "type" => "FastFoodRestaurant", "display" => "-- FastFoodRestaurant" ),
70
+ array( "type" => "IceCreamShop", "display" => "-- IceCreamShop" ),
71
+ array( "type" => "Restaurant", "display" => "-- Restaurant" ),
72
+ array( "type" => "Winery", "display" => "-- Winery" ),
73
+
74
+ array( "type" => "GovernmentOffice", "display" => "- GovernmentOffice" ),
75
+ array( "type" => "PostOffice", "display" => "-- PostOffice" ),
76
+
77
+ array( "type" => "HealthAndBeautyBusiness", "display" => "- HealthAndBeautyBusiness" ),
78
+ array( "type" => "BeautySalon", "display" => "-- BeautySalon" ),
79
+ array( "type" => "DaySpa", "display" => "-- DaySpa" ),
80
+ array( "type" => "HairSalon", "display" => "-- HairSalon" ),
81
+ array( "type" => "HealthClub", "display" => "-- HealthClub" ),
82
+ array( "type" => "NailSalon", "display" => "-- NailSalon" ),
83
+ array( "type" => "TattooParlor", "display" => "-- TattooParlor" ),
84
+
85
+ array( "type" => "HomeAndConstructionBusiness", "display" => "- HomeAndConstructionBusiness" ),
86
+ array( "type" => "Electrician", "display" => "-- Electrician" ),
87
+ array( "type" => "GeneralContractor", "display" => "-- GeneralContractor" ),
88
+ array( "type" => "HVACBusiness", "display" => "-- HVACBusiness" ),
89
+ array( "type" => "HousePainter", "display" => "-- HousePainter" ),
90
+ array( "type" => "Locksmith", "display" => "-- Locksmith" ),
91
+ array( "type" => "MovingCompany", "display" => "-- MovingCompany" ),
92
+ array( "type" => "Plumber", "display" => "-- Plumber" ),
93
+ array( "type" => "RoofingContractor", "display" => "-- RoofingContractor" ),
94
+
95
+ array( "type" => "InternetCafe", "display" => "- InternetCafe" ),
96
+
97
+ array( "type" => "LegalService", "display" => "- LegalService" ),
98
+ array( "type" => "Attorney", "display" => "-- Attorney" ),
99
+ array( "type" => "Notary", "display" => "-- Notary" ),
100
+
101
+ array( "type" => "Library", "display" => "- Library" ),
102
+
103
+ array( "type" => "LodgingBusiness", "display" => "- LodgingBusiness" ),
104
+ array( "type" => "BedAndBreakfast", "display" => "-- BedAndBreakfast" ),
105
+ array( "type" => "Hostel", "display" => "-- Hostel" ),
106
+ array( "type" => "Hotel", "display" => "-- Hotel" ),
107
+ array( "type" => "Motel", "display" => "-- Motel" ),
108
+
109
+ array( "type" => "MedicalOrganization", "display" => "- MedicalOrganization" ),
110
+ array( "type" => "Dentist", "display" => "-- Dentist" ),
111
+ array( "type" => "DiagnosticLab", "display" => "-- DiagnosticLab" ),
112
+ array( "type" => "Hospital", "display" => "-- Hospital" ),
113
+ array( "type" => "MedicalClinic", "display" => "-- MedicalClinic" ),
114
+ array( "type" => "Optician", "display" => "-- Optician" ),
115
+ array( "type" => "Pharmacy", "display" => "-- Pharmacy" ),
116
+ array( "type" => "Physician", "display" => "-- Physician" ),
117
+ array( "type" => "VeterinaryCare", "display" => "-- VeterinaryCare" ),
118
+
119
+ array( "type" => "ProfessionalService", "display" => "- ProfessionalService" ),
120
+
121
+ array( "type" => "RadioStation", "display" => "- RadioStation" ),
122
+
123
+ array( "type" => "RealEstateAgent", "display" => "- RealEstateAgent" ),
124
+
125
+ array( "type" => "RecyclingCenter", "display" => "- RecyclingCenter" ),
126
+
127
+ array( "type" => "SelfStorage", "display" => "- SelfStorage" ),
128
+
129
+ array( "type" => "ShoppingCenter", "display" => "- ShoppingCenter" ),
130
+
131
+ array( "type" => "SportsActivityLocation", "display" => "- SportsActivityLocation" ),
132
+ array( "type" => "BowlingAlley", "display" => "-- BowlingAlley" ),
133
+ array( "type" => "ExerciseGym", "display" => "-- ExerciseGym" ),
134
+ array( "type" => "GolfCourse", "display" => "-- GolfCourse" ),
135
+ array( "type" => "HealthClub", "display" => "-- HealthClub" ),
136
+ array( "type" => "PublicSwimmingPool", "display" => "-- PublicSwimmingPool" ),
137
+ array( "type" => "SkiResort", "display" => "-- SkiResort" ),
138
+ array( "type" => "SportsClub", "display" => "-- SportsClub" ),
139
+ array( "type" => "StadiumOrArena", "display" => "-- StadiumOrArena" ),
140
+ array( "type" => "TennisComplex", "display" => "-- TennisComplex" ),
141
+
142
+ array( "type" => "Store", "display" => "- Store" ),
143
+ array( "type" => "AutoPartsStore", "display" => "-- AutoPartsStore" ),
144
+ array( "type" => "BikeStore", "display" => "-- BikeStore" ),
145
+ array( "type" => "BookStore", "display" => "-- BookStore" ),
146
+ array( "type" => "ClothingStore", "display" => "-- ClothingStore" ),
147
+ array( "type" => "ComputerStore", "display" => "-- ComputerStore" ),
148
+ array( "type" => "ConvenienceStore", "display" => "-- ConvenienceStore" ),
149
+ array( "type" => "DepartmentStore", "display" => "-- DepartmentStore" ),
150
+ array( "type" => "ElectronicsStore", "display" => "-- ElectronicsStore" ),
151
+ array( "type" => "Florist", "display" => "-- Florist" ),
152
+ array( "type" => "FurnitureStore", "display" => "-- FurnitureStore" ),
153
+ array( "type" => "GardenStore", "display" => "-- GardenStore" ),
154
+ array( "type" => "GroceryStore", "display" => "-- GroceryStore" ),
155
+ array( "type" => "HardwareStore", "display" => "-- HardwareStore" ),
156
+ array( "type" => "HobbyShop", "display" => "-- HobbyShop" ),
157
+ array( "type" => "HomeGoodsStore", "display" => "-- HomeGoodsStore" ),
158
+ array( "type" => "JewelryStore", "display" => "-- JewelryStore" ),
159
+ array( "type" => "LiquorStore", "display" => "-- LiquorStore" ),
160
+ array( "type" => "MensClothingStore", "display" => "-- MensClothingStore" ),
161
+ array( "type" => "MobilePhoneStore", "display" => "-- MobilePhoneStore" ),
162
+ array( "type" => "MovieRentalStore", "display" => "-- MovieRentalStore" ),
163
+ array( "type" => "MusicStore", "display" => "-- MusicStore" ),
164
+ array( "type" => "OfficeEquipmentStore", "display" => "-- OfficeEquipmentStore" ),
165
+ array( "type" => "OutletStore", "display" => "-- OutletStore" ),
166
+ array( "type" => "PawnShop", "display" => "-- PawnShop" ),
167
+ array( "type" => "PetStore", "display" => "-- PetStore" ),
168
+ array( "type" => "ShoeStore", "display" => "-- ShoeStore" ),
169
+ array( "type" => "SportingGoodsStore", "display" => "-- SportingGoodsStore" ),
170
+ array( "type" => "TireShop", "display" => "-- TireShop" ),
171
+ array( "type" => "ToyStore", "display" => "-- ToyStore" ),
172
+ array( "type" => "WholesaleStore", "display" => "-- WholesaleStore" ),
173
+
174
+ array( "type" => "TelevisionStation", "display" => "- TelevisionStation" ),
175
+
176
+ array( "type" => "TouristInformationCenter", "display" => "- TouristInformationCenter" ),
177
+
178
+ array( "type" => "TravelAgency", "display" => "- TravelAgency" )
179
+ );
180
+
181
+ /** weekType defined. */
182
+ private $week_array = array(
183
+ array("type" => "Mo", "display" => "Monday"),
184
+ array("type" => "Tu", "display" => "Tuesday"),
185
+ array("type" => "We", "display" => "Wednesday"),
186
+ array("type" => "Th", "display" => "Thursday"),
187
+ array("type" => "Fr", "display" => "Friday"),
188
+ array("type" => "Sa", "display" => "Saturday"),
189
+ array("type" => "Su", "display" => "Sunday")
190
+ );
191
+
192
+ /**
193
+ * Constructor Define.
194
+ *
195
+ * @version 3.1.4
196
+ * @since 2.3.0
197
+ * @param array $option
198
+ */
199
+ public function __construct ( array $option ) {
200
+ /** Default Value Set */
201
+ $option_array = $this->get_default_options();
202
+
203
+ if ( !empty( $option ) ) {
204
+ $option_array = array_merge( $option_array, $option );
205
+ }
206
+
207
+ $this->page_render( $option_array );
208
+ }
209
+
210
+ /**
211
+ * Form Layout Render
212
+ *
213
+ * @version 4.1.3
214
+ * @since 2.3.3
215
+ * @param array $option
216
+ */
217
+ private function page_render ( array $option ) {
218
+ /** Local Business Type */
219
+ $html = '<table class="schema-admin-table">';
220
+ $html .= '<caption>Local Business</caption>';
221
+ $html .= $this->set_form_select( 'business_type', 'Local Business Type', $option['business_type'] );
222
+ $html .= $this->set_form_text( 'image', 'An image of the business', $option['image'], true );
223
+ $html .= $this->set_form_text( 'name', 'Business Name', $option['name'], true );
224
+ $html .= $this->set_form_text( 'url', 'Url', $option['url'], true );
225
+ $html .= $this->set_form_text( 'telephone', 'Telephone', $option['telephone'], false, 'e.g. : +1-880-555-1212' );
226
+ $html .= '</table>';
227
+ echo $html;
228
+
229
+ /** For food establishments */
230
+ $html = '<table class="schema-admin-table">';
231
+ $html .= '<caption>For food establishments</caption>';
232
+ $html .= $this->set_form_checkbox( 'food_active', 'Setting', $option['food_active'], 'Enabled' );
233
+ $html .= $this->set_form_text( 'menu', 'Menu url', $option['menu'], false, 'For food establishments, the fully-qualified URL of the menu.' );
234
+ $html .= $this->set_form_checkbox( 'accepts_reservations', 'Accepts Reservations', $option['accepts_reservations'], 'For food establishments, and whether it is possible to accept a reservation?' );
235
+ $html .= $this->set_form_text( 'serves_cuisine', 'Serves Cuisine', $option['serves_cuisine'], false, 'If marking up a restaurant, provide the type of cuisine they serve.' );
236
+ $html .= '</table>';
237
+ echo $html;
238
+
239
+ /** Postal Address */
240
+ $html = '<table class="schema-admin-table">';
241
+ $html .= '<caption>Postal Address</caption>';
242
+ $html .= $this->set_form_text( 'street_address', 'Street Address', $option['street_address'], true );
243
+ $html .= $this->set_form_text( 'address_locality', 'Address Locality', $option['address_locality'], true );
244
+ $html .= $this->set_form_text( 'address_region', 'Address Region', $option['address_region'], false );
245
+ $html .= $this->set_form_text( 'postal_code', 'Postal Code', $option['postal_code'], true );
246
+ $html .= $this->set_form_text( 'address_country', 'Address Country', $option['address_country'], true, '<a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2" target="_blank">The 2-letter ISO 3166-1 alpha-2 country code.</a>' );
247
+ $html .= '</table>';
248
+ echo $html;
249
+
250
+ /** Geo Circle */
251
+ $html = '<table class="schema-admin-table">';
252
+ $html .= '<caption>Geo Circle</caption>';
253
+ $html .= $this->set_form_checkbox( 'geo_circle_active', 'Setting', $option['geo_circle_active'], 'Enabled' );
254
+ $html .= $this->set_form_text( 'geo_circle_radius', 'geoRadius', $option['geo_circle_radius'], false );
255
+ $html .= '</table>';
256
+ echo $html;
257
+
258
+ /** Geo Coordinates */
259
+ $html = '<table class="schema-admin-table">';
260
+ $html .= '<caption>Geo Coordinates</caption>';
261
+ $html .= $this->set_form_checkbox( 'geo_active', 'Setting', $option['geo_active'], 'Enabled' );
262
+ $html .= $this->set_form_text( 'latitude', 'Latitude', $option['latitude'], false );
263
+ $html .= $this->set_form_text( 'longitude', 'Longitude', $option['longitude'], false );
264
+ $html .= '</table>';
265
+ echo $html;
266
+
267
+ /** Opening Hours Specification */
268
+ $html = '<table class="schema-admin-table">';
269
+ $html .= '<caption>Opening Hours Specification</caption>';
270
+
271
+ $i = 0;
272
+
273
+ foreach ( $this->week_array as $value ) {
274
+ if ( !isset( $option[$value['type']] ) ) {
275
+ $option[$value['type']] = "";
276
+ }
277
+
278
+ $html .= $this->set_form_checkbox( $value['type'], $value['display'], $option[$value['type']], 'Enabled' );
279
+
280
+ if ( isset( $option['week'][$value['type']] ) ) {
281
+ foreach ( $option['week'][$value['type']] as $type ) {
282
+ if ( !empty( $type['open'] ) ) {
283
+ $html .= $this->set_form_time( $value['type'], '', $type['open'], $type['close'], '', $i );
284
+ $i++;
285
+ } else {
286
+ $html .= $this->set_form_time( $value['type'], '', '', '', '', 0 );
287
+ break;
288
+ }
289
+ }
290
+ } else {
291
+ $html .= $this->set_form_time( $value['type'], '', '', '', '', 0 );
292
+ }
293
+
294
+ $i = 0;
295
+ }
296
+
297
+ $html .= '</table>';
298
+ echo $html;
299
+
300
+ /** Holiday Opening Hours */
301
+ $html = '<table class="schema-admin-table">';
302
+ $html .= '<caption>Holiday Opening Hours</caption>';
303
+ $html .= $this->set_form_checkbox( 'holiday_active', 'Setting', $option['holiday_active'], 'Enabled' );
304
+ $html .= $this->set_form_time_holiday( $option['holiday_open'], $option['holiday_close'] );
305
+ $html .= $this->set_form_date( 'holiday_valid_from', 'validFrom', $option['holiday_valid_from'], false );
306
+ $html .= $this->set_form_date( 'holiday_valid_through', 'validThrough', $option['holiday_valid_through'], false );
307
+
308
+ $html .= '</table>';
309
+ echo $html;
310
+
311
+ /** Price Range */
312
+ $html = '<table class="schema-admin-table">';
313
+ $html .= '<caption>Price Range</caption>';
314
+ $html .= $this->set_form_text( 'price_range', 'Price Range', $option['price_range'], false, 'The price range of the business, for example $$$.' );
315
+ $html .= '</table>';
316
+ echo $html;
317
+
318
+ echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/data-types/local-businesses" target="_blank">https://developers.google.com/search/docs/data-types/local-businesses</a></p>';
319
+ submit_button();
320
+ }
321
+
322
+ /**
323
+ * Return the default options array
324
+ *
325
+ * @since 4.1.3
326
+ * @version 2.5.0
327
+ * @return array $args
328
+ */
329
+ private function get_default_options () {
330
+ $args['business_type'] = 'local_business';
331
+ $args['name'] = '';
332
+ $args['image'] = '';
333
+ $args['url'] = '';
334
+ $args['telephone'] = '';
335
+ $args['food_active'] = '';
336
+ $args['menu'] = '';
337
+ $args['accepts_reservations'] = '';
338
+ $args['serves_cuisine'] = '';
339
+ $args['street_address'] = '';
340
+ $args['address_locality'] = '';
341
+ $args['address_region'] = '';
342
+ $args['postal_code'] = '';
343
+ $args['address_country'] = '';
344
+ $args['geo_circle_active'] = '';
345
+ $args['geo_circle_radius'] = '';
346
+ $args['geo_active'] = '';
347
+ $args['latitude'] = '';
348
+ $args['longitude'] = '';
349
+ $args['opening_active'] = '';
350
+
351
+ foreach ( $this->week_array as $value ) {
352
+ $args[$value['type']] = '';
353
+ $args['week'][$value['type']]['open'] = '';
354
+ $args['week'][$value['type']]['close'] = '';
355
+ }
356
+
357
+ $args['holiday_active'] = '';
358
+ $args['holiday_open'] = '';
359
+ $args['holiday_close'] = '';
360
+ $args['holiday_valid_from'] = '';
361
+ $args['holiday_valid_through'] = '';
362
+ $args['price_range'] = '';
363
+
364
+ return (array) $args;
365
+ }
366
+
367
+ /**
368
+ * Return the form text
369
+ *
370
+ * @version 4.1.3
371
+ * @since 2.3.0
372
+ * @param string $id
373
+ * @param string $display
374
+ * @param string $value
375
+ * @param boolean $required
376
+ * @param string $note
377
+ * @return string $html
378
+ */
379
+ private function set_form_text ( $id, $display, $value = "", $required = false, $note = "" ) {
380
+ $value = esc_attr( $value );
381
+
382
+ if ( $required ) {
383
+ $format = '<tr><th class="require"><label for=%s>%s :</label></th><td>';
384
+ } else {
385
+ $format = '<tr><th><label for=%s>%s :</label></th><td>';
386
+ }
387
+
388
+ $format .= '<input type="text" name="option[%s]" id="%s" class="regular-text" value="%s"';
389
+
390
+ if ( $required ) {
391
+ $format .= ' required';
392
+ }
393
+ if ( $note === "" ) {
394
+ $format .= '></td></tr>';
395
+ } else {
396
+ $format .= '><small>%s</small></td></tr>';
397
+ }
398
+
399
+ return (string) sprintf( $format, $id, $display, $id, $id, $value, $note );
400
+ }
401
+
402
+ /**
403
+ * Return the form date
404
+ *
405
+ * @since 3.0.5
406
+ * @version 2.5.0
407
+ * @param string $id
408
+ * @param string $display
409
+ * @param string $value
410
+ * @param boolean $required
411
+ * @param string $note
412
+ * @return string $html
413
+ */
414
+ private function set_form_date ( $id, $display, $value = "", $required = false, $note = "" ) {
415
+ $value = esc_attr( $value );
416
+
417
+ $format = '<tr><th><label for=%s>%s :</label></th><td>';
418
+ $format .= '<input type="date" name="option[%s]" id="%s" value="%s"';
419
+ if ( $required ) {
420
+ $format .= ' required';
421
+ }
422
+ $format .= '><small>%s</small></td></tr>';
423
+
424
+ return (string) sprintf( $format, $id, $display, $id, $id, $value, $note );
425
+ }
426
+
427
+ /**
428
+ * Return the form checkbox
429
+ *
430
+ * @version 3.0.5
431
+ * @since 2.3.0
432
+ * @param string $id
433
+ * @param string $display
434
+ * @param string $value
435
+ * @param string $note
436
+ * @return string $html
437
+ */
438
+ private function set_form_checkbox ( $id, $display, $value = "", $note = "" ) {
439
+ $value = esc_attr( $value );
440
+
441
+ $format = '<tr><th><label for=%s>%s :</label></th><td>';
442
+ $format .= '<input type="checkbox" name="option[%s]" id="%s" value="on"';
443
+ if ( $value === 'on' ) {
444
+ $format .= ' checked="checked"';
445
+ }
446
+ $format .= '>%s</td></tr>';
447
+
448
+ return (string) sprintf( $format, $id, $display, $id, $id, $note );
449
+ }
450
+
451
+ /**
452
+ * Return the form select
453
+ *
454
+ * @since 2.3.0
455
+ * @param string $id
456
+ * @param string $display
457
+ * @param string $value
458
+ * @param string $note
459
+ * @return string $html
460
+ */
461
+ private function set_form_select ( $id, $display, $value = "", $note = "" ) {
462
+ $value = esc_attr( $value );
463
+
464
+ $format = '<tr><th class="require"><label for=%s>%s :</label></th><td>';
465
+ $format .= '<select id="%s" name="option[%s]">';
466
+ foreach ( $this->business_type_array as $args ) {
467
+ $format .= '<option value="' . $args['type'] . '"';
468
+ if ( $args['type'] === $value ) {
469
+ $format .= ' selected';
470
+ }
471
+ $format .= '>' . $args['display'] . '</option>';
472
+ }
473
+ $format .= '</select>';
474
+ $format .= '<small>%s</small></td></tr>';
475
+
476
+ return (string) sprintf( $format, $id, $display, $id, $id, $note );
477
+ }
478
+
479
+ /**
480
+ * Return the form time
481
+ *
482
+ * @version 3.0.5
483
+ * @since 2.3.0
484
+ * @param string $id
485
+ * @param string $display
486
+ * @param string $value1
487
+ * @param string $value2
488
+ * @param string $note
489
+ * @param int $count
490
+ * @return string $html
491
+ */
492
+ private function set_form_time ( $id, $display, $value1 = "", $value2 = "", $note = "", $count = 0 ) {
493
+ $value1 = esc_attr( $value1 );
494
+ $value2 = esc_attr( $value2 );
495
+
496
+ $format = '<tr class="opening-hours %s"><th><label for=%s>%s :</label></th><td>';
497
+ $format .= 'Open Time : <input type="time" name="option[week][%s][%d][open]" id="%s-open" value="%s">';
498
+ $format .= ' Close Time : <input type="time" name="option[week][%s][%d][close]" id="%s-close" value="%s">';
499
+ $format .= '%s<a class="dashicons dashicons-plus markup-time plus"></a>';
500
+ if( $count !== 0 ) {
501
+ $format .= '<a class="dashicons dashicons-minus markup-time minus"></a>';
502
+ }
503
+ $format .= '</td></tr>';
504
+
505
+ return (string) sprintf( $format, $id, $id, $display, $id, $count, $id, $value1, $id, $count, $id, $value2, $note );
506
+ }
507
+
508
+ /**
509
+ * Return the form time (Holiday)
510
+ *
511
+ * @since 2.5.0
512
+ * @version 2.5.0
513
+ * @param string $value1
514
+ * @param string $value2
515
+ * @return string $html
516
+ */
517
+ private function set_form_time_holiday ( $value1 = "", $value2 = "" ) {
518
+ $value1 = esc_attr( $value1 );
519
+ $value2 = esc_attr( $value2 );
520
+
521
+ $format = '<tr><th>Holiday Time :</th><td>';
522
+ $format .= 'Open Time : <input type="time" name="option[holiday_open]" value="%s">';
523
+ $format .= 'Close Time : <input type="time" name="option[holiday_close]" value="%s">';
524
+ $format .= '</td></tr>';
525
+
526
+ return (string) sprintf( $format, $value1, $value2 );
527
+ }
528
+ }
trunk/includes/admin/wp-structuring-admin-type-news-article.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type News Article
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.1.3
7
+ * @since 1.0.0
8
+ * @see wp-structuring-admin-db.php
9
+ * @link http://schema.org/NewsArticle
10
+ * @link https://developers.google.com/search/docs/data-types/articles
11
+ */
12
+ class Structuring_Markup_Type_NewsArticle {
13
+
14
+ /**
15
+ * Constructor Define.
16
+ *
17
+ * @version 3.2.2
18
+ * @since 1.0.0
19
+ * @param array $option
20
+ */
21
+ public function __construct ( array $option ) {
22
+ /** Default Value Set */
23
+ $option_array = $this->get_default_options();
24
+
25
+ if ( !empty( $option ) ) {
26
+ $option_array = array_merge( $option_array, $option );
27
+ }
28
+
29
+ $this->page_render( $option_array );
30
+ }
31
+
32
+ /**
33
+ * Form Layout Render
34
+ *
35
+ * @version 4.1.3
36
+ * @since 1.0.0
37
+ * @param array $option
38
+ */
39
+ private function page_render ( array $option ) {
40
+ $html = '<table class="schema-admin-table">';
41
+ $html .= '<caption>Basic Setting</caption>';
42
+ $html .= '<tr><th>headline :</th><td><small>Default : post_title</small></td></tr>';
43
+ $html .= '<tr><th>datePublished :</th><td><small>Default : get_the_time( DATE_ISO8601, ID )</small></td></tr>';
44
+ $html .= '<tr><th>dateModified :</th><td><small>Default : get_the_modified_time( DATE_ISO8601, false, ID )</small></td></tr>';
45
+ $html .= '<tr><th>description :</th><td><small>Default : post_excerpt</small></td></tr>';
46
+ $html .= '</table>';
47
+ echo $html;
48
+
49
+ $html = '<table class="schema-admin-table">';
50
+ $html .= '<caption>mainEntityOfPage</caption>';
51
+ $html .= '<tr><th>@type :</th><td><small>"WebPage"</small></td></tr>';
52
+ $html .= '<tr><th>@id :</th><td><small>Default : get_permalink( ID )</small></td></tr>';
53
+ $html .= '</table>';
54
+ echo $html;
55
+
56
+ $html = '<table class="schema-admin-table">';
57
+ $html .= '<caption>image</caption>';
58
+ $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
59
+ $html .= '<tr><th>url :</th><td><small>Default : thumbnail</small></td></tr>';
60
+ $html .= '<tr><th>height :</th><td><small>Auto : The height of the image, in pixels.</small></td></tr>';
61
+ $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>';
62
+ $html .= '<tr><th><label for="content_image">Setting image url :</label></th><td>';
63
+ $html .= '<input type="checkbox" name="option[' . "content_image" . ']" id="content_image" value="on"';
64
+ if ( isset( $option['content_image'] ) && $option['content_image'] === 'on' ) {
65
+ $html .= ' checked="checked"';
66
+ }
67
+ $html .= '>Set the first image in the content.<br><small>Pattern without feature image set (feature image takes precedence)</small>';
68
+ $html .= '</td></tr>';
69
+ $html .= '</table>';
70
+ echo $html;
71
+
72
+ $html = '<table class="schema-admin-table">';
73
+ $html .= '<caption>author</caption>';
74
+ $html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
75
+ $html .= '<tr><th>name :</th><td><small>Default : get_the_author_meta( "display_name", author )</small>';
76
+ $html .= '</td></tr>';
77
+ $html .= '</table>';
78
+ echo $html;
79
+
80
+ $html = '<table class="schema-admin-table">';
81
+ $html .= '<caption>publisher</caption>';
82
+ $html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
83
+ $html .= '<tr><th><label for="name">Organization Name :</label></th><td>';
84
+ $html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" value="' . esc_attr( $option['name'] ) . '">';
85
+ $html .= '</td></tr>';
86
+ $html .= '</table>';
87
+ echo $html;
88
+
89
+ $html = '<table class="schema-admin-table">';
90
+ $html .= '<caption>publisher.logo</caption>';
91
+ $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
92
+ $html .= '<tr><th><label for="logo">url :</label></th><td>';
93
+ $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
94
+ $html .= '<button id="media-upload" class="dashicons-before dashicons-admin-media schema-admin-media-button"></button>';
95
+ $html .= '</td></tr>';
96
+ $html .= '<tr><th><label for="logo-width">width :</label></th><td>';
97
+ $html .= '<input type="number" name="option[' . "logo-width" . ']" id="logo-width" min="0" value="' . esc_attr( $option['logo-width'] ) . '" placeholder="width <= 600px.">px';
98
+ $html .= '</td></tr>';
99
+ $html .= '<tr><th><label for="logo-height">height :</label></th><td>';
100
+ $html .= '<input type="number" name="option[' . "logo-height" . ']" id="logo-height" min="0" value="' . esc_attr( $option['logo-height'] ) . '" placeholder="height <= 60px.">px';
101
+ $html .= '</td></tr>';
102
+ $html .= '</table>';
103
+ echo $html;
104
+
105
+ 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>';
106
+ submit_button();
107
+ }
108
+
109
+ /**
110
+ * Return the default options array
111
+ *
112
+ * @since 4.1.3
113
+ * @version 2.2.0
114
+ * @return array $args
115
+ */
116
+ private function get_default_options () {
117
+ $args['name'] = '';
118
+ $args['content_image'] = '';
119
+ $args['logo'] = '';
120
+ $args['logo-height'] = 0;
121
+ $args['logo-width'] = 0;
122
+
123
+ return (array) $args;
124
+ }
125
+ }
trunk/includes/admin/wp-structuring-admin-type-organization.php ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Organization
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.1.3
7
+ * @since 1.0.0
8
+ * @see wp-structuring-admin-db.php
9
+ * @link https://schema.org/Organization
10
+ * @link https://developers.google.com/search/docs/guides/enhance-site
11
+ */
12
+ class Structuring_Markup_Type_Organization {
13
+
14
+ /**
15
+ * Variable definition.
16
+ *
17
+ * @version 2.3.2
18
+ * @since 1.0.0
19
+ */
20
+ /** contactType defined. */
21
+ private $contact_type_array = array(
22
+ array("type" => "customer service", "display" => "customer service"),
23
+ array("type" => "technical support", "display" => "technical support"),
24
+ array("type" => "billing support", "display" => "billing support"),
25
+ array("type" => "bill payment", "display" => "bill payment"),
26
+ array("type" => "sales", "display" => "sales"),
27
+ array("type" => "reservations", "display" => "reservations"),
28
+ array("type" => "credit card_support", "display" => "credit card support"),
29
+ array("type" => "emergency", "display" => "emergency"),
30
+ array("type" => "baggage tracking", "display" => "baggage tracking"),
31
+ array("type" => "roadside assistance", "display" => "roadside assistance"),
32
+ array("type" => "package tracking", "display" => "package tracking")
33
+ );
34
+ /** Social Profile */
35
+ private $social_array = array(
36
+ array("type" => "facebook", "display" => "Facebook"),
37
+ array("type" => "twitter", "display" => "Twitter"),
38
+ array("type" => "google", "display" => "Google+"),
39
+ array("type" => "instagram", "display" => "Instagram"),
40
+ array("type" => "youtube", "display" => "Youtube"),
41
+ array("type" => "linkedin", "display" => "LinkedIn"),
42
+ array("type" => "myspace", "display" => "Myspace"),
43
+ array("type" => "pinterest", "display" => "Pinterest"),
44
+ array("type" => "soundcloud", "display" => "SoundCloud"),
45
+ array("type" => "tumblr", "display" => "Tumblr")
46
+ );
47
+
48
+ /**
49
+ * Constructor Define.
50
+ *
51
+ * @version 4.1.0
52
+ * @since 1.0.0
53
+ * @param array $option
54
+ */
55
+ public function __construct ( array $option ) {
56
+ /** Default Value Set */
57
+ $option_array = $this->get_default_options();
58
+
59
+ if ( !empty( $option ) ) {
60
+ $option_array = array_merge( $option_array, $option );
61
+ }
62
+ $this->page_render( $option_array );
63
+ }
64
+
65
+ /**
66
+ * Form Layout Render
67
+ *
68
+ * @version 4.1.3
69
+ * @since 1.0.0
70
+ * @param array $option
71
+ */
72
+ private function page_render ( array $option ) {
73
+ /** Logos */
74
+ $html = '<table class="schema-admin-table">';
75
+ $html .= '<caption>Logos</caption>';
76
+ $html .= '<tr><th class="require"><label for="name">Organization Name :</label></th><td>';
77
+ $html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" required value="' . esc_attr( $option['name'] ) . '">';
78
+ $html .= '</td></tr>';
79
+ $html .= '<tr><th class="require"><label for="url">url :</label></th><td>';
80
+ $html .= '<input type="text" name="option[' . "url" . ']" id="url" class="regular-text" required value="' . esc_attr( $option['url'] ) . '">';
81
+ $html .= '</td></tr>';
82
+ $html .= '<tr><th class="require"><label for="logo">logo :</label></th><td>';
83
+ $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" required value="' . esc_attr( $option['logo'] ) . '">';
84
+ $html .= '<button id="media-upload" class="dashicons-before dashicons-admin-media schema-admin-media-button"></button>';
85
+ $html .= '</td></tr>';
86
+ $html .= '</table>';
87
+ echo $html;
88
+
89
+ /** Corporate Contact */
90
+ $html = '<table class="schema-admin-table">';
91
+ $html .= '<caption>Corporate Contact</caption>';
92
+ $html .= '<tr><th><label for="contact_point">contactPoint :</label></th><td>';
93
+ $html .= '<input type="checkbox" name="option[' . "contact_point" . ']" id="contact_point" value="on"';
94
+ if ( isset( $option['contact_point'] ) && $option['contact_point'] === 'on' ) {
95
+ $html .= ' checked="checked"';
96
+ }
97
+ $html .= '>Enabled';
98
+ $html .= '</td></tr>';
99
+ $html .= '<tr><th><label for="telephone">telephone :</label></th><td>';
100
+ $html .= '<input type="text" name="option[' . "telephone" . ']" id="telephone" class="regular-text" value="' . esc_attr( $option['telephone'] ) . '" placeholder="e.g. : +1-880-555-1212">';
101
+ $html .= '</td></tr>';
102
+ $html .= '<tr><th><label for="contact_type">contactType :</label></th><td>';
103
+ $html .= '<select id="contact_type" name="option[' . "contact_type" . ']">';
104
+ foreach ( $this->contact_type_array as $value ) {
105
+ $html .= '<option value="' . $value['type'] . '"';
106
+ if ( $value['type'] === $option['contact_type'] ) {
107
+ $html .= ' selected';
108
+ }
109
+ $html .= '>' . $value['display'] . '</option>';
110
+ }
111
+ $html .= '</select>';
112
+ $html .= '</td></tr>';
113
+ $html .= '<tr><th><label for="email">email :</label></th><td>';
114
+ $html .= '<input type="email" name="option[' . "email" . ']" id="email" class="regular-text" value="' . esc_attr( $option['email'] ) . '" placeholder="e.g. : info@example.com">';
115
+ $html .= '</td></tr>';
116
+ $html .= '<tr><th><label for="area_served">areaServed :</label></th><td>';
117
+ $html .= '<input type="text" name="option[' . "area_served" . ']" id="area_served" class="regular-text" value="' . esc_attr( $option['area_served'] ) . '">';
118
+ $html .= '<small>Default : "US"&nbsp;&nbsp;Multiple : "US,CA"</small>';
119
+ $html .= '</td></tr>';
120
+ $html .= '<tr><th>contactOption :</th><td>';
121
+ $html .= '<label><input type="checkbox" name="option[' . "contact_point_1" . ']" id="contact_point_1" value="on"';
122
+ if ( isset( $option['contact_point_1'] ) && $option['contact_point_1'] === 'on' ) {
123
+ $html .= ' checked="checked"';
124
+ }
125
+ $html .= '>HearingImpairedSupported</label><br>';
126
+ $html .= '<label><input type="checkbox" name="option[' . "contact_point_2" . ']" id="contact_point_2" value="on"';
127
+ if ( isset( $option['contact_point_2'] ) && $option['contact_point_2'] === 'on' ) {
128
+ $html .= ' checked="checked"';
129
+ }
130
+ $html .= '>TollFree</label><br>';
131
+ $html .= '</td></tr>';
132
+ $html .= '<tr><th><label for="available_language">available&nbsp;Language :</label></th><td>';
133
+ $html .= '<input type="text" name="option[' . "available_language" . ']" id="available_language" class="regular-text" value="' . esc_attr( $option['available_language'] ) . '">';
134
+ $html .= '<small>Default : "English"&nbsp;&nbsp;Multiple : "French,English"</small>';
135
+ $html .= '</td></tr>';
136
+ $html .= '</table>';
137
+ echo $html;
138
+
139
+ /** Social Profiles */
140
+ $html = '<table class="schema-admin-table">';
141
+ $html .= '<caption>Social Profiles</caption>';
142
+ foreach ( $this->social_array as $value ) {
143
+ $html .= '<tr><th><label for="' . $value['type'] . '">' . $value['display'] . ' :</label></th><td>';
144
+ $html .= '<input type="text" name="option[' . "social" . '][' . $value['type'] . ']" id="' . $value['type'] . '" class="regular-text" value="' . esc_attr( $option['social'][$value['type']] ) . '">';
145
+ $html .= '</td></tr>';
146
+ }
147
+ $html .= '</table>';
148
+ echo $html;
149
+
150
+ echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/guides/enhance-site" target="_blank">https://developers.google.com/search/docs/guides/enhance-site</a></p>';
151
+ submit_button();
152
+ }
153
+
154
+ /**
155
+ * Return the default options array
156
+ *
157
+ * @version 4.1.3
158
+ * @since 1.0.0
159
+ * @return array $args
160
+ */
161
+ private function get_default_options () {
162
+ $args['name'] = '';
163
+ $args['url'] = '';
164
+ $args['logo'] = '';
165
+ $args['contact_point'] = '';
166
+ $args['telephone'] = '';
167
+ $args['contact_type'] = 'customer_service';
168
+ $args['email'] = '';
169
+ $args['area_served'] = 'US';
170
+ $args['contact_option_1'] = '';
171
+ $args['contact_option_2'] = '';
172
+ $args['available_language'] = 'English';
173
+
174
+ foreach ( $this->social_array as $value ) {
175
+ $args['social'][$value['type']] = '';
176
+ }
177
+
178
+ return (array) $args;
179
+ }
180
+ }
trunk/includes/admin/wp-structuring-admin-type-person.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Person
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.1.3
7
+ * @since 2.4.0
8
+ * @see wp-structuring-admin-db.php
9
+ * @link https://schema.org/Person
10
+ * @link https://developers.google.com/search/docs/data-types/social-profile-links
11
+ */
12
+ class Structuring_Markup_Type_Person {
13
+
14
+ /**
15
+ * Variable definition.
16
+ *
17
+ * @version 2.4.0
18
+ * @since 2.4.0
19
+ */
20
+ /** Social Profile */
21
+ private $social_array = array(
22
+ array("type" => "facebook", "display" => "Facebook"),
23
+ array("type" => "twitter", "display" => "Twitter"),
24
+ array("type" => "google", "display" => "Google+"),
25
+ array("type" => "instagram", "display" => "Instagram"),
26
+ array("type" => "youtube", "display" => "Youtube"),
27
+ array("type" => "linkedin", "display" => "LinkedIn"),
28
+ array("type" => "myspace", "display" => "Myspace"),
29
+ array("type" => "pinterest", "display" => "Pinterest"),
30
+ array("type" => "soundcloud", "display" => "SoundCloud"),
31
+ array("type" => "tumblr", "display" => "Tumblr")
32
+ );
33
+
34
+ /**
35
+ * Constructor Define.
36
+ *
37
+ * @version 2.4.0
38
+ * @since 2.4.0
39
+ * @param array $option
40
+ */
41
+ public function __construct ( array $option ) {
42
+ /** Default Value Set */
43
+ $option_array = $this->get_default_options();
44
+
45
+ if ( !empty( $option ) ) {
46
+ $option_array = array_merge( $option_array, $option );
47
+ }
48
+
49
+ $this->page_render( $option_array );
50
+ }
51
+
52
+ /**
53
+ * Form Layout Render
54
+ *
55
+ * @version 4.1.3
56
+ * @since 2.4.0
57
+ * @param array $option
58
+ */
59
+ private function page_render ( array $option ) {
60
+ /** Basic Settings */
61
+ $html = '<table class="schema-admin-table">';
62
+ $html .= '<caption>Basic Settings</caption>';
63
+ $html .= '<tr><th class="require"><label for="name">Name :</label></th><td>';
64
+ $html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" required value="' . esc_attr( $option['name'] ) . '">';
65
+ $html .= '</td></tr>';
66
+ $html .= '<tr><th class="require"><label for="url">url :</label></th><td>';
67
+ $html .= '<input type="text" name="option[' . "url" . ']" id="url" class="regular-text" required value="' . esc_attr( $option['url'] ) . '">';
68
+ $html .= '</td></tr>';
69
+ $html .= '</table>';
70
+ echo $html;
71
+
72
+ /** Place Settings */
73
+ $html = '<table class="schema-admin-table">';
74
+ $html .= '<caption>Place Settings</caption>';
75
+ $html .= '<tr><th class="require"><label for="addressCountry">addressCountry :</label></th><td>';
76
+ $html .= '<input type="text" name="option[' . "addressCountry" . ']" id="addressCountry" class="regular-text" required value="' . esc_attr( $option['addressCountry'] ) . '" placeholder="e.g. Japan">';
77
+ $html .= '</td></tr>';
78
+ $html .= '</table>';
79
+ echo $html;
80
+
81
+ /** Social Profiles */
82
+ $html = '<table class="schema-admin-table">';
83
+ $html .= '<caption>Social Profiles</caption>';
84
+ foreach ( $this->social_array as $value ) {
85
+ $html .= '<tr><th><label for="' . $value['type'] . '">' . $value['display'] . ' :</label></th><td>';
86
+ $html .= '<input type="text" name="option[' . "social" . '][' . $value['type'] . ']" id="' . $value['type'] . '" class="regular-text" value="' . esc_attr( $option['social'][$value['type']] ) . '">';
87
+ $html .= '</td></tr>';
88
+ }
89
+ $html .= '</table>';
90
+ echo $html;
91
+
92
+ echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/data-types/social-profile-links" target="_blank">https://developers.google.com/search/docs/data-types/social-profile-links</a></p>';
93
+ submit_button();
94
+ }
95
+
96
+ /**
97
+ * Return the default options array
98
+ *
99
+ * @since 4.1.3
100
+ * @version 2.4.0
101
+ * @return array $args
102
+ */
103
+ private function get_default_options () {
104
+ $args['name'] = '';
105
+ $args['url'] = '';
106
+ $args['addressCountry'] = '';
107
+
108
+ foreach ( $this->social_array as $value ) {
109
+ $args['social'][$value['type']] = '';
110
+ }
111
+
112
+ return (array) $args;
113
+ }
114
+ }
trunk/includes/admin/wp-structuring-admin-type-site-navigation.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Site Navigation Element
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.1.0
7
+ * @since 3.1.0
8
+ * @see wp-structuring-admin-db.php
9
+ * @link https://schema.org/SiteNavigationElement
10
+ */
11
+ class Structuring_Markup_Type_Site_Navigation {
12
+
13
+ /**
14
+ * Constructor Define.
15
+ *
16
+ * @version 3.1.0
17
+ * @since 3.1.0
18
+ * @param array $option
19
+ */
20
+ public function __construct ( array $option ) {
21
+ /** Default Value Set */
22
+ if ( empty( $option ) ) {
23
+ $option = $this->get_default_options( $option );
24
+ }
25
+ $this->page_render( $option );
26
+ }
27
+
28
+ /**
29
+ * Form Layout Render
30
+ *
31
+ * @version 3.1.0
32
+ * @since 3.1.0
33
+ * @param array $option
34
+ */
35
+ private function page_render ( array $option ) {
36
+ $html = '<table class="schema-admin-table">';
37
+ $html .= '<caption>Basic Setting</caption>';
38
+ $html .= '<tr><th class="require"><label for="menu_name">Menu Name :</label></th><td>';
39
+
40
+ $nav_menus = wp_get_nav_menus();
41
+
42
+ if ( count( $nav_menus ) > 0 ) {
43
+ $html .= '<select name="option[' . "menu_name" . ']" id="menu_name">';
44
+
45
+ foreach ( (array) $nav_menus as $menu ) {
46
+ if ( $option['menu_name'] === $menu->name ) {
47
+ $html .= '<option value="' . esc_attr( $menu->name ) . '" selected>';
48
+ } else {
49
+ $html .= '<option value="' . esc_attr( $menu->name ) . '">';
50
+ }
51
+ $html .= esc_html( $menu->name );
52
+ $html .= '</option>';
53
+ }
54
+
55
+ $html .= '</select>';
56
+ }
57
+
58
+ $html .= '</td></tr>';
59
+ $html .= '</table>';
60
+ echo $html;
61
+
62
+ echo '<p>Setting Knowledge : <a href="https://schema.org/SiteNavigationElement" target="_blank">https://schema.org/SiteNavigationElement</a></p>';
63
+ submit_button();
64
+ }
65
+
66
+ /**
67
+ * Return the default options array
68
+ *
69
+ * @version 3.1.0
70
+ * @since 3.1.0
71
+ * @param array $args
72
+ * @return array $args
73
+ */
74
+ private function get_default_options ( array $args ) {
75
+ $args['menu_name'] = '';
76
+
77
+ return (array) $args;
78
+ }
79
+ }
trunk/includes/admin/wp-structuring-admin-type-video.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Video
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.0.5
7
+ * @since 3.0.0
8
+ * @see wp-structuring-admin-db.php
9
+ * @link https://schema.org/VideoObject
10
+ * @link https://developers.google.com/search/docs/data-types/videos
11
+ */
12
+ class Structuring_Markup_Type_Videos {
13
+
14
+ /**
15
+ * Constructor Define.
16
+ *
17
+ * @since 3.0.0
18
+ */
19
+ public function __construct () {
20
+ $this->page_render();
21
+ }
22
+
23
+ /**
24
+ * Form Layout Render
25
+ *
26
+ * @version 3.0.5
27
+ * @since 3.0.0
28
+ */
29
+ private function page_render () {
30
+ $html = '<table class="schema-admin-table">';
31
+ $html .= '<caption>Basic Setting</caption>';
32
+ $html .= '<tr><th class="require">name :</th><td><small>Post Title</small></td></tr>';
33
+ $html .= '<tr><th class="require">Description :</th><td><small>Post Description</small></td></tr>';
34
+ $html .= '<tr><th class="require">thumbnailUrl :</th><td><small>Featured Image URL</small></td></tr>';
35
+ $html .= '<tr><th class="require">uploadDate :</th><td><small>Update Date</small></td></tr>';
36
+ $html .= '<tr><th>duration :</th><td><small>Input a custom post: field name "schema_video_duration"</small></td></tr>';
37
+ $html .= '<tr><th>contentUrl :</th><td><small>Input a custom post: field name "schema_video_content_url"</small></td></tr>';
38
+ $html .= '<tr><th>embedUrl :</th><td><small>Input a custom post: field name "schema_video_embed_url"</small></td></tr>';
39
+ $html .= '<tr><th>interactionCount :</th><td><small>Input a custom post: field name "schema_video_interaction_count"</small></td></tr>';
40
+ $html .= '<tr><th>expires :</th><td><small>Input a custom post: field name "schema_video_expires_date" & "schema_video_expires_time"</small></td></tr>';
41
+ $html .= '</table>';
42
+ echo $html;
43
+
44
+ echo '<p>Custom post name "schema_video_post"</p>';
45
+ echo '<p>Archive rewrite name "videos"</p>';
46
+ echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/data-types/videos" target="_blank">https://developers.google.com/search/docs/data-types/videos</a></p>';
47
+
48
+ submit_button();
49
+ }
50
+ }
trunk/includes/admin/wp-structuring-admin-type-website.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type WebSite
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.1.3
7
+ * @since 1.0.0
8
+ * @see wp-structuring-admin-db.php
9
+ * @link https://schema.org/WebSite
10
+ * @link https://developers.google.com/search/docs/guides/enhance-site#add-a-sitelinks-searchbox-for-your-site
11
+ * @link https://developers.google.com/search/docs/data-types/sitename
12
+ */
13
+ class Structuring_Markup_Type_Website {
14
+
15
+ /**
16
+ * Constructor Define.
17
+ *
18
+ * @version 3.1.0
19
+ * @since 1.0.0
20
+ * @param array $option
21
+ */
22
+ public function __construct ( array $option ) {
23
+ /** Default Value Set */
24
+ $option_array = $this->get_default_options();
25
+
26
+ if ( !empty( $option ) ) {
27
+ $option_array = array_merge( $option_array, $option );
28
+ }
29
+
30
+ $this->page_render( $option_array );
31
+ }
32
+
33
+ /**
34
+ * Form Layout Render
35
+ *
36
+ * @version 4.1.3
37
+ * @since 2.3.3
38
+ * @param array $option
39
+ */
40
+ private function page_render ( array $option ) {
41
+ $html = '<table class="schema-admin-table">';
42
+ $html .= '<caption>Basic Setting</caption>';
43
+ $html .= '<tr><th class="require"><label for="name">name :</label></th><td>';
44
+ $html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" required value="' . esc_attr( $option['name'] ) . '">';
45
+ $html .= '</td></tr>';
46
+ $html .= '<tr><th><label for="alternateName">alternateName :</label></th><td>';
47
+ $html .= '<input type="text" name="option[' . "alternateName" . ']" id="alternateName" class="regular-text" value="' . esc_attr( $option['alternateName'] ) . '">';
48
+ $html .= '</td></tr>';
49
+ $html .= '<tr><th class="require"><label for="url">url :</label></th><td>';
50
+ $html .= '<input type="text" name="option[' . "url" . ']" id="url" class="regular-text" required value="' . esc_attr( $option['url'] ) . '">';
51
+ $html .= '</td></tr>';
52
+ $html .= '</table>';
53
+ echo $html;
54
+
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'] ) . '">';
66
+ $html .= '</td></tr>';
67
+ $html .= '</table>';
68
+ echo $html;
69
+
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'] ) . '">';
81
+ $html .= '</td></tr>';
82
+ $html .= '</table>';
83
+ echo $html;
84
+
85
+ echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/data-types/sitename" target="_blank">https://developers.google.com/search/docs/data-types/sitename</a></p>';
86
+ submit_button();
87
+ }
88
+
89
+ /**
90
+ * Return the default options array
91
+ *
92
+ * @version 4.1.3
93
+ * @since 1.0.0
94
+ * @return array $args
95
+ */
96
+ private function get_default_options () {
97
+ $args = array();
98
+
99
+ $args['name'] = '';
100
+ $args['alternateName'] = '';
101
+ $args['url'] = '';
102
+ $args['potential_action'] = '';
103
+ $args['target'] = '';
104
+ $args['potential_action_app'] = '';
105
+ $args['target_app'] = '';
106
+
107
+ return (array) $args;
108
+ }
109
+ }
trunk/includes/custom/wp-structuring-custom-post-event.php ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Custom Post "Event"
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.1.1
7
+ * @since 2.1.0
8
+ * @link https://schema.org/Event
9
+ * @link https://developers.google.com/search/docs/data-types/events
10
+ */
11
+ class Structuring_Markup_Custom_Post_Event {
12
+
13
+ /**
14
+ * Variable definition.
15
+ *
16
+ * @version 2.1.0
17
+ * @since 2.1.0
18
+ */
19
+ private $text_domain;
20
+ private $custom_type = 'schema_event_post';
21
+
22
+ /**
23
+ * Event Type.
24
+ *
25
+ * @version 3.1.3
26
+ * @since 3.1.3
27
+ */
28
+ private $event_type = array(
29
+ "Event",
30
+ "BusinessEvent",
31
+ "ChildrensEvent",
32
+ "ComedyEvent",
33
+ "DanceEvent",
34
+ "DeliveryEvent",
35
+ "EducationEvent",
36
+ "ExhibitionEvent",
37
+ "Festival",
38
+ "FoodEvent",
39
+ "LiteraryEvent",
40
+ "MusicEvent",
41
+ "PublicationEvent",
42
+ "SaleEvent",
43
+ "ScreeningEvent",
44
+ "SocialEvent",
45
+ "SportsEvent",
46
+ "TheaterEvent",
47
+ "VisualArtsEvent"
48
+ );
49
+
50
+ /**
51
+ * Event Type.
52
+ *
53
+ * @version 4.0.2
54
+ * @since 4.0.2
55
+ */
56
+ private $offers_availability = array(
57
+ "InStock",
58
+ "SoldOut",
59
+ "PreOrder"
60
+ );
61
+
62
+ /**
63
+ * Constructor Define.
64
+ *
65
+ * @version 3.1.6
66
+ * @since 2.1.0
67
+ * @param String $text_domain
68
+ */
69
+ public function __construct ( $text_domain ) {
70
+ $this->text_domain = $text_domain;
71
+
72
+ /** Custom post menu controls */
73
+ $show_flag = __return_false();
74
+ if ( isset( $_POST['type'] ) && $_POST['type'] === 'event' ) {
75
+ if ( isset( $_POST['activate'] ) && $_POST['activate'] === 'on' ) {
76
+ $show_flag = __return_true();
77
+ }
78
+ } else {
79
+ /** DB Connect */
80
+ $db = new Structuring_Markup_Admin_Db();
81
+ $results = $db->get_type_options('event');
82
+
83
+ if ( isset( $results['activate'] ) && $results['activate'] == 'on' ) {
84
+ $show_flag = __return_true();
85
+ }
86
+ }
87
+
88
+ register_post_type(
89
+ $this->custom_type,
90
+ array(
91
+ 'labels' => array(
92
+ 'name' => esc_html__( 'Event Posts', $this->text_domain ),
93
+ 'singular_name' => esc_html__( 'Event Posts', $this->text_domain ),
94
+ 'all_items' => esc_html__( 'All Event Posts', $this->text_domain )
95
+ ),
96
+ 'capability_type' => 'post',
97
+ 'has_archive' => true,
98
+ 'hierarchical' => false,
99
+ 'menu_position' => 5,
100
+ 'public' => $show_flag,
101
+ 'query_var' => false,
102
+ 'rewrite' => array( 'with_front' => true, 'slug' => 'events' ),
103
+ 'show_in_menu' => $show_flag,
104
+ 'show_ui' => $show_flag,
105
+ 'supports' => array( 'title', 'editor', 'author', 'thumbnail' )
106
+ )
107
+ );
108
+
109
+ if ( is_admin() ) {
110
+ add_action( 'admin_init', array( $this, 'admin_init' ) );
111
+ add_action( 'admin_menu', array( $this, 'admin_menu' ) );
112
+ }
113
+ }
114
+
115
+ /**
116
+ * admin init.
117
+ *
118
+ * @version 2.1.0
119
+ * @since 2.1.0
120
+ */
121
+ public function admin_init () {
122
+ add_action( 'save_post_' . $this->custom_type, array( $this, 'save_post' ) );
123
+ }
124
+
125
+ /**
126
+ * admin meta boxes.
127
+ *
128
+ * @version 2.1.0
129
+ * @since 2.1.0
130
+ */
131
+ public function admin_menu () {
132
+ $custom_field_title = esc_html__( 'Schema.org Type Event', $this->text_domain );
133
+ add_meta_box( $this->custom_type, $custom_field_title, array( $this, 'set_custom_fields' ), $this->custom_type, 'normal' );
134
+ }
135
+
136
+ /**
137
+ * Set custom fields.
138
+ *
139
+ * @version 4.1.1
140
+ * @since 2.1.0
141
+ */
142
+ public function set_custom_fields () {
143
+ $custom_array = get_post_meta( get_the_ID(), $this->custom_type, false );
144
+ $custom_array = isset( $custom_array[0] ) ? unserialize( $custom_array[0] ) : array();
145
+
146
+ /** Default Value Set */
147
+ $args = $this->get_default_options();
148
+
149
+ if ( !empty( $args ) ) {
150
+ $args = array_merge( $args, $custom_array );
151
+ }
152
+
153
+ $html = '';
154
+ $html .= '<table class="schema-admin-custom-post">';
155
+ $html .= '<tr><td><label class="schema-admin-required" for="schema_event_type">';
156
+ $html .= esc_html__( 'Event Type', $this->text_domain );
157
+ $html .= '</label></td><td>';
158
+ $html .= '<select name="option[' . "schema_event_type" . ']" id="schema_event_type">';
159
+ foreach( $this->event_type as $value) {
160
+ $html .= '<option';
161
+ if ( $value === $args['schema_event_type'] ) {
162
+ $html .= ' selected="selected"';
163
+ }
164
+ $html .= ' value="' . $value . '">' . $value . '</option>';
165
+ }
166
+ $html .= '</select>';
167
+ $html .= '</td></tr>';
168
+ $html .= '<tr><td><label class="schema-admin-required" for="schema_event_name">';
169
+ $html .= esc_html__( 'Event Name', $this->text_domain );
170
+ $html .= '</label></td><td>';
171
+ $html .= '<input type="text" name="option[' . "schema_event_name" . ']" id="schema_event_name" class="regular-text" required value="' . esc_attr( $args['schema_event_name'] ) . '">';
172
+ $html .= '</td></tr>';
173
+ $html .= '<tr><td><label class="schema-admin-recommended" for="schema_event_description">';
174
+ $html .= esc_html__( 'Event Description', $this->text_domain );
175
+ $html .= '</label></td><td>';
176
+ $html .= '<textarea name="option[' . "schema_event_description" . ']" id="schema_event_description" class="large-text code" rows="3">' . esc_attr( $args['schema_event_description'] ) . '</textarea>';
177
+ $html .= '</td></tr>';
178
+ $html .= '<tr><td><label class="schema-admin-recommended" for="schema_event_image">';
179
+ $html .= esc_html__( 'Event Image', $this->text_domain );
180
+ $html .= '</label></td><td>';
181
+ $html .= '<input type="text" name="option[' . "schema_event_image" . ']" id="schema_event_image" class="large-text" value="' . esc_attr( $args['schema_event_image'] ) . '">';
182
+ $html .= '</td></tr>';
183
+ $html .= '<tr><td><label class="schema-admin-required" for="schema_event_date">';
184
+ $html .= esc_html__( 'Start Date', $this->text_domain );
185
+ $html .= '</label></td><td>';
186
+ $html .= '<input type="date" name="option[' . "schema_event_date" . ']" id="schema_event_date" required value="' . esc_attr( $args['schema_event_date'] ) . '">';
187
+ $html .= '<input type="time" name="option[' . "schema_event_time" . ']" id="schema_event_time" required value="' . esc_attr( $args['schema_event_time'] ) . '">';
188
+ $html .= '</td></tr>';
189
+ $html .= '<tr><td><label class="schema-admin-recommended" for="schema_event_date_end">';
190
+ $html .= esc_html__( 'End Date', $this->text_domain );
191
+ $html .= '</label></td><td>';
192
+ $html .= '<input type="date" name="option[' . "schema_event_date_end" . ']" id="schema_event_date" value="' . esc_attr( $args['schema_event_date_end'] ) . '">';
193
+ $html .= '<input type="time" name="option[' . "schema_event_time_end" . ']" id="schema_event_time" value="' . esc_attr( $args['schema_event_time_end'] ) . '">';
194
+ $html .= '</td></tr>';
195
+ $html .= '<tr><td><label class="schema-admin-required" for="schema_event_url">';
196
+ $html .= esc_html__( 'Event URL', $this->text_domain );
197
+ $html .= '</label></td><td>';
198
+ $html .= '<input type="text" name="option[' . "schema_event_url" . ']" id="schema_event_url" class="regular-text" required value="' . esc_attr( $args['schema_event_url'] ) . '">';
199
+ $html .= '</td></tr>';
200
+ $html .= '<tr><td><label class="schema-admin-required" for="schema_event_place_name">';
201
+ $html .= esc_html__( 'Place Name', $this->text_domain );
202
+ $html .= '</label></td><td>';
203
+ $html .= '<input type="text" name="option[' . "schema_event_place_name" . ']" id="schema_event_place_name" class="regular-text" required value="' . esc_attr( $args['schema_event_place_name'] ) . '">';
204
+ $html .= '</td></tr>';
205
+ $html .= '<tr><td><label class="schema-admin-required" for="schema_event_place_url">';
206
+ $html .= esc_html__( 'Place URL', $this->text_domain );
207
+ $html .= '</label></td><td>';
208
+ $html .= '<input type="text" name="option[' . "schema_event_place_url" . ']" id="schema_event_place_url" class="regular-text" required value="' . esc_attr( $args['schema_event_place_url'] ) . '">';
209
+ $html .= '</td></tr>';
210
+ $html .= '<tr><td><label class="schema-admin-required" for="schema_event_place_address">';
211
+ $html .= esc_html__( 'Place Address', $this->text_domain );
212
+ $html .= '</label></td><td>';
213
+ $html .= '<input type="text" name="option[' . "schema_event_place_address" . ']" id="schema_event_place_address" class="regular-text" required value="' . esc_attr( $args['schema_event_place_address'] ) . '">';
214
+ $html .= '</td></tr>';
215
+ $html .= '<tr><td><label class="schema-admin-required" for="schema_event_type">';
216
+ $html .= esc_html__( 'Availability', $this->text_domain );
217
+ $html .= '</label></td><td>';
218
+ $html .= '<select name="option[' . "schema_event_offers_availability" . ']" id="schema_event_offers_availability">';
219
+ foreach( $this->offers_availability as $value) {
220
+ $html .= '<option';
221
+ if ( $value === $args['schema_event_offers_availability'] ) {
222
+ $html .= ' selected="selected"';
223
+ }
224
+ $html .= ' value="' . $value . '">' . $value . '</option>';
225
+ }
226
+ $html .= '</select>';
227
+ $html .= '</td></tr>';
228
+ $html .= '<tr><td><label class="schema-admin-required" for="schema_event_offers_price">';
229
+ $html .= esc_html__( 'Price', $this->text_domain );
230
+ $html .= '</label></td><td>';
231
+ $html .= '<input type="number" name="option[' . "schema_event_offers_price" . ']" id="schema_event_offers_price" required value="' . esc_attr( $args['schema_event_offers_price'] ) . '">';
232
+ $html .= '</td></tr>';
233
+ $html .= '<tr><td><label class="schema-admin-required" for="schema_event_offers_currency">';
234
+ $html .= esc_html__( 'Currency', $this->text_domain );
235
+ $html .= '</label></td><td>';
236
+ $html .= '<input type="text" name="option[' . "schema_event_offers_currency" . ']" id="schema_event_offers_currency" maxlength="3" required value="' . esc_attr( $args['schema_event_offers_currency'] ) . '">';
237
+ $html .= '&nbsp;&nbsp;<small>( with <a hre="https://en.wikipedia.org/wiki/ISO_4217#Active_codes" target="_blank">ISO 4217 codes</a> e.g. "USD" )</small>';
238
+ $html .= '</td></tr>';
239
+ $html .= '<tr><td><label class="schema-admin-recommended" for="schema_event_offers_date">';
240
+ $html .= esc_html__( 'validFrom', $this->text_domain );
241
+ $html .= '</label></td><td>';
242
+ $html .= '<input type="date" name="option[' . "schema_event_offers_date" . ']" id="schema_event_offers_date" value="' . esc_attr( $args['schema_event_offers_date'] ) . '">';
243
+ $html .= '<input type="time" name="option[' . "schema_event_offers_time" . ']" id="schema_event_offers_time" value="' . esc_attr( $args['schema_event_offers_time'] ) . '">';
244
+ $html .= '</td></tr>';
245
+ $html .= '<tr><td><label class="schema-admin-recommended" for="schema_event_performer_name">';
246
+ $html .= esc_html__( 'Event Performer', $this->text_domain );
247
+ $html .= '</label></td><td>';
248
+ $html .= '<input type="text" name="option[' . "schema_event_performer_name" . ']" id="schema_event_performer_name" class="regular-text" required value="' . esc_attr( $args['schema_event_performer_name'] ) . '">';
249
+ $html .= '</td></tr>';
250
+ $html .= '</table>';
251
+
252
+ echo $html;
253
+ }
254
+
255
+ /**
256
+ * Save custom post.
257
+ *
258
+ * @version 2.1.0
259
+ * @since 2.1.0
260
+ * @param integer $post_id The post ID.
261
+ */
262
+ public function save_post ( $post_id ) {
263
+ if ( isset( $_POST['option'] ) ) {
264
+ update_post_meta( $post_id, $this->custom_type, serialize( $_POST['option'] ) );
265
+ }
266
+ }
267
+
268
+ /**
269
+ * Return the default options array
270
+ *
271
+ * @version 4.0.2
272
+ * @since 3.2.3
273
+ * @return array $args
274
+ */
275
+ private function get_default_options () {
276
+ $args = array(
277
+ 'schema_event_type' => 'Event',
278
+ 'schema_event_name' => '',
279
+ 'schema_event_description' => '',
280
+ 'schema_event_image' => '',
281
+ 'schema_event_date' => date( 'Y-m-d' ),
282
+ 'schema_event_time' => date( 'h:i' ),
283
+ 'schema_event_date_end' => '',
284
+ 'schema_event_time_end' => '',
285
+ 'schema_event_url' => '',
286
+ 'schema_event_place_name' => '',
287
+ 'schema_event_place_url' => '',
288
+ 'schema_event_place_address' => '',
289
+ 'schema_event_offers_availability' => 'InStock',
290
+ 'schema_event_offers_price' => 0,
291
+ 'schema_event_offers_currency' => esc_html__( 'USD', $this->text_domain ),
292
+ 'schema_event_offers_date' => '',
293
+ 'schema_event_offers_time' => '',
294
+ 'schema_event_performer_name' => ''
295
+ );
296
+
297
+ return (array) $args;
298
+ }
299
+ }
trunk/includes/custom/wp-structuring-custom-post-video.php ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Custom Post "Video"
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.1.1
7
+ * @since 3.0.0
8
+ * @link https://schema.org/VideoObject
9
+ * @link https://developers.google.com/search/docs/data-types/videos
10
+ */
11
+ class Structuring_Markup_Custom_Post_Video {
12
+
13
+ /**
14
+ * Variable definition.
15
+ *
16
+ * @version 3.0.0
17
+ * @since 3.0.0
18
+ */
19
+ private $text_domain;
20
+ private $custom_type = 'schema_video_post';
21
+
22
+ /**
23
+ * Constructor Define.
24
+ *
25
+ * @version 3.1.6
26
+ * @since 3.0.0
27
+ * @param String $text_domain
28
+ */
29
+ public function __construct ( $text_domain ) {
30
+ $this->text_domain = $text_domain;
31
+
32
+ /** Custom post menu controls */
33
+ $show_flag = __return_false();
34
+ if ( isset( $_POST['type'] ) && $_POST['type'] === 'video' ) {
35
+ if ( isset( $_POST['activate'] ) && $_POST['activate'] === 'on' ) {
36
+ $show_flag = __return_true();
37
+ }
38
+ } else {
39
+ /** DB Connect */
40
+ $db = new Structuring_Markup_Admin_Db();
41
+ $results = $db->get_type_options('video');
42
+
43
+ if ( isset( $results['activate'] ) && $results['activate'] == 'on' ) {
44
+ $show_flag = __return_true();
45
+ }
46
+ }
47
+
48
+ register_post_type(
49
+ $this->custom_type,
50
+ array(
51
+ 'labels' => array(
52
+ 'name' => esc_html__( 'Video Posts', $this->text_domain ),
53
+ 'singular_name' => esc_html__( 'Video Posts', $this->text_domain ),
54
+ 'all_items' => esc_html__( 'All Video Posts', $this->text_domain )
55
+ ),
56
+ 'capability_type' => 'post',
57
+ 'has_archive' => true,
58
+ 'hierarchical' => false,
59
+ 'menu_position' => 5,
60
+ 'public' => $show_flag,
61
+ 'query_var' => false,
62
+ 'rewrite' => array( 'with_front' => true, 'slug' => 'videos' ),
63
+ 'show_in_menu' => $show_flag,
64
+ 'show_ui' => $show_flag,
65
+ 'supports' => array( 'title', 'editor', 'author', 'thumbnail' )
66
+ )
67
+ );
68
+
69
+ if ( is_admin() ) {
70
+ add_action( 'admin_init', array( $this, 'admin_init' ) );
71
+ add_action( 'admin_menu', array( $this, 'admin_menu' ) );
72
+ }
73
+ }
74
+
75
+ /**
76
+ * admin init.
77
+ *
78
+ * @version 3.0.0
79
+ * @since 3.0.0
80
+ */
81
+ public function admin_init () {
82
+ add_action( 'save_post_' . $this->custom_type, array( $this, 'save_post' ) );
83
+ }
84
+
85
+ /**
86
+ * admin meta boxes.
87
+ *
88
+ * @version 3.0.0
89
+ * @since 3.0.0
90
+ */
91
+ public function admin_menu () {
92
+ $custom_field_title = esc_html__( 'Schema.org Type Video', $this->text_domain );
93
+ add_meta_box( $this->custom_type, $custom_field_title, array( $this, 'set_custom_fields' ), $this->custom_type, 'normal' );
94
+ }
95
+
96
+ /**
97
+ * Set custom fields.
98
+ *
99
+ * @version 4.1.1
100
+ * @since 3.0.0
101
+ */
102
+ public function set_custom_fields () {
103
+ $custom_array = get_post_meta( get_the_ID(), $this->custom_type, false );
104
+ $custom_array = isset( $custom_array[0] ) ? unserialize( $custom_array[0] ) : array();
105
+
106
+ /** Default Value Set */
107
+ $args = $this->get_default_options();
108
+
109
+ if ( !empty( $args ) ) {
110
+ $args = array_merge( $args, $custom_array );
111
+ }
112
+
113
+ $html = '';
114
+ $html .= '<table class="schema-admin-custom-post">';
115
+ $html .= '<tr><td><label class="schema-admin-required" for="schema_video_name">';
116
+ $html .= esc_html__( 'Video Name', $this->text_domain );
117
+ $html .= '</label></td><td>';
118
+ $html .= '<input type="text" name="option[' . "schema_video_name" . ']" id="schema_video_name" class="regular-text" required value="' . esc_attr( $args['schema_video_name'] ) . '">';
119
+ $html .= '</td></tr>';
120
+ $html .= '<tr><td><label class="schema-admin-required" for="schema_video_description">';
121
+ $html .= esc_html__( 'Video Description', $this->text_domain );
122
+ $html .= '</label></td><td>';
123
+ $html .= '<textarea name="option[' . "schema_video_description" . ']" id="schema_video_description" class="large-text code" required rows="3">' . esc_attr( $args['schema_video_description'] ) . '</textarea>';
124
+ $html .= '</td></tr>';
125
+ $html .= '<tr><td><label class="schema-admin-required" for="schema_video_thumbnail_url">';
126
+ $html .= esc_html__( 'Thumbnail Url', $this->text_domain );
127
+ $html .= '</label></td><td>';
128
+ $html .= '<input type="text" name="option[' . "schema_video_thumbnail_url" . ']" id="schema_video_thumbnail_url" class="regular-text" required value="' . esc_attr( $args['schema_video_thumbnail_url'] ) . '">';
129
+ $html .= '</td></tr>';
130
+ $html .= '<tr><td><label class="schema-admin-required" for="schema_video_upload_date">';
131
+ $html .= esc_html__( 'Upload Date', $this->text_domain );
132
+ $html .= '</label></td><td>';
133
+ $html .= '<input type="date" name="option[' . "schema_video_upload_date" . ']" id="schema_video_upload_date" required value="' . esc_attr( $args['schema_video_upload_date'] ) . '">';
134
+ $html .= '<input type="time" name="option[' . "schema_video_upload_time" . ']" id="schema_video_upload_time" required value="' . esc_attr( $args['schema_video_upload_time'] ) . '">';
135
+ $html .= '</td></tr>';
136
+ $html .= '<tr><td><label class="schema-admin-recommended" for="schema_video_duration">';
137
+ $html .= esc_html__( 'duration', $this->text_domain );
138
+ $html .= '</label></td><td>';
139
+ $html .= '<input type="text" name="option[' . "schema_video_duration" . ']" id="schema_video_duration" class="regular-text" value="' . esc_attr( $args['schema_video_duration'] ) . '">';
140
+ $html .= '</td></tr>';
141
+ $html .= '<tr><td><label class="schema-admin-recommended" for="schema_video_content_url">';
142
+ $html .= esc_html__( 'contentURL', $this->text_domain );
143
+ $html .= '</label></td><td>';
144
+ $html .= '<input type="text" name="option[' . "schema_video_content_url" . ']" id="schema_video_content_url" class="regular-text" value="' . esc_attr( $args['schema_video_content_url'] ) . '">';
145
+ $html .= '</td></tr>';
146
+ $html .= '<tr><td><label class="schema-admin-recommended" for="schema_video_embed_url">';
147
+ $html .= esc_html__( 'embedURL', $this->text_domain );
148
+ $html .= '</label></td><td>';
149
+ $html .= '<input type="text" name="option[' . "schema_video_embed_url" . ']" id="schema_video_embed_url" class="regular-text" value="' . esc_attr( $args['schema_video_embed_url'] ) . '">';
150
+ $html .= '</td></tr>';
151
+ $html .= '<tr><td><label class="schema-admin-recommended" for="schema_video_interaction_count">';
152
+ $html .= esc_html__( 'interactionCount', $this->text_domain );
153
+ $html .= '</label></td><td>';
154
+ $html .= '<input type="text" name="option[' . "schema_video_interaction_count" . ']" id="schema_video_interaction_count" class="regular-text" value="' . esc_attr( $args['schema_video_interaction_count'] ) . '">';
155
+ $html .= '</td></tr>';
156
+ $html .= '<tr><td><label class="schema-admin-recommended" for="schema_video_expires_date">';
157
+ $html .= esc_html__( 'expires', $this->text_domain );
158
+ $html .= '</label></td><td>';
159
+ $html .= '<input type="date" name="option[' . "schema_video_expires_date" . ']" id="schema_video_expires_date" value="' . esc_attr( $args['schema_video_expires_date'] ) . '">';
160
+ $html .= '<input type="time" name="option[' . "schema_video_expires_time" . ']" id="schema_video_expires_time" value="' . esc_attr( $args['schema_video_expires_time'] ) . '">';
161
+ $html .= '</td></tr>';
162
+ $html .= '</table>';
163
+
164
+ echo $html;
165
+ }
166
+
167
+ /**
168
+ * Save custom post.
169
+ *
170
+ * @version 3.0.0
171
+ * @since 3.0.0
172
+ * @param integer $post_id The post ID.
173
+ */
174
+ public function save_post ( $post_id ) {
175
+ if ( isset( $_POST['option'] ) ) {
176
+ update_post_meta( $post_id, $this->custom_type, serialize( $_POST['option'] ) );
177
+ }
178
+ }
179
+
180
+ /**
181
+ * Return the default options array
182
+ *
183
+ * @version 3.2.3
184
+ * @since 3.2.3
185
+ * @return array $args
186
+ */
187
+ private function get_default_options () {
188
+ $args = array(
189
+ 'schema_video_name' => '',
190
+ 'schema_video_description' => '',
191
+ 'schema_video_thumbnail_url' => '',
192
+ 'schema_video_upload_date' => '',
193
+ 'schema_video_upload_time' => '',
194
+ 'schema_video_duration' => '',
195
+ 'schema_video_content_url' => '',
196
+ 'schema_video_embed_url' => '',
197
+ 'schema_video_interaction_count' => '',
198
+ 'schema_video_expires_date' => '',
199
+ 'schema_video_expires_time' => '',
200
+ );
201
+
202
+ return (array) $args;
203
+ }
204
+ }
trunk/includes/meta/wp-structuring-meta-article.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Article
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.1.0
7
+ * @since 4.0.0
8
+ * @link http://schema.org/Article
9
+ * @link https://developers.google.com/search/docs/data-types/articles
10
+ */
11
+ class Structuring_Markup_Meta_Article {
12
+
13
+ /**
14
+ * Utility
15
+ *
16
+ * @version 4.0.0
17
+ * @since 4.0.0
18
+ */
19
+ private $utility;
20
+
21
+ /**
22
+ * Constructor Define.
23
+ *
24
+ * @version 4.0.0
25
+ * @since 4.0.0
26
+ * @param Structuring_Markup_Utility $utility
27
+ */
28
+ public function __construct ( Structuring_Markup_Utility $utility ) {
29
+ $this->utility = $utility;
30
+ }
31
+
32
+ /**
33
+ * Setting schema.org Article
34
+ *
35
+ * @version 4.1.0
36
+ * @since 4.0.0
37
+ * @param array $options
38
+ * @return array $args
39
+ */
40
+ public function set_meta ( array $options ) {
41
+ global $post;
42
+
43
+ $excerpt = $this->utility->escape_text( $post->post_excerpt );
44
+ $content = $excerpt === "" ? mb_substr( $this->utility->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
45
+
46
+ $args = array(
47
+ "@context" => "http://schema.org",
48
+ "@type" => "Article",
49
+ "mainEntityOfPage" => array(
50
+ "@type" => "WebPage",
51
+ "@id" => get_permalink( $post->ID )
52
+ ),
53
+ "headline" => mb_substr( esc_html( $post->post_title ), 0, 110 ),
54
+ "datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
55
+ "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
56
+ "author" => array(
57
+ "@type" => "Person",
58
+ "name" => esc_html( get_the_author_meta( 'display_name', $post->post_author ) )
59
+ ),
60
+ "description" => $content
61
+ );
62
+
63
+ if ( has_post_thumbnail( $post->ID ) ) {
64
+ $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
65
+ $images_args = array(
66
+ "image" => array(
67
+ "@type" => "ImageObject",
68
+ "url" => $images[0],
69
+ "width" => $images[1],
70
+ "height" => $images[2]
71
+ )
72
+ );
73
+ $args = array_merge( $args, $images_args );
74
+ } elseif ( isset( $options['content_image'] ) && $options['content_image'] === 'on' ) {
75
+ if ( $images = $this->utility->get_content_image( $post->post_content ) ) {
76
+ if ( $size = $this->utility->get_image_dimensions( $images ) ) {
77
+ $images_args = array(
78
+ "image" => array(
79
+ "@type" => "ImageObject",
80
+ "url" => $images,
81
+ "width" => $size['width'],
82
+ "height" => $size['height']
83
+ )
84
+ );
85
+ $args = array_merge( $args, $images_args );
86
+ }
87
+ }
88
+ }
89
+
90
+ if ( isset( $options['name'] ) ) {
91
+ $publisher_args = array(
92
+ "publisher" => array(
93
+ "@type" => "Organization",
94
+ "name" => esc_html( $options['name'] ),
95
+ )
96
+ );
97
+
98
+ $options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
99
+
100
+ if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
101
+ $publisher_args['publisher']['logo'] = array(
102
+ "@type" => "ImageObject",
103
+ "url" => $options['logo'],
104
+ "width" => $logo['width'],
105
+ "height" => $logo['height']
106
+ );
107
+ } else if ( !empty( $options['logo'] ) ) {
108
+ $publisher_args['publisher']['logo'] = array(
109
+ "@type" => "ImageObject",
110
+ "url" => $options['logo'],
111
+ "width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
112
+ "height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
113
+ );
114
+ }
115
+ $args = array_merge( $args, $publisher_args );
116
+ }
117
+
118
+ return (array) $args;
119
+ }
120
+ }
trunk/includes/meta/wp-structuring-meta-blog-posting.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type BlogPosting
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.1.0
7
+ * @since 4.0.0
8
+ * @link http://schema.org/BlogPosting
9
+ * @link https://developers.google.com/search/docs/data-types/articles
10
+ */
11
+ class Structuring_Markup_Meta_Blog_Posting {
12
+
13
+ /**
14
+ * Utility
15
+ *
16
+ * @version 4.0.0
17
+ * @since 4.0.0
18
+ */
19
+ private $utility;
20
+
21
+ /**
22
+ * Constructor Define.
23
+ *
24
+ * @version 4.0.0
25
+ * @since 4.0.0
26
+ * @param Structuring_Markup_Utility $utility
27
+ */
28
+ public function __construct ( Structuring_Markup_Utility $utility ) {
29
+ $this->utility = $utility;
30
+ }
31
+
32
+ /**
33
+ * Setting schema.org BlogPosting
34
+ *
35
+ * @version 4.1.0
36
+ * @since 4.0.0
37
+ * @param array $options
38
+ * @return array $args
39
+ */
40
+ public function set_meta ( array $options ) {
41
+ global $post;
42
+
43
+ $excerpt = $this->utility->escape_text( $post->post_excerpt );
44
+ $content = $excerpt === "" ? mb_substr( $this->utility->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
45
+
46
+ $args = array(
47
+ "@context" => "http://schema.org",
48
+ "@type" => "BlogPosting",
49
+ "mainEntityOfPage" => array(
50
+ "@type" => "WebPage",
51
+ "@id" => get_permalink( $post->ID )
52
+ ),
53
+ "headline" => mb_substr( esc_html( $post->post_title ), 0, 110 ),
54
+ "datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
55
+ "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
56
+ "author" => array(
57
+ "@type" => "Person",
58
+ "name" => esc_html( get_the_author_meta( 'display_name', $post->post_author ) )
59
+ ),
60
+ "description" => $content
61
+ );
62
+
63
+ if ( has_post_thumbnail( $post->ID ) ) {
64
+ $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
65
+
66
+ $images_args = array(
67
+ "image" => array(
68
+ "@type" => "ImageObject",
69
+ "url" => $images[0],
70
+ "width" => $images[1],
71
+ "height" => $images[2]
72
+ )
73
+ );
74
+ $args = array_merge( $args, $images_args );
75
+ } elseif ( isset( $options['content_image'] ) && $options['content_image'] === 'on' ) {
76
+ if ( $images = $this->utility->get_content_image( $post->post_content ) ) {
77
+ if ( $size = $this->utility->get_image_dimensions( $images ) ) {
78
+ $images_args = array(
79
+ "image" => array(
80
+ "@type" => "ImageObject",
81
+ "url" => $images,
82
+ "width" => $size['width'],
83
+ "height" => $size['height']
84
+ )
85
+ );
86
+ $args = array_merge( $args, $images_args );
87
+ }
88
+ }
89
+ }
90
+
91
+ if ( isset( $options['name'] ) ) {
92
+ $publisher_args = array(
93
+ "publisher" => array(
94
+ "@type" => "Organization",
95
+ "name" => esc_html( $options['name'] ),
96
+ )
97
+ );
98
+
99
+ $options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
100
+
101
+ if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
102
+ $publisher_args['publisher']['logo'] = array(
103
+ "@type" => "ImageObject",
104
+ "url" => $options['logo'],
105
+ "width" => $logo['width'],
106
+ "height" => $logo['height']
107
+ );
108
+ } else if ( !empty( $options['logo'] ) ) {
109
+ $publisher_args['publisher']['logo'] = array(
110
+ "@type" => "ImageObject",
111
+ "url" => $options['logo'],
112
+ "width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
113
+ "height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
114
+ );
115
+ }
116
+ $args = array_merge( $args, $publisher_args );
117
+ }
118
+
119
+ return (array) $args;
120
+ }
121
+ }
trunk/includes/meta/wp-structuring-meta-breadcrumb.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Breadcrumb
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.0
7
+ * @since 4.0.0
8
+ * @see wp-structuring-short-code-breadcrumb.php
9
+ * @link https://schema.org/BreadcrumbList
10
+ * @link https://developers.google.com/search/docs/data-types/breadcrumbs
11
+ */
12
+ class Structuring_Markup_Meta_Breadcrumb {
13
+
14
+ /**
15
+ * Setting schema.org Breadcrumb
16
+ *
17
+ * @version 4.0.0
18
+ * @since 4.0.0
19
+ * @param array $options
20
+ * @return array $args
21
+ */
22
+ public function set_meta ( array $options ) {
23
+ $obj = new Structuring_Markup_ShortCode_Breadcrumb();
24
+ $item_array = $obj->breadcrumb_array_setting( $options );
25
+
26
+ if ( $item_array ) {
27
+ /** itemListElement build */
28
+ $item_list_element = array();
29
+ $position = 1;
30
+ foreach ($item_array as $item) {
31
+ $item_list_element[] = array(
32
+ "@type" => "ListItem",
33
+ "position" => $position,
34
+ "item" => $item
35
+ );
36
+ $position++;
37
+ }
38
+
39
+ /** Breadcrumb Schema build */
40
+ $args = array(
41
+ "@context" => "http://schema.org",
42
+ "@type" => "BreadcrumbList",
43
+ "itemListElement" => $item_list_element
44
+ );
45
+
46
+ return (array) $args;
47
+ }
48
+ }
49
+
50
+ }
trunk/includes/meta/wp-structuring-meta-event.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Event
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.2
7
+ * @since 4.0.0
8
+ * @link http://schema.org/Event
9
+ * @link http://schema.org/Place
10
+ * @link http://schema.org/Offer
11
+ * @link https://developers.google.com/search/docs/data-types/events
12
+ */
13
+ class Structuring_Markup_Meta_Event {
14
+
15
+ /**
16
+ * Setting schema.org Event
17
+ *
18
+ * @version 4.0.2
19
+ * @since 4.0.0
20
+ * @return array $args
21
+ */
22
+ public function set_meta () {
23
+ global $post;
24
+ $meta = get_post_meta( $post->ID, 'schema_event_post', false );
25
+
26
+ if ( isset( $meta[0] ) ) {
27
+ $meta = unserialize( $meta[0] );
28
+
29
+ // @type: Event
30
+ if ( !isset( $meta['schema_event_type']) ) $meta['schema_event_type'] = 'Event';
31
+ if ( !isset( $meta['schema_event_name']) ) $meta['schema_event_name'] = '';
32
+ if ( !isset( $meta['schema_event_date']) ) $meta['schema_event_date'] = date('Y-m-d');
33
+ if ( !isset( $meta['schema_event_time']) ) $meta['schema_event_time'] = date('h:i');
34
+ if ( !isset( $meta['schema_event_url']) ) $meta['schema_event_url'] = '';
35
+ if ( !isset( $meta['schema_event_place_name'] ) ) $meta['schema_event_place_name'] = '';
36
+ if ( !isset( $meta['schema_event_place_url'] ) ) $meta['schema_event_place_url'] = '';
37
+ if ( !isset( $meta['schema_event_place_address'] ) ) $meta['schema_event_place_address'] = '';
38
+ if ( !isset( $meta['schema_event_offers_price'] ) ) $meta['schema_event_offers_price'] = 0;
39
+ if ( !isset( $meta['schema_event_offers_currency'] ) ) $meta['schema_event_offers_currency'] = '';
40
+
41
+ $args = array(
42
+ "@context" => "http://schema.org",
43
+ "@type" => esc_html( $meta['schema_event_type'] ),
44
+ "name" => esc_html( $meta['schema_event_name'] ),
45
+ "startDate" => esc_html( $meta['schema_event_date'] ) . 'T' . esc_html( $meta['schema_event_time'] ),
46
+ "url" => esc_url( $meta['schema_event_url'] ),
47
+ "location" => array(
48
+ "@type" => "Place",
49
+ "sameAs" => esc_url( $meta['schema_event_place_url'] ),
50
+ "name" => esc_html( $meta['schema_event_place_name'] ),
51
+ "address" => esc_html( $meta['schema_event_place_address'] )
52
+ )
53
+ );
54
+
55
+ // @type: Event recommended items
56
+ if ( isset( $meta['schema_event_description'] ) && $meta['schema_event_description'] !== '' ) {
57
+ $args['description'] = esc_html( $meta['schema_event_description'] );
58
+ }
59
+ if ( isset( $meta['schema_event_image'] ) && $meta['schema_event_image'] !== '' ) {
60
+ $args['image'] = esc_html( $meta['schema_event_image'] );
61
+ }
62
+ if ( isset( $meta['schema_event_date_end'] ) && $meta['schema_event_date_end'] !== '' && isset( $meta['schema_event_time_end'] ) && $meta['schema_event_time_end'] !== '' ) {
63
+ $args['endDate'] = esc_html( $meta['schema_event_date_end'] ) . 'T' . esc_html( $meta['schema_event_time_end'] );
64
+ }
65
+
66
+ // @type: Offer
67
+ $offer = array(
68
+ "@type" => "Offer",
69
+ "price" => esc_html( $meta['schema_event_offers_price'] ),
70
+ "priceCurrency" => esc_html( $meta['schema_event_offers_currency'] ),
71
+ "url" => esc_url( $meta['schema_event_url'] )
72
+ );
73
+
74
+ // @type: Offer recommended items
75
+ if ( isset( $meta['schema_event_offers_availability'] ) && $meta['schema_event_offers_availability'] !== '' ) {
76
+ $offer['availability'] = "http://schema.org/" . esc_html( $meta['schema_event_offers_availability'] );
77
+ }
78
+ if ( isset( $meta['schema_event_offers_date'] ) && $meta['schema_event_offers_date'] !== '' && isset( $meta['schema_event_offers_time'] ) && $meta['schema_event_offers_time'] !== '' ) {
79
+ $offer['validFrom'] = esc_html( $meta['schema_event_offers_date'] ) . 'T' . esc_html( $meta['schema_event_offers_time'] );
80
+ }
81
+
82
+ $args['offers'] = $offer;
83
+
84
+ // @type: PerformingGroup recommended items
85
+ if ( isset( $meta['schema_event_performer_name'] ) && $meta['schema_event_performer_name'] !== '' ) {
86
+ $args['performer'] = array(
87
+ "@type" => "PerformingGroup",
88
+ "name" => esc_html( $meta['schema_event_performer_name'] )
89
+ );
90
+ }
91
+
92
+ return (array) $args;
93
+ }
94
+ }
95
+ }
trunk/includes/meta/wp-structuring-meta-local-business.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type LocalBusiness
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.1.6
7
+ * @since 4.0.0
8
+ * @see wp-structuring-opening-hours.php
9
+ * @link http://schema.org/LocalBusiness
10
+ * @link https://schema.org/GeoCircle
11
+ * @link https://developers.google.com/search/docs/data-types/local-businesses
12
+ */
13
+ class Structuring_Markup_Meta_LocalBusiness {
14
+
15
+ /**
16
+ * Setting schema.org LocalBusiness
17
+ *
18
+ * @version 4.1.6
19
+ * @since 4.0.0
20
+ * @param array $options
21
+ * @return array $args
22
+ */
23
+ public function set_meta ( array $options ) {
24
+
25
+ /** weekType defined. */
26
+ $week_array = array(
27
+ array( "type" => "Mo", "display" => "Monday" ),
28
+ array( "type" => "Tu", "display" => "Tuesday" ),
29
+ array( "type" => "We", "display" => "Wednesday" ),
30
+ array( "type" => "Th", "display" => "Thursday" ),
31
+ array( "type" => "Fr", "display" => "Friday" ),
32
+ array( "type" => "Sa", "display" => "Saturday" ),
33
+ array( "type" => "Su", "display" => "Sunday" )
34
+ );
35
+
36
+ $args = array(
37
+ "@context" => "http://schema.org",
38
+ "@type" => isset( $options['business_type'] ) ? esc_html( $options['business_type'] ) : "",
39
+ "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
40
+ "image" => isset( $options['image'] ) ? esc_html( $options['image'] ) : "",
41
+ "url" => isset( $options['url'] ) ? esc_url( $options['url'] ) : ""
42
+ );
43
+
44
+ if ( isset( $options['telephone'] ) && !empty( $options['telephone'] ) ) {
45
+ $args['telephone'] = esc_html( $options['telephone'] );
46
+ }
47
+
48
+ if ( isset( $options['food_active'] ) && $options['food_active'] === 'on' ) {
49
+ if ( isset( $options['menu'] ) && $options['menu'] !== '' ) {
50
+ $args['menu'] = esc_url( $options['menu'] );
51
+ }
52
+ if ( isset( $options['accepts_reservations'] ) && $options['accepts_reservations'] === 'on' ) {
53
+ $args['acceptsReservations'] = "True";
54
+ } else {
55
+ $args['acceptsReservations'] = "False";
56
+ }
57
+ if ( isset( $options['serves_cuisine'] ) && $options['serves_cuisine'] !== '' ) {
58
+ $args['servesCuisine'] = esc_html( $options['serves_cuisine'] );
59
+ }
60
+ }
61
+
62
+ $address_array['address'] = array(
63
+ "@type" => "PostalAddress",
64
+ "streetAddress" => isset( $options['street_address'] ) ? esc_html( $options['street_address'] ) : "",
65
+ "addressLocality" => isset( $options['address_locality'] ) ? esc_html( $options['address_locality'] ) : "",
66
+ "postalCode" => isset( $options['postal_code'] ) ? esc_html( $options['postal_code'] ) : "",
67
+ "addressCountry" => isset( $options['address_country'] ) ? esc_html( $options['address_country'] ) : ""
68
+ );
69
+
70
+ if ( isset( $options['address_region'] ) && !empty( $options['address_region'] ) ) {
71
+ $address_array['address']['addressRegion'] = esc_html( $options['address_region'] );
72
+ }
73
+
74
+ $args = array_merge( $args, $address_array );
75
+ $geo_array = array();
76
+
77
+ if ( isset( $options['geo_active'] ) && $options['geo_active'] === 'on' ) {
78
+ $geo_array["geo"] = array(
79
+ "@type" => "GeoCoordinates",
80
+ "latitude" => isset( $options['latitude'] ) ? esc_html(floatval($options['latitude'])) : "",
81
+ "longitude" => isset( $options['longitude'] ) ? esc_html(floatval($options['longitude'])) : ""
82
+ );
83
+ }
84
+
85
+ if ( isset( $options['geo_circle_active'] ) && $options['geo_circle_active'] === 'on' ) {
86
+ $place_array["location"] = array( "@type" => "Place" );
87
+ $place_array["location"]["geo"] = array(
88
+ "@type" => "GeoCircle",
89
+ "geoRadius" => isset( $options['geo_circle_radius'] ) ? esc_html( floatval( $options['geo_circle_radius'] ) ) : ""
90
+ );
91
+ if ( isset( $options['geo_active'] ) && $options['geo_active'] === 'on' ) {
92
+ $place_array["location"]["geo"]["geoMidpoint"] = $geo_array["geo"];
93
+ }
94
+ $args = array_merge( $args, $place_array );
95
+ } else {
96
+ if ( isset( $options['geo_active'] ) && $options['geo_active'] === 'on' ) {
97
+ $args = array_merge( $args, $geo_array );
98
+ }
99
+ }
100
+
101
+ /* openingHours */
102
+ $active_days = array();
103
+ foreach ( $week_array as $value ) {
104
+ if ( isset( $options[$value['type']] ) && $options[$value['type']] === 'on' ) {
105
+ $active_days[$value['type']] = $options['week'][$value['type']];
106
+ }
107
+ }
108
+
109
+ if( !empty( $active_days ) ) {
110
+
111
+ $obj = new Structuring_Markup_Opening_Hours( $active_days );
112
+ $opening_hours = $obj->display();
113
+
114
+ $opening_array["openingHours"] = array();
115
+
116
+ foreach( $opening_hours as $value ) {
117
+ $opening_array["openingHours"][] = $value;
118
+ }
119
+
120
+ $args = array_merge( $args, $opening_array );
121
+
122
+ }
123
+
124
+ if ( isset( $options['holiday_active'] ) && $options['holiday_active'] === 'on' ) {
125
+ $holiday_array["openingHoursSpecification"] = array(
126
+ "@type" => "OpeningHoursSpecification",
127
+ "opens" => isset( $options['holiday_open'] ) ? esc_html( $options['holiday_open'] ) : "",
128
+ "closes" => isset( $options['holiday_close'] ) ? esc_html( $options['holiday_close'] ) : "",
129
+ "validFrom" => isset( $options['holiday_valid_from'] ) ? esc_html( $options['holiday_valid_from'] ) : "",
130
+ "validThrough" => isset( $options['holiday_valid_through'] ) ? esc_html( $options['holiday_valid_through'] ) : ""
131
+ );
132
+ $args = array_merge( $args, $holiday_array );
133
+ }
134
+
135
+ if ( isset( $options['price_range'] ) && !empty( $options['price_range'] ) ) {
136
+ $price_array["priceRange"] = $options['price_range'];
137
+ $args = array_merge( $args, $price_array );
138
+ }
139
+
140
+ return (array) $args;
141
+ }
142
+
143
+ }
trunk/includes/meta/wp-structuring-meta-news-article.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type News Article
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.1.0
7
+ * @since 4.0.0
8
+ * @link http://schema.org/NewsArticle
9
+ * @link https://developers.google.com/search/docs/data-types/articles
10
+ */
11
+ class Structuring_Markup_Meta_NewsArticle {
12
+
13
+ /**
14
+ * Utility
15
+ *
16
+ * @version 4.0.0
17
+ * @since 4.0.0
18
+ */
19
+ private $utility;
20
+
21
+ /**
22
+ * Constructor Define.
23
+ *
24
+ * @version 4.0.0
25
+ * @since 4.0.0
26
+ * @param Structuring_Markup_Utility $utility
27
+ */
28
+ public function __construct ( Structuring_Markup_Utility $utility ) {
29
+ $this->utility = $utility;
30
+ }
31
+
32
+ /**
33
+ * Setting schema.org NewsArticle
34
+ *
35
+ * @version 4.1.0
36
+ * @since 4.0.0
37
+ * @param array $options
38
+ * @return array $args
39
+ */
40
+ public function set_meta ( array $options ) {
41
+ global $post;
42
+
43
+ $excerpt = $this->utility->escape_text( $post->post_excerpt );
44
+ $content = $excerpt === "" ? mb_substr( $this->utility->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
45
+
46
+ $args = array(
47
+ "@context" => "http://schema.org",
48
+ "@type" => "NewsArticle",
49
+ "mainEntityOfPage" => array(
50
+ "@type" => "WebPage",
51
+ "@id" => get_permalink( $post->ID )
52
+ ),
53
+ "headline" => mb_substr( esc_html( $post->post_title ), 0, 110 ),
54
+ "datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
55
+ "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
56
+ "author" => array(
57
+ "@type" => "Person",
58
+ "name" => esc_html( get_the_author_meta( 'display_name', $post->post_author ) )
59
+ ),
60
+ "description" => $content
61
+ );
62
+
63
+ if ( has_post_thumbnail( $post->ID ) ) {
64
+ $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
65
+
66
+ $images_args = array(
67
+ "image" => array(
68
+ "@type" => "ImageObject",
69
+ "url" => $images[0],
70
+ "width" => $images[1],
71
+ "height" => $images[2]
72
+ )
73
+ );
74
+ $args = array_merge( $args, $images_args );
75
+ } elseif ( isset( $options['content_image'] ) && $options['content_image'] === 'on' ) {
76
+ if ( $images = $this->utility->get_content_image( $post->post_content ) ) {
77
+ if ( $size = $this->utility->get_image_dimensions( $images ) ) {
78
+ $images_args = array(
79
+ "image" => array(
80
+ "@type" => "ImageObject",
81
+ "url" => $images,
82
+ "width" => $size['width'],
83
+ "height" => $size['height']
84
+ )
85
+ );
86
+ $args = array_merge( $args, $images_args );
87
+ }
88
+ }
89
+ }
90
+
91
+ if ( isset( $options['name'] ) ) {
92
+ $publisher_args = array(
93
+ "publisher" => array(
94
+ "@type" => "Organization",
95
+ "name" => esc_html( $options['name'] ),
96
+ )
97
+ );
98
+
99
+ $options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
100
+
101
+ if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
102
+ $publisher_args['publisher']['logo'] = array(
103
+ "@type" => "ImageObject",
104
+ "url" => $options['logo'],
105
+ "width" => $logo['width'],
106
+ "height" => $logo['height']
107
+ );
108
+ } else if ( !empty( $options['logo'] ) ) {
109
+ $publisher_args['publisher']['logo'] = array(
110
+ "@type" => "ImageObject",
111
+ "url" => $options['logo'],
112
+ "width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
113
+ "height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
114
+ );
115
+ }
116
+ $args = array_merge( $args, $publisher_args );
117
+ }
118
+
119
+ return (array) $args;
120
+ }
121
+ }
trunk/includes/meta/wp-structuring-meta-organization.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Organization
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.1.3
7
+ * @since 4.0.0
8
+ * @link https://schema.org/Organization
9
+ * @link https://developers.google.com/search/docs/guides/enhance-site
10
+ */
11
+ class Structuring_Markup_Meta_Organization {
12
+
13
+ /**
14
+ * Setting schema.org Organization
15
+ *
16
+ * @version 4.1.3
17
+ * @since 4.0.0
18
+ * @param array $options
19
+ * @return array $args
20
+ */
21
+ public function set_meta ( array $options ) {
22
+ /** Logos */
23
+ $args = array(
24
+ "@context" => "http://schema.org",
25
+ "@type" => "Organization",
26
+ "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
27
+ "url" => isset( $options['url'] ) ? esc_url( $options['url'] ) : "",
28
+ "logo" => isset( $options['logo'] ) ? esc_url( $options['logo'] ) : ""
29
+ );
30
+
31
+ /** Corporate Contact */
32
+ if ( isset( $options['contact_point'] ) && $options['contact_point'] === 'on' ) {
33
+ $contact_point_data = array(
34
+ "@type" => "ContactPoint",
35
+ "telephone" => isset( $options['telephone'] ) ? esc_html( $options['telephone'] ) : "",
36
+ "contactType" => isset( $options['contact_type'] ) ? esc_html( $options['contact_type'] ) : ""
37
+ );
38
+
39
+ if ( !empty( $options['email'] ) ) {
40
+ $contact_point_data['email'] = isset( $options['email'] ) ? esc_html( $options['email'] ) : "";
41
+ }
42
+ if ( !empty( $options['area_served'] ) ) {
43
+ $array = explode( ',', esc_html( $options['area_served'] ) );
44
+ for ( $i = 0; $i < count( $array ); $i++ ) {
45
+ $contact_point_data['areaServed'][] = isset( $options['area_served'] ) ? $array[$i] : "";
46
+ }
47
+ }
48
+ if ( isset( $options['contact_point_1'] ) && $options['contact_point_1'] === 'on' ) {
49
+ $contact_point_data['contactOption'][] = 'HearingImpairedSupported';
50
+ }
51
+ if ( isset( $options['contact_point_2'] ) && $options['contact_point_2'] === 'on' ) {
52
+ $contact_point_data['contactOption'][] = 'TollFree';
53
+ }
54
+ if ( !empty( $options['available_language'] ) ) {
55
+ $array = explode( ',', esc_html( $options['available_language'] ) );
56
+ for ( $i = 0; $i < count( $array ); $i++ ) {
57
+ $contact_point_data['availableLanguage'][] = isset( $options['available_language'] ) ? $array[$i] : "";
58
+ }
59
+ }
60
+
61
+ $contact_point["contactPoint"] = array( $contact_point_data );
62
+ $args = array_merge( $args, $contact_point );
63
+ }
64
+
65
+ /** Social Profiles */
66
+ if ( isset( $options['social'] ) ) {
67
+ $socials["sameAs"] = array();
68
+
69
+ foreach ( $options['social'] as $value ) {
70
+ if ( $value ) {
71
+ $socials["sameAs"][] = esc_url( $value );
72
+ }
73
+ }
74
+ if ( count( $socials["sameAs"] ) > 0 ) {
75
+ $args = array_merge( $args, $socials );
76
+ }
77
+ }
78
+ return (array) $args;
79
+ }
80
+ }
trunk/includes/meta/wp-structuring-meta-person.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Person
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.0
7
+ * @since 4.0.0
8
+ * @link https://schema.org/Person
9
+ * @link https://developers.google.com/search/docs/data-types/social-profile-links
10
+ */
11
+ class Structuring_Markup_Meta_Person {
12
+
13
+ /**
14
+ * Setting schema.org Person
15
+ *
16
+ * @version 4.0.0
17
+ * @since 4.0.0
18
+ * @param array $options
19
+ * @return array $args
20
+ */
21
+ public function set_meta ( array $options ) {
22
+ /** Logos */
23
+ $args = array(
24
+ "@context" => "http://schema.org",
25
+ "@type" => "Person",
26
+ "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
27
+ "url" => isset( $options['url'] ) ? esc_url( $options['url'] ) : ""
28
+ );
29
+
30
+ /** Place */
31
+ if ( isset( $options['addressCountry'] ) ) {
32
+ $place["homeLocation"] = array(
33
+ "@type" => "Place",
34
+ "address" => array(
35
+ "@type" => "PostalAddress",
36
+ "addressCountry" => $options['addressCountry']
37
+ )
38
+ );
39
+ $args = array_merge( $args, $place );
40
+ }
41
+
42
+ /** Social Profiles */
43
+ if ( isset( $options['social'] ) ) {
44
+ $socials["sameAs"] = array();
45
+
46
+ foreach ( $options['social'] as $value ) {
47
+ if ( !empty( $value ) ) {
48
+ $socials["sameAs"][] = esc_html( $value );
49
+ }
50
+ }
51
+ if ( count( $socials["sameAs"] ) > 0 ) {
52
+ $args = array_merge( $args, $socials );
53
+ }
54
+ }
55
+ return (array) $args;
56
+ }
57
+ }
trunk/includes/meta/wp-structuring-meta-site-navigation.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Site Navigation Element
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.0
7
+ * @since 4.0.0
8
+ * @link https://schema.org/SiteNavigationElement
9
+ */
10
+ class Structuring_Markup_Meta_Site_Navigation {
11
+
12
+ /**
13
+ * Setting schema.org Site Navigation
14
+ *
15
+ * @version 4.0.0
16
+ * @since 4.0.0
17
+ * @param array $options
18
+ * @return array $args
19
+ */
20
+ public function set_meta ( array $options ) {
21
+ if ( isset( $options['menu_name'] ) && wp_get_nav_menu_items( $options['menu_name'] ) ) {
22
+ $items_array = wp_get_nav_menu_items( $options['menu_name'] );
23
+ $name_array = array();
24
+ $url_array = array();
25
+
26
+ foreach ( (array) $items_array as $key => $menu_item ) {
27
+ $url_array[] = $menu_item->url;
28
+ $name_array[] = $menu_item->title;
29
+ }
30
+
31
+ if ( count( $items_array ) > 0 ) {
32
+ $args = array(
33
+ "@context" => "http://schema.org",
34
+ "@type" => "SiteNavigationElement",
35
+ "name" => $name_array,
36
+ "url" => $url_array
37
+ );
38
+ return (array) $args;
39
+ }
40
+ }
41
+ }
42
+ }
trunk/includes/meta/wp-structuring-meta-video.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Video
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.0
7
+ * @since 4.0.0
8
+ * @link https://schema.org/VideoObject
9
+ * @link https://developers.google.com/search/docs/data-types/videos
10
+ */
11
+ class Structuring_Markup_Meta_Video {
12
+
13
+ /**
14
+ * Utility
15
+ *
16
+ * @version 4.0.0
17
+ * @since 4.0.0
18
+ */
19
+ private $utility;
20
+
21
+ /**
22
+ * Constructor Define.
23
+ *
24
+ * @version 4.0.0
25
+ * @since 4.0.0
26
+ * @param Structuring_Markup_Utility $utility
27
+ */
28
+ public function __construct ( Structuring_Markup_Utility $utility ) {
29
+ $this->utility = $utility;
30
+ }
31
+
32
+ /**
33
+ * Setting schema.org Video
34
+ *
35
+ * @version 4.0.0
36
+ * @since 4.0.0
37
+ * @return array $args
38
+ */
39
+ public function set_meta () {
40
+ global $post;
41
+ $meta = get_post_meta( $post->ID, 'schema_video_post', false );
42
+
43
+ if ( isset( $meta[0] ) ) {
44
+ $meta = unserialize( $meta[0] );
45
+
46
+ if ( has_post_thumbnail( $post->ID ) ) {
47
+ $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
48
+ $excerpt = $this->utility->escape_text( $post->post_excerpt );
49
+ $content = $excerpt === "" ? mb_substr( $this->utility->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
50
+ } else {
51
+ $images[0] = '';
52
+ $content = '';
53
+ }
54
+
55
+ /* required items */
56
+ if ( !isset( $meta['schema_video_name']) ) $meta['schema_video_name'] = esc_html( $post->post_title );
57
+ if ( !isset( $meta['schema_video_description'] ) ) $meta['schema_video_description'] = esc_html( $content );
58
+ if ( !isset( $meta['schema_video_thumbnail_url'] ) ) $meta['schema_video_description'] = esc_html( $images[0] );
59
+ if ( !isset( $meta['schema_video_upload_date'] ) ) $meta['schema_video_upload_date'] = get_post_modified_time( 'Y-m-d', __return_false(), $post->ID );
60
+ if ( !isset( $meta['schema_video_upload_time'] ) ) $meta['schema_video_upload_time'] = get_post_modified_time( 'H:i:s', __return_false(), $post->ID );
61
+
62
+ $args = array(
63
+ "@context" => "http://schema.org",
64
+ "@type" => "VideoObject",
65
+ "name" => esc_html( $meta['schema_video_name'] ),
66
+ "description" => esc_html( $meta['schema_video_description'] ),
67
+ "thumbnailUrl" => esc_html( $meta['schema_video_thumbnail_url'] ),
68
+ "uploadDate" => esc_html( $meta['schema_video_upload_date'] ) . 'T' . esc_html( $meta['schema_video_upload_time'] )
69
+ );
70
+
71
+ /* recommended items */
72
+ if ( isset( $meta['schema_video_duration'] ) && $meta['schema_video_duration'] !== '' ) {
73
+ $args["duration"] = esc_html( $meta['schema_video_duration'] );
74
+ }
75
+ if ( isset( $meta['schema_video_content_url'] ) && $meta['schema_video_content_url'] !== '' ) {
76
+ $args["contentUrl"] = esc_url( $meta['schema_video_content_url'] );
77
+ }
78
+ if ( isset( $meta['schema_video_embed_url'] ) && $meta['schema_video_embed_url'] !== '' ) {
79
+ $args["embedUrl"] = esc_url( $meta['schema_video_embed_url'] );
80
+ }
81
+ if ( isset( $meta['schema_video_interaction_count'] ) && $meta['schema_video_interaction_count'] !== '' ) {
82
+ $args["interactionCount"] = esc_html( $meta['schema_video_interaction_count'] );
83
+ }
84
+ if ( isset( $meta['schema_video_expires_date'] ) && $meta['schema_video_expires_date'] !== '' && isset( $meta['schema_video_expires_time'] ) && $meta['schema_video_expires_time'] !== '' ) {
85
+ $args["expires"] = esc_html( $meta['schema_video_expires_date'] ) . 'T' . esc_html( $meta['schema_video_expires_time'] );
86
+ }
87
+ return (array) $args;
88
+ }
89
+ }
90
+ }
trunk/includes/meta/wp-structuring-meta-website.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type WebSite
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.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
10
+ * @link https://developers.google.com/search/docs/data-types/sitename
11
+ */
12
+ class Structuring_Markup_Meta_WebSite {
13
+
14
+ /**
15
+ * Setting schema.org WebSite
16
+ *
17
+ * @version 4.0.0
18
+ * @since 4.0.0
19
+ * @param array $options
20
+ * @return array $args
21
+ */
22
+ public function set_meta ( array $options ) {
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();
32
+
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
+ }
41
+
42
+ if ( count( $search_array ) > 0 ) {
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
+ }
51
+
52
+ $potential_action["potentialAction"] = $search_array;
53
+ $args = array_merge( $args, $potential_action );
54
+ }
55
+
56
+ return (array) $args;
57
+ }
58
+ }
trunk/includes/wp-structuring-display-amp.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Display (AMP)
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.0
7
+ * @since 4.0.0
8
+ */
9
+ class Structuring_Markup_Display_Amp {
10
+
11
+ /**
12
+ * Utility
13
+ *
14
+ * @version 4.0.0
15
+ * @since 4.0.0
16
+ */
17
+ private $utility;
18
+
19
+ /**
20
+ * JSON-LD output data
21
+ *
22
+ * @version 4.0.0
23
+ * @since 4.0.0
24
+ */
25
+ public $json_ld = array();
26
+
27
+ /**
28
+ * Constructor Define.
29
+ *
30
+ * @version 4.0.0
31
+ * @since 4.0.0
32
+ */
33
+ public function __construct () {
34
+ require_once( plugin_dir_path( __FILE__ ) . 'wp-structuring-utility.php' );
35
+ $this->utility = new Structuring_Markup_Utility();
36
+
37
+ $db = new Structuring_Markup_Admin_Db();
38
+ $this->set_schema( $db );
39
+ }
40
+
41
+ /**
42
+ * Setting schema.org
43
+ *
44
+ * @version 4.0.0
45
+ * @since 4.0.0
46
+ * @param Structuring_Markup_Admin_Db $db
47
+ */
48
+ private function set_schema ( Structuring_Markup_Admin_Db $db ) {
49
+ $structuring_markup_args = $db->get_list_options();
50
+
51
+ if ( is_single() && get_post_type() === 'post' ) {
52
+ $this->get_schema_data( 'amp', $structuring_markup_args );
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Setting JSON-LD Template
58
+ *
59
+ * @version 4.0.0
60
+ * @since 4.0.0
61
+ * @param string $output
62
+ * @param array $structuring_markup_args
63
+ */
64
+ private function get_schema_data ( $output, array $structuring_markup_args ) {
65
+
66
+ foreach ( $structuring_markup_args as $row ) {
67
+ /** Output page check. */
68
+ $output_args = unserialize( $row->output );
69
+ if ( array_key_exists( $output, $output_args ) ) {
70
+
71
+ /** Activate check. */
72
+ if ( isset( $row->type ) && isset( $row->activate ) && $row->activate === 'on' ) {
73
+ switch ( $row->type ) {
74
+ case 'article':
75
+ if ( isset( $row->options ) && $row->options ) {
76
+ require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-article.php' );
77
+ $obj = new Structuring_Markup_Meta_Article( $this->utility );
78
+ $this->json_ld = $obj->set_meta( unserialize( $row->options ) );
79
+ }
80
+ break;
81
+ case 'blog_posting':
82
+ if ( isset( $row->options ) && $row->options ) {
83
+ require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-blog-posting.php' );
84
+ $obj = new Structuring_Markup_Meta_Blog_Posting( $this->utility );
85
+ $this->json_ld = $obj->set_meta( unserialize( $row->options ) );
86
+ }
87
+ break;
88
+ case 'news_article':
89
+ if ( isset( $row->options ) && $row->options ) {
90
+ require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-news-article.php' );
91
+ $obj = new Structuring_Markup_Meta_NewsArticle( $this->utility );
92
+ $this->json_ld = $obj->set_meta( unserialize( $row->options ) );
93
+ }
94
+ break;
95
+ }
96
+ }
97
+ }
98
+ }
99
+ }
100
+ }
trunk/includes/wp-structuring-display.php ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Display
4
+ *
5
+ * @author Kazuya Takami
6
+ * @author Justin Frydman
7
+ * @version 4.0.1
8
+ * @since 1.0.0
9
+ */
10
+ class Structuring_Markup_Display {
11
+
12
+ /**
13
+ * Utility
14
+ *
15
+ * @version 4.0.0
16
+ * @since 4.0.0
17
+ */
18
+ private $utility;
19
+
20
+ /**
21
+ * Constructor Define.
22
+ *
23
+ * @version 4.0.0
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
+ }
34
+
35
+ /**
36
+ * Setting schema.org
37
+ *
38
+ * @version 3.1.4
39
+ * @since 1.0.0
40
+ * @param Structuring_Markup_Admin_Db $db
41
+ * @param string $version
42
+ */
43
+ private function set_schema ( Structuring_Markup_Admin_Db $db, $version ) {
44
+ $structuring_markup_args = $db->get_list_options();
45
+
46
+ echo '<!-- Markup (JSON-LD) structured in schema.org ver.' . $version . ' START -->' . PHP_EOL;
47
+
48
+ $this->get_schema_data( 'all', $structuring_markup_args );
49
+ if ( is_home() || is_front_page() ) {
50
+ $this->get_schema_data( 'home', $structuring_markup_args );
51
+ }
52
+ if ( is_single() && get_post_type() === 'post' ) {
53
+ $this->get_schema_data( 'post', $structuring_markup_args );
54
+ }
55
+ if ( is_singular( 'schema_event_post' ) ) {
56
+ $this->get_schema_data( 'event', $structuring_markup_args );
57
+ }
58
+ if ( is_singular( 'schema_video_post' ) ) {
59
+ $this->get_schema_data( 'video', $structuring_markup_args );
60
+ }
61
+ if ( is_page() ) {
62
+ $this->get_schema_data( 'page', $structuring_markup_args );
63
+ }
64
+ $args = array(
65
+ 'public' => true,
66
+ '_builtin' => false
67
+ );
68
+ $post_types = get_post_types( $args, 'objects' );
69
+
70
+ unset( $post_types['schema_event_post'] );
71
+ unset( $post_types['schema_video_post'] );
72
+
73
+ foreach ( $post_types as $post_type ) {
74
+ if ( is_singular( $post_type->name ) ) {
75
+ $this->get_schema_data( $post_type->name, $structuring_markup_args );
76
+ }
77
+ }
78
+ echo '<!-- Markup (JSON-LD) structured in schema.org END -->' . PHP_EOL;
79
+ }
80
+
81
+ /**
82
+ * Setting JSON-LD Template
83
+ *
84
+ * @version 4.0.0
85
+ * @since 1.0.0
86
+ * @param string $output
87
+ * @param array $structuring_markup_args
88
+ */
89
+ private function get_schema_data ( $output, array $structuring_markup_args ) {
90
+
91
+ foreach ( $structuring_markup_args as $row ) {
92
+ /** Output page check. */
93
+ $output_args = unserialize( $row->output );
94
+ if ( array_key_exists( $output, $output_args ) ) {
95
+
96
+ /** Activate check. */
97
+ if ( isset( $row->type ) && isset( $row->activate ) && $row->activate === 'on' ) {
98
+ switch ( $row->type ) {
99
+ case 'article':
100
+ if ( isset( $row->options ) && $row->options ) {
101
+ require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-article.php' );
102
+ $obj = new Structuring_Markup_Meta_Article( $this->utility );
103
+ $this->set_schema_json( $obj->set_meta( unserialize( $row->options ) ) );
104
+ }
105
+ break;
106
+ case 'blog_posting':
107
+ if ( isset( $row->options ) && $row->options ) {
108
+ require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-blog-posting.php' );
109
+ $obj = new Structuring_Markup_Meta_Blog_Posting( $this->utility );
110
+ $this->set_schema_json( $obj->set_meta( unserialize( $row->options ) ) );
111
+ }
112
+ break;
113
+ case 'breadcrumb':
114
+ if ( isset( $row->options ) && $row->options ) {
115
+ require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-breadcrumb.php' );
116
+ require_once( plugin_dir_path( __FILE__ ) . 'wp-structuring-short-code-breadcrumb.php' );
117
+ $obj = new Structuring_Markup_Meta_Breadcrumb();
118
+ $this->set_schema_json( $obj->set_meta( unserialize( $row->options ) ) );
119
+ }
120
+ break;
121
+ case 'event':
122
+ require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-event.php' );
123
+ $obj = new Structuring_Markup_Meta_Event();
124
+ $this->set_schema_json( $obj->set_meta() );
125
+ break;
126
+ case 'local_business':
127
+ if ( isset( $row->options ) && $row->options ) {
128
+ require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-local-business.php' );
129
+ require_once( plugin_dir_path( __FILE__ ) . 'wp-structuring-opening-hours.php' );
130
+ $obj = new Structuring_Markup_Meta_LocalBusiness();
131
+ $this->set_schema_json( $obj->set_meta( unserialize( $row->options ) ) );
132
+ }
133
+ break;
134
+ case 'news_article':
135
+ if ( isset( $row->options ) && $row->options ) {
136
+ require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-news-article.php' );
137
+ $obj = new Structuring_Markup_Meta_NewsArticle( $this->utility );
138
+ $this->set_schema_json( $obj->set_meta( unserialize( $row->options ) ) );
139
+ }
140
+ break;
141
+ case 'organization':
142
+ if ( isset( $row->options ) && $row->options ) {
143
+ require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-organization.php' );
144
+ $obj = new Structuring_Markup_Meta_Organization();
145
+ $this->set_schema_json( $obj->set_meta( unserialize( $row->options ) ) );
146
+ }
147
+ break;
148
+ case 'person':
149
+ if ( isset( $row->options ) && $row->options ) {
150
+ require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-person.php' );
151
+ $obj = new Structuring_Markup_Meta_Person();
152
+ $this->set_schema_json( $obj->set_meta( unserialize( $row->options ) ) );
153
+ }
154
+ break;
155
+ case 'site_navigation':
156
+ if ( isset( $row->options ) && $row->options ) {
157
+ require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-site-navigation.php' );
158
+ $obj = new Structuring_Markup_Meta_Site_Navigation();
159
+ $this->set_schema_json( $obj->set_meta( unserialize( $row->options ) ) );
160
+ }
161
+ break;
162
+ case 'video':
163
+ require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-video.php' );
164
+ $obj = new Structuring_Markup_Meta_Video( $this->utility );
165
+ $this->set_schema_json( $obj->set_meta() );
166
+ break;
167
+ case 'website':
168
+ if ( isset( $row->options ) && $row->options ) {
169
+ require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-website.php' );
170
+ $obj = new Structuring_Markup_Meta_WebSite();
171
+ $this->set_schema_json( $obj->set_meta( unserialize( $row->options ) ) );
172
+ }
173
+ break;
174
+ }
175
+ }
176
+ }
177
+ }
178
+ }
179
+
180
+ /**
181
+ * Setting JSON-LD Template
182
+ *
183
+ * @since 4.0.1
184
+ * @since 1.0.0
185
+ * @param array $args
186
+ * @param boolean $error
187
+ */
188
+ private function set_schema_json ( $args, $error = false ) {
189
+ if ( $error ) {
190
+ /** Error Display */
191
+ if ( isset( $args["@type"] ) ) {
192
+ foreach ( $args["message"] as $message ) {
193
+ echo "<!-- Schema.org ", $args["@type"], " : ", $message, " -->", PHP_EOL;
194
+ }
195
+ }
196
+ } else {
197
+ if ( is_array( $args ) ) {
198
+ echo '<script type="application/ld+json">', PHP_EOL;
199
+ echo json_encode( $args, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ), PHP_EOL;
200
+ echo '</script>', PHP_EOL;
201
+ }
202
+ }
203
+ }
204
+ }
trunk/includes/wp-structuring-opening-hours.php ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org openingHours
4
+ *
5
+ * @author Justin Frydman
6
+ * @version 2.4.0
7
+ * @since 2.4.0
8
+ * @see wp-structuring-display.php
9
+ * @link https://schema.org/openingHours
10
+ * @link https://schema.org/LocalBusiness
11
+ */
12
+ class Structuring_Markup_Opening_Hours {
13
+
14
+ /**
15
+ * Multidimensional array of days and opening hours
16
+ *
17
+ * @since 2.4.0
18
+ * @var array
19
+ */
20
+ protected $opening_hours;
21
+
22
+ /**
23
+ * List of days
24
+ *
25
+ * @since 2.4.0
26
+ * @var array
27
+ */
28
+ protected $days;
29
+
30
+ /**
31
+ * Grouped, unique hour periods
32
+ *
33
+ * @since 2.4.0
34
+ * @var array
35
+ */
36
+ protected $periods;
37
+
38
+ /**
39
+ * Days grouped with open-close hours
40
+ *
41
+ * @since 2.4.0
42
+ * @var array
43
+ */
44
+ protected $grouped_days;
45
+
46
+ /**
47
+ * Open/close hours grouped by Mo-Su
48
+ *
49
+ * @since 2.4.0
50
+ * @var array
51
+ */
52
+ protected $weekly_hours;
53
+
54
+ /**
55
+ * Constructor
56
+ *
57
+ * @since 2.4.0
58
+ * @param array $opening_hours
59
+ */
60
+ public function __construct ( array $opening_hours ) {
61
+ /** Default Value Set */
62
+ if ( !empty( $opening_hours ) ) {
63
+ $this->opening_hours = $opening_hours;
64
+ $this->init();
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Initialize the class
70
+ *
71
+ * @since 2.4.0
72
+ */
73
+ public function init () {
74
+ $this->days = array_keys( $this->opening_hours );
75
+ $this->periods = $this->group_periods();
76
+ $this->grouped_days = $this->group_periods_with_days();
77
+ $this->weekly_hours = $this->group_weekly_hours();
78
+ }
79
+
80
+ /**
81
+ * Groups unique open and closed hour periods
82
+ *
83
+ * @since 2.4.0
84
+ * @return array
85
+ */
86
+ public function group_periods () {
87
+ $periods = array();
88
+ foreach( $this->opening_hours as $day ) {
89
+ foreach( $day as $group ) {
90
+ if( !in_array( $group, $periods ) ) {
91
+ if( !empty( $group['open'] ) && !empty( $group['close'] ) ) {
92
+ $periods[] = $group;
93
+ }
94
+ }
95
+ }
96
+ }
97
+
98
+ return (array) $periods;
99
+ }
100
+
101
+ /**
102
+ * Groups day ranges with their opening hours
103
+ *
104
+ * @since 2.4.0
105
+ * @return array
106
+ */
107
+ public function group_periods_with_days () {
108
+ $periods = $this->periods;
109
+
110
+ foreach( $periods as $key => $group ) {
111
+ $days = array();
112
+
113
+ foreach( $this->opening_hours as $day => $grouped_days ) {
114
+ if( in_array( $group, $grouped_days) ) {
115
+ $days[] = $day;
116
+ }
117
+ }
118
+
119
+ $periods[$key]['days'] = $days;
120
+ }
121
+
122
+ return (array) $periods;
123
+ }
124
+
125
+ /**
126
+ * Group weekly group ranges with their opening hours
127
+ *
128
+ * @since 2.4.0
129
+ * @return array
130
+ */
131
+ public function group_weekly_hours () {
132
+ $grouped_days = $this->grouped_days;
133
+ $days = $this->days;
134
+ $object = $this;
135
+
136
+ return (array) array_reduce( $grouped_days, function($result, $group) use ( $days, $object ) {
137
+ return array_merge( $result, $object->group_periods_to_day_range( $group ) );
138
+ }, array() );
139
+ }
140
+
141
+ /**
142
+ * Groups days of the week with their opening hours
143
+ *
144
+ * @since 2.4.0
145
+ * @param array $group
146
+ * @return array
147
+ */
148
+ public function group_periods_to_day_range ( array $group ) {
149
+ $starting_day = null;
150
+ $ending_day = null;
151
+
152
+ $consecutive_days = array();
153
+
154
+ foreach( $this->days as $i => $day ) {
155
+ $has_day = in_array( $day, $group['days'] );
156
+
157
+ if( $has_day ) {
158
+ $starting_day = $starting_day ? $starting_day : $day;
159
+ $ending_day = $day;
160
+ }
161
+
162
+ if( $starting_day && (!$has_day || $i == count($this->days) - 1) ) {
163
+ $consecutive_days[] = array(
164
+ 'start' => $starting_day,
165
+ 'end' => $ending_day,
166
+ 'open' => $group['open'],
167
+ 'close' => $group['close']
168
+ );
169
+
170
+ $starting_day = null;
171
+ }
172
+ }
173
+
174
+ return (array) $this->sort_by_day_of_the_week( $consecutive_days );
175
+ }
176
+
177
+ /**
178
+ * Sorts our days in the proper weekly hour
179
+ *
180
+ * @since 2.4.0
181
+ * @param array $consecutive_days
182
+ * @return array
183
+ */
184
+ public function sort_by_day_of_the_week ( array $consecutive_days ) {
185
+ $days = $this->days;
186
+
187
+ arsort($consecutive_days);
188
+
189
+ $sort_by_day_func = function( $a, $b ) use ( $days ) {
190
+ $aKey = array_search( $a['start'], $days );
191
+ $bKey = array_search( $b['start'], $days );
192
+ return $aKey === $bKey ? 1 : $aKey < $bKey ? -1 : 1;
193
+ };
194
+
195
+ usort($consecutive_days, $sort_by_day_func);
196
+
197
+ return (array) $consecutive_days;
198
+ }
199
+
200
+ /**
201
+ * Displays formatted opening hours
202
+ *
203
+ * @since 2.4.0
204
+ * @return array
205
+ */
206
+ public function display () {
207
+ $opening_hours = array();
208
+
209
+ foreach( $this->weekly_hours as $key => $group ) {
210
+ if( $group['start'] != $group['end'] ) {
211
+ $hours = $group['start'].'-'.$group['end'];
212
+ } else {
213
+ $hours = $group['start'];
214
+ }
215
+
216
+ $hours .= ' ' . $group['open'] . '-' . $group['close'];
217
+
218
+ $opening_hours[] = $hours;
219
+ }
220
+
221
+ return (array) $opening_hours;
222
+ }
223
+
224
+ }
trunk/includes/wp-structuring-short-code-breadcrumb.php ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Breadcrumb ShortCode Settings
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.2.0
7
+ * @since 2.0.0
8
+ */
9
+ class Structuring_Markup_ShortCode_Breadcrumb {
10
+
11
+ /**
12
+ * ShortCode Display.
13
+ *
14
+ * @version 2.3.1
15
+ * @since 2.0.0
16
+ * @access public
17
+ * @param array $options
18
+ * @param string $args
19
+ * @return string $html
20
+ */
21
+ public function short_code_display ( array $options, $args ) {
22
+ extract( shortcode_atts( array (
23
+ 'id' => "",
24
+ 'class' => ""
25
+ ), $args ) );
26
+
27
+ $instance = array(
28
+ 'id' => esc_attr( $id ),
29
+ 'class' => esc_attr( $class )
30
+ );
31
+
32
+ $item_array = $this->breadcrumb_array_setting( $options );
33
+ $html = '';
34
+
35
+ if ( isset( $item_array ) && count( $item_array ) > 0 ) {
36
+ $html .= '<!-- Markup (JSON-LD) structured in schema.org Breadcrumb START -->' . PHP_EOL;
37
+
38
+ if ( $id !== '' && $class !== '' ) {
39
+ $html .= '<ol id="' . $id . '" class="' . $class . '">';
40
+ } else if ( $id !== '' && $class === '' ) {
41
+ $html .= '<ol id="' . $id . '">';
42
+ } else if ( $id === '' && $class !== '' ) {
43
+ $html .= '<ol class="' . $class . '">';
44
+ } else {
45
+ $html .= '<ol>';
46
+ }
47
+ $html .= PHP_EOL;
48
+ foreach ( $item_array as $item ) {
49
+ $html .= '<li>';
50
+ $html .= '<a href="' . esc_url( $item['@id'] ) . '">';
51
+ $html .= esc_html( $item['name'] );
52
+ $html .= '</a>';
53
+ $html .= '</li>' . PHP_EOL;
54
+ }
55
+ $html .= '</ol>' . PHP_EOL;
56
+ $html .= '<!-- Markup (JSON-LD) structured in schema.org Breadcrumb END -->' . PHP_EOL;
57
+ }
58
+
59
+ return (string) $html;
60
+ }
61
+
62
+ /**
63
+ * Breadcrumb array setting.
64
+ *
65
+ * @version 4.1.1
66
+ * @since 2.0.0
67
+ * @access public
68
+ * @param array $options
69
+ * @return array $item_array
70
+ */
71
+ public function breadcrumb_array_setting ( array $options ) {
72
+ global $post;
73
+
74
+ /** item build */
75
+ $item_array = array();
76
+ $current_url = esc_url( home_url() . $_SERVER['REQUEST_URI'] );
77
+
78
+ if ( get_option( 'show_on_front' ) == 'page' ) {
79
+ $front_page_id = get_option( 'page_on_front' );
80
+ } else {
81
+ $front_page_id = null;
82
+ }
83
+
84
+ if ( isset( $options['home_on'] ) && $options['home_on'] === 'on' ) {
85
+ if ( isset( $options['home_name'] ) && $options['home_name'] !== '' ) {
86
+ $item_array[] = $this->set_schema_breadcrumb_item( home_url(), $options['home_name'] );
87
+ } else {
88
+ if ( is_null( $front_page_id ) ) {
89
+ $item_array[] = $this->set_schema_breadcrumb_item( home_url(), get_bloginfo( 'name' ) );
90
+ } else {
91
+ $front_page = get_post( $front_page_id );
92
+ $item_array[] = $this->set_schema_breadcrumb_item( home_url(), esc_html( $front_page->post_title ) );
93
+ }
94
+ }
95
+ }
96
+
97
+ if ( is_search() ) {
98
+ $search_query = get_search_query();
99
+ if ( $search_query !== '' ) {
100
+ $item_array[] = $this->set_schema_breadcrumb_item( $current_url, get_search_query() );
101
+ }
102
+ } elseif ( is_tag() ) {
103
+ $item_array[] = $this->set_schema_breadcrumb_item( $current_url, single_tag_title( '', false ) );
104
+ } elseif ( is_date() ) {
105
+ $item_array[] = $this->set_schema_breadcrumb_item( get_year_link( get_query_var( 'year' ) ), get_query_var( 'year' ) );
106
+ if ( get_query_var( 'day' ) !== 0 ) {
107
+ $item_array[] = $this->set_schema_breadcrumb_item( get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) ), get_query_var( 'monthnum' ) );
108
+ $item_array[] = $this->set_schema_breadcrumb_item( get_day_link( get_query_var( 'year' ), get_query_var( 'monthnum' ), get_query_var( 'day' ) ), get_query_var( 'day' ) );
109
+ } elseif ( get_query_var( 'monthnum' ) !== 0 ) {
110
+ $item_array[] = $this->set_schema_breadcrumb_item( get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) ), get_query_var( 'monthnum' ) );
111
+ }
112
+ } elseif ( is_category() ) {
113
+ $categories = get_queried_object();
114
+ if( $categories->parent !== 0 ) {
115
+ $ancestors = array_reverse( get_ancestors( $categories->cat_ID, 'category' ) );
116
+ foreach( $ancestors as $ancestor ) {
117
+ $item_array[] = $this->set_schema_breadcrumb_item( get_category_link( $ancestor ), get_cat_name( $ancestor ) );
118
+ }
119
+ }
120
+ $item_array[] = $this->set_schema_breadcrumb_item( get_category_link( $categories->term_id ), $categories->name );
121
+ } elseif ( is_author() ) {
122
+ $item_array[] = $this->set_schema_breadcrumb_item( $current_url, get_the_author_meta( 'display_name', get_query_var( 'author' ) ) );
123
+ } elseif ( is_page() && $front_page_id != $post->ID ) {
124
+ if( $post->post_parent !== 0 ) {
125
+ $ancestors = array_reverse( get_post_ancestors( $post->ID ) );
126
+ foreach( $ancestors as $ancestor ){
127
+ $item_array[] = $this->set_schema_breadcrumb_item( get_permalink( $ancestor ), get_the_title( $ancestor ) );
128
+ }
129
+ }
130
+ $item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
131
+ } elseif ( is_attachment() ) {
132
+ if ( $post->post_parent !== 0 ) {
133
+ $item_array[] = $this->set_schema_breadcrumb_item( get_permalink( $post->post_parent ), get_the_title( $post->post_parent ) );
134
+ }
135
+ $item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
136
+ } elseif ( is_404() ) {
137
+ $item_array[] = $this->set_schema_breadcrumb_item( $current_url, '404 Not Found' );
138
+ } elseif ( is_post_type_archive() ) {
139
+ if ( get_post_type_archive_link( get_post_type() ) ) {
140
+ $item_array[] = $this->set_schema_breadcrumb_item( get_post_type_archive_link( get_post_type() ), post_type_archive_title( '', false) );
141
+ }
142
+ } elseif ( is_archive() ) {
143
+ if ( get_post_type_archive_link( get_post_type() ) ) {
144
+ $item_array[] = $this->set_schema_breadcrumb_item( get_post_type_archive_link( get_post_type() ), get_post_type_object( get_post_type() )->label );
145
+ }
146
+ if( is_tax() ){
147
+ $tax_slug = get_query_var( 'taxonomy' );
148
+ $term_slug = get_query_var( 'term' );
149
+ $term = get_term_by( "slug", $term_slug, $tax_slug );
150
+
151
+ if( $term->parent !== 0 ) {
152
+ $ancestors = array_reverse( get_ancestors( $term->term_taxonomy_id, $tax_slug ) );
153
+ foreach( $ancestors as $ancestor ) {
154
+ $item_array[] = $this->set_schema_breadcrumb_item( get_category_link( $ancestor ), get_cat_name( $ancestor ) );
155
+ }
156
+ }
157
+ $item_array[] = $this->set_schema_breadcrumb_item( get_term_link( $term_slug, $tax_slug ), esc_html( $term->name ) );
158
+ }
159
+ } elseif ( is_singular( 'post' ) ) {
160
+ $args = $this->set_taxonomy_item( $post->ID, 'category' );
161
+ if ( count( $args ) > 0 ) {
162
+ $item_array = array_merge( $item_array, $args );
163
+ }
164
+ $item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
165
+ } elseif ( is_single() ) {
166
+ if ( get_post_type_archive_link( get_post_type() ) ) {
167
+ $item_array[] = $this->set_schema_breadcrumb_item( get_post_type_archive_link( get_post_type() ), get_post_type_object( get_post_type() )->label );
168
+ }
169
+ $taxonomy_names = get_post_taxonomies();
170
+ if ( count( $taxonomy_names ) > 0 ) {
171
+ $args = $this->set_taxonomy_item( $post->ID, $taxonomy_names[0] );
172
+ if ( count( $args ) > 0 ) {
173
+ $item_array = array_merge( $item_array, $args );
174
+ }
175
+ }
176
+ $item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
177
+ }
178
+
179
+ if ( !isset( $options['current_on'] ) || $options['current_on'] !== 'on' ) {
180
+ array_pop( $item_array );
181
+ }
182
+
183
+ return (array) $item_array;
184
+ }
185
+
186
+ /**
187
+ * taxonomy item settings
188
+ *
189
+ * @version 4.2.0
190
+ * @since 4.0.0
191
+ * @param int $id
192
+ * @param string $taxonomy
193
+ * @return array $args
194
+ */
195
+ private function set_taxonomy_item ( $id, $taxonomy ) {
196
+ $terms = get_the_terms( $id, $taxonomy );
197
+ $term_bottom = array();
198
+ $args = array();
199
+
200
+ if ( $terms && ! is_wp_error( $terms ) ) {
201
+ $parent_ids = array();
202
+
203
+ foreach ( $terms as $term ) {
204
+ if ( $term->parent != 0 ) {
205
+ $parent_ids[] = $term->parent;
206
+ }
207
+ }
208
+ foreach ( $terms as $term ) {
209
+ if ( !in_array( $term->term_id, $parent_ids ) ) {
210
+ $term_bottom[] = $term->term_id;
211
+ }
212
+ }
213
+ }
214
+
215
+ if ( count( $term_bottom ) > 0 ) {
216
+ $ancestors = array_reverse( get_ancestors( $term_bottom[0], $taxonomy ) );
217
+ $ancestors[] = $term_bottom[0];
218
+
219
+ foreach ( $ancestors as $ancestor ) {
220
+ $term = get_term( $ancestor, $taxonomy );
221
+ $args[] = $this->set_schema_breadcrumb_item( esc_url( get_term_link( $ancestor ) ), esc_html( $term->name ) );
222
+ }
223
+ }
224
+ return (array) $args;
225
+ }
226
+
227
+ /**
228
+ * Breadcrumb item settings
229
+ *
230
+ * @version 2.0.0
231
+ * @since 2.0.0
232
+ * @param string $id
233
+ * @param string $name
234
+ * @return array $args
235
+ */
236
+ private function set_schema_breadcrumb_item ( $id, $name ) {
237
+ $args = array(
238
+ "@id" => esc_url( $id ),
239
+ "name" => esc_html( $name )
240
+ );
241
+ return (array) $args;
242
+ }
243
+ }
trunk/includes/wp-structuring-utility.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Utility
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.1.0
7
+ * @since 4.0.0
8
+ */
9
+ class Structuring_Markup_Utility {
10
+
11
+ /**
12
+ * Escape Text
13
+ *
14
+ * @version 4.0.0
15
+ * @since 4.0.0
16
+ * @param string $text
17
+ * @return string $text
18
+ */
19
+ public function escape_text ( $text ) {
20
+ $text = strip_tags( $text );
21
+ $text = strip_shortcodes( $text );
22
+ $text = str_replace( array( "\r", "\n" ), '', $text );
23
+
24
+ return (string) $text;
25
+ }
26
+
27
+ /**
28
+ * Return image dimensions
29
+ *
30
+ * @version 4.0.0
31
+ * @since 4.0.0
32
+ * @author Kazuya Takami
33
+ * @param string $url
34
+ * @return array | boolean $dimensions
35
+ */
36
+ public function get_image_dimensions ( $url ) {
37
+ $image = wp_get_image_editor( $url );
38
+
39
+ if ( ! is_wp_error( $image ) ) {
40
+ return $image->get_size();
41
+ } else {
42
+ return __return_false();
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Return image dimensions
48
+ *
49
+ * @version 4.1.0
50
+ * @since 4.1.0
51
+ * @author Kazuya Takami
52
+ * @param string $content
53
+ * @return array | boolean $images
54
+ */
55
+ public function get_content_image ( $content ) {
56
+ $pattern = '/<img.*?src\s*=\s*[\"|\'](.*?)[\"|\'].*?>/i';
57
+
58
+ if ( preg_match( $pattern, $content, $images ) ){
59
+ if ( is_array( $images ) && isset( $images[1] ) ) {
60
+ return $images[1];
61
+ } else {
62
+ return __return_false();
63
+ }
64
+ } else {
65
+ return __return_false();
66
+ }
67
+ }
68
+ }
trunk/js/main.js ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Markup (JSON-LD) structured in schema.org */
2
+ jQuery(document).ready(function ($) {
3
+ 'use strict';
4
+
5
+ // add row
6
+ $('.schema-admin-table').on('click', '.markup-time.plus', function () {
7
+ var newRow = $(this).closest('tr.opening-hours').clone();
8
+ $(this).closest('tr.opening-hours').after(newRow);
9
+ newRow.find('input').val('');
10
+ newRow.find('.minus').show();
11
+ newRow.find('input').each(function () {
12
+ var
13
+ name = $(this).prop('name'),
14
+ currentIndex = parseInt(name.split('][')[2], 10),
15
+ nextIndex = currentIndex + 1;
16
+
17
+ if (currentIndex === 0) {
18
+ $(this).parent().find('.plus:last-child').after('<a class="dashicons dashicons-minus markup-time minus"></a>');
19
+ }
20
+ $(this).prop('name', name.replace(currentIndex, nextIndex));
21
+ });
22
+ });
23
+
24
+ // remove row
25
+ $('.schema-admin-table').on('click', '.markup-time.minus', function () {
26
+ $(this).closest('tr.opening-hours').fadeOut('normal', function () {
27
+ $(this).remove();
28
+ });
29
+ });
30
+ });
trunk/js/main.min.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(document).ready(function(n){"use strict";n(".schema-admin-table").on("click",".markup-time.plus",function(){var i=n(this).closest("tr.opening-hours").clone();n(this).closest("tr.opening-hours").after(i),i.find("input").val(""),i.find(".minus").show(),i.find("input").each(function(){var i=n(this).prop("name"),s=parseInt(i.split("][")[2],10),t=s+1;0===s&&n(this).parent().find(".plus:last-child").after('<a class="dashicons dashicons-minus markup-time minus"></a>'),n(this).prop("name",i.replace(s,t))})}),n(".schema-admin-table").on("click",".markup-time.minus",function(){n(this).closest("tr.opening-hours").fadeOut("normal",function(){n(this).remove()})})});
trunk/js/media-uploader-main.js ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($) {
2
+ $(function() {
3
+ var custom_uploader = wp.media({
4
+ title: 'Choose Image',
5
+ library: {
6
+ type: 'image'
7
+ },
8
+ button: {
9
+ text: 'Choose Image'
10
+ },
11
+ multiple: false
12
+ });
13
+
14
+ custom_uploader.on("select", function () {
15
+ var images = custom_uploader.state().get('selection');
16
+
17
+ images.each(function(file) {
18
+ $("#logo").val(file.toJSON().url);
19
+ $("#logo-width").val(file.toJSON().width);
20
+ $("#logo-height").val(file.toJSON().height);
21
+ });
22
+ });
23
+
24
+ $("#media-upload").on("click", function(e) {
25
+ e.preventDefault();
26
+ custom_uploader.open();
27
+ });
28
+ });
29
+ })(jQuery);
trunk/languages/wp-structuring-markup-ja.mo ADDED
Binary file
trunk/languages/wp-structuring-markup-ja.po ADDED
@@ -0,0 +1,217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2016 Markup (JSON-LD) structured in schema.org
2
+ # This file is distributed under the same license as the Markup (JSON-LD) structured in schema.org package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Markup (JSON-LD) structured in schema.org 3.0.0\n"
6
+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-structuring-"
7
+ "markup\n"
8
+ "POT-Creation-Date: 2016-06-20 10:36:01+00:00\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: Kazuya Takami <foundationmeister@outlook.com>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+
16
+ #: includes/wp-structuring-admin-list.php:43
17
+ msgid "Schema.org Settings List"
18
+ msgstr "Schema.org 設定一覧"
19
+
20
+ #: includes/wp-structuring-admin-list.php:50
21
+ msgid "Status"
22
+ msgstr "Status"
23
+
24
+ #: includes/wp-structuring-admin-list.php:51
25
+ msgid "Schema.org Type"
26
+ msgstr "Schema.org タイプ"
27
+
28
+ #: includes/wp-structuring-admin-list.php:52
29
+ #: includes/wp-structuring-admin-post.php:142
30
+ msgid "Output On"
31
+ msgstr "出力ページ"
32
+
33
+ #: includes/wp-structuring-admin-list.php:53
34
+ msgid "ShortCode"
35
+ msgstr "ショートコード"
36
+
37
+ #: includes/wp-structuring-admin-list.php:81 wp-structuring-markup.php:159
38
+ msgid "Edit"
39
+ msgstr "編集"
40
+
41
+ #: includes/wp-structuring-admin-list.php:87
42
+ msgid "Without registration."
43
+ msgstr "登録されていません。"
44
+
45
+ #: includes/wp-structuring-admin-post.php:117
46
+ msgid "Schema.org Register"
47
+ msgstr "Schema.org 登録"
48
+
49
+ #: includes/wp-structuring-admin-post.php:147
50
+ #: includes/wp-structuring-admin-post.php:158
51
+ #: includes/wp-structuring-admin-post.php:187
52
+ #: includes/wp-structuring-admin-post.php:199
53
+ #: includes/wp-structuring-admin-post.php:213
54
+ #: includes/wp-structuring-admin-post.php:227
55
+ #: includes/wp-structuring-admin-post.php:249
56
+ msgid "Posts"
57
+ msgstr "投稿ページ"
58
+
59
+ #: includes/wp-structuring-admin-post.php:148
60
+ #: includes/wp-structuring-admin-post.php:159
61
+ #: includes/wp-structuring-admin-post.php:188
62
+ #: includes/wp-structuring-admin-post.php:200
63
+ #: includes/wp-structuring-admin-post.php:214
64
+ #: includes/wp-structuring-admin-post.php:228
65
+ #: includes/wp-structuring-admin-post.php:250
66
+ msgid "Pages"
67
+ msgstr "固定ページ"
68
+
69
+ #: includes/wp-structuring-admin-post.php:169
70
+ #: includes/wp-structuring-admin-post.php:185
71
+ #: includes/wp-structuring-admin-post.php:211
72
+ #: includes/wp-structuring-admin-post.php:225
73
+ #: includes/wp-structuring-admin-post.php:247
74
+ msgid "All Pages (In Header)"
75
+ msgstr "全てのページ(ヘッダー)"
76
+
77
+ #: includes/wp-structuring-admin-post.php:177
78
+ msgid "Event Post Page"
79
+ msgstr "イベント投稿ページ"
80
+
81
+ #: includes/wp-structuring-admin-post.php:186
82
+ #: includes/wp-structuring-admin-post.php:212
83
+ #: includes/wp-structuring-admin-post.php:226
84
+ #: includes/wp-structuring-admin-post.php:248
85
+ msgid "Homepage"
86
+ msgstr "ホームページ"
87
+
88
+ #: includes/wp-structuring-admin-post.php:239
89
+ msgid "Video Post Page"
90
+ msgstr "ビデオ投稿ページ"
91
+
92
+ #: includes/wp-structuring-admin-post.php:295
93
+ msgid "Output On(Custom Posts)"
94
+ msgstr "出力ページ(カスタム投稿)"
95
+
96
+ #: includes/wp-structuring-custom-post-event.php:34
97
+ #: includes/wp-structuring-custom-post-event.php:35
98
+ msgid "Event Posts"
99
+ msgstr "イベント投稿"
100
+
101
+ #: includes/wp-structuring-custom-post-event.php:36
102
+ msgid "All Event Posts"
103
+ msgstr "イベント投稿一覧"
104
+
105
+ #: includes/wp-structuring-custom-post-event.php:74
106
+ msgid "Schema.org Type Event"
107
+ msgstr "Schema.org Type Event"
108
+
109
+ #: includes/wp-structuring-custom-post-event.php:96
110
+ msgid "USD"
111
+ msgstr "JPY"
112
+
113
+ #: includes/wp-structuring-custom-post-event.php:101
114
+ msgid "Event Name"
115
+ msgstr "イベント名"
116
+
117
+ #: includes/wp-structuring-custom-post-event.php:106
118
+ msgid "Start Date"
119
+ msgstr "開始日"
120
+
121
+ #: includes/wp-structuring-custom-post-event.php:112
122
+ msgid "Event URL"
123
+ msgstr "イベントURL"
124
+
125
+ #: includes/wp-structuring-custom-post-event.php:117
126
+ msgid "Place Name"
127
+ msgstr "場所名"
128
+
129
+ #: includes/wp-structuring-custom-post-event.php:122
130
+ msgid "Place URL"
131
+ msgstr "会場URL"
132
+
133
+ #: includes/wp-structuring-custom-post-event.php:127
134
+ msgid "Place Address"
135
+ msgstr "会場住所"
136
+
137
+ #: includes/wp-structuring-custom-post-event.php:132
138
+ msgid "Price"
139
+ msgstr "参加費"
140
+
141
+ #: includes/wp-structuring-custom-post-event.php:137
142
+ msgid "Currency"
143
+ msgstr "通貨"
144
+
145
+ #: includes/wp-structuring-custom-post-video.php:34
146
+ #: includes/wp-structuring-custom-post-video.php:35
147
+ msgid "Video Posts"
148
+ msgstr "ビデオ投稿"
149
+
150
+ #: includes/wp-structuring-custom-post-video.php:36
151
+ msgid "All Video Posts"
152
+ msgstr "ビデオ投稿一覧"
153
+
154
+ #: includes/wp-structuring-custom-post-video.php:74
155
+ msgid "Schema.org Type Video"
156
+ msgstr "Schema.org Type Video"
157
+
158
+ #: includes/wp-structuring-custom-post-video.php:98
159
+ msgid "duration"
160
+ msgstr "所要時間"
161
+
162
+ #: includes/wp-structuring-custom-post-video.php:103
163
+ msgid "contentURL"
164
+ msgstr "コンテンツURL"
165
+
166
+ #: includes/wp-structuring-custom-post-video.php:108
167
+ msgid "embedURL"
168
+ msgstr "embedURL"
169
+
170
+ #: includes/wp-structuring-custom-post-video.php:113
171
+ msgid "interactionCount"
172
+ msgstr "ビデオ視聴回数"
173
+
174
+ #: includes/wp-structuring-custom-post-video.php:118
175
+ msgid "expires"
176
+ msgstr "有効期限"
177
+
178
+ #: includes/wp-structuring-display.php:309
179
+ #: includes/wp-structuring-display.php:373
180
+ #: includes/wp-structuring-display.php:630
181
+ #: includes/wp-structuring-display.php:767
182
+ msgid "Featured Image not set."
183
+ msgstr "アイキャッチ画像が設定されていません。"
184
+
185
+ #: includes/wp-structuring-display.php:312
186
+ #: includes/wp-structuring-display.php:376
187
+ #: includes/wp-structuring-display.php:633
188
+ msgid "Logo Image not set."
189
+ msgstr "ロゴ画像が設定されていません。"
190
+
191
+ #: wp-structuring-markup.php:150 wp-structuring-markup.php:151
192
+ msgid "Schema.org Settings"
193
+ msgstr "Schema.org 設定"
194
+
195
+ #: wp-structuring-markup.php:158
196
+ msgid "Schema.org Setting Edit"
197
+ msgstr "Schema.org 設定編集"
198
+
199
+ #. Plugin Name of the plugin/theme
200
+ msgid "Markup (JSON-LD) structured in schema.org"
201
+ msgstr "Markup (JSON-LD) structured in schema.org"
202
+
203
+ #. Plugin URI of the plugin/theme
204
+ msgid "https://wordpress.org/plugins/wp-structuring-markup/"
205
+ msgstr "https://wordpress.org/plugins/wp-structuring-markup/"
206
+
207
+ #. Description of the plugin/theme
208
+ msgid "Allows you to include Schema.org JSON-LD syntax markup on your website"
209
+ msgstr "ウェブサイト上でSchema.orgをJSON-LD構文で簡単に導入することができます"
210
+
211
+ #. Author of the plugin/theme
212
+ msgid "Kazuya Takami"
213
+ msgstr "Kazuya Takami"
214
+
215
+ #. Author URI of the plugin/theme
216
+ msgid "http://programp.com/"
217
+ msgstr "http://programp.com/"
trunk/languages/wp-structuring-markup-tr_TR.mo ADDED
Binary file
trunk/languages/wp-structuring-markup-tr_TR.po ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2016 Markup (JSON-LD) structured in schema.org
2
+ # This file is distributed under the same license as the Markup (JSON-LD) structured in schema.org package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Markup (JSON-LD) structured in schema.org 2.4.1\n"
6
+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-structuring-"
7
+ "markup\n"
8
+ "POT-Creation-Date: 2016-03-01 08:58:28+00:00\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "PO-Revision-Date: 2016-03-08 03:21+0200\n"
13
+ "Last-Translator: Keremcan Buyuktaskin <keremcan@gmail.com>\n"
14
+ "Language-Team: Keremcan Buyuktaskin <keremcan@gmail.com>\n"
15
+ "Plural-Forms: nplurals=1; plural=0;\n"
16
+ "Language: tr_TR\n"
17
+ "X-Generator: Poedit 1.6.6\n"
18
+ "X-Poedit-Basepath: D:\\Google Drive\\Sites\\Tayland Gezi\\wp-content\\plugins"
19
+ "\\wp-structuring-markup\n"
20
+
21
+ #: includes/wp-structuring-admin-list.php:43
22
+ msgid "Schema.org Settings List"
23
+ msgstr "Schema.org Ayarları Listesi"
24
+
25
+ #: includes/wp-structuring-admin-list.php:50
26
+ msgid "Status"
27
+ msgstr "Durum"
28
+
29
+ #: includes/wp-structuring-admin-list.php:51
30
+ msgid "Schema Type"
31
+ msgstr "Şema Tipi"
32
+
33
+ #: includes/wp-structuring-admin-list.php:52
34
+ #: includes/wp-structuring-admin-post.php:115
35
+ msgid "Output On"
36
+ msgstr "Devredeki Çıktı"
37
+
38
+ #: includes/wp-structuring-admin-list.php:53
39
+ msgid "ShortCode"
40
+ msgstr "Kısa Kod"
41
+
42
+ #: includes/wp-structuring-admin-list.php:81 wp-structuring-markup.php:155
43
+ msgid "Edit"
44
+ msgstr "Düzenle"
45
+
46
+ #: includes/wp-structuring-admin-list.php:87
47
+ msgid "Without registration."
48
+ msgstr "Kayıt olmadan."
49
+
50
+ #: includes/wp-structuring-admin-post.php:90
51
+ msgid "Schema.org Register"
52
+ msgstr "Schema.org Kayıt"
53
+
54
+ #: includes/wp-structuring-admin-post.php:120
55
+ #: includes/wp-structuring-admin-post.php:128
56
+ #: includes/wp-structuring-admin-post.php:154
57
+ #: includes/wp-structuring-admin-post.php:163
58
+ #: includes/wp-structuring-admin-post.php:173
59
+ #: includes/wp-structuring-admin-post.php:184
60
+ #: includes/wp-structuring-admin-post.php:195
61
+ msgid "Posts"
62
+ msgstr "Yazılar"
63
+
64
+ #: includes/wp-structuring-admin-post.php:136
65
+ #: includes/wp-structuring-admin-post.php:152
66
+ #: includes/wp-structuring-admin-post.php:171
67
+ #: includes/wp-structuring-admin-post.php:182
68
+ #: includes/wp-structuring-admin-post.php:193
69
+ msgid "All Pages (In Header)"
70
+ msgstr "Tüm Sayfalar (Üst Kısımda)"
71
+
72
+ #: includes/wp-structuring-admin-post.php:144
73
+ msgid "Event Post Page"
74
+ msgstr "Etkinlik Yazı Sayfası"
75
+
76
+ #: includes/wp-structuring-admin-post.php:153
77
+ #: includes/wp-structuring-admin-post.php:172
78
+ #: includes/wp-structuring-admin-post.php:183
79
+ #: includes/wp-structuring-admin-post.php:194
80
+ msgid "Homepage"
81
+ msgstr "Ana Sayfa"
82
+
83
+ #: includes/wp-structuring-admin-post.php:155
84
+ #: includes/wp-structuring-admin-post.php:174
85
+ #: includes/wp-structuring-admin-post.php:185
86
+ #: includes/wp-structuring-admin-post.php:196
87
+ msgid "Pages"
88
+ msgstr "Sayfalar"
89
+
90
+ #: includes/wp-structuring-custom-post-event.php:34
91
+ #: includes/wp-structuring-custom-post-event.php:35
92
+ msgid "Event Posts"
93
+ msgstr "Etkinlik Yazıları"
94
+
95
+ #: includes/wp-structuring-custom-post-event.php:73
96
+ msgid "Schema.org Type Event"
97
+ msgstr "Schema.org Tip Etkinliği"
98
+
99
+ #: includes/wp-structuring-custom-post-event.php:95
100
+ msgid "USD"
101
+ msgstr "USD"
102
+
103
+ #: includes/wp-structuring-custom-post-event.php:100
104
+ msgid "Event Name"
105
+ msgstr "Etkinlik Adı"
106
+
107
+ #: includes/wp-structuring-custom-post-event.php:105
108
+ msgid "Start Date"
109
+ msgstr "Başlangıç Tarihi"
110
+
111
+ #: includes/wp-structuring-custom-post-event.php:111
112
+ msgid "Event URL"
113
+ msgstr "Etkinlik URL'si"
114
+
115
+ #: includes/wp-structuring-custom-post-event.php:116
116
+ msgid "Place Name"
117
+ msgstr "Yer Adı"
118
+
119
+ #: includes/wp-structuring-custom-post-event.php:121
120
+ msgid "Place URL"
121
+ msgstr "Yer URL'si"
122
+
123
+ #: includes/wp-structuring-custom-post-event.php:126
124
+ msgid "Place Address"
125
+ msgstr "Yer Adresi"
126
+
127
+ #: includes/wp-structuring-custom-post-event.php:131
128
+ msgid "Price"
129
+ msgstr "Fiyat"
130
+
131
+ #: includes/wp-structuring-custom-post-event.php:136
132
+ msgid "Currency"
133
+ msgstr "Para Birimi"
134
+
135
+ #: wp-structuring-markup.php:146 wp-structuring-markup.php:147
136
+ msgid "Schema.org Settings"
137
+ msgstr "Schema.org Ayarları"
138
+
139
+ #: wp-structuring-markup.php:154
140
+ msgid "Schema.org Setting Edit"
141
+ msgstr "Schema.org Ayarları Düzenle"
142
+
143
+ #. Plugin Name of the plugin/theme
144
+ msgid "Markup (JSON-LD) structured in schema.org"
145
+ msgstr "Markup (JSON-LD) structured in schema.org"
146
+
147
+ #. Plugin URI of the plugin/theme
148
+ msgid "https://wordpress.org/plugins/wp-structuring-markup/"
149
+ msgstr "https://wordpress.org/plugins/wp-structuring-markup/"
150
+
151
+ #. Description of the plugin/theme
152
+ msgid "Allows you to include schema.org JSON-LD syntax markup on your website"
153
+ msgstr ""
154
+ "Web sitenizde schema.org JSON-LD sözdizimi biçimlendirmesini dahil etmenize "
155
+ "izin verir"
156
+
157
+ #. Author of the plugin/theme
158
+ msgid "Kazuya Takami"
159
+ msgstr "Kazuya Takami"
160
+
161
+ #. Author URI of the plugin/theme
162
+ msgid "http://programp.com/"
163
+ msgstr "http://programp.com/"
trunk/languages/wp-structuring-markup.pot ADDED
@@ -0,0 +1,217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2016 Markup (JSON-LD) structured in schema.org
2
+ # This file is distributed under the same license as the Markup (JSON-LD) structured in schema.org package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Markup (JSON-LD) structured in schema.org 3.0.0\n"
6
+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-structuring-"
7
+ "markup\n"
8
+ "POT-Creation-Date: 2016-06-20 10:36:01+00:00\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: Kazuya Takami <foundationmeister@outlook.com>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+
16
+ #: includes/wp-structuring-admin-list.php:43
17
+ msgid "Schema.org Settings List"
18
+ msgstr ""
19
+
20
+ #: includes/wp-structuring-admin-list.php:50
21
+ msgid "Status"
22
+ msgstr ""
23
+
24
+ #: includes/wp-structuring-admin-list.php:51
25
+ msgid "Schema.org Type"
26
+ msgstr ""
27
+
28
+ #: includes/wp-structuring-admin-list.php:52
29
+ #: includes/wp-structuring-admin-post.php:142
30
+ msgid "Output On"
31
+ msgstr ""
32
+
33
+ #: includes/wp-structuring-admin-list.php:53
34
+ msgid "ShortCode"
35
+ msgstr ""
36
+
37
+ #: includes/wp-structuring-admin-list.php:81 wp-structuring-markup.php:159
38
+ msgid "Edit"
39
+ msgstr ""
40
+
41
+ #: includes/wp-structuring-admin-list.php:87
42
+ msgid "Without registration."
43
+ msgstr ""
44
+
45
+ #: includes/wp-structuring-admin-post.php:117
46
+ msgid "Schema.org Register"
47
+ msgstr ""
48
+
49
+ #: includes/wp-structuring-admin-post.php:147
50
+ #: includes/wp-structuring-admin-post.php:158
51
+ #: includes/wp-structuring-admin-post.php:187
52
+ #: includes/wp-structuring-admin-post.php:199
53
+ #: includes/wp-structuring-admin-post.php:213
54
+ #: includes/wp-structuring-admin-post.php:227
55
+ #: includes/wp-structuring-admin-post.php:249
56
+ msgid "Posts"
57
+ msgstr ""
58
+
59
+ #: includes/wp-structuring-admin-post.php:148
60
+ #: includes/wp-structuring-admin-post.php:159
61
+ #: includes/wp-structuring-admin-post.php:188
62
+ #: includes/wp-structuring-admin-post.php:200
63
+ #: includes/wp-structuring-admin-post.php:214
64
+ #: includes/wp-structuring-admin-post.php:228
65
+ #: includes/wp-structuring-admin-post.php:250
66
+ msgid "Pages"
67
+ msgstr ""
68
+
69
+ #: includes/wp-structuring-admin-post.php:169
70
+ #: includes/wp-structuring-admin-post.php:185
71
+ #: includes/wp-structuring-admin-post.php:211
72
+ #: includes/wp-structuring-admin-post.php:225
73
+ #: includes/wp-structuring-admin-post.php:247
74
+ msgid "All Pages (In Header)"
75
+ msgstr ""
76
+
77
+ #: includes/wp-structuring-admin-post.php:177
78
+ msgid "Event Post Page"
79
+ msgstr ""
80
+
81
+ #: includes/wp-structuring-admin-post.php:186
82
+ #: includes/wp-structuring-admin-post.php:212
83
+ #: includes/wp-structuring-admin-post.php:226
84
+ #: includes/wp-structuring-admin-post.php:248
85
+ msgid "Homepage"
86
+ msgstr ""
87
+
88
+ #: includes/wp-structuring-admin-post.php:239
89
+ msgid "Video Post Page"
90
+ msgstr ""
91
+
92
+ #: includes/wp-structuring-admin-post.php:295
93
+ msgid "Output On(Custom Posts)"
94
+ msgstr ""
95
+
96
+ #: includes/wp-structuring-custom-post-event.php:34
97
+ #: includes/wp-structuring-custom-post-event.php:35
98
+ msgid "Event Posts"
99
+ msgstr ""
100
+
101
+ #: includes/wp-structuring-custom-post-event.php:36
102
+ msgid "All Event Posts"
103
+ msgstr ""
104
+
105
+ #: includes/wp-structuring-custom-post-event.php:74
106
+ msgid "Schema.org Type Event"
107
+ msgstr ""
108
+
109
+ #: includes/wp-structuring-custom-post-event.php:96
110
+ msgid "USD"
111
+ msgstr ""
112
+
113
+ #: includes/wp-structuring-custom-post-event.php:101
114
+ msgid "Event Name"
115
+ msgstr ""
116
+
117
+ #: includes/wp-structuring-custom-post-event.php:106
118
+ msgid "Start Date"
119
+ msgstr ""
120
+
121
+ #: includes/wp-structuring-custom-post-event.php:112
122
+ msgid "Event URL"
123
+ msgstr ""
124
+
125
+ #: includes/wp-structuring-custom-post-event.php:117
126
+ msgid "Place Name"
127
+ msgstr ""
128
+
129
+ #: includes/wp-structuring-custom-post-event.php:122
130
+ msgid "Place URL"
131
+ msgstr ""
132
+
133
+ #: includes/wp-structuring-custom-post-event.php:127
134
+ msgid "Place Address"
135
+ msgstr ""
136
+
137
+ #: includes/wp-structuring-custom-post-event.php:132
138
+ msgid "Price"
139
+ msgstr ""
140
+
141
+ #: includes/wp-structuring-custom-post-event.php:137
142
+ msgid "Currency"
143
+ msgstr ""
144
+
145
+ #: includes/wp-structuring-custom-post-video.php:34
146
+ #: includes/wp-structuring-custom-post-video.php:35
147
+ msgid "Video Posts"
148
+ msgstr ""
149
+
150
+ #: includes/wp-structuring-custom-post-video.php:36
151
+ msgid "All Video Posts"
152
+ msgstr ""
153
+
154
+ #: includes/wp-structuring-custom-post-video.php:74
155
+ msgid "Schema.org Type Video"
156
+ msgstr ""
157
+
158
+ #: includes/wp-structuring-custom-post-video.php:98
159
+ msgid "duration"
160
+ msgstr ""
161
+
162
+ #: includes/wp-structuring-custom-post-video.php:103
163
+ msgid "contentURL"
164
+ msgstr ""
165
+
166
+ #: includes/wp-structuring-custom-post-video.php:108
167
+ msgid "embedURL"
168
+ msgstr ""
169
+
170
+ #: includes/wp-structuring-custom-post-video.php:113
171
+ msgid "interactionCount"
172
+ msgstr ""
173
+
174
+ #: includes/wp-structuring-custom-post-video.php:118
175
+ msgid "expires"
176
+ msgstr ""
177
+
178
+ #: includes/wp-structuring-display.php:309
179
+ #: includes/wp-structuring-display.php:373
180
+ #: includes/wp-structuring-display.php:630
181
+ #: includes/wp-structuring-display.php:767
182
+ msgid "Featured Image not set."
183
+ msgstr ""
184
+
185
+ #: includes/wp-structuring-display.php:312
186
+ #: includes/wp-structuring-display.php:376
187
+ #: includes/wp-structuring-display.php:633
188
+ msgid "Logo Image not set."
189
+ msgstr ""
190
+
191
+ #: wp-structuring-markup.php:150 wp-structuring-markup.php:151
192
+ msgid "Schema.org Settings"
193
+ msgstr ""
194
+
195
+ #: wp-structuring-markup.php:158
196
+ msgid "Schema.org Setting Edit"
197
+ msgstr ""
198
+
199
+ #. Plugin Name of the plugin/theme
200
+ msgid "Markup (JSON-LD) structured in schema.org"
201
+ msgstr ""
202
+
203
+ #. Plugin URI of the plugin/theme
204
+ msgid "https://wordpress.org/plugins/wp-structuring-markup/"
205
+ msgstr ""
206
+
207
+ #. Description of the plugin/theme
208
+ msgid "Allows you to include schema.org JSON-LD syntax markup on your website"
209
+ msgstr ""
210
+
211
+ #. Author of the plugin/theme
212
+ msgid "Kazuya Takami"
213
+ msgstr ""
214
+
215
+ #. Author URI of the plugin/theme
216
+ msgid "http://programp.com/"
217
+ msgstr ""
trunk/readme.txt ADDED
@@ -0,0 +1,325 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Markup (JSON-LD) structured in schema.org ===
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.4
6
+ Stable tag: 4.2.0
7
+
8
+ Allows you to include schema.org JSON-LD syntax markup on your website
9
+
10
+ == Description ==
11
+
12
+ Allows you to include schema.org JSON-LD syntax markup on your website
13
+ Base knowledge is "https://schema.org/" and "https://developers.google.com/structured-data/"
14
+
15
+ = Schema.org Type =
16
+
17
+ * Article: http://schema.org/Article
18
+ * BlogPosting: http://schema.org/BlogPosting
19
+ * BreadcrumbList: https://schema.org/BreadcrumbList
20
+ * Event: https://schema.org/Event
21
+ * LocalBusiness : http://schema.org/LocalBusiness
22
+ * NewsArticle: http://schema.org/NewsArticle
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
+
29
+ = Breadcrumb =
30
+
31
+ You can display the breadcrumbs in the short code. Breadcrumb definition is available even if not active.
32
+
33
+ [ Example ]
34
+ `
35
+ <?php
36
+ if ( shortcode_exists( 'wp-structuring-markup-breadcrumb' ) ) {
37
+ echo do_shortcode( '[wp-structuring-markup-breadcrumb]' );
38
+ }
39
+ ?>
40
+ `
41
+
42
+ [ ShortCode Options ]
43
+
44
+ * Option : id="id_name" attribute additional ol element.
45
+ * Option : class="class_name" attribute additional ol element.
46
+
47
+
48
+ == Installation ==
49
+
50
+ * A plug-in installation screen is displayed in the WordPress admin panel.
51
+ * It installs in `wp-content/plugins`.
52
+ * The plug-in is activated.
53
+ * Open 'Schema.org Setting' menu.
54
+
55
+ == Changelog ==
56
+
57
+ = 4.2.0 (2018-03-23) =
58
+ * Fixed : Taxonomy name of custom posting is not displayed.
59
+
60
+ = 4.1.8 (2018-02-16) =
61
+ * Checked : WordPress version 4.9.4 operation check.
62
+ * Checked : WordPress version 4.9.3 operation check.
63
+
64
+ = 4.1.7 (2018-01-22) =
65
+ * Checked : WordPress version 4.9.2 operation check.
66
+
67
+ = 4.1.6 (2017-12-12) =
68
+ * Checked : WordPress version 4.9.1 operation check.
69
+ * Fixed : Hidden if addressRegion and telephone is empty.
70
+
71
+ = 4.1.5 (2017-11-22) =
72
+ * Checked : WordPress version 4.9.0 operation check.
73
+
74
+ = 4.1.4 (2017-11-01) =
75
+ * Checked : WordPress version 4.8.3 operation check.
76
+ * Fixed : Error setting aria-label.
77
+
78
+ = 4.1.3 (2017-09-27) =
79
+ * Checked : WordPress version 4.8.2 operation check.
80
+ * Updated : Stop setting the default value.
81
+ * Fixed : availableLanguage and area_served array setting ( Organization )
82
+
83
+ = 4.1.2 (2017-08-23) =
84
+ * Checked : WordPress version 4.8.1 operation check.
85
+
86
+ = 4.1.1 (2017-07-26) =
87
+ * Added : Correct to display / hide the current page.(BreadcrumbList schema.org)
88
+ * Updated : Event and Video type css update.
89
+ * Fixed : Do not display when the search query is empty.
90
+
91
+ = 4.1.0 (2017-07-03) =
92
+ * Added : If there is no feature image setting, set the first image of the post.
93
+ * Updated : Organization Image recommended.(Article / NewsArticle / BlogPosting)
94
+ * Fixed : Events and videos of custom posts should not appear in choices.
95
+ * Fixed : Organization type Notice Error.
96
+
97
+ = 4.0.2 (2017-06-14) =
98
+ * Checked : WordPress version 4.8.0 operation check.
99
+ * Updated : Warning: Event type schema.org ( availability, validFrom and performer. )
100
+ * Fixed : Events and videos of custom posts should not appear in choices.
101
+
102
+ = 4.0.1 (2017-05-25) =
103
+ * Added : Hook point of AMP plug-ins (Automattic, Inc. release). https://wordpress.org/plugins/amp/
104
+ * Added : Site Navigation on only Home Page.
105
+ * Fixed : Problem with custom taxonomies.(BreadcrumbList)
106
+
107
+ = 3.2.6 (2017-05-20) =
108
+ * Checked : WordPress version 4.7.5 operation check.
109
+
110
+ = 3.2.5 (2017-04-24) =
111
+ * Checked : WordPress version 4.7.4 operation check.
112
+
113
+ = 3.2.4 (2017-03-30) =
114
+ * Fixed : BreadcrumbList - Ignore the Home setting when setting the head fixed page.
115
+ * Fixed : BreadcrumbList - Categories of two or more levels are not displayed.
116
+ * Fixed : Minor bug fixed.
117
+ * Updated : Article,BlogPosting and NewsArticle - Limit headline to 110 chars.
118
+
119
+ = 3.2.3 (2017-03-21) =
120
+ * Fixed : "Warning: Illegal string offset" error occurred on Video and Event Schema.org.
121
+ * Updated : Event Types add fields.
122
+ * Updated : Video Types add fields.
123
+ * Updated : Change selection method of SiteNavigation type.
124
+
125
+ = 3.2.2 (2017-03-09) =
126
+ * Fixed : Article, BlogPosting, and NewsArticle can not display the Publisher attribute.
127
+ * Added : Add media selection function to the field for inputting image path.
128
+ * Checked : WordPress version 4.7.3 operation check.
129
+
130
+ = 3.2.1 (2017-02-21) =
131
+ * Fixed : Call to undefined function imagecreatefromstring().
132
+
133
+ = 3.2.0 (2017-01-30) =
134
+ * Fixed : Invalid breadcrumb markup.
135
+ * Fixed : Some items are not displayed on "Organization schema.org".
136
+ * Added : Add items to e-mail to "Organization schema.org".
137
+ * Checked : WordPress version 4.7.2 operation check.
138
+
139
+ = 3.1.7 (2017-01-12) =
140
+ * Checked : WordPress version 4.7.1 operation check.
141
+
142
+ = 3.1.6 (2016-12-16) =
143
+ * Updated : Change ImageObject attribute of Schema.org type "Article", "BlogPosting", "NewsArticle" from "required" to "recommended".
144
+ * Fixed : Custom post menu control.
145
+
146
+ = 3.1.5 (2016-12-08) =
147
+ * Checked : WordPress version 4.7.0 operation check.
148
+
149
+ = 3.1.4 (2016-11-25) =
150
+ * Added : Schema.org type "LocalBusiness" item added. "Image", "priceRange" and "servesCuisine".
151
+ * Added : Print plugin version in comments.
152
+
153
+ = 3.1.3 (2016-11-22) =
154
+ * Updated : Event Type select item of Schema.org type "Event".
155
+ * Updated : Short Code display changed of Schema.org type "BreadcrumbList".
156
+
157
+ = 3.1.2 (2016-09-27) =
158
+ * Updated : homeLocation input item of Schema.org type "Person".
159
+
160
+ = 3.1.1 (2016-09-20) =
161
+ * Added : Schema.org type "SiteNavigation".
162
+ * Checked : WordPress version 4.6.1 operation check.
163
+ * Updated : Application URL input item of Schema.org type "WebSite".
164
+ * Fixed : LocalBusiness Convert data(In the case of version 2.3.x) Logic remove.
165
+
166
+ = 3.0.5 (2016-09-06) =
167
+ * Fixed : CSS & JavaScript version control.
168
+ * Fixed : Registration screen display adjustment.
169
+
170
+ = 3.0.4 (2016-08-17) =
171
+ * Fixed : Type Person and Organization Non-display case "sameAs" is empty.
172
+ * Checked : WordPress version 4.6.0 operation check.
173
+
174
+ = 3.0.3 (2016-07-27) =
175
+ * Fixed : If you select a static page in a display of the front page, the home page is not output at the output page. (Added is_front_page function)
176
+
177
+ = 3.0.2 (2016-07-15) =
178
+ * Updated : Security measures of the update process.
179
+
180
+ = 3.0.1 (2016-06-25) =
181
+
182
+ * Checked : WordPress version 4.5.3 operation check.
183
+
184
+ = 3.0.0 (2016-06-20) =
185
+
186
+ * Added : Schema.org type "Video".
187
+ * Added : Display the cause of the JSON-LD is not output in HTML comments.
188
+ * Fixed : "Schema.org Event" solve the output of JSON-LD is a problem with the double in the custom posts.
189
+ * Fixed : Changes to the search of the array to remove the SQL statement to get the output page.
190
+ * Fixed : "Schema.org Organization" If you have not set up a Social Profiles, it does not show an empty array.
191
+ * Updated : Japanese translation.
192
+
193
+ = 2.5.1 (2016-05-09) =
194
+
195
+ * Checked : WordPress version 4.5.2 operation check.
196
+ * Checked : WordPress version 4.5.1 operation check.
197
+
198
+ = 2.5.0 (2016-04-19) =
199
+
200
+ * Updated : You can select a custom posts at the output page.
201
+ * Updated : Add the output on "Pages" in the "Article","BlogPosting" and "NewsArticle" Schema.org type.
202
+ * Updated : It added the Holiday Opening Hour of items to Schema.org Type "LocalBusiness".
203
+ * Updated : It added the GeoCircle of items to Schema.org Type "LocalBusiness".
204
+ * Updated : Japanese translation.
205
+ * Checked : WordPress version 4.5.0 operation check.
206
+
207
+ = 2.4.2 (2016-03-09) =
208
+
209
+ * Fixed : Updated image size detection to use curl first, as attachment_url_to_postid() hits the database
210
+ * Updated : Added a transient cache class to cache taxing operations
211
+ * Updated : Turkish translation.
212
+
213
+ = 2.4.1 (2016-03-01) =
214
+
215
+ * Updated : Japanese translation.
216
+
217
+ = 2.4.0 (2016-02-06) =
218
+
219
+ * Added : Schema.org type "Person".
220
+ * Updated : Schema.org type "LocalBusiness" OpenHours : shift time setting.
221
+ * Checked : WordPress version 4.4.2 operation check.
222
+
223
+ = 2.3.3 (2016-01-19) =
224
+
225
+ * Fixed : Improved wording on admin pages.
226
+ * Fixed : Added alternate methods to get image dimensions for systems running legacy SSL.
227
+
228
+ = 2.3.2 (2016-01-10) =
229
+
230
+ * Fixed : Fixed a bug that Organization type of display error of contactType comes out.
231
+ * Fixed : Fixed a bug that can not save LocalBusiness type of latitude and longitude.
232
+
233
+ = 2.3.1 (2016-01-07) =
234
+
235
+ * Checked : WordPress version 4.4.1 operation check.
236
+ * Added : Breadcrumb ShortCode option add.
237
+
238
+ = 2.3.0 (2016-01-03) =
239
+
240
+ * Added : Schema.org type "LocalBusiness".
241
+ * Fixed : Organization Definition minor bug fixed.
242
+
243
+ = 2.2.1 (2015-12-21) =
244
+
245
+ * Fixed : Breadcrumb ShortCode minor bug fixed.
246
+
247
+ = 2.2.0 (2015-12-16) =
248
+
249
+ * Updated : Updated on December 14, 2015 was structured data (Article) AMP correspondence. https://developers.google.com/structured-data/rich-snippets/articles?hl=ja
250
+
251
+ = 2.1.3 (2015-12-11) =
252
+
253
+ * Fixed : Minor bug fixed.
254
+
255
+ = 2.1.2 (2015-12-09) =
256
+
257
+ * Check : WordPress version 4.4 operation check.
258
+
259
+ = 2.1.1 (2015-12-04) =
260
+
261
+ * Added : Add the table update processing at the time of version up.
262
+
263
+ = 2.1.0 (2015-12-03) =
264
+
265
+ * Added : Schema.org type "Event" schema.org definition Add "Event" custom post output that works.
266
+
267
+ = 2.0.2 (2015-11-27) =
268
+
269
+ * Fixed : Breadcrumb ShortCode minor bug fixed.
270
+
271
+ = 2.0.1 (2015-11-25) =
272
+
273
+ * Fixed : Notice error fixed.
274
+
275
+ = 2.0.0 (2015-11-23) =
276
+
277
+ * Added : Schema.org type "BreadcrumbList" schema.org definition Add breadcrumbs short code output that works.
278
+ * Updated : Schema.org definition immobilization.
279
+
280
+ = 1.3.2 (2015-11-17) =
281
+
282
+ * Fixed : Fixed translation.
283
+ * Added : Additional output comment.
284
+
285
+ = 1.3.1 =
286
+
287
+ * Fixed : none-function fixed.
288
+
289
+ = 1.3.0 =
290
+
291
+ * Added : Localizing into Japanese.
292
+
293
+ = 1.2.1 =
294
+
295
+ * Updated : Read admin menu css -> wp_register_style setting
296
+ * Fixed : Typo Missing.
297
+
298
+ = 1.2.0 =
299
+
300
+ * Added : Schema.org type "BlogPosting".
301
+
302
+ = 1.1.3 =
303
+
304
+ * Fixed : To escape a newline code and the tag of the body attribute in Type "Article" and "NewsArticle".
305
+
306
+ = 1.1.2 =
307
+
308
+ * Updated : Schema.org type "Article" image attribute.
309
+
310
+ = 1.1.0 =
311
+
312
+ * Added : Schema.org type "Article".
313
+
314
+ = 1.0.1 - 1.0.8 =
315
+
316
+ * Fixed : Missing plugin path setting.
317
+
318
+ = 1.0.0 =
319
+
320
+ * First release of this plugin.
321
+
322
+ == Contact ==
323
+
324
+ * email to foundationmeister[at]outlook.com
325
+ * twitter @miiitaka
trunk/uninstall.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
3
+ exit;
4
+ }
5
+ new Structuring_Markup_Uninstall();
6
+
7
+ /**
8
+ * Schema.org Plugin Uninstall
9
+ *
10
+ * @author Kazuya Takami
11
+ * @version 3.0.0
12
+ * @since 1.0.0
13
+ */
14
+ class Structuring_Markup_Uninstall {
15
+
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' );
33
+ $this->delete_custom_post( $this->custom_type_event );
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( 'wp_structuring_markup' );
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 ) {
48
+ global $wpdb;
49
+ $table_name = $wpdb->prefix . $table_name;
50
+ $wpdb->query( "DROP TABLE IF EXISTS " . $table_name );
51
+ }
52
+
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 ) {
61
+ global $wpdb;
62
+ $table_name = $wpdb->prefix . "posts";
63
+
64
+ $key = array( 'post_type' => $custom_type );
65
+ $key_prepared = array( '%s' );
66
+
67
+ $wpdb->delete( $table_name, $key, $key_prepared );
68
+ }
69
+
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 ) {
78
+ global $wpdb;
79
+ $table_name = $wpdb->prefix . "postmeta";
80
+
81
+ $key = array( 'meta_key' => $custom_type );
82
+ $key_prepared = array( '%s' );
83
+
84
+ $wpdb->delete( $table_name, $key, $key_prepared );
85
+ }
86
+ }
trunk/wp-structuring-markup.php ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
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.2.0
7
+ Author: Kazuya Takami
8
+ Author URI: https://www.terakoya.work/
9
+ License: GPLv2 or later
10
+ Text Domain: wp-structuring-markup
11
+ Domain Path: /languages
12
+ */
13
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/admin/wp-structuring-admin-db.php' );
14
+
15
+ new Structuring_Markup();
16
+
17
+ /**
18
+ * Schema.org Basic Class
19
+ *
20
+ * @author Kazuya Takami
21
+ * @version 4.2.0
22
+ * @since 1.0.0
23
+ */
24
+ class Structuring_Markup {
25
+
26
+ /**
27
+ * Variable definition version.
28
+ *
29
+ * @version 4.2.0
30
+ * @since 1.3.0
31
+ */
32
+ private $version = '4.2.0';
33
+
34
+ /**
35
+ * Variable definition Text Domain.
36
+ *
37
+ * @version 3.2.5
38
+ * @since 1.3.0
39
+ */
40
+ private $text_domain = 'wp-structuring-markup';
41
+
42
+ /**
43
+ * Constructor Define.
44
+ *
45
+ * @version 4.1.1
46
+ * @since 1.0.0
47
+ */
48
+ public function __construct() {
49
+ register_activation_hook( __FILE__, array( $this, 'create_table' ) );
50
+
51
+ add_shortcode( $this->text_domain . '-breadcrumb', array( $this, 'short_code_init_breadcrumb' ) );
52
+
53
+ add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
54
+ add_action( 'init', array( $this, 'create_post_type' ) );
55
+
56
+ if ( is_admin() ) {
57
+ add_action( 'admin_init', array( $this, 'admin_init' ) );
58
+ add_action( 'admin_menu', array( $this, 'admin_menu' ) );
59
+ add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) );
60
+ } else {
61
+ add_action( 'wp_head', array( $this, 'wp_head' ) );
62
+ add_filter( 'amp_post_template_metadata', array( $this, 'amp_post_template_metadata' ), 9 );
63
+ }
64
+ }
65
+
66
+ /**
67
+ * Create table.
68
+ *
69
+ * @version 2.0.0
70
+ * @since 2.0.0
71
+ */
72
+ public function create_table() {
73
+ $db = new Structuring_Markup_Admin_Db();
74
+ $db->create_table( $this->text_domain, $this->version );
75
+ }
76
+
77
+ /**
78
+ * Breadcrumb ShortCode Register.
79
+ *
80
+ * @version 2.3.1
81
+ * @since 2.0.0
82
+ * @param string $args short code params
83
+ * @return string $html
84
+ */
85
+ public function short_code_init_breadcrumb ( $args ) {
86
+ $db = new Structuring_Markup_Admin_Db();
87
+ $results = $db->get_type_options( 'breadcrumb' );
88
+
89
+ if ( isset( $results['option'] ) ) {
90
+ $options = $results['option'];
91
+
92
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-short-code-breadcrumb.php');
93
+ $obj = new Structuring_Markup_ShortCode_Breadcrumb();
94
+ return $obj->short_code_display( $options, $args );
95
+ } else {
96
+ return __return_false();
97
+ }
98
+ }
99
+
100
+ /**
101
+ * i18n.
102
+ *
103
+ * @version 1.3.0
104
+ * @since 1.3.0
105
+ */
106
+ public function plugins_loaded () {
107
+ load_plugin_textdomain( $this->text_domain, __return_false(), dirname( plugin_basename( __FILE__ ) ) . '/languages' );
108
+ }
109
+
110
+ /**
111
+ * Create custom post type.
112
+ *
113
+ * @version 4.0.0
114
+ * @since 2.1.0
115
+ */
116
+ function create_post_type () {
117
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/custom/wp-structuring-custom-post-event.php' );
118
+ new Structuring_Markup_Custom_Post_Event( $this->text_domain );
119
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/custom/wp-structuring-custom-post-video.php' );
120
+ new Structuring_Markup_Custom_Post_Video( $this->text_domain );
121
+ }
122
+
123
+ /**
124
+ * admin init.
125
+ *
126
+ * @version 4.1.1
127
+ * @since 1.3.1
128
+ */
129
+ public function admin_init () {
130
+ /** version up check */
131
+ $options = get_option( $this->text_domain );
132
+ if ( !isset( $options['version'] ) || $options['version'] !== $this->version ) {
133
+ $this->create_table();
134
+ }
135
+
136
+ wp_register_style( 'wp-structuring-markup-admin-style', plugins_url( 'css/style.css', __FILE__ ), array(), $this->version );
137
+ wp_register_style( 'wp-structuring-markup-admin-post', plugins_url( 'css/schema-custom-post.css', __FILE__ ), array(), $this->version );
138
+ }
139
+
140
+ /**
141
+ * Add Menu to the Admin Screen.
142
+ *
143
+ * @version 4.1.1
144
+ * @since 1.0.0
145
+ */
146
+ public function admin_menu () {
147
+ $list_page = 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
+ $post_page = add_submenu_page(
155
+ $this->text_domain . '-post',
156
+ esc_html__( 'Schema.org Setting Edit', $this->text_domain ),
157
+ esc_html__( 'Edit', $this->text_domain ),
158
+ 'manage_options',
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', array( $this, 'add_style_post' ) );
165
+ add_action( 'admin_print_styles-' . $list_page, array( $this, 'add_style' ) );
166
+ add_action( 'admin_print_styles-' . $post_page, array( $this, 'add_style' ) );
167
+ add_action( 'admin_print_scripts-' . $post_page, array( $this, 'admin_scripts' ) );
168
+ }
169
+
170
+ /**
171
+ * Add Menu to the Admin Screen.
172
+ *
173
+ * @version 4.1.1
174
+ * @since 4.1.1
175
+ * @param array $links
176
+ * @return array $links
177
+ */
178
+ public function plugin_action_links( $links ) {
179
+ $url = admin_url( 'admin.php?page=' . $this->text_domain . '/' . $this->text_domain . '.php' );
180
+ $url = '<a href="' . esc_url( $url ) . '">' . __( 'Settings' ) . '</a>';
181
+ array_unshift( $links, $url );
182
+ return $links;
183
+ }
184
+
185
+ /**
186
+ * CSS admin add. (Custom Post)
187
+ *
188
+ * @version 4.1.1
189
+ * @since 4.1.1
190
+ */
191
+ public function add_style_post () {
192
+ wp_enqueue_style( 'wp-structuring-markup-admin-post' );
193
+ }
194
+
195
+ /**
196
+ * CSS admin add.
197
+ *
198
+ * @version 1.3.1
199
+ * @since 1.3.1
200
+ */
201
+ public function add_style () {
202
+ wp_enqueue_style( 'wp-structuring-markup-admin-style' );
203
+ }
204
+
205
+ /**
206
+ * admin_scripts
207
+ *
208
+ * @author Justin Frydman
209
+ * @author Kazuya Takami
210
+ * @version 3.2.2
211
+ * @since 2.4.0
212
+ */
213
+ public function admin_scripts () {
214
+ if ( isset( $_GET["type"] ) && $_GET["type"] === 'local_business' ) {
215
+ wp_enqueue_script ( 'wp-structuring-markup-admin-main-js', plugins_url ( 'js/main.min.js', __FILE__ ), array( 'jquery' ), $this->version );
216
+ }
217
+ if ( isset( $_GET["type"] ) ) {
218
+ switch ( $_GET["type"] ) {
219
+ case "article":
220
+ case "blog_posting":
221
+ case "news_article":
222
+ case "organization":
223
+ wp_enqueue_script ( 'wp-structuring-markup-admin-media-js', plugins_url ( 'js/media-uploader-main.js', __FILE__ ), array( 'jquery' ), $this->version );
224
+ wp_enqueue_media();
225
+ break;
226
+ }
227
+ }
228
+ }
229
+
230
+ /**
231
+ * LIST Page Template Require.
232
+ *
233
+ * @version 4.0.0
234
+ * @since 1.0.0
235
+ */
236
+ public function list_page_render () {
237
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/admin/wp-structuring-admin-list.php' );
238
+ new Structuring_Markup_Admin_List( $this->text_domain );
239
+ }
240
+
241
+ /**
242
+ * POST Page Template Require.
243
+ *
244
+ * @version 4.0.0
245
+ * @since 1.0.0
246
+ */
247
+ public function post_page_render () {
248
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/admin/wp-structuring-admin-post.php' );
249
+ new Structuring_Markup_Admin_Post( $this->text_domain );
250
+ }
251
+
252
+ /**
253
+ * Display Page Template Require.
254
+ *
255
+ * @version 4.0.0
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
+ /**
264
+ * Display Page Template Require.
265
+ *
266
+ * @version 4.0.0
267
+ * @since 4.0.0
268
+ * @param array $metadata
269
+ * @return array $metadata
270
+ */
271
+ public function amp_post_template_metadata ( array $metadata ) {
272
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-display-amp.php' );
273
+ $amp = new Structuring_Markup_Display_Amp();
274
+
275
+ if ( !empty( $amp->json_ld ) ) {
276
+ $metadata = $amp->json_ld;
277
+ }
278
+ return (array) $metadata;
279
+ }
280
+ }