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

Version Description

(2017-05-25) = * Added : Hook point of AMP plug-ins (Automattic, Inc. release). https://wordpress.org/plugins/amp/ * Added : Site Navigation on only Home Page. * Fixed : Problem with custom taxonomies.(BreadcrumbList)

Download this release

Release Info

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

Code changes from version 3.2.6 to 4.0.0

Files changed (94) hide show
  1. includes/admin/wp-structuring-admin-db.php +254 -0
  2. includes/admin/wp-structuring-admin-list.php +99 -0
  3. includes/admin/wp-structuring-admin-post.php +369 -0
  4. includes/admin/wp-structuring-admin-type-article.php +120 -0
  5. includes/admin/wp-structuring-admin-type-blog-posting.php +120 -0
  6. includes/admin/wp-structuring-admin-type-breadcrumb.php +80 -0
  7. includes/admin/wp-structuring-admin-type-event.php +66 -0
  8. includes/admin/wp-structuring-admin-type-local-business.php +523 -0
  9. includes/admin/wp-structuring-admin-type-news-article.php +120 -0
  10. includes/admin/wp-structuring-admin-type-organization.php +184 -0
  11. includes/admin/wp-structuring-admin-type-person.php +117 -0
  12. includes/admin/wp-structuring-admin-type-site-navigation.php +79 -0
  13. includes/admin/wp-structuring-admin-type-video.php +50 -0
  14. includes/admin/wp-structuring-admin-type-website.php +114 -0
  15. includes/custom/wp-structuring-custom-post-event.php +259 -0
  16. includes/custom/wp-structuring-custom-post-video.php +204 -0
  17. includes/meta/wp-structuring-meta-article.php +110 -0
  18. includes/meta/wp-structuring-meta-blog-posting.php +110 -0
  19. includes/meta/wp-structuring-meta-breadcrumb.php +50 -0
  20. includes/meta/wp-structuring-meta-event.php +75 -0
  21. includes/meta/wp-structuring-meta-local-business.php +136 -0
  22. includes/meta/wp-structuring-meta-news-article.php +110 -0
  23. includes/meta/wp-structuring-meta-organization.php +74 -0
  24. includes/meta/wp-structuring-meta-person.php +57 -0
  25. includes/meta/wp-structuring-meta-site-navigation.php +42 -0
  26. includes/meta/wp-structuring-meta-video.php +90 -0
  27. includes/meta/wp-structuring-meta-website.php +58 -0
  28. includes/wp-structuring-display-amp.php +100 -0
  29. includes/wp-structuring-display.php +45 -740
  30. includes/wp-structuring-opening-hours.php +9 -9
  31. includes/wp-structuring-short-code-breadcrumb.php +63 -40
  32. includes/wp-structuring-utility.php +45 -0
  33. readme.txt +6 -1
  34. trunk/css/style.css +145 -0
  35. trunk/includes/admin/wp-structuring-admin-db.php +254 -0
  36. trunk/includes/admin/wp-structuring-admin-list.php +99 -0
  37. trunk/includes/admin/wp-structuring-admin-post.php +369 -0
  38. trunk/includes/admin/wp-structuring-admin-type-article.php +120 -0
  39. trunk/includes/admin/wp-structuring-admin-type-blog-posting.php +120 -0
  40. trunk/includes/admin/wp-structuring-admin-type-breadcrumb.php +80 -0
  41. trunk/includes/admin/wp-structuring-admin-type-event.php +66 -0
  42. trunk/includes/admin/wp-structuring-admin-type-local-business.php +523 -0
  43. trunk/includes/admin/wp-structuring-admin-type-news-article.php +120 -0
  44. trunk/includes/admin/wp-structuring-admin-type-organization.php +184 -0
  45. trunk/includes/admin/wp-structuring-admin-type-person.php +117 -0
  46. trunk/includes/admin/wp-structuring-admin-type-site-navigation.php +79 -0
  47. trunk/includes/admin/wp-structuring-admin-type-video.php +50 -0
  48. trunk/includes/admin/wp-structuring-admin-type-website.php +114 -0
  49. trunk/includes/custom/wp-structuring-custom-post-event.php +259 -0
  50. trunk/includes/custom/wp-structuring-custom-post-video.php +204 -0
  51. trunk/includes/meta/wp-structuring-meta-article.php +110 -0
  52. trunk/includes/meta/wp-structuring-meta-blog-posting.php +110 -0
  53. trunk/includes/meta/wp-structuring-meta-breadcrumb.php +50 -0
  54. trunk/includes/meta/wp-structuring-meta-event.php +75 -0
  55. trunk/includes/meta/wp-structuring-meta-local-business.php +136 -0
  56. trunk/includes/meta/wp-structuring-meta-news-article.php +110 -0
  57. trunk/includes/meta/wp-structuring-meta-organization.php +74 -0
  58. trunk/includes/meta/wp-structuring-meta-person.php +57 -0
  59. trunk/includes/meta/wp-structuring-meta-site-navigation.php +42 -0
  60. trunk/includes/meta/wp-structuring-meta-video.php +90 -0
  61. trunk/includes/meta/wp-structuring-meta-website.php +58 -0
  62. trunk/includes/wp-structuring-admin-db.php +254 -0
  63. trunk/includes/wp-structuring-admin-list.php +99 -0
  64. trunk/includes/wp-structuring-admin-post.php +365 -0
  65. trunk/includes/wp-structuring-admin-type-article.php +120 -0
  66. trunk/includes/wp-structuring-admin-type-blog-posting.php +120 -0
  67. trunk/includes/wp-structuring-admin-type-breadcrumb.php +80 -0
  68. trunk/includes/wp-structuring-admin-type-event.php +66 -0
  69. trunk/includes/wp-structuring-admin-type-local-business.php +523 -0
  70. trunk/includes/wp-structuring-admin-type-news-article.php +120 -0
  71. trunk/includes/wp-structuring-admin-type-organization.php +184 -0
  72. trunk/includes/wp-structuring-admin-type-person.php +117 -0
  73. trunk/includes/wp-structuring-admin-type-site-navigation.php +79 -0
  74. trunk/includes/wp-structuring-admin-type-video.php +50 -0
  75. trunk/includes/wp-structuring-admin-type-website.php +114 -0
  76. trunk/includes/wp-structuring-custom-post-event.php +259 -0
  77. trunk/includes/wp-structuring-custom-post-video.php +204 -0
  78. trunk/includes/wp-structuring-display-amp.php +100 -0
  79. trunk/includes/wp-structuring-display.php +204 -0
  80. trunk/includes/wp-structuring-opening-hours.php +224 -0
  81. trunk/includes/wp-structuring-short-code-breadcrumb.php +235 -0
  82. trunk/includes/wp-structuring-utility.php +45 -0
  83. trunk/js/main.js +30 -0
  84. trunk/js/main.min.js +1 -0
  85. trunk/js/media-uploader-main.js +29 -0
  86. trunk/languages/wp-structuring-markup-ja.mo +0 -0
  87. trunk/languages/wp-structuring-markup-ja.po +217 -0
  88. trunk/languages/wp-structuring-markup-tr_TR.mo +0 -0
  89. trunk/languages/wp-structuring-markup-tr_TR.po +163 -0
  90. trunk/languages/wp-structuring-markup.pot +217 -0
  91. trunk/readme.txt +280 -0
  92. trunk/uninstall.php +86 -0
  93. trunk/wp-structuring-markup.php +252 -0
  94. wp-structuring-markup.php +33 -15
includes/admin/wp-structuring-admin-db.php ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Admin DB Connection.
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.1.0
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 3.1.0
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 3.1.0
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
+ $args = array(
105
+ 'type' => $key,
106
+ 'activate' => $activate,
107
+ 'output' => $list->output,
108
+ 'options' => $list->options,
109
+ 'register_date' => date( "Y-m-d H:i:s" ),
110
+ 'update_date' => date( "Y-m-d H:i:s" )
111
+ );
112
+ }
113
+ }
114
+ $this->insert_options( $args );
115
+ }
116
+ }
117
+ }
118
+ }
119
+
120
+ /**
121
+ * Create table execute
122
+ *
123
+ * @version 2.1.1
124
+ * @since 2.0.0
125
+ * @param string $charset_collate
126
+ * @param string $text_domain
127
+ * @param string $version
128
+ */
129
+ private function create_table_execute ( $charset_collate, $text_domain, $version ) {
130
+ $query = " CREATE TABLE " . $this->table_name;
131
+ $query .= " (id MEDIUMINT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY";
132
+ $query .= ",type TINYTEXT NOT NULL";
133
+ $query .= ",activate TINYTEXT NOT NULL";
134
+ $query .= ",output TEXT NOT NULL";
135
+ $query .= ",options TEXT NOT NULL";
136
+ $query .= ",register_date DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL";
137
+ $query .= ",update_date DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL";
138
+ $query .= ",UNIQUE KEY id (id)) " . $charset_collate;
139
+
140
+ dbDelta( $query );
141
+
142
+ $options = array( 'version' => $version );
143
+ update_option( $text_domain, $options, 'yes' );
144
+ }
145
+
146
+ /**
147
+ * Get Data.
148
+ *
149
+ * @version 2.1.0
150
+ * @since 1.0.0
151
+ * @param integer $id
152
+ * @return array $results
153
+ */
154
+ public function get_options ( $id ) {
155
+ global $wpdb;
156
+
157
+ $query = "SELECT * FROM " . $this->table_name . " WHERE id = %d";
158
+ $data = array( esc_html( $id ) );
159
+ $prepared = $wpdb->prepare( $query, $data );
160
+ $args = $wpdb->get_row( $prepared );
161
+ $results = array();
162
+
163
+ if ( $args ) {
164
+ $results['id'] = $args->id;
165
+ $results['activate'] = isset( $args->activate ) ? $args->activate : "";
166
+ $results['type'] = $args->type;
167
+ $results['output'] = unserialize( $args->output );
168
+ $results['option'] = unserialize( $args->options );
169
+ }
170
+ return (array) $results;
171
+ }
172
+
173
+ /**
174
+ * Get All Data.
175
+ *
176
+ * @since 1.0.0
177
+ * @return array $results
178
+ */
179
+ public function get_list_options () {
180
+ global $wpdb;
181
+
182
+ $query = "SELECT * FROM " . $this->table_name . " ORDER BY type ASC";
183
+
184
+ return (array) $wpdb->get_results( $query );
185
+ }
186
+
187
+ /**
188
+ * Get Type Data.
189
+ *
190
+ * @version 2.1.0
191
+ * @since 2.0.0
192
+ * @param string $type
193
+ * @return array $results
194
+ */
195
+ public function get_type_options ( $type ) {
196
+ global $wpdb;
197
+
198
+ $query = "SELECT * FROM " . $this->table_name . " WHERE type = %s";
199
+ $data = array( esc_html( $type ) );
200
+ $prepared = $wpdb->prepare( $query, $data );
201
+ $args = $wpdb->get_row( $prepared );
202
+ $results = array();
203
+
204
+ if ( $args ) {
205
+ $results['id'] = $args->id;
206
+ $results['activate'] = isset( $args->activate ) ? $args->activate : "";
207
+ $results['type'] = $args->type;
208
+ $results['output'] = unserialize( $args->output );
209
+ $results['option'] = unserialize( $args->options );
210
+ }
211
+ return (array) $results;
212
+ }
213
+
214
+ /**
215
+ * Insert Data.
216
+ *
217
+ * @version 2.0.0
218
+ * @since 1.0.0
219
+ * @param array $args
220
+ */
221
+ private function insert_options ( array $args ) {
222
+ global $wpdb;
223
+
224
+ $prepared = array( '%s', '%s', '%s', '%s', '%s', '%s' );
225
+ $wpdb->insert( $this->table_name, $args, $prepared );
226
+ }
227
+
228
+ /**
229
+ * Update Data.
230
+ *
231
+ * @version 2.0.0
232
+ * @since 1.0.0
233
+ * @param array $post($_POST)
234
+ * @return integer $post['id']
235
+ */
236
+ public function update_options ( array $post ) {
237
+ global $wpdb;
238
+
239
+ $data = array(
240
+ 'type' => $post['type'],
241
+ 'activate' => isset( $post['activate'] ) ? $post['activate'] : "",
242
+ 'output' => serialize( $post['output'] ),
243
+ 'options' => isset( $post['option'] ) ? serialize( $post['option'] ) : "",
244
+ 'update_date' => date( "Y-m-d H:i:s" )
245
+ );
246
+ $key = array( 'id' => esc_html( $post['id'] ) );
247
+ $prepared = array( '%s', '%s', '%s', '%s', '%s' );
248
+ $key_prepared = array( '%d' );
249
+
250
+ $wpdb->update( $this->table_name, $data, $key, $prepared, $key_prepared );
251
+
252
+ return (integer) $post['id'];
253
+ }
254
+ }
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 3.2.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 3.2.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-status">' . esc_html__( 'Status', $this->text_domain ) . '</th>';
51
+ $html .= '<th scope="row" class="schema-admin-table-list-type">' . esc_html__( 'Schema.org Type', $this->text_domain ) . '</th>';
52
+ $html .= '<th scope="row" class="schema-admin-table-list-output">' . esc_html__( 'Output On', $this->text_domain ) . '</th>';
53
+ $html .= '<th scope="row">&nbsp;</th>';
54
+ $html .= '</tr>';
55
+ echo $html;
56
+
57
+ $db = new Structuring_Markup_Admin_Db();
58
+ $results = $db->get_list_options();
59
+ $type_array = $db->type_array;
60
+
61
+ if ( $results ) {
62
+ foreach ( $results as $row ) {
63
+ if ( $row->activate === 'on' ) {
64
+ $html = '<tr class="active"><td><span class="active">Enabled';
65
+ } else {
66
+ $html = '<tr class="stop"><td><span class="stop">Disabled';
67
+ }
68
+ $html .= '</span></td>';
69
+ $html .= '<td><a href="';
70
+ $html .= admin_url( $post_url . '&type=' . esc_html( $row->type ) . '&schema_post_id=' . esc_html( $row->id ) ) . '">' . $type_array[esc_html( $row->type )];
71
+ $html .= '</a></td>';
72
+ $html .= '<td>' . $this->unserialize_output( $row->output ) . '</td>';
73
+ $html .= '<td><a href="';
74
+ $html .= admin_url( $post_url . '&type=' . esc_html( $row->type ) . '&schema_post_id=' . esc_html( $row->id ) ) . '">' . esc_html__( 'Edit', $this->text_domain );
75
+ $html .= '</a></td>';
76
+ $html .= '</tr>';
77
+ echo $html;
78
+ }
79
+ } else {
80
+ echo '<td colspan="5">' . 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
+ }
includes/admin/wp-structuring-admin-post.php ADDED
@@ -0,0 +1,369 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Admin Post
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.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 3.0.2
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
+ foreach ( $post_types as $post_type ) {
58
+ $this->post_args[] = array(
59
+ 'label' => esc_html( $post_type->label ),
60
+ 'value' => esc_html( $post_type->name )
61
+ );
62
+ }
63
+ $this->text_domain = $text_domain;
64
+ $this->nonce_name = "_wpnonce_" . $text_domain;
65
+ $this->nonce_action = "edit-" . $text_domain;
66
+
67
+ /**
68
+ * Update Status
69
+ *
70
+ * "ok" : Successful update
71
+ * "output" : Output No Check
72
+ */
73
+ $status = "";
74
+
75
+ /** DB Connect */
76
+ $db = new Structuring_Markup_Admin_Db();
77
+ $this->type_array = $db->type_array;
78
+
79
+ /** Set Default Parameter for Array */
80
+ $options = array(
81
+ "id" => "",
82
+ "type" => "",
83
+ "activate" => "",
84
+ "output" => array(),
85
+ "option" => array()
86
+ );
87
+
88
+ /** DataBase Update & Insert Mode */
89
+ if ( ! empty( $_POST ) && check_admin_referer( $this->nonce_action, $this->nonce_name ) ) {
90
+ if ( isset( $_POST['id'] ) && is_numeric( $_POST['id'] ) ) {
91
+ if ( isset( $_POST['output'] ) ) {
92
+ $options['id'] = $db->update_options( $_POST );
93
+ $status = "ok";
94
+ } else {
95
+ $status = "output";
96
+ }
97
+ }
98
+ }
99
+
100
+ /** Key Set */
101
+ if ( isset( $_GET['schema_post_id'] ) && is_numeric( $_GET['schema_post_id'] ) ) {
102
+ $options['id'] = esc_html( $_GET['schema_post_id'] );
103
+ }
104
+
105
+ /** Type Set */
106
+ if ( isset( $_GET['type'] ) && array_key_exists( $_GET['type'], $this->type_array) ) {
107
+ $options['type'] = esc_html( $_GET['type'] );
108
+ }
109
+
110
+ $options = $db->get_options( $options['id'] );
111
+ if ( $options['option'] === false ) {
112
+ $options['option'] = array();
113
+ }
114
+
115
+ $this->page_render( $options, $status );
116
+ }
117
+
118
+ /**
119
+ * Setting Page of the Admin Screen.
120
+ *
121
+ * @version 4.0.0
122
+ * @since 1.0.0
123
+ * @param array $options
124
+ * @param string $status
125
+ */
126
+ private function page_render ( array $options, $status ) {
127
+ $html = '';
128
+ $html .= '<div class="wrap">';
129
+ $html .= '<h1>' . esc_html__( 'Schema.org Register', $this->text_domain );
130
+ $html .= '<span class="schema-admin-h1-span">[ Schema Type : ' . esc_html( $this->type_array[$options['type']] ) . ' ]</span>';
131
+ $html .= '</h1>';
132
+ switch ( $status ) {
133
+ case "ok":
134
+ $html .= $this->information_render();
135
+ break;
136
+ case "output":
137
+ $html .= $this->output_error_render();
138
+ break;
139
+ default:
140
+ break;
141
+ }
142
+ echo $html;
143
+
144
+ /** Output Page Select */
145
+ $html = '<hr>';
146
+ $html .= '<p class="schema-admin-require">';
147
+ $html .= esc_html__( 'Please note that all fields followed by an asterisk must be filled in.', $this->text_domain );
148
+ $html .= '</p>';
149
+ $html .= '<form method="post" action="">';
150
+ echo $html;
151
+
152
+ wp_nonce_field( $this->nonce_action, $this->nonce_name );
153
+
154
+ $html = '<input type="hidden" name="id" value="' . esc_attr( $options['id'] ) . '">';
155
+ $html .= '<input type="hidden" name="type" value="' . esc_attr( $options['type'] ) . '">';
156
+ $html .= '<table class="schema-admin-table">';
157
+ $html .= '<tr><th class="require">Enabled : </th><td>';
158
+ $html .= '<input type="checkbox" name="activate" value="on"';
159
+ $html .= ( isset( $options['activate'] ) && $options['activate'] === "on" ) ? ' checked' : '';
160
+ $html .= '></td></tr>';
161
+ $html .= '<tr><th class="require">' . esc_html__( 'Output On', $this->text_domain ) . ' : </th><td>';
162
+ echo $html;
163
+
164
+ switch ( $options['type'] ) {
165
+ case 'article':
166
+ $html = $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
167
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
168
+ $html .= $this->output_checkbox_render( $options['output'], "amp", esc_html__( 'Posts(AMP)', $this->text_domain ) );
169
+ $html .= '</td></tr>';
170
+ $html .= $this->output_custom_posts_render( $options['output'] );
171
+ $html .= '</table><hr>';
172
+ echo $html;
173
+
174
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-article.php' );
175
+ new Structuring_Markup_Type_Article( $options['option'] );
176
+ break;
177
+ case 'blog_posting':
178
+ $html = $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
179
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
180
+ $html .= $this->output_checkbox_render( $options['output'], "amp", esc_html__( 'Posts(AMP)', $this->text_domain ) );
181
+ $html .= '</td></tr>';
182
+ $html .= $this->output_custom_posts_render( $options['output'] );
183
+ $html .= '</table><hr>';
184
+ echo $html;
185
+
186
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-blog-posting.php' );
187
+ new Structuring_Markup_Type_Blog_Posting( $options['option'] );
188
+ break;
189
+ case 'breadcrumb':
190
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
191
+ $html .= '</td></tr></table><hr>';
192
+ echo $html;
193
+
194
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-breadcrumb.php' );
195
+ new Structuring_Markup_Type_Breadcrumb( $options['option'] );
196
+ break;
197
+ case 'event':
198
+ $html = $this->output_checkbox_render( $options['output'], "event", esc_html__( 'Event Post Page', $this->text_domain ) );
199
+ $html .= '</td></tr></table><hr>';
200
+ echo $html;
201
+
202
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-event.php' );
203
+ new Structuring_Markup_Type_Event();
204
+ break;
205
+ case 'local_business':
206
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
207
+ $html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
208
+ $html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
209
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
210
+ $html .= '</td></tr>';
211
+ $html .= $this->output_custom_posts_render( $options['output'] );
212
+ $html .= '</table><hr>';
213
+
214
+ echo $html;
215
+
216
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-local-business.php' );
217
+ new Structuring_Markup_Type_LocalBusiness( $options['option'] );
218
+ break;
219
+ case 'news_article':
220
+ $html = $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
221
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
222
+ $html .= $this->output_checkbox_render( $options['output'], "amp", esc_html__( 'Posts(AMP)', $this->text_domain ) );
223
+ $html .= '</td></tr>';
224
+ $html .= $this->output_custom_posts_render( $options['output'] );
225
+ $html .= '</table><hr>';
226
+
227
+ echo $html;
228
+
229
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-news-article.php' );
230
+ new Structuring_Markup_Type_NewsArticle( $options['option'] );
231
+ break;
232
+ case 'organization':
233
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
234
+ $html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
235
+ $html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
236
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
237
+ $html .= '</td></tr>';
238
+ $html .= $this->output_custom_posts_render( $options['output'] );
239
+ $html .= '</table><hr>';
240
+
241
+ echo $html;
242
+
243
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-organization.php' );
244
+ new Structuring_Markup_Type_Organization( $options['option'] );
245
+ break;
246
+ case 'person':
247
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
248
+ $html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
249
+ $html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
250
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
251
+ $html .= '</td></tr>';
252
+ $html .= $this->output_custom_posts_render( $options['output'] );
253
+ $html .= '</table><hr>';
254
+
255
+ echo $html;
256
+
257
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-person.php' );
258
+ new Structuring_Markup_Type_Person( $options['option'] );
259
+ break;
260
+ case 'site_navigation':
261
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
262
+ $html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
263
+ $html .= '</td></tr></table><hr>';
264
+ echo $html;
265
+
266
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-site-navigation.php' );
267
+ new Structuring_Markup_Type_Site_Navigation( $options['option'] );
268
+ break;
269
+ case 'video':
270
+ $html = $this->output_checkbox_render( $options['output'], "video", esc_html__( 'Video Post Page', $this->text_domain ) );
271
+ $html .= '</td></tr></table><hr>';
272
+ echo $html;
273
+
274
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-video.php' );
275
+ new Structuring_Markup_Type_Videos();
276
+ break;
277
+ case 'website':
278
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
279
+ $html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
280
+ $html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
281
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
282
+ $html .= '</td></tr>';
283
+ $html .= $this->output_custom_posts_render( $options['output'] );
284
+ $html .= '</table><hr>';
285
+
286
+ echo $html;
287
+
288
+ require_once( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-website.php' );
289
+ new Structuring_Markup_Type_Website( $options['option'] );
290
+ break;
291
+ }
292
+
293
+ $html = '</form>';
294
+ $html .= '</div>';
295
+ echo $html;
296
+ }
297
+
298
+ /**
299
+ * CheckBox Build Render
300
+ *
301
+ * @version 2.5.0
302
+ * @since 1.0.0
303
+ * @param array $option['output']
304
+ * @param string $output
305
+ * @param string $value
306
+ * @return string $html
307
+ */
308
+ private function output_checkbox_render ( array $option, $output, $value ) {
309
+ $html = '<label>';
310
+ $html .= '<input type="checkbox" name="output[' . $output . ']" value="' . $value . '""';
311
+ $html .= isset( $option[$output] ) ? ' checked' : '';
312
+ $html .= '>' . $value . '</label>';
313
+
314
+ return (string) $html;
315
+ }
316
+
317
+ /**
318
+ * Custom Posts Build Render
319
+ *
320
+ * @version 2.5.0
321
+ * @since 2.5.0
322
+ * @param array $option['output']
323
+ * @return string $html
324
+ */
325
+ private function output_custom_posts_render ( array $option ) {
326
+ $html = '<tr><th>' . esc_html__( 'Output On(Custom Posts)', $this->text_domain ) . ' : </th><td>';
327
+ foreach ( $this->post_args as $post_type ) {
328
+ $html .= $this->output_checkbox_render( $option, $post_type['value'], $post_type['label'] );
329
+ }
330
+ $html .= '</td></tr>';
331
+ return (string) $html;
332
+ }
333
+
334
+ /**
335
+ * Information Message Render
336
+ *
337
+ * @version 2.0.0
338
+ * @since 1.0.0
339
+ * @return string $html
340
+ */
341
+ private function information_render () {
342
+ $html = '<div id="message" class="updated notice notice-success is-dismissible below-h2">';
343
+ $html .= '<p>Schema.org Information Update.</p>';
344
+ $html .= '<button type="button" class="notice-dismiss">';
345
+ $html .= '<span class="screen-reader-text">Dismiss this notice.</span>';
346
+ $html .= '</button>';
347
+ $html .= '</div>';
348
+
349
+ return (string) $html;
350
+ }
351
+
352
+ /**
353
+ * Error Message Render
354
+ *
355
+ * @version 2.0.0
356
+ * @since 1.0.0
357
+ * @return string $html
358
+ */
359
+ private function output_error_render () {
360
+ $html = '<div id="notice" class="notice notice-error is-dismissible below-h2">';
361
+ $html .= '<p>Output No Select.</p>';
362
+ $html .= '<button type="button" class="notice-dismiss">';
363
+ $html .= '<span class="screen-reader-text">Dismiss this notice.</span>';
364
+ $html .= '</button>';
365
+ $html .= '</div>';
366
+
367
+ return (string) $html;
368
+ }
369
+ }
includes/admin/wp-structuring-admin-type-article.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Article
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.2.2
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 3.2.2
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 .= '</table>';
63
+ echo $html;
64
+
65
+ $html = '<table class="schema-admin-table">';
66
+ $html .= '<caption>author</caption>';
67
+ $html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
68
+ $html .= '<tr><th>name :</th><td><small>Default : get_the_author_meta( "display_name", author )</small>';
69
+ $html .= '</td></tr>';
70
+ $html .= '</table>';
71
+ echo $html;
72
+
73
+ $html = '<table class="schema-admin-table">';
74
+ $html .= '<caption>publisher</caption>';
75
+ $html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
76
+ $html .= '<tr><th><label for="name">Organization Name :</label></th><td>';
77
+ $html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" value="' . esc_attr( $option['name'] ) . '">';
78
+ $html .= '<small>Default : bloginfo("name")</small>';
79
+ $html .= '</td></tr>';
80
+ $html .= '</table>';
81
+ echo $html;
82
+
83
+ $html = '<table class="schema-admin-table">';
84
+ $html .= '<caption>publisher.logo</caption>';
85
+ $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
86
+ $html .= '<tr><th><label for="logo">url :</label></th><td>';
87
+ $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
88
+ $html .= '<button id="media-upload" class="schema-admin-media-button dashicons-before dashicons-admin-media"><span>Add Media</span></button>';
89
+ $html .= '</td></tr>';
90
+ $html .= '<tr><th><label for="logo-width">width :</label></th><td>';
91
+ $html .= '<input type="number" name="option[' . "logo-width" . ']" id="logo-width" min="0" value="' . esc_attr( $option['logo-width'] ) . '">px';
92
+ $html .= '<small>height <= 600px.</small>';
93
+ $html .= '</td></tr>';
94
+ $html .= '<tr><th><label for="logo-height">height :</label></th><td>';
95
+ $html .= '<input type="number" name="option[' . "logo-height" . ']" id="logo-height" min="0" value="' . esc_attr( $option['logo-height'] ) . '">px';
96
+ $html .= '<small>height <= 60px.</small>';
97
+ $html .= '</td></tr>';
98
+ $html .= '</table>';
99
+ echo $html;
100
+
101
+ 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>';
102
+ submit_button();
103
+ }
104
+
105
+ /**
106
+ * Return the default options array
107
+ *
108
+ * @since 3.2.2
109
+ * @version 2.2.0
110
+ * @return array $args
111
+ */
112
+ private function get_default_options () {
113
+ $args['name'] = get_bloginfo('name');
114
+ $args['logo'] = "";
115
+ $args['logo-height'] = 0;
116
+ $args['logo-width'] = 0;
117
+
118
+ return (array) $args;
119
+ }
120
+ }
includes/admin/wp-structuring-admin-type-blog-posting.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type BlogPosting
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.2.2
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 3.2.2
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 .= '</table>';
63
+ echo $html;
64
+
65
+ $html = '<table class="schema-admin-table">';
66
+ $html .= '<caption>author</caption>';
67
+ $html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
68
+ $html .= '<tr><th>name :</th><td><small>Default : get_the_author_meta( "display_name", author )</small>';
69
+ $html .= '</td></tr>';
70
+ $html .= '</table>';
71
+ echo $html;
72
+
73
+ $html = '<table class="schema-admin-table">';
74
+ $html .= '<caption>publisher</caption>';
75
+ $html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
76
+ $html .= '<tr><th><label for="name">Organization Name :</label></th><td>';
77
+ $html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" value="' . esc_attr( $option['name'] ) . '">';
78
+ $html .= '<small>Default : bloginfo("name")</small>';
79
+ $html .= '</td></tr>';
80
+ $html .= '</table>';
81
+ echo $html;
82
+
83
+ $html = '<table class="schema-admin-table">';
84
+ $html .= '<caption>publisher.logo</caption>';
85
+ $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
86
+ $html .= '<tr><th><label for="logo">url :</label></th><td>';
87
+ $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
88
+ $html .= '<button id="media-upload" class="schema-admin-media-button dashicons-before dashicons-admin-media"><span>Add Media</span></button>';
89
+ $html .= '</td></tr>';
90
+ $html .= '<tr><th><label for="logo-width">width :</label></th><td>';
91
+ $html .= '<input type="number" name="option[' . "logo-width" . ']" id="logo-width" min="0" value="' . esc_attr( $option['logo-width'] ) . '">px';
92
+ $html .= '<small>height <= 600px.</small>';
93
+ $html .= '</td></tr>';
94
+ $html .= '<tr><th><label for="logo-height">height :</label></th><td>';
95
+ $html .= '<input type="number" name="option[' . "logo-height" . ']" id="logo-height" min="0" value="' . esc_attr( $option['logo-height'] ) . '">px';
96
+ $html .= '<small>height <= 60px.</small>';
97
+ $html .= '</td></tr>';
98
+ $html .= '</table>';
99
+ echo $html;
100
+
101
+ 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>';
102
+ submit_button();
103
+ }
104
+
105
+ /**
106
+ * Return the default options array
107
+ *
108
+ * @version 3.2.2
109
+ * @since 2.2.0
110
+ * @return array $args
111
+ */
112
+ private function get_default_options () {
113
+ $args['name'] = get_bloginfo('name');
114
+ $args['logo'] = "";
115
+ $args['logo-height'] = 0;
116
+ $args['logo-width'] = 0;
117
+
118
+ return (array) $args;
119
+ }
120
+ }
includes/admin/wp-structuring-admin-type-breadcrumb.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Breadcrumb
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.2.4
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
+ * @since 2.0.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.2.4
32
+ * @since 2.3.3
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><label for="home_on">Display Home Page :</label></th><td>';
39
+ $html .= '<input type="checkbox" name="option[' . "home_on" . ']" id="home_on" value="on"';
40
+ if ( isset( $option['home_on'] ) && $option['home_on'] === 'on' ) {
41
+ $html .= ' checked="checked"';
42
+ }
43
+ $html .= '>Enabled';
44
+ $html .= '<small>( Installed the HOME to breadcrumbs )</small>';
45
+ $html .= '</td></tr>';
46
+ $html .= '<tr><th><label for="home_name">Home Name :</label></th><td>';
47
+ $html .= '<input type="text" name="option[' . "home_name" . ']" id="home_name" class="regular-text" value="' . esc_attr( $option['home_name'] ) . '">';
48
+ $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>';
49
+ $html .= '</td></tr>';
50
+ $html .= '</table>';
51
+ echo $html;
52
+
53
+ $html = '<table class="schema-admin-table">';
54
+ $html .= '<caption>Short Code</caption>';
55
+ $html .= '<tr><th><label for="home_on">Short Code Copy :</label></th><td>';
56
+ $html .= '<input type="text" onfocus="this.select();" readonly="readonly" value="[wp-structuring-markup-breadcrumb]" class="large-text code">';
57
+ $html .= '<small>Option : id="id_name" and class="class_name" attribute additional ol element.</small>';
58
+ $html .= '</td></tr>';
59
+ $html .= '</table>';
60
+ echo $html;
61
+
62
+ 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>';
63
+ submit_button();
64
+ }
65
+
66
+ /**
67
+ * Return the default options array
68
+ *
69
+ * @version 2.0.2
70
+ * @since 2.0.0
71
+ * @param array $args
72
+ * @return array $args
73
+ */
74
+ private function get_default_options ( array $args ) {
75
+ $args['home_on'] = '';
76
+ $args['home_name'] = '';
77
+
78
+ return (array) $args;
79
+ }
80
+ }
includes/admin/wp-structuring-admin-type-event.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Event
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.2.4
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 3.2.4
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_place_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_place_name"</small></td></tr>';
55
+ $html .= '<tr><th class="require">priceCurrency :</th><td><small>Input a custom post: field name "schema_event_place_address"</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 .= '</table>';
58
+ echo $html;
59
+
60
+ echo '<p>Custom post name "schema_event_post"</p>';
61
+ echo '<p>Archive rewrite name "events"</p>';
62
+ 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>';
63
+
64
+ submit_button();
65
+ }
66
+ }
includes/admin/wp-structuring-admin-type-local-business.php ADDED
@@ -0,0 +1,523 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type LocalBusiness
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.0.5
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
+ * @since 2.3.0
19
+ */
20
+ /** LocalBusiness Type defined. */
21
+ private $business_type_array = array(
22
+ array( "type" => "LocalBusiness", "display" => "LocalBusiness" ),
23
+
24
+ array( "type" => "AnimalShelter", "display" => "- AnimalShelter" ),
25
+
26
+ array( "type" => "AutomotiveBusiness", "display" => "- AutomotiveBusiness" ),
27
+ array( "type" => "AutoBodyShop", "display" => "-- AutoBodyShop" ),
28
+ array( "type" => "AutoDealer", "display" => "-- AutoDealer" ),
29
+ array( "type" => "AutoPartsStore", "display" => "-- AutoPartsStore" ),
30
+ array( "type" => "AutoRental", "display" => "-- AutoRental" ),
31
+ array( "type" => "AutoRepair", "display" => "-- AutoRepair" ),
32
+ array( "type" => "AutoWash", "display" => "-- AutoWash" ),
33
+ array( "type" => "GasStation", "display" => "-- GasStation" ),
34
+ array( "type" => "MotorcycleDealer", "display" => "-- MotorcycleDealer" ),
35
+ array( "type" => "MotorcycleRepair", "display" => "-- MotorcycleRepair" ),
36
+
37
+ array( "type" => "ChildCare", "display" => "- ChildCare" ),
38
+
39
+ array( "type" => "DryCleaningOrLaundry", "display" => "- DryCleaningOrLaundry" ),
40
+
41
+ array( "type" => "EmergencyService", "display" => "- EmergencyService" ),
42
+ array( "type" => "FireStation", "display" => "-- FireStation" ),
43
+ array( "type" => "Hospital", "display" => "-- Hospital" ),
44
+ array( "type" => "PoliceStation", "display" => "-- PoliceStation" ),
45
+
46
+ array( "type" => "EmploymentAgency", "display" => "- EmploymentAgency" ),
47
+
48
+ array( "type" => "EntertainmentBusiness", "display" => "- EntertainmentBusiness" ),
49
+ array( "type" => "AdultEntertainment", "display" => "-- AdultEntertainment" ),
50
+ array( "type" => "AmusementPark", "display" => "-- AmusementPark" ),
51
+ array( "type" => "ArtGallery", "display" => "-- ArtGallery" ),
52
+ array( "type" => "Casino", "display" => "-- Casino" ),
53
+ array( "type" => "ComedyClub", "display" => "-- ComedyClub" ),
54
+ array( "type" => "MovieTheater", "display" => "-- MovieTheater" ),
55
+ array( "type" => "NightClub", "display" => "-- NightClub" ),
56
+
57
+ array( "type" => "FinancialService", "display" => "- FinancialService" ),
58
+ array( "type" => "AccountingService", "display" => "-- AccountingService" ),
59
+ array( "type" => "AutomatedTeller", "display" => "-- AutomatedTeller" ),
60
+ array( "type" => "BankOrCreditUnion", "display" => "-- BankOrCreditUnion" ),
61
+ array( "type" => "InsuranceAgency", "display" => "-- InsuranceAgency" ),
62
+
63
+ array( "type" => "FoodEstablishment", "display" => "- FoodEstablishment" ),
64
+ array( "type" => "Bakery", "display" => "-- Bakery" ),
65
+ array( "type" => "BarOrPub", "display" => "-- BarOrPub" ),
66
+ array( "type" => "Brewery", "display" => "-- Brewery" ),
67
+ array( "type" => "CafeOrCoffeeShop", "display" => "-- CafeOrCoffeeShop" ),
68
+ array( "type" => "FastFoodRestaurant", "display" => "-- FastFoodRestaurant" ),
69
+ array( "type" => "IceCreamShop", "display" => "-- IceCreamShop" ),
70
+ array( "type" => "Restaurant", "display" => "-- Restaurant" ),
71
+ array( "type" => "Winery", "display" => "-- Winery" ),
72
+
73
+ array( "type" => "GovernmentOffice", "display" => "- GovernmentOffice" ),
74
+ array( "type" => "PostOffice", "display" => "-- PostOffice" ),
75
+
76
+ array( "type" => "HealthAndBeautyBusiness", "display" => "- HealthAndBeautyBusiness" ),
77
+ array( "type" => "BeautySalon", "display" => "-- BeautySalon" ),
78
+ array( "type" => "DaySpa", "display" => "-- DaySpa" ),
79
+ array( "type" => "HairSalon", "display" => "-- HairSalon" ),
80
+ array( "type" => "HealthClub", "display" => "-- HealthClub" ),
81
+ array( "type" => "NailSalon", "display" => "-- NailSalon" ),
82
+ array( "type" => "TattooParlor", "display" => "-- TattooParlor" ),
83
+
84
+ array( "type" => "HomeAndConstructionBusiness", "display" => "- HomeAndConstructionBusiness" ),
85
+ array( "type" => "Electrician", "display" => "-- Electrician" ),
86
+ array( "type" => "GeneralContractor", "display" => "-- GeneralContractor" ),
87
+ array( "type" => "HVACBusiness", "display" => "-- HVACBusiness" ),
88
+ array( "type" => "HousePainter", "display" => "-- HousePainter" ),
89
+ array( "type" => "Locksmith", "display" => "-- Locksmith" ),
90
+ array( "type" => "MovingCompany", "display" => "-- MovingCompany" ),
91
+ array( "type" => "Plumber", "display" => "-- Plumber" ),
92
+ array( "type" => "RoofingContractor", "display" => "-- RoofingContractor" ),
93
+
94
+ array( "type" => "InternetCafe", "display" => "- InternetCafe" ),
95
+
96
+ array( "type" => "LegalService", "display" => "- LegalService" ),
97
+ array( "type" => "Attorney", "display" => "-- Attorney" ),
98
+ array( "type" => "Notary", "display" => "-- Notary" ),
99
+
100
+ array( "type" => "Library", "display" => "- Library" ),
101
+
102
+ array( "type" => "LodgingBusiness", "display" => "- LodgingBusiness" ),
103
+ array( "type" => "BedAndBreakfast", "display" => "-- BedAndBreakfast" ),
104
+ array( "type" => "Hostel", "display" => "-- Hostel" ),
105
+ array( "type" => "Hotel", "display" => "-- Hotel" ),
106
+ array( "type" => "Motel", "display" => "-- Motel" ),
107
+
108
+ array( "type" => "MedicalOrganization", "display" => "- MedicalOrganization" ),
109
+ array( "type" => "Dentist", "display" => "-- Dentist" ),
110
+ array( "type" => "DiagnosticLab", "display" => "-- DiagnosticLab" ),
111
+ array( "type" => "Hospital", "display" => "-- Hospital" ),
112
+ array( "type" => "MedicalClinic", "display" => "-- MedicalClinic" ),
113
+ array( "type" => "Optician", "display" => "-- Optician" ),
114
+ array( "type" => "Pharmacy", "display" => "-- Pharmacy" ),
115
+ array( "type" => "Physician", "display" => "-- Physician" ),
116
+ array( "type" => "VeterinaryCare", "display" => "-- VeterinaryCare" ),
117
+
118
+ array( "type" => "ProfessionalService", "display" => "- ProfessionalService" ),
119
+
120
+ array( "type" => "RadioStation", "display" => "- RadioStation" ),
121
+
122
+ array( "type" => "RealEstateAgent", "display" => "- RealEstateAgent" ),
123
+
124
+ array( "type" => "RecyclingCenter", "display" => "- RecyclingCenter" ),
125
+
126
+ array( "type" => "SelfStorage", "display" => "- SelfStorage" ),
127
+
128
+ array( "type" => "ShoppingCenter", "display" => "- ShoppingCenter" ),
129
+
130
+ array( "type" => "SportsActivityLocation", "display" => "- SportsActivityLocation" ),
131
+ array( "type" => "BowlingAlley", "display" => "-- BowlingAlley" ),
132
+ array( "type" => "ExerciseGym", "display" => "-- ExerciseGym" ),
133
+ array( "type" => "GolfCourse", "display" => "-- GolfCourse" ),
134
+ array( "type" => "HealthClub", "display" => "-- HealthClub" ),
135
+ array( "type" => "PublicSwimmingPool", "display" => "-- PublicSwimmingPool" ),
136
+ array( "type" => "SkiResort", "display" => "-- SkiResort" ),
137
+ array( "type" => "SportsClub", "display" => "-- SportsClub" ),
138
+ array( "type" => "StadiumOrArena", "display" => "-- StadiumOrArena" ),
139
+ array( "type" => "TennisComplex", "display" => "-- TennisComplex" ),
140
+
141
+ array( "type" => "Store", "display" => "- Store" ),
142
+ array( "type" => "AutoPartsStore", "display" => "-- AutoPartsStore" ),
143
+ array( "type" => "BikeStore", "display" => "-- BikeStore" ),
144
+ array( "type" => "BookStore", "display" => "-- BookStore" ),
145
+ array( "type" => "ClothingStore", "display" => "-- ClothingStore" ),
146
+ array( "type" => "ComputerStore", "display" => "-- ComputerStore" ),
147
+ array( "type" => "ConvenienceStore", "display" => "-- ConvenienceStore" ),
148
+ array( "type" => "DepartmentStore", "display" => "-- DepartmentStore" ),
149
+ array( "type" => "ElectronicsStore", "display" => "-- ElectronicsStore" ),
150
+ array( "type" => "Florist", "display" => "-- Florist" ),
151
+ array( "type" => "FurnitureStore", "display" => "-- FurnitureStore" ),
152
+ array( "type" => "GardenStore", "display" => "-- GardenStore" ),
153
+ array( "type" => "GroceryStore", "display" => "-- GroceryStore" ),
154
+ array( "type" => "HardwareStore", "display" => "-- HardwareStore" ),
155
+ array( "type" => "HobbyShop", "display" => "-- HobbyShop" ),
156
+ array( "type" => "HomeGoodsStore", "display" => "-- HomeGoodsStore" ),
157
+ array( "type" => "JewelryStore", "display" => "-- JewelryStore" ),
158
+ array( "type" => "LiquorStore", "display" => "-- LiquorStore" ),
159
+ array( "type" => "MensClothingStore", "display" => "-- MensClothingStore" ),
160
+ array( "type" => "MobilePhoneStore", "display" => "-- MobilePhoneStore" ),
161
+ array( "type" => "MovieRentalStore", "display" => "-- MovieRentalStore" ),
162
+ array( "type" => "MusicStore", "display" => "-- MusicStore" ),
163
+ array( "type" => "OfficeEquipmentStore", "display" => "-- OfficeEquipmentStore" ),
164
+ array( "type" => "OutletStore", "display" => "-- OutletStore" ),
165
+ array( "type" => "PawnShop", "display" => "-- PawnShop" ),
166
+ array( "type" => "PetStore", "display" => "-- PetStore" ),
167
+ array( "type" => "ShoeStore", "display" => "-- ShoeStore" ),
168
+ array( "type" => "SportingGoodsStore", "display" => "-- SportingGoodsStore" ),
169
+ array( "type" => "TireShop", "display" => "-- TireShop" ),
170
+ array( "type" => "ToyStore", "display" => "-- ToyStore" ),
171
+ array( "type" => "WholesaleStore", "display" => "-- WholesaleStore" ),
172
+
173
+ array( "type" => "TelevisionStation", "display" => "- TelevisionStation" ),
174
+
175
+ array( "type" => "TouristInformationCenter", "display" => "- TouristInformationCenter" ),
176
+
177
+ array( "type" => "TravelAgency", "display" => "- TravelAgency" )
178
+ );
179
+
180
+ /** weekType defined. */
181
+ private $week_array = array(
182
+ array("type" => "Mo", "display" => "Monday"),
183
+ array("type" => "Tu", "display" => "Tuesday"),
184
+ array("type" => "We", "display" => "Wednesday"),
185
+ array("type" => "Th", "display" => "Thursday"),
186
+ array("type" => "Fr", "display" => "Friday"),
187
+ array("type" => "Sa", "display" => "Saturday"),
188
+ array("type" => "Su", "display" => "Sunday")
189
+ );
190
+
191
+ /**
192
+ * Constructor Define.
193
+ *
194
+ * @version 3.1.4
195
+ * @since 2.3.0
196
+ * @param array $option
197
+ */
198
+ public function __construct ( array $option ) {
199
+ /** Default Value Set */
200
+ $option_array = $this->get_default_options();
201
+
202
+ if ( !empty( $option ) ) {
203
+ $option_array = array_merge( $option_array, $option );
204
+ }
205
+
206
+ $this->page_render( $option_array );
207
+ }
208
+
209
+ /**
210
+ * Form Layout Render
211
+ *
212
+ * @version 3.1.4
213
+ * @since 2.3.3
214
+ * @param array $option
215
+ */
216
+ private function page_render ( array $option ) {
217
+ /** Local Business Type */
218
+ $html = '<table class="schema-admin-table">';
219
+ $html .= '<caption>Local Business</caption>';
220
+ $html .= $this->set_form_select( 'business_type', 'Local Business Type', $option['business_type'], 'Default : "Local Business"' );
221
+ $html .= $this->set_form_text( 'image', 'An image of the business', $option['image'], true, 'Default : bloginfo("url")' );
222
+ $html .= $this->set_form_text( 'name', 'Business Name', $option['name'], true, 'Default : bloginfo("name")' );
223
+ $html .= $this->set_form_text( 'url', 'Url', $option['url'], true, 'Default : bloginfo("url")' );
224
+ $html .= $this->set_form_text( 'telephone', 'Telephone', $option['telephone'], false, 'e.g. : +1-880-555-1212' );
225
+ $html .= '</table>';
226
+ echo $html;
227
+
228
+ /** For food establishments */
229
+ $html = '<table class="schema-admin-table">';
230
+ $html .= '<caption>For food establishments</caption>';
231
+ $html .= $this->set_form_checkbox( 'food_active', 'Setting', $option['food_active'], 'Enabled' );
232
+ $html .= $this->set_form_text( 'menu', 'Menu url', $option['menu'], false, 'For food establishments, the fully-qualified URL of the menu.' );
233
+ $html .= $this->set_form_checkbox( 'accepts_reservations', 'Accepts Reservations', $option['accepts_reservations'], 'For food establishments, and whether it is possible to accept a reservation?' );
234
+ $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.' );
235
+ $html .= '</table>';
236
+ echo $html;
237
+
238
+ /** Postal Address */
239
+ $html = '<table class="schema-admin-table">';
240
+ $html .= '<caption>Postal Address</caption>';
241
+ $html .= $this->set_form_text( 'street_address', 'Street Address', $option['street_address'], true );
242
+ $html .= $this->set_form_text( 'address_locality', 'Address Locality', $option['address_locality'], true );
243
+ $html .= $this->set_form_text( 'address_region', 'Address Region', $option['address_region'], false );
244
+ $html .= $this->set_form_text( 'postal_code', 'Postal Code', $option['postal_code'], true );
245
+ $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>' );
246
+ $html .= '</table>';
247
+ echo $html;
248
+
249
+ /** Geo Circle */
250
+ $html = '<table class="schema-admin-table">';
251
+ $html .= '<caption>Geo Circle</caption>';
252
+ $html .= $this->set_form_checkbox( 'geo_circle_active', 'Setting', $option['geo_circle_active'], 'Enabled' );
253
+ $html .= $this->set_form_text( 'geo_circle_radius', 'geoRadius', $option['geo_circle_radius'], false );
254
+ $html .= '</table>';
255
+ echo $html;
256
+
257
+ /** Geo Coordinates */
258
+ $html = '<table class="schema-admin-table">';
259
+ $html .= '<caption>Geo Coordinates</caption>';
260
+ $html .= $this->set_form_checkbox( 'geo_active', 'Setting', $option['geo_active'], 'Enabled' );
261
+ $html .= $this->set_form_text( 'latitude', 'Latitude', $option['latitude'], false );
262
+ $html .= $this->set_form_text( 'longitude', 'Longitude', $option['longitude'], false );
263
+ $html .= '</table>';
264
+ echo $html;
265
+
266
+ /** Opening Hours Specification */
267
+ $html = '<table class="schema-admin-table">';
268
+ $html .= '<caption>Opening Hours Specification</caption>';
269
+
270
+ $i = 0;
271
+
272
+ foreach ( $this->week_array as $value ) {
273
+ if ( !isset( $option[$value['type']] ) ) {
274
+ $option[$value['type']] = "";
275
+ }
276
+
277
+ $html .= $this->set_form_checkbox( $value['type'], $value['display'], $option[$value['type']], 'Enabled' );
278
+
279
+ if ( isset( $option['week'][$value['type']] ) ) {
280
+ foreach ( $option['week'][$value['type']] as $type ) {
281
+ if ( !empty( $type['open'] ) ) {
282
+ $html .= $this->set_form_time( $value['type'], '', $type['open'], $type['close'], '', $i );
283
+ $i++;
284
+ } else {
285
+ $html .= $this->set_form_time( $value['type'], '', '', '', '', 0 );
286
+ break;
287
+ }
288
+ }
289
+ } else {
290
+ $html .= $this->set_form_time( $value['type'], '', '', '', '', 0 );
291
+ }
292
+
293
+ $i = 0;
294
+ }
295
+
296
+ $html .= '</table>';
297
+ echo $html;
298
+
299
+ /** Holiday Opening Hours */
300
+ $html = '<table class="schema-admin-table">';
301
+ $html .= '<caption>Holiday Opening Hours</caption>';
302
+ $html .= $this->set_form_checkbox( 'holiday_active', 'Setting', $option['holiday_active'], 'Enabled' );
303
+ $html .= $this->set_form_time_holiday( $option['holiday_open'], $option['holiday_close'] );
304
+ $html .= $this->set_form_date( 'holiday_valid_from', 'validFrom', $option['holiday_valid_from'], false );
305
+ $html .= $this->set_form_date( 'holiday_valid_through', 'validThrough', $option['holiday_valid_through'], false );
306
+
307
+ $html .= '</table>';
308
+ echo $html;
309
+
310
+ /** Price Range */
311
+ $html = '<table class="schema-admin-table">';
312
+ $html .= '<caption>Price Range</caption>';
313
+ $html .= $this->set_form_text( 'price_range', 'Price Range', $option['price_range'], false, 'The price range of the business, for example $$$.' );
314
+ $html .= '</table>';
315
+ echo $html;
316
+
317
+ 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>';
318
+ submit_button();
319
+ }
320
+
321
+ /**
322
+ * Return the default options array
323
+ *
324
+ * @since 3.1.4
325
+ * @version 2.5.0
326
+ * @return array $args
327
+ */
328
+ private function get_default_options () {
329
+ $args['business_type'] = 'local_business';
330
+ $args['name'] = get_bloginfo('name');
331
+ $args['image'] = get_bloginfo('url');
332
+ $args['url'] = get_bloginfo('url');
333
+ $args['telephone'] = '';
334
+ $args['food_active'] = '';
335
+ $args['menu'] = '';
336
+ $args['accepts_reservations'] = '';
337
+ $args['serves_cuisine'] = '';
338
+ $args['street_address'] = '';
339
+ $args['address_locality'] = '';
340
+ $args['address_region'] = '';
341
+ $args['postal_code'] = '';
342
+ $args['address_country'] = '';
343
+ $args['geo_circle_active'] = '';
344
+ $args['geo_circle_radius'] = '';
345
+ $args['geo_active'] = '';
346
+ $args['latitude'] = '';
347
+ $args['longitude'] = '';
348
+ $args['opening_active'] = '';
349
+
350
+ foreach ( $this->week_array as $value ) {
351
+ $args[$value['type']] = '';
352
+ $args['week'][$value['type']]['open'] = '';
353
+ $args['week'][$value['type']]['close'] = '';
354
+ }
355
+
356
+ $args['holiday_active'] = '';
357
+ $args['holiday_open'] = '';
358
+ $args['holiday_close'] = '';
359
+ $args['holiday_valid_from'] = '';
360
+ $args['holiday_valid_through'] = '';
361
+ $args['price_range'] = '';
362
+
363
+ return (array) $args;
364
+ }
365
+
366
+ /**
367
+ * Return the form text
368
+ *
369
+ * @version 3.0.5
370
+ * @since 2.3.0
371
+ * @param string $id
372
+ * @param string $display
373
+ * @param string $value
374
+ * @param boolean $required
375
+ * @param string $note
376
+ * @return string $html
377
+ */
378
+ private function set_form_text ( $id, $display, $value = "", $required = false, $note = "" ) {
379
+ $value = esc_attr( $value );
380
+
381
+ if ( $required ) {
382
+ $format = '<tr><th class="require"><label for=%s>%s :</label></th><td>';
383
+ } else {
384
+ $format = '<tr><th><label for=%s>%s :</label></th><td>';
385
+ }
386
+
387
+ $format .= '<input type="text" name="option[%s]" id="%s" class="regular-text" value="%s"';
388
+
389
+ if ( $required ) {
390
+ $format .= ' required';
391
+ }
392
+ $format .= '><small>%s</small></td></tr>';
393
+
394
+ return (string) sprintf( $format, $id, $display, $id, $id, $value, $note );
395
+ }
396
+
397
+ /**
398
+ * Return the form date
399
+ *
400
+ * @since 3.0.5
401
+ * @version 2.5.0
402
+ * @param string $id
403
+ * @param string $display
404
+ * @param string $value
405
+ * @param boolean $required
406
+ * @param string $note
407
+ * @return string $html
408
+ */
409
+ private function set_form_date ( $id, $display, $value = "", $required = false, $note = "" ) {
410
+ $value = esc_attr( $value );
411
+
412
+ $format = '<tr><th><label for=%s>%s :</label></th><td>';
413
+ $format .= '<input type="date" name="option[%s]" id="%s" value="%s"';
414
+ if ( $required ) {
415
+ $format .= ' required';
416
+ }
417
+ $format .= '><small>%s</small></td></tr>';
418
+
419
+ return (string) sprintf( $format, $id, $display, $id, $id, $value, $note );
420
+ }
421
+
422
+ /**
423
+ * Return the form checkbox
424
+ *
425
+ * @version 3.0.5
426
+ * @since 2.3.0
427
+ * @param string $id
428
+ * @param string $display
429
+ * @param string $value
430
+ * @param string $note
431
+ * @return string $html
432
+ */
433
+ private function set_form_checkbox ( $id, $display, $value = "", $note = "" ) {
434
+ $value = esc_attr( $value );
435
+
436
+ $format = '<tr><th><label for=%s>%s :</label></th><td>';
437
+ $format .= '<input type="checkbox" name="option[%s]" id="%s" value="on"';
438
+ if ( $value === 'on' ) {
439
+ $format .= ' checked="checked"';
440
+ }
441
+ $format .= '>%s</td></tr>';
442
+
443
+ return (string) sprintf( $format, $id, $display, $id, $id, $note );
444
+ }
445
+
446
+ /**
447
+ * Return the form select
448
+ *
449
+ * @since 2.3.0
450
+ * @param string $id
451
+ * @param string $display
452
+ * @param string $value
453
+ * @param string $note
454
+ * @return string $html
455
+ */
456
+ private function set_form_select ( $id, $display, $value = "", $note = "" ) {
457
+ $value = esc_attr( $value );
458
+
459
+ $format = '<tr><th class="require"><label for=%s>%s :</label></th><td>';
460
+ $format .= '<select id="%s" name="option[%s]">';
461
+ foreach ( $this->business_type_array as $args ) {
462
+ $format .= '<option value="' . $args['type'] . '"';
463
+ if ( $args['type'] === $value ) {
464
+ $format .= ' selected';
465
+ }
466
+ $format .= '>' . $args['display'] . '</option>';
467
+ }
468
+ $format .= '</select>';
469
+ $format .= '<small>%s</small></td></tr>';
470
+
471
+ return (string) sprintf( $format, $id, $display, $id, $id, $note );
472
+ }
473
+
474
+ /**
475
+ * Return the form time
476
+ *
477
+ * @version 3.0.5
478
+ * @since 2.3.0
479
+ * @param string $id
480
+ * @param string $display
481
+ * @param string $value1
482
+ * @param string $value2
483
+ * @param string $note
484
+ * @param int $count
485
+ * @return string $html
486
+ */
487
+ private function set_form_time ( $id, $display, $value1 = "", $value2 = "", $note = "", $count = 0 ) {
488
+ $value1 = esc_attr( $value1 );
489
+ $value2 = esc_attr( $value2 );
490
+
491
+ $format = '<tr class="opening-hours %s"><th><label for=%s>%s :</label></th><td>';
492
+ $format .= 'Open Time : <input type="time" name="option[week][%s][%d][open]" id="%s-open" value="%s">';
493
+ $format .= ' Close Time : <input type="time" name="option[week][%s][%d][close]" id="%s-close" value="%s">';
494
+ $format .= '%s<a class="dashicons dashicons-plus markup-time plus"></a>';
495
+ if( $count !== 0 ) {
496
+ $format .= '<a class="dashicons dashicons-minus markup-time minus"></a>';
497
+ }
498
+ $format .= '</td></tr>';
499
+
500
+ return (string) sprintf( $format, $id, $id, $display, $id, $count, $id, $value1, $id, $count, $id, $value2, $note );
501
+ }
502
+
503
+ /**
504
+ * Return the form time (Holiday)
505
+ *
506
+ * @since 2.5.0
507
+ * @version 2.5.0
508
+ * @param string $value1
509
+ * @param string $value2
510
+ * @return string $html
511
+ */
512
+ private function set_form_time_holiday ( $value1 = "", $value2 = "" ) {
513
+ $value1 = esc_attr( $value1 );
514
+ $value2 = esc_attr( $value2 );
515
+
516
+ $format = '<tr><th>Holiday Time :</th><td>';
517
+ $format .= 'Open Time : <input type="time" name="option[holiday_open]" value="%s">';
518
+ $format .= 'Close Time : <input type="time" name="option[holiday_close]" value="%s">';
519
+ $format .= '</td></tr>';
520
+
521
+ return (string) sprintf( $format, $value1, $value2 );
522
+ }
523
+ }
includes/admin/wp-structuring-admin-type-news-article.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type News Article
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.2.2
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 3.2.2
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 .= '</table>';
63
+ echo $html;
64
+
65
+ $html = '<table class="schema-admin-table">';
66
+ $html .= '<caption>author</caption>';
67
+ $html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
68
+ $html .= '<tr><th>name :</th><td><small>Default : get_the_author_meta( "display_name", author )</small>';
69
+ $html .= '</td></tr>';
70
+ $html .= '</table>';
71
+ echo $html;
72
+
73
+ $html = '<table class="schema-admin-table">';
74
+ $html .= '<caption>publisher</caption>';
75
+ $html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
76
+ $html .= '<tr><th><label for="name">Organization Name :</label></th><td>';
77
+ $html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" value="' . esc_attr( $option['name'] ) . '">';
78
+ $html .= '<small>Default : bloginfo("name")</small>';
79
+ $html .= '</td></tr>';
80
+ $html .= '</table>';
81
+ echo $html;
82
+
83
+ $html = '<table class="schema-admin-table">';
84
+ $html .= '<caption>publisher.logo</caption>';
85
+ $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
86
+ $html .= '<tr><th><label for="logo">url :</label></th><td>';
87
+ $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
88
+ $html .= '<button id="media-upload" class="schema-admin-media-button dashicons-before dashicons-admin-media"><span>Add Media</span></button>';
89
+ $html .= '</td></tr>';
90
+ $html .= '<tr><th><label for="logo-width">width :</label></th><td>';
91
+ $html .= '<input type="number" name="option[' . "logo-width" . ']" id="logo-width" min="0" value="' . esc_attr( $option['logo-width'] ) . '">px';
92
+ $html .= '<small>height <= 600px.</small>';
93
+ $html .= '</td></tr>';
94
+ $html .= '<tr><th><label for="logo-height">height :</label></th><td>';
95
+ $html .= '<input type="number" name="option[' . "logo-height" . ']" id="logo-height" min="0" value="' . esc_attr( $option['logo-height'] ) . '">px';
96
+ $html .= '<small>height <= 60px.</small>';
97
+ $html .= '</td></tr>';
98
+ $html .= '</table>';
99
+ echo $html;
100
+
101
+ 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>';
102
+ submit_button();
103
+ }
104
+
105
+ /**
106
+ * Return the default options array
107
+ *
108
+ * @since 3.2.2
109
+ * @version 2.2.0
110
+ * @return array $args
111
+ */
112
+ private function get_default_options () {
113
+ $args['name'] = get_bloginfo('name');
114
+ $args['logo'] = "";
115
+ $args['logo-height'] = 0;
116
+ $args['logo-width'] = 0;
117
+
118
+ return (array) $args;
119
+ }
120
+ }
includes/admin/wp-structuring-admin-type-organization.php ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Organization
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.1.4
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
+ * @since 1.0.0
52
+ * @param array $option
53
+ */
54
+ public function __construct ( array $option ) {
55
+ /** Default Value Set */
56
+ if ( empty( $option ) ) {
57
+ $option = $this->get_default_options( $option );
58
+ }
59
+ $this->page_render( $option );
60
+ }
61
+
62
+ /**
63
+ * Form Layout Render
64
+ *
65
+ * @version 3.2.0
66
+ * @since 1.0.0
67
+ * @param array $option
68
+ */
69
+ private function page_render ( array $option ) {
70
+ /** Logos */
71
+ $html = '<table class="schema-admin-table">';
72
+ $html .= '<caption>Logos</caption>';
73
+ $html .= '<tr><th class="require"><label for="name">Organization Name :</label></th><td>';
74
+ $html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" required value="' . esc_attr( $option['name'] ) . '">';
75
+ $html .= '<small>Default : bloginfo("name")</small>';
76
+ $html .= '</td></tr>';
77
+ $html .= '<tr><th class="require"><label for="url">url :</label></th><td>';
78
+ $html .= '<input type="text" name="option[' . "url" . ']" id="url" class="regular-text" required value="' . esc_attr( $option['url'] ) . '">';
79
+ $html .= '<small>Default : bloginfo("url")</small>';
80
+ $html .= '</td></tr>';
81
+ $html .= '<tr><th class="require"><label for="logo">logo :</label></th><td>';
82
+ $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" required value="' . esc_attr( $option['logo'] ) . '">';
83
+ $html .= '<button id="media-upload" class="schema-admin-media-button dashicons-before dashicons-admin-media"><span>Add Media</span></button>';
84
+ $html .= '<small>Default : bloginfo("url") + "/images/logo.png"</small>';
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'] ) . '">';
101
+ $html .= '<small>e.g. : +1-880-555-1212</small>';
102
+ $html .= '</td></tr>';
103
+ $html .= '<tr><th><label for="contact_type">contactType :</label></th><td>';
104
+ $html .= '<select id="contact_type" name="option[' . "contact_type" . ']">';
105
+ foreach ( $this->contact_type_array as $value ) {
106
+ $html .= '<option value="' . $value['type'] . '"';
107
+ if ( $value['type'] === $option['contact_type'] ) {
108
+ $html .= ' selected';
109
+ }
110
+ $html .= '>' . $value['display'] . '</option>';
111
+ }
112
+ $html .= '</select>';
113
+ $html .= '<small>Default : "customer service"</small>';
114
+ $html .= '</td></tr>';
115
+ $html .= '<tr><th><label for="email">email :</label></th><td>';
116
+ $html .= '<input type="email" name="option[' . "email" . ']" id="email" class="regular-text" value="' . esc_attr( $option['email'] ) . '">';
117
+ $html .= '<small>e.g. : info@example.com</small>';
118
+ $html .= '</td></tr>';
119
+ $html .= '<tr><th><label for="area_served">areaServed :</label></th><td>';
120
+ $html .= '<input type="text" name="option[' . "area_served" . ']" id="area_served" class="regular-text" value="' . esc_attr( $option['area_served'] ) . '">';
121
+ $html .= '<small>Default : "US"&nbsp;&nbsp;Multiple : "US,CA"</small>';
122
+ $html .= '</td></tr>';
123
+ $html .= '<tr><th>contactOption :</th><td>';
124
+ $html .= '<label><input type="checkbox" name="option[' . "contact_point_1" . ']" id="contact_point_1" value="on"';
125
+ if ( isset( $option['contact_point_1'] ) && $option['contact_point_1'] === 'on' ) {
126
+ $html .= ' checked="checked"';
127
+ }
128
+ $html .= '>HearingImpairedSupported</label><br>';
129
+ $html .= '<label><input type="checkbox" name="option[' . "contact_point_2" . ']" id="contact_point_2" value="on"';
130
+ if ( isset( $option['contact_point_2'] ) && $option['contact_point_2'] === 'on' ) {
131
+ $html .= ' checked="checked"';
132
+ }
133
+ $html .= '>TollFree</label><br>';
134
+ $html .= '</td></tr>';
135
+ $html .= '<tr><th><label for="available_language">available&nbsp;Language :</label></th><td>';
136
+ $html .= '<input type="text" name="option[' . "available_language" . ']" id="available_language" class="regular-text" value="' . esc_attr( $option['available_language'] ) . '">';
137
+ $html .= '<small>Default : "English"&nbsp;&nbsp;Multiple : "French,English"</small>';
138
+ $html .= '</td></tr>';
139
+ $html .= '</table>';
140
+ echo $html;
141
+
142
+ /** Social Profiles */
143
+ $html = '<table class="schema-admin-table">';
144
+ $html .= '<caption>Social Profiles</caption>';
145
+ foreach ( $this->social_array as $value ) {
146
+ $html .= '<tr><th><label for="' . $value['type'] . '">' . $value['display'] . ' :</label></th><td>';
147
+ $html .= '<input type="text" name="option[' . "social" . '][' . $value['type'] . ']" id="' . $value['type'] . '" class="regular-text" value="' . esc_attr( $option['social'][$value['type']] ) . '">';
148
+ $html .= '</td></tr>';
149
+ }
150
+ $html .= '</table>';
151
+ echo $html;
152
+
153
+ 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>';
154
+ submit_button();
155
+ }
156
+
157
+ /**
158
+ * Return the default options array
159
+ *
160
+ * @version 3.2.0
161
+ * @since 1.0.0
162
+ * @param array $args
163
+ * @return array $args
164
+ */
165
+ private function get_default_options ( array $args ) {
166
+ $args['name'] = get_bloginfo('name');
167
+ $args['url'] = get_bloginfo('url');
168
+ $args['logo'] = get_bloginfo('url') . '/images/logo.png';
169
+ $args['contact_point'] = '';
170
+ $args['telephone'] = '';
171
+ $args['contact_type'] = 'customer_service';
172
+ $args['email'] = '';
173
+ $args['area_served'] = 'US';
174
+ $args['contact_option_1'] = '';
175
+ $args['contact_option_2'] = '';
176
+ $args['available_language'] = 'English';
177
+
178
+ foreach ( $this->social_array as $value ) {
179
+ $args['social'][$value['type']] = '';
180
+ }
181
+
182
+ return (array) $args;
183
+ }
184
+ }
includes/admin/wp-structuring-admin-type-person.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Person
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.1.2
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 3.1.2
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 .= '<small>Default : bloginfo("name")</small>';
66
+ $html .= '</td></tr>';
67
+ $html .= '<tr><th class="require"><label for="url">url :</label></th><td>';
68
+ $html .= '<input type="text" name="option[' . "url" . ']" id="url" class="regular-text" required value="' . esc_attr( $option['url'] ) . '">';
69
+ $html .= '<small>Default : bloginfo("url")</small>';
70
+ $html .= '</td></tr>';
71
+ $html .= '</table>';
72
+ echo $html;
73
+
74
+ /** Place Settings */
75
+ $html = '<table class="schema-admin-table">';
76
+ $html .= '<caption>Place Settings</caption>';
77
+ $html .= '<tr><th class="require"><label for="addressCountry">addressCountry :</label></th><td>';
78
+ $html .= '<input type="text" name="option[' . "addressCountry" . ']" id="addressCountry" class="regular-text" required value="' . esc_attr( $option['addressCountry'] ) . '">';
79
+ $html .= '<small>e.g. Japan</small>';
80
+ $html .= '</td></tr>';
81
+ $html .= '</table>';
82
+ echo $html;
83
+
84
+ /** Social Profiles */
85
+ $html = '<table class="schema-admin-table">';
86
+ $html .= '<caption>Social Profiles</caption>';
87
+ foreach ( $this->social_array as $value ) {
88
+ $html .= '<tr><th><label for="' . $value['type'] . '">' . $value['display'] . ' :</label></th><td>';
89
+ $html .= '<input type="text" name="option[' . "social" . '][' . $value['type'] . ']" id="' . $value['type'] . '" class="regular-text" value="' . esc_attr( $option['social'][$value['type']] ) . '">';
90
+ $html .= '</td></tr>';
91
+ }
92
+ $html .= '</table>';
93
+ echo $html;
94
+
95
+ 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>';
96
+ submit_button();
97
+ }
98
+
99
+ /**
100
+ * Return the default options array
101
+ *
102
+ * @since 3.1.2
103
+ * @version 2.4.0
104
+ * @return array $args
105
+ */
106
+ private function get_default_options () {
107
+ $args['name'] = get_bloginfo('name');
108
+ $args['url'] = get_bloginfo('url');
109
+ $args['addressCountry'] = '';
110
+
111
+ foreach ( $this->social_array as $value ) {
112
+ $args['social'][$value['type']] = '';
113
+ }
114
+
115
+ return (array) $args;
116
+ }
117
+ }
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
+ }
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
+ }
includes/admin/wp-structuring-admin-type-website.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type WebSite
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.1.0
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 3.1.0
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 .= '<small>Default : bloginfo("name")</small>';
46
+ $html .= '</td></tr>';
47
+ $html .= '<tr><th><label for="alternateName">alternateName :</label></th><td>';
48
+ $html .= '<input type="text" name="option[' . "alternateName" . ']" id="alternateName" class="regular-text" value="' . esc_attr( $option['alternateName'] ) . '">';
49
+ $html .= '<small>Default : bloginfo("name")</small>';
50
+ $html .= '</td></tr>';
51
+ $html .= '<tr><th class="require"><label for="url">url :</label></th><td>';
52
+ $html .= '<input type="text" name="option[' . "url" . ']" id="url" class="regular-text" required value="' . esc_attr( $option['url'] ) . '">';
53
+ $html .= '<small>Default : bloginfo("url")</small>';
54
+ $html .= '</td></tr>';
55
+ $html .= '</table>';
56
+ echo $html;
57
+
58
+ $html = '<table class="schema-admin-table">';
59
+ $html .= '<caption>Sitelink Search Box [ Site ]</caption>';
60
+ $html .= '<tr><th><label for="potential_action">potentialAction Active :</label></th><td>';
61
+ $html .= '<input type="checkbox" name="option[' . "potential_action" . ']" id="potential_action" value="on"';
62
+ if ( isset( $option['potential_action'] ) && $option['potential_action'] === 'on' ) {
63
+ $html .= ' checked="checked"';
64
+ }
65
+ $html .= '>Enabled';
66
+ $html .= '</td></tr>';
67
+ $html .= '<tr><th><label for="target">target :</label></th><td>';
68
+ $html .= '<input type="text" name="option[' . "target" . ']" id="target" class="regular-text" value="' . esc_attr( $option['target'] ) . '">';
69
+ $html .= '<small>Default : bloginfo("url") + /?s=</small>';
70
+ $html .= '</td></tr>';
71
+ $html .= '</table>';
72
+ echo $html;
73
+
74
+ $html = '<table class="schema-admin-table">';
75
+ $html .= '<caption>Sitelink Search Box [ App ] *required Sitelink Search Box [ Site ]</caption>';
76
+ $html .= '<tr><th><label for="potential_action_app">potentialAction Active :</label></th><td>';
77
+ $html .= '<input type="checkbox" name="option[' . "potential_action_app" . ']" id="potential_action_app" value="on"';
78
+ if ( isset( $option['potential_action_app'] ) && $option['potential_action_app'] === 'on' ) {
79
+ $html .= ' checked="checked"';
80
+ }
81
+ $html .= '>Enabled';
82
+ $html .= '</td></tr>';
83
+ $html .= '<tr><th><label for="target_app">target :</label></th><td>';
84
+ $html .= '<input type="text" name="option[' . "target_app" . ']" id="target_app" class="regular-text" value="' . esc_attr( $option['target_app'] ) . '">';
85
+ $html .= '<small>e.g. android-app://com.example/https/query.example.com/search/?q=</small>';
86
+ $html .= '</td></tr>';
87
+ $html .= '</table>';
88
+ echo $html;
89
+
90
+ 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>';
91
+ submit_button();
92
+ }
93
+
94
+ /**
95
+ * Return the default options array
96
+ *
97
+ * @version 3.1.0
98
+ * @since 1.0.0
99
+ * @return array $args
100
+ */
101
+ private function get_default_options () {
102
+ $args = array();
103
+
104
+ $args['name'] = get_bloginfo('name');
105
+ $args['alternateName'] = $args['name'];
106
+ $args['url'] = get_bloginfo('url');
107
+ $args['potential_action'] = '';
108
+ $args['target'] = $args['url'] . '/?s=';
109
+ $args['potential_action_app'] = '';
110
+ $args['target_app'] = '';
111
+
112
+ return (array) $args;
113
+ }
114
+ }
includes/custom/wp-structuring-custom-post-event.php ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Custom Post "Event"
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.2.3
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
+ * Constructor Define.
52
+ *
53
+ * @version 3.1.6
54
+ * @since 2.1.0
55
+ * @param String $text_domain
56
+ */
57
+ public function __construct ( $text_domain ) {
58
+ $this->text_domain = $text_domain;
59
+
60
+ /** Custom post menu controls */
61
+ $show_flag = __return_false();
62
+ if ( isset( $_POST['type'] ) && $_POST['type'] === 'event' ) {
63
+ if ( isset( $_POST['activate'] ) && $_POST['activate'] === 'on' ) {
64
+ $show_flag = __return_true();
65
+ }
66
+ } else {
67
+ /** DB Connect */
68
+ $db = new Structuring_Markup_Admin_Db();
69
+ $results = $db->get_type_options('event');
70
+
71
+ if ( isset( $results['activate'] ) && $results['activate'] == 'on' ) {
72
+ $show_flag = __return_true();
73
+ }
74
+ }
75
+
76
+ register_post_type(
77
+ $this->custom_type,
78
+ array(
79
+ 'labels' => array(
80
+ 'name' => esc_html__( 'Event Posts', $this->text_domain ),
81
+ 'singular_name' => esc_html__( 'Event Posts', $this->text_domain ),
82
+ 'all_items' => esc_html__( 'All Event Posts', $this->text_domain )
83
+ ),
84
+ 'capability_type' => 'post',
85
+ 'has_archive' => true,
86
+ 'hierarchical' => false,
87
+ 'menu_position' => 5,
88
+ 'public' => $show_flag,
89
+ 'query_var' => false,
90
+ 'rewrite' => array( 'with_front' => true, 'slug' => 'events' ),
91
+ 'show_in_menu' => $show_flag,
92
+ 'show_ui' => $show_flag,
93
+ 'supports' => array( 'title', 'editor', 'author', 'thumbnail' )
94
+ )
95
+ );
96
+
97
+ if ( is_admin() ) {
98
+ add_action( 'admin_init', array( $this, 'admin_init' ) );
99
+ add_action( 'admin_menu', array( $this, 'admin_menu' ) );
100
+ }
101
+ }
102
+
103
+ /**
104
+ * admin init.
105
+ *
106
+ * @version 2.1.0
107
+ * @since 2.1.0
108
+ */
109
+ public function admin_init () {
110
+ add_action( 'save_post_' . $this->custom_type, array( $this, 'save_post' ) );
111
+ }
112
+
113
+ /**
114
+ * admin meta boxes.
115
+ *
116
+ * @version 2.1.0
117
+ * @since 2.1.0
118
+ */
119
+ public function admin_menu () {
120
+ $custom_field_title = esc_html__( 'Schema.org Type Event', $this->text_domain );
121
+ add_meta_box( $this->custom_type, $custom_field_title, array( $this, 'set_custom_fields' ), $this->custom_type, 'normal' );
122
+ }
123
+
124
+ /**
125
+ * Set custom fields.
126
+ *
127
+ * @version 3.2.3
128
+ * @since 2.1.0
129
+ */
130
+ public function set_custom_fields () {
131
+ $custom_array = get_post_meta( get_the_ID(), $this->custom_type, false );
132
+ $custom_array = isset( $custom_array[0] ) ? unserialize( $custom_array[0] ) : array();
133
+
134
+ /** Default Value Set */
135
+ $args = $this->get_default_options();
136
+
137
+ if ( !empty( $args ) ) {
138
+ $args = array_merge( $args, $custom_array );
139
+ }
140
+
141
+ $html = '';
142
+ $html .= '<table>';
143
+ $html .= '<tr><td><label for="schema_event_type">';
144
+ $html .= esc_html__( 'Event Type', $this->text_domain );
145
+ $html .= '&nbsp;(required)</label></td><td>';
146
+ $html .= '<select name="option[' . "schema_event_type" . ']" id="schema_event_type">';
147
+ foreach( $this->event_type as $value) {
148
+ $html .= '<option';
149
+ if ( $value === $args['schema_event_type'] ) {
150
+ $html .= ' selected="selected"';
151
+ }
152
+ $html .= ' value="' . $value . '">' . $value . '</option>';
153
+ }
154
+ $html .= '</select>';
155
+ $html .= '</td></tr>';
156
+ $html .= '<tr><td><label for="schema_event_name">';
157
+ $html .= esc_html__( 'Event Name', $this->text_domain );
158
+ $html .= '&nbsp;(required)</label></td><td>';
159
+ $html .= '<input type="text" name="option[' . "schema_event_name" . ']" id="schema_event_name" class="regular-text" required value="' . esc_attr( $args['schema_event_name'] ) . '">';
160
+ $html .= '</td></tr>';
161
+ $html .= '<tr><td><label for="schema_event_description">';
162
+ $html .= esc_html__( 'Event Description', $this->text_domain );
163
+ $html .= '&nbsp;(recommended)</label></td><td>';
164
+ $html .= '<textarea name="option[' . "schema_event_description" . ']" id="schema_event_description" class="large-text code" rows="3">' . esc_attr( $args['schema_event_description'] ) . '</textarea>';
165
+ $html .= '</td></tr>';
166
+ $html .= '<tr><td><label for="schema_event_image">';
167
+ $html .= esc_html__( 'Event Image', $this->text_domain );
168
+ $html .= '&nbsp;(recommended)</label></td><td>';
169
+ $html .= '<input type="text" name="option[' . "schema_event_image" . ']" id="schema_event_image" class="large-text" value="' . esc_attr( $args['schema_event_image'] ) . '">';
170
+ $html .= '</td></tr>';
171
+ $html .= '<tr><td><label for="schema_event_date">';
172
+ $html .= esc_html__( 'Start Date', $this->text_domain );
173
+ $html .= '&nbsp;(required)</label></td><td>';
174
+ $html .= '<input type="date" name="option[' . "schema_event_date" . ']" id="schema_event_date" required value="' . esc_attr( $args['schema_event_date'] ) . '">';
175
+ $html .= '<input type="time" name="option[' . "schema_event_time" . ']" id="schema_event_time" required value="' . esc_attr( $args['schema_event_time'] ) . '">';
176
+ $html .= '</td></tr>';
177
+ $html .= '<tr><td><label for="schema_event_date_end">';
178
+ $html .= esc_html__( 'End Date', $this->text_domain );
179
+ $html .= '&nbsp;(recommended)</label></td><td>';
180
+ $html .= '<input type="date" name="option[' . "schema_event_date_end" . ']" id="schema_event_date" value="' . esc_attr( $args['schema_event_date_end'] ) . '">';
181
+ $html .= '<input type="time" name="option[' . "schema_event_time_end" . ']" id="schema_event_time" value="' . esc_attr( $args['schema_event_time_end'] ) . '">';
182
+ $html .= '</td></tr>';
183
+ $html .= '<tr><td><label for="schema_event_url">';
184
+ $html .= esc_html__( 'Event URL', $this->text_domain );
185
+ $html .= '&nbsp;(required)</label></td><td>';
186
+ $html .= '<input type="text" name="option[' . "schema_event_url" . ']" id="schema_event_url" class="regular-text" required value="' . esc_attr( $args['schema_event_url'] ) . '">';
187
+ $html .= '</td></tr>';
188
+ $html .= '<tr><td><label for="schema_event_place_name">';
189
+ $html .= esc_html__( 'Place Name', $this->text_domain );
190
+ $html .= '&nbsp;(required)</label></td><td>';
191
+ $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'] ) . '">';
192
+ $html .= '</td></tr>';
193
+ $html .= '<tr><td><label for="schema_event_place_url">';
194
+ $html .= esc_html__( 'Place URL', $this->text_domain );
195
+ $html .= '&nbsp;(required)</label></td><td>';
196
+ $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'] ) . '">';
197
+ $html .= '</td></tr>';
198
+ $html .= '<tr><td><label for="schema_event_place_address">';
199
+ $html .= esc_html__( 'Place Address', $this->text_domain );
200
+ $html .= '&nbsp;(required)</label></td><td>';
201
+ $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'] ) . '">';
202
+ $html .= '</td></tr>';
203
+ $html .= '<tr><td><label for="schema_event_offers_price">';
204
+ $html .= esc_html__( 'Price', $this->text_domain );
205
+ $html .= '&nbsp;(required)</label></td><td>';
206
+ $html .= '<input type="number" name="option[' . "schema_event_offers_price" . ']" id="schema_event_offers_price" required value="' . esc_attr( $args['schema_event_offers_price'] ) . '">';
207
+ $html .= '</td></tr>';
208
+ $html .= '<tr><td><label for="schema_event_offers_currency">';
209
+ $html .= esc_html__( 'Currency', $this->text_domain );
210
+ $html .= '&nbsp;(required)</label></td><td>';
211
+ $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'] ) . '">';
212
+ $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>';
213
+ $html .= '</td></tr>';
214
+ $html .= '</table>';
215
+
216
+ echo $html;
217
+ }
218
+
219
+ /**
220
+ * Save custom post.
221
+ *
222
+ * @version 2.1.0
223
+ * @since 2.1.0
224
+ * @param integer $post_id The post ID.
225
+ */
226
+ public function save_post ( $post_id ) {
227
+ if ( isset( $_POST['option'] ) ) {
228
+ update_post_meta( $post_id, $this->custom_type, serialize( $_POST['option'] ) );
229
+ }
230
+ }
231
+
232
+ /**
233
+ * Return the default options array
234
+ *
235
+ * @version 3.2.3
236
+ * @since 3.2.3
237
+ * @return array $args
238
+ */
239
+ private function get_default_options () {
240
+ $args = array(
241
+ 'schema_event_type' => 'Event',
242
+ 'schema_event_name' => '',
243
+ 'schema_event_description' => '',
244
+ 'schema_event_image' => '',
245
+ 'schema_event_date' => date( 'Y-m-d' ),
246
+ 'schema_event_time' => date( 'h:i' ),
247
+ 'schema_event_date_end' => '',
248
+ 'schema_event_time_end' => '',
249
+ 'schema_event_url' => '',
250
+ 'schema_event_place_name' => '',
251
+ 'schema_event_place_url' => '',
252
+ 'schema_event_place_address' => '',
253
+ 'schema_event_offers_price' => 0,
254
+ 'schema_event_offers_currency' => esc_html__( 'USD', $this->text_domain )
255
+ );
256
+
257
+ return (array) $args;
258
+ }
259
+ }
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 3.2.3
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 3.2.3
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>';
115
+ $html .= '<tr><td><label for="schema_video_name">';
116
+ $html .= esc_html__( 'Video Name', $this->text_domain );
117
+ $html .= '&nbsp;(required)</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 for="schema_video_description">';
121
+ $html .= esc_html__( 'Video Description', $this->text_domain );
122
+ $html .= '&nbsp;(required)</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 for="schema_video_thumbnail_url">';
126
+ $html .= esc_html__( 'Thumbnail Url', $this->text_domain );
127
+ $html .= '&nbsp;(required)</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 for="schema_video_upload_date">';
131
+ $html .= esc_html__( 'Upload Date', $this->text_domain );
132
+ $html .= '&nbsp;(required)</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 for="schema_video_duration">';
137
+ $html .= esc_html__( 'duration', $this->text_domain );
138
+ $html .= '&nbsp;(recommended)</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 for="schema_video_content_url">';
142
+ $html .= esc_html__( 'contentURL', $this->text_domain );
143
+ $html .= '&nbsp;(recommended)</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 for="schema_video_embed_url">';
147
+ $html .= esc_html__( 'embedURL', $this->text_domain );
148
+ $html .= '&nbsp;(recommended)</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 for="schema_video_interaction_count">';
152
+ $html .= esc_html__( 'interactionCount', $this->text_domain );
153
+ $html .= '&nbsp;(recommended)</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 for="schema_video_expires_date">';
157
+ $html .= esc_html__( 'expires', $this->text_domain );
158
+ $html .= '&nbsp;(recommended)</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
+ }
includes/meta/wp-structuring-meta-article.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Article
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.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.0.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
+ }
75
+
76
+ $options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
77
+
78
+ if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
79
+ $publisher_args = array(
80
+ "publisher" => array(
81
+ "@type" => "Organization",
82
+ "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
83
+ "logo" => array(
84
+ "@type" => "ImageObject",
85
+ "url" => $options['logo'],
86
+ "width" => $logo['width'],
87
+ "height" => $logo['height']
88
+ )
89
+ )
90
+ );
91
+ $args = array_merge( $args, $publisher_args );
92
+ } else if ( !empty( $options['logo'] ) ) {
93
+ $publisher_args = array(
94
+ "publisher" => array(
95
+ "@type" => "Organization",
96
+ "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
97
+ "logo" => array(
98
+ "@type" => "ImageObject",
99
+ "url" => $options['logo'],
100
+ "width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
101
+ "height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
102
+ )
103
+ )
104
+ );
105
+ $args = array_merge( $args, $publisher_args );
106
+ }
107
+
108
+ return (array) $args;
109
+ }
110
+ }
includes/meta/wp-structuring-meta-blog-posting.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type BlogPosting
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.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.0.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
+ }
76
+
77
+ $options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
78
+ if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
79
+ $publisher_args = array(
80
+ "publisher" => array(
81
+ "@type" => "Organization",
82
+ "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
83
+ "logo" => array(
84
+ "@type" => "ImageObject",
85
+ "url" => $options['logo'],
86
+ "width" => $logo['width'],
87
+ "height" => $logo['height']
88
+ )
89
+ )
90
+ );
91
+ $args = array_merge( $args, $publisher_args );
92
+ } else if ( !empty( $options['logo'] ) ) {
93
+ $publisher_args = array(
94
+ "publisher" => array(
95
+ "@type" => "Organization",
96
+ "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
97
+ "logo" => array(
98
+ "@type" => "ImageObject",
99
+ "url" => $options['logo'],
100
+ "width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
101
+ "height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
102
+ )
103
+ )
104
+ );
105
+ $args = array_merge( $args, $publisher_args );
106
+ }
107
+
108
+ return (array) $args;
109
+ }
110
+ }
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
+ }
includes/meta/wp-structuring-meta-event.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Event
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.0
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.0
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
+ /* required items */
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
+ "offers" => array(
54
+ "@type" => "Offer",
55
+ "price" => esc_html( $meta['schema_event_offers_price'] ),
56
+ "priceCurrency" => esc_html( $meta['schema_event_offers_currency'] ),
57
+ "url" => esc_url( $meta['schema_event_url'] )
58
+ )
59
+ );
60
+
61
+ /* recommended items */
62
+ if ( isset( $meta['schema_event_description'] ) && $meta['schema_event_description'] !== '' ) {
63
+ $args['description'] = esc_html( $meta['schema_event_description'] );
64
+ }
65
+ if ( isset( $meta['schema_event_image'] ) && $meta['schema_event_image'] !== '' ) {
66
+ $args['image'] = esc_html( $meta['schema_event_image'] );
67
+ }
68
+ if ( isset( $meta['schema_event_date_end'] ) && $meta['schema_event_date_end'] !== '' && isset( $meta['schema_event_time_end'] ) && $meta['schema_event_time_end'] !== '' ) {
69
+ $args['endDate'] = esc_html( $meta['schema_event_date_end'] ) . 'T' . esc_html( $meta['schema_event_time_end'] );
70
+ }
71
+
72
+ return (array) $args;
73
+ }
74
+ }
75
+ }
includes/meta/wp-structuring-meta-local-business.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type LocalBusiness
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.0
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.0.0
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
+ "telephone" => isset( $options['telephone'] ) ? esc_html( $options['telephone'] ) : ""
43
+ );
44
+
45
+ if ( isset( $options['food_active'] ) && $options['food_active'] === 'on' ) {
46
+ if ( isset( $options['menu'] ) && $options['menu'] !== '' ) {
47
+ $args['menu'] = esc_url( $options['menu'] );
48
+ }
49
+ if ( isset( $options['accepts_reservations'] ) && $options['accepts_reservations'] === 'on' ) {
50
+ $args['acceptsReservations'] = "True";
51
+ } else {
52
+ $args['acceptsReservations'] = "False";
53
+ }
54
+ if ( isset( $options['serves_cuisine'] ) && $options['serves_cuisine'] !== '' ) {
55
+ $args['servesCuisine'] = esc_html( $options['serves_cuisine'] );
56
+ }
57
+ }
58
+
59
+ $address_array["address"] = array(
60
+ "@type" => "PostalAddress",
61
+ "streetAddress" => isset( $options['street_address'] ) ? esc_html( $options['street_address'] ) : "",
62
+ "addressLocality" => isset( $options['address_locality'] ) ? esc_html( $options['address_locality'] ) : "",
63
+ "addressRegion" => isset( $options['address_region'] ) ? esc_html( $options['address_region'] ) : "",
64
+ "postalCode" => isset( $options['postal_code'] ) ? esc_html( $options['postal_code'] ) : "",
65
+ "addressCountry" => isset( $options['address_country'] ) ? esc_html( $options['address_country'] ) : ""
66
+ );
67
+ $args = array_merge( $args, $address_array );
68
+ $geo_array = array();
69
+
70
+ if ( isset( $options['geo_active'] ) && $options['geo_active'] === 'on' ) {
71
+ $geo_array["geo"] = array(
72
+ "@type" => "GeoCoordinates",
73
+ "latitude" => isset( $options['latitude'] ) ? esc_html(floatval($options['latitude'])) : "",
74
+ "longitude" => isset( $options['longitude'] ) ? esc_html(floatval($options['longitude'])) : ""
75
+ );
76
+ }
77
+
78
+ if ( isset( $options['geo_circle_active'] ) && $options['geo_circle_active'] === 'on' ) {
79
+ $place_array["location"] = array( "@type" => "Place" );
80
+ $place_array["location"]["geo"] = array(
81
+ "@type" => "GeoCircle",
82
+ "geoRadius" => isset( $options['geo_circle_radius'] ) ? esc_html( floatval( $options['geo_circle_radius'] ) ) : ""
83
+ );
84
+ if ( isset( $options['geo_active'] ) && $options['geo_active'] === 'on' ) {
85
+ $place_array["location"]["geo"]["geoMidpoint"] = $geo_array["geo"];
86
+ }
87
+ $args = array_merge( $args, $place_array );
88
+ } else {
89
+ if ( isset( $options['geo_active'] ) && $options['geo_active'] === 'on' ) {
90
+ $args = array_merge( $args, $geo_array );
91
+ }
92
+ }
93
+
94
+ /* openingHours */
95
+ $active_days = array();
96
+ foreach ( $week_array as $value ) {
97
+ if ( isset( $options[$value['type']] ) && $options[$value['type']] === 'on' ) {
98
+ $active_days[$value['type']] = $options['week'][$value['type']];
99
+ }
100
+ }
101
+
102
+ if( !empty( $active_days ) ) {
103
+
104
+ $obj = new Structuring_Markup_Opening_Hours( $active_days );
105
+ $opening_hours = $obj->display();
106
+
107
+ $opening_array["openingHours"] = array();
108
+
109
+ foreach( $opening_hours as $value ) {
110
+ $opening_array["openingHours"][] = $value;
111
+ }
112
+
113
+ $args = array_merge( $args, $opening_array );
114
+
115
+ }
116
+
117
+ if ( isset( $options['holiday_active'] ) && $options['holiday_active'] === 'on' ) {
118
+ $holiday_array["openingHoursSpecification"] = array(
119
+ "@type" => "OpeningHoursSpecification",
120
+ "opens" => isset( $options['holiday_open'] ) ? esc_html( $options['holiday_open'] ) : "",
121
+ "closes" => isset( $options['holiday_close'] ) ? esc_html( $options['holiday_close'] ) : "",
122
+ "validFrom" => isset( $options['holiday_valid_from'] ) ? esc_html( $options['holiday_valid_from'] ) : "",
123
+ "validThrough" => isset( $options['holiday_valid_through'] ) ? esc_html( $options['holiday_valid_through'] ) : ""
124
+ );
125
+ $args = array_merge( $args, $holiday_array );
126
+ }
127
+
128
+ if ( isset( $options['price_range'] ) && $options['price_range'] !== '' ) {
129
+ $price_array["priceRange"] = $options['price_range'];
130
+ $args = array_merge( $args, $price_array );
131
+ }
132
+
133
+ return (array) $args;
134
+ }
135
+
136
+ }
includes/meta/wp-structuring-meta-news-article.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type News Article
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.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.0.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
+ }
76
+
77
+ $options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
78
+ if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
79
+ $publisher_args = array(
80
+ "publisher" => array(
81
+ "@type" => "Organization",
82
+ "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
83
+ "logo" => array(
84
+ "@type" => "ImageObject",
85
+ "url" => $options['logo'],
86
+ "width" => $logo['width'],
87
+ "height" => $logo['height']
88
+ )
89
+ )
90
+ );
91
+ $args = array_merge( $args, $publisher_args );
92
+ } else if ( !empty( $options['logo'] ) ) {
93
+ $publisher_args = array(
94
+ "publisher" => array(
95
+ "@type" => "Organization",
96
+ "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
97
+ "logo" => array(
98
+ "@type" => "ImageObject",
99
+ "url" => $options['logo'],
100
+ "width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
101
+ "height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
102
+ )
103
+ )
104
+ );
105
+ $args = array_merge( $args, $publisher_args );
106
+ }
107
+
108
+ return (array) $args;
109
+ }
110
+ }
includes/meta/wp-structuring-meta-organization.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Organization
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.0
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.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" => "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
+ $contact_point_data['areaServed'][] = isset( $options['area_served'] ) ? esc_html( $options['area_served'] ) : "";
44
+ }
45
+ if ( isset( $options['contact_point_1'] ) && $options['contact_point_1'] === 'on' ) {
46
+ $contact_point_data['contactOption'][] = 'HearingImpairedSupported';
47
+ }
48
+ if ( isset( $options['contact_point_2'] ) && $options['contact_point_2'] === 'on' ) {
49
+ $contact_point_data['contactOption'][] = 'TollFree';
50
+ }
51
+ if ( !empty( $options['available_language'] ) ) {
52
+ $contact_point_data['availableLanguage'][] = isset( $options['available_language'] ) ? esc_html( $options['available_language'] ) : "";
53
+ }
54
+
55
+ $contact_point["contactPoint"] = array( $contact_point_data );
56
+ $args = array_merge( $args, $contact_point );
57
+ }
58
+
59
+ /** Social Profiles */
60
+ if ( isset( $options['social'] ) ) {
61
+ $socials["sameAs"] = array();
62
+
63
+ foreach ( $options['social'] as $value ) {
64
+ if ( $value ) {
65
+ $socials["sameAs"][] = esc_url( $value );
66
+ }
67
+ }
68
+ if ( count( $socials["sameAs"] ) > 0 ) {
69
+ $args = array_merge( $args, $socials );
70
+ }
71
+ }
72
+ return (array) $args;
73
+ }
74
+ }
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
+ }
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
+ }
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
+ }
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
+ }
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
+ }
includes/wp-structuring-display.php CHANGED
@@ -4,27 +4,30 @@
4
  *
5
  * @author Kazuya Takami
6
  * @author Justin Frydman
7
- * @version 3.2.4
8
  * @since 1.0.0
9
  */
10
  class Structuring_Markup_Display {
11
 
12
  /**
13
- * Text Domain
14
  *
15
- * @version 3.0.0
16
- * @since 3.0.0
17
  */
18
- private $text_domain = 'wp-structuring-markup';
19
 
20
  /**
21
  * Constructor Define.
22
  *
23
- * @version 3.1.4
24
  * @since 1.0.0
25
  * @param string $version
26
  */
27
  public function __construct ( $version ) {
 
 
 
28
  $db = new Structuring_Markup_Admin_Db();
29
  $this->set_schema( $db, $version );
30
  }
@@ -78,7 +81,7 @@ class Structuring_Markup_Display {
78
  /**
79
  * Setting JSON-LD Template
80
  *
81
- * @version 3.1.0
82
  * @since 1.0.0
83
  * @param string $output
84
  * @param array $structuring_markup_args
@@ -95,53 +98,77 @@ class Structuring_Markup_Display {
95
  switch ( $row->type ) {
96
  case 'article':
97
  if ( isset( $row->options ) && $row->options ) {
98
- $this->set_schema_article( unserialize( $row->options ) );
 
 
99
  }
100
  break;
101
  case 'blog_posting':
102
  if ( isset( $row->options ) && $row->options ) {
103
- $this->set_schema_blog_posting( unserialize( $row->options ) );
 
 
104
  }
105
  break;
106
  case 'breadcrumb':
107
  if ( isset( $row->options ) && $row->options ) {
108
- $this->set_schema_breadcrumb( unserialize( $row->options ) );
 
 
 
109
  }
110
  break;
111
  case 'event':
112
- $this->set_schema_event();
 
 
113
  break;
114
  case 'local_business':
115
  if ( isset( $row->options ) && $row->options ) {
116
- $this->set_schema_local_business( unserialize( $row->options ) );
 
 
 
117
  }
118
  break;
119
  case 'news_article':
120
  if ( isset( $row->options ) && $row->options ) {
121
- $this->set_schema_news_article( unserialize( $row->options ) );
 
 
122
  }
123
  break;
124
  case 'organization':
125
  if ( isset( $row->options ) && $row->options ) {
126
- $this->set_schema_organization( unserialize( $row->options ) );
 
 
127
  }
128
  break;
129
  case 'person':
130
  if ( isset( $row->options ) && $row->options ) {
131
- $this->set_schema_person( unserialize( $row->options ) );
 
 
132
  }
133
  break;
134
  case 'site_navigation':
135
  if ( isset( $row->options ) && $row->options ) {
136
- $this->set_schema_site_navigation( unserialize( $row->options ) );
 
 
137
  }
138
  break;
139
  case 'video':
140
- $this->set_schema_video();
 
 
141
  break;
142
  case 'website':
143
  if ( isset( $row->options ) && $row->options ) {
144
- $this->set_schema_website( unserialize( $row->options ) );
 
 
145
  }
146
  break;
147
  }
@@ -172,726 +199,4 @@ class Structuring_Markup_Display {
172
  echo '</script>', PHP_EOL;
173
  }
174
  }
175
-
176
- /**
177
- * Setting JSON-LD Template
178
- *
179
- * @version 3.1.0
180
- * @since 1.1.3
181
- * @param string $text
182
- * @return string $text
183
- */
184
- private function escape_text ( $text ) {
185
- $text = strip_tags( $text );
186
- $text = strip_shortcodes( $text );
187
- $text = str_replace( array( "\r", "\n" ), '', $text );
188
-
189
- return (string) $text;
190
- }
191
-
192
- /**
193
- * Return image dimensions
194
- *
195
- * @version 3.2.1
196
- * @since 2.3.3
197
- * @author Justin Frydman
198
- * @author Kazuya Takami
199
- * @param string $url
200
- * @return array | boolean $dimensions
201
- */
202
- private function get_image_dimensions ( $url ) {
203
- $image = wp_get_image_editor( $url );
204
-
205
- if ( ! is_wp_error( $image ) ) {
206
- return $image->get_size();
207
- } else {
208
- return __return_false();
209
- }
210
- }
211
-
212
- /**
213
- * Setting schema.org Article
214
- *
215
- * @version 3.2.4
216
- * @since 1.1.0
217
- * @param array $options
218
- */
219
- private function set_schema_article ( array $options ) {
220
- global $post;
221
-
222
- $excerpt = $this->escape_text( $post->post_excerpt );
223
- $content = $excerpt === "" ? mb_substr( $this->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
224
-
225
- $args = array(
226
- "@context" => "http://schema.org",
227
- "@type" => "Article",
228
- "mainEntityOfPage" => array(
229
- "@type" => "WebPage",
230
- "@id" => get_permalink( $post->ID )
231
- ),
232
- "headline" => mb_substr( esc_html( $post->post_title ), 0, 110 ),
233
- "datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
234
- "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
235
- "author" => array(
236
- "@type" => "Person",
237
- "name" => esc_html( get_the_author_meta( 'display_name', $post->post_author ) )
238
- ),
239
- "description" => $content
240
- );
241
-
242
- if ( has_post_thumbnail( $post->ID ) ) {
243
- $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
244
- $images_args = array(
245
- "image" => array(
246
- "@type" => "ImageObject",
247
- "url" => $images[0],
248
- "width" => $images[1],
249
- "height" => $images[2]
250
- )
251
- );
252
- $args = array_merge( $args, $images_args );
253
- }
254
-
255
- $options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
256
- if ( $logo = $this->get_image_dimensions( $options['logo'] ) ) {
257
- $publisher_args = array(
258
- "publisher" => array(
259
- "@type" => "Organization",
260
- "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
261
- "logo" => array(
262
- "@type" => "ImageObject",
263
- "url" => $options['logo'],
264
- "width" => $logo['width'],
265
- "height" => $logo['height']
266
- )
267
- )
268
- );
269
- $args = array_merge( $args, $publisher_args );
270
- } else if ( !empty( $options['logo'] ) ) {
271
- $publisher_args = array(
272
- "publisher" => array(
273
- "@type" => "Organization",
274
- "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
275
- "logo" => array(
276
- "@type" => "ImageObject",
277
- "url" => $options['logo'],
278
- "width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
279
- "height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
280
- )
281
- )
282
- );
283
- $args = array_merge( $args, $publisher_args );
284
- }
285
-
286
- $this->set_schema_json( $args );
287
- }
288
-
289
- /**
290
- * Setting schema.org BlogPosting
291
- *
292
- * @version 3.2.4
293
- * @since 1.2.0
294
- * @param array $options
295
- */
296
- private function set_schema_blog_posting ( array $options ) {
297
- global $post;
298
-
299
- $excerpt = $this->escape_text( $post->post_excerpt );
300
- $content = $excerpt === "" ? mb_substr( $this->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
301
-
302
- $args = array(
303
- "@context" => "http://schema.org",
304
- "@type" => "BlogPosting",
305
- "mainEntityOfPage" => array(
306
- "@type" => "WebPage",
307
- "@id" => get_permalink( $post->ID )
308
- ),
309
- "headline" => mb_substr( esc_html( $post->post_title ), 0, 110 ),
310
- "datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
311
- "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
312
- "author" => array(
313
- "@type" => "Person",
314
- "name" => esc_html( get_the_author_meta( 'display_name', $post->post_author ) )
315
- ),
316
- "description" => $content
317
- );
318
-
319
- if ( has_post_thumbnail( $post->ID ) ) {
320
- $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
321
-
322
- $images_args = array(
323
- "image" => array(
324
- "@type" => "ImageObject",
325
- "url" => $images[0],
326
- "width" => $images[1],
327
- "height" => $images[2]
328
- )
329
- );
330
- $args = array_merge( $args, $images_args );
331
- }
332
-
333
- $options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
334
- if ( $logo = $this->get_image_dimensions( $options['logo'] ) ) {
335
- $publisher_args = array(
336
- "publisher" => array(
337
- "@type" => "Organization",
338
- "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
339
- "logo" => array(
340
- "@type" => "ImageObject",
341
- "url" => $options['logo'],
342
- "width" => $logo['width'],
343
- "height" => $logo['height']
344
- )
345
- )
346
- );
347
- $args = array_merge( $args, $publisher_args );
348
- } else if ( !empty( $options['logo'] ) ) {
349
- $publisher_args = array(
350
- "publisher" => array(
351
- "@type" => "Organization",
352
- "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
353
- "logo" => array(
354
- "@type" => "ImageObject",
355
- "url" => $options['logo'],
356
- "width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
357
- "height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
358
- )
359
- )
360
- );
361
- $args = array_merge( $args, $publisher_args );
362
- }
363
-
364
- $this->set_schema_json( $args );
365
- }
366
-
367
- /**
368
- * Setting schema.org Breadcrumb
369
- *
370
- * @version 3.1.0
371
- * @since 2.0.0
372
- * @param array $options
373
- */
374
- private function set_schema_breadcrumb ( array $options ) {
375
- require_once( plugin_dir_path( __FILE__ ) . 'wp-structuring-short-code-breadcrumb.php' );
376
- $obj = new Structuring_Markup_ShortCode_Breadcrumb();
377
- $item_array = $obj->breadcrumb_array_setting( $options );
378
-
379
- if ( $item_array ) {
380
- /** itemListElement build */
381
- $item_list_element = array();
382
- $position = 1;
383
- foreach ($item_array as $item) {
384
- $item_list_element[] = array(
385
- "@type" => "ListItem",
386
- "position" => $position,
387
- "item" => $item
388
- );
389
- $position++;
390
- }
391
-
392
- /** Breadcrumb Schema build */
393
- $args = array(
394
- "@context" => "http://schema.org",
395
- "@type" => "BreadcrumbList",
396
- "itemListElement" => $item_list_element
397
- );
398
-
399
- $this->set_schema_json($args);
400
- }
401
- }
402
-
403
- /**
404
- * Setting schema.org Event
405
- *
406
- * @version 3.2.3
407
- * @since 2.1.0
408
- */
409
- private function set_schema_event () {
410
- global $post;
411
- $meta = get_post_meta( $post->ID, 'schema_event_post', false );
412
-
413
- if ( isset( $meta[0] ) ) {
414
- $meta = unserialize( $meta[0] );
415
-
416
- /* required items */
417
- if ( !isset( $meta['schema_event_type']) ) $meta['schema_event_type'] = 'Event';
418
- if ( !isset( $meta['schema_event_name']) ) $meta['schema_event_name'] = '';
419
- if ( !isset( $meta['schema_event_date']) ) $meta['schema_event_date'] = date('Y-m-d');
420
- if ( !isset( $meta['schema_event_time']) ) $meta['schema_event_time'] = date('h:i');
421
- if ( !isset( $meta['schema_event_url']) ) $meta['schema_event_url'] = '';
422
- if ( !isset( $meta['schema_event_place_name'] ) ) $meta['schema_event_place_name'] = '';
423
- if ( !isset( $meta['schema_event_place_url'] ) ) $meta['schema_event_place_url'] = '';
424
- if ( !isset( $meta['schema_event_place_address'] ) ) $meta['schema_event_place_address'] = '';
425
- if ( !isset( $meta['schema_event_offers_price'] ) ) $meta['schema_event_offers_price'] = 0;
426
- if ( !isset( $meta['schema_event_offers_currency'] ) ) $meta['schema_event_offers_currency'] = '';
427
-
428
- $args = array(
429
- "@context" => "http://schema.org",
430
- "@type" => esc_html( $meta['schema_event_type'] ),
431
- "name" => esc_html( $meta['schema_event_name'] ),
432
- "startDate" => esc_html( $meta['schema_event_date'] ) . 'T' . esc_html( $meta['schema_event_time'] ),
433
- "url" => esc_url( $meta['schema_event_url'] ),
434
- "location" => array(
435
- "@type" => "Place",
436
- "sameAs" => esc_url( $meta['schema_event_place_url'] ),
437
- "name" => esc_html( $meta['schema_event_place_name'] ),
438
- "address" => esc_html( $meta['schema_event_place_address'] )
439
- ),
440
- "offers" => array(
441
- "@type" => "Offer",
442
- "price" => esc_html( $meta['schema_event_offers_price'] ),
443
- "priceCurrency" => esc_html( $meta['schema_event_offers_currency'] ),
444
- "url" => esc_url( $meta['schema_event_url'] )
445
- )
446
- );
447
-
448
- /* recommended items */
449
- if ( isset( $meta['schema_event_description'] ) && $meta['schema_event_description'] !== '' ) {
450
- $args['description'] = esc_html( $meta['schema_event_description'] );
451
- }
452
- if ( isset( $meta['schema_event_image'] ) && $meta['schema_event_image'] !== '' ) {
453
- $args['image'] = esc_html( $meta['schema_event_image'] );
454
- }
455
- if ( isset( $meta['schema_event_date_end'] ) && $meta['schema_event_date_end'] !== '' && isset( $meta['schema_event_time_end'] ) && $meta['schema_event_time_end'] !== '' ) {
456
- $args['endDate'] = esc_html( $meta['schema_event_date_end'] ) . 'T' . esc_html( $meta['schema_event_time_end'] );
457
- }
458
-
459
- $this->set_schema_json( $args );
460
- }
461
- }
462
-
463
- /**
464
- * Setting schema.org LocalBusiness
465
- *
466
- * @version 3.1.4
467
- * @since 2.3.0
468
- * @param array $options
469
- */
470
- private function set_schema_local_business ( array $options ) {
471
-
472
- /** weekType defined. */
473
- $week_array = array(
474
- array( "type" => "Mo", "display" => "Monday" ),
475
- array( "type" => "Tu", "display" => "Tuesday" ),
476
- array( "type" => "We", "display" => "Wednesday" ),
477
- array( "type" => "Th", "display" => "Thursday" ),
478
- array( "type" => "Fr", "display" => "Friday" ),
479
- array( "type" => "Sa", "display" => "Saturday" ),
480
- array( "type" => "Su", "display" => "Sunday" )
481
- );
482
-
483
- $args = array(
484
- "@context" => "http://schema.org",
485
- "@type" => isset( $options['business_type'] ) ? esc_html( $options['business_type'] ) : "",
486
- "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
487
- "image" => isset( $options['image'] ) ? esc_html( $options['image'] ) : "",
488
- "url" => isset( $options['url'] ) ? esc_url( $options['url'] ) : "",
489
- "telephone" => isset( $options['telephone'] ) ? esc_html( $options['telephone'] ) : ""
490
- );
491
-
492
- if ( isset( $options['food_active'] ) && $options['food_active'] === 'on' ) {
493
- if ( isset( $options['menu'] ) && $options['menu'] !== '' ) {
494
- $args['menu'] = esc_url( $options['menu'] );
495
- }
496
- if ( isset( $options['accepts_reservations'] ) && $options['accepts_reservations'] === 'on' ) {
497
- $args['acceptsReservations'] = "True";
498
- } else {
499
- $args['acceptsReservations'] = "False";
500
- }
501
- if ( isset( $options['serves_cuisine'] ) && $options['serves_cuisine'] !== '' ) {
502
- $args['servesCuisine'] = esc_html( $options['serves_cuisine'] );
503
- }
504
- }
505
-
506
- $address_array["address"] = array(
507
- "@type" => "PostalAddress",
508
- "streetAddress" => isset( $options['street_address'] ) ? esc_html( $options['street_address'] ) : "",
509
- "addressLocality" => isset( $options['address_locality'] ) ? esc_html( $options['address_locality'] ) : "",
510
- "addressRegion" => isset( $options['address_region'] ) ? esc_html( $options['address_region'] ) : "",
511
- "postalCode" => isset( $options['postal_code'] ) ? esc_html( $options['postal_code'] ) : "",
512
- "addressCountry" => isset( $options['address_country'] ) ? esc_html( $options['address_country'] ) : ""
513
- );
514
- $args = array_merge( $args, $address_array );
515
- $geo_array = array();
516
-
517
- if ( isset( $options['geo_active'] ) && $options['geo_active'] === 'on' ) {
518
- $geo_array["geo"] = array(
519
- "@type" => "GeoCoordinates",
520
- "latitude" => isset( $options['latitude'] ) ? esc_html(floatval($options['latitude'])) : "",
521
- "longitude" => isset( $options['longitude'] ) ? esc_html(floatval($options['longitude'])) : ""
522
- );
523
- }
524
-
525
- if ( isset( $options['geo_circle_active'] ) && $options['geo_circle_active'] === 'on' ) {
526
- $place_array["location"] = array( "@type" => "Place" );
527
- $place_array["location"]["geo"] = array(
528
- "@type" => "GeoCircle",
529
- "geoRadius" => isset( $options['geo_circle_radius'] ) ? esc_html( floatval( $options['geo_circle_radius'] ) ) : ""
530
- );
531
- if ( isset( $options['geo_active'] ) && $options['geo_active'] === 'on' ) {
532
- $place_array["location"]["geo"]["geoMidpoint"] = $geo_array["geo"];
533
- }
534
- $args = array_merge( $args, $place_array );
535
- } else {
536
- if ( isset( $options['geo_active'] ) && $options['geo_active'] === 'on' ) {
537
- $args = array_merge( $args, $geo_array );
538
- }
539
- }
540
-
541
- /* openingHours */
542
- $active_days = array();
543
- foreach ( $week_array as $value ) {
544
- if ( isset( $options[$value['type']] ) && $options[$value['type']] === 'on' ) {
545
- $active_days[$value['type']] = $options['week'][$value['type']];
546
- }
547
- }
548
-
549
- if( !empty( $active_days ) ) {
550
-
551
- $obj = new Structuring_Markup_Opening_Hours( $active_days );
552
- $opening_hours = $obj->display();
553
-
554
- $opening_array["openingHours"] = array();
555
-
556
- foreach( $opening_hours as $value ) {
557
- $opening_array["openingHours"][] = $value;
558
- }
559
-
560
- $args = array_merge( $args, $opening_array );
561
-
562
- }
563
-
564
- if ( isset( $options['holiday_active'] ) && $options['holiday_active'] === 'on' ) {
565
- $holiday_array["openingHoursSpecification"] = array(
566
- "@type" => "OpeningHoursSpecification",
567
- "opens" => isset( $options['holiday_open'] ) ? esc_html( $options['holiday_open'] ) : "",
568
- "closes" => isset( $options['holiday_close'] ) ? esc_html( $options['holiday_close'] ) : "",
569
- "validFrom" => isset( $options['holiday_valid_from'] ) ? esc_html( $options['holiday_valid_from'] ) : "",
570
- "validThrough" => isset( $options['holiday_valid_through'] ) ? esc_html( $options['holiday_valid_through'] ) : ""
571
- );
572
- $args = array_merge( $args, $holiday_array );
573
- }
574
-
575
- if ( isset( $options['price_range'] ) && $options['price_range'] !== '' ) {
576
- $price_array["priceRange"] = $options['price_range'];
577
- $args = array_merge( $args, $price_array );
578
- }
579
-
580
- $this->set_schema_json( $args );
581
- }
582
-
583
- /**
584
- * Setting schema.org NewsArticle
585
- *
586
- * @version 3.2.4
587
- * @since 1.0.0
588
- * @param array $options
589
- */
590
- private function set_schema_news_article ( array $options ) {
591
- global $post;
592
-
593
- $excerpt = $this->escape_text( $post->post_excerpt );
594
- $content = $excerpt === "" ? mb_substr( $this->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
595
-
596
- $args = array(
597
- "@context" => "http://schema.org",
598
- "@type" => "NewsArticle",
599
- "mainEntityOfPage" => array(
600
- "@type" => "WebPage",
601
- "@id" => get_permalink( $post->ID )
602
- ),
603
- "headline" => mb_substr( esc_html( $post->post_title ), 0, 110 ),
604
- "datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
605
- "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
606
- "author" => array(
607
- "@type" => "Person",
608
- "name" => esc_html( get_the_author_meta( 'display_name', $post->post_author ) )
609
- ),
610
- "description" => $content
611
- );
612
-
613
- if ( has_post_thumbnail( $post->ID ) ) {
614
- $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
615
-
616
- $images_args = array(
617
- "image" => array(
618
- "@type" => "ImageObject",
619
- "url" => $images[0],
620
- "width" => $images[1],
621
- "height" => $images[2]
622
- )
623
- );
624
- $args = array_merge( $args, $images_args );
625
- }
626
-
627
- $options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
628
- if ( $logo = $this->get_image_dimensions( $options['logo'] ) ) {
629
- $publisher_args = array(
630
- "publisher" => array(
631
- "@type" => "Organization",
632
- "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
633
- "logo" => array(
634
- "@type" => "ImageObject",
635
- "url" => $options['logo'],
636
- "width" => $logo['width'],
637
- "height" => $logo['height']
638
- )
639
- )
640
- );
641
- $args = array_merge( $args, $publisher_args );
642
- } else if ( !empty( $options['logo'] ) ) {
643
- $publisher_args = array(
644
- "publisher" => array(
645
- "@type" => "Organization",
646
- "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
647
- "logo" => array(
648
- "@type" => "ImageObject",
649
- "url" => $options['logo'],
650
- "width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
651
- "height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
652
- )
653
- )
654
- );
655
- $args = array_merge( $args, $publisher_args );
656
- }
657
-
658
- $this->set_schema_json( $args );
659
- }
660
-
661
- /**
662
- * Setting schema.org Organization
663
- *
664
- * @version 3.2.0
665
- * @since 1.0.0
666
- * @param array $options
667
- */
668
- private function set_schema_organization ( array $options ) {
669
- /** Logos */
670
- $args = array(
671
- "@context" => "http://schema.org",
672
- "@type" => "Organization",
673
- "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
674
- "url" => isset( $options['url'] ) ? esc_url( $options['url'] ) : "",
675
- "logo" => isset( $options['logo'] ) ? esc_url( $options['logo'] ) : ""
676
- );
677
-
678
- /** Corporate Contact */
679
- if ( isset( $options['contact_point'] ) && $options['contact_point'] === 'on' ) {
680
- $contact_point_data = array(
681
- "@type" => "ContactPoint",
682
- "telephone" => isset( $options['telephone'] ) ? esc_html( $options['telephone'] ) : "",
683
- "contactType" => isset( $options['contact_type'] ) ? esc_html( $options['contact_type'] ) : ""
684
- );
685
-
686
- if ( !empty( $options['email'] ) ) {
687
- $contact_point_data['email'] = isset( $options['email'] ) ? esc_html( $options['email'] ) : "";
688
- }
689
- if ( !empty( $options['area_served'] ) ) {
690
- $contact_point_data['areaServed'][] = isset( $options['area_served'] ) ? esc_html( $options['area_served'] ) : "";
691
- }
692
- if ( isset( $options['contact_point_1'] ) && $options['contact_point_1'] === 'on' ) {
693
- $contact_point_data['contactOption'][] = 'HearingImpairedSupported';
694
- }
695
- if ( isset( $options['contact_point_2'] ) && $options['contact_point_2'] === 'on' ) {
696
- $contact_point_data['contactOption'][] = 'TollFree';
697
- }
698
- if ( !empty( $options['available_language'] ) ) {
699
- $contact_point_data['availableLanguage'][] = isset( $options['available_language'] ) ? esc_html( $options['available_language'] ) : "";
700
- }
701
-
702
- $contact_point["contactPoint"] = array( $contact_point_data );
703
- $args = array_merge( $args, $contact_point );
704
- }
705
-
706
- /** Social Profiles */
707
- if ( isset( $options['social'] ) ) {
708
- $socials["sameAs"] = array();
709
-
710
- foreach ( $options['social'] as $value ) {
711
- if ( $value ) {
712
- $socials["sameAs"][] = esc_url( $value );
713
- }
714
- }
715
- if ( count( $socials["sameAs"] ) > 0 ) {
716
- $args = array_merge( $args, $socials );
717
- }
718
- }
719
- $this->set_schema_json( $args );
720
- }
721
-
722
- /**
723
- * Setting schema.org Person
724
- *
725
- * @version 3.1.2
726
- * @since 2.4.0
727
- * @param array $options
728
- */
729
- private function set_schema_person ( array $options ) {
730
- /** Logos */
731
- $args = array(
732
- "@context" => "http://schema.org",
733
- "@type" => "Person",
734
- "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
735
- "url" => isset( $options['url'] ) ? esc_url( $options['url'] ) : ""
736
- );
737
-
738
- /** Place */
739
- if ( isset( $options['addressCountry'] ) ) {
740
- $place["homeLocation"] = array(
741
- "@type" => "Place",
742
- "address" => array(
743
- "@type" => "PostalAddress",
744
- "addressCountry" => $options['addressCountry']
745
- )
746
- );
747
- $args = array_merge( $args, $place );
748
- }
749
-
750
- /** Social Profiles */
751
- if ( isset( $options['social'] ) ) {
752
- $socials["sameAs"] = array();
753
-
754
- foreach ( $options['social'] as $value ) {
755
- if ( !empty( $value ) ) {
756
- $socials["sameAs"][] = esc_html( $value );
757
- }
758
- }
759
- if ( count( $socials["sameAs"] ) > 0 ) {
760
- $args = array_merge( $args, $socials );
761
- }
762
- }
763
- $this->set_schema_json( $args );
764
- }
765
-
766
- /**
767
- * Setting schema.org Site Navigation
768
- *
769
- * @version 3.2.3
770
- * @since 3.1.0
771
- * @param array $options
772
- */
773
- private function set_schema_site_navigation ( array $options ) {
774
- if ( isset( $options['menu_name'] ) && wp_get_nav_menu_items( $options['menu_name'] ) ) {
775
- $items_array = wp_get_nav_menu_items( $options['menu_name'] );
776
- $name_array = array();
777
- $url_array = array();
778
-
779
- foreach ( (array) $items_array as $key => $menu_item ) {
780
- $url_array[] = $menu_item->url;
781
- $name_array[] = $menu_item->title;
782
- }
783
-
784
- if ( count( $items_array ) > 0 ) {
785
- $args = array(
786
- "@context" => "http://schema.org",
787
- "@type" => "SiteNavigationElement",
788
- "name" => $name_array,
789
- "url" => $url_array
790
- );
791
- $this->set_schema_json ( $args );
792
- }
793
- }
794
- }
795
-
796
- /**
797
- * Setting schema.org Video
798
- *
799
- * @version 3.2.3
800
- * @since 3.0.0
801
- */
802
- private function set_schema_video () {
803
- global $post;
804
- $meta = get_post_meta( $post->ID, 'schema_video_post', false );
805
-
806
- if ( isset( $meta[0] ) ) {
807
- $meta = unserialize( $meta[0] );
808
-
809
- if ( has_post_thumbnail( $post->ID ) ) {
810
- $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
811
- $excerpt = $this->escape_text( $post->post_excerpt );
812
- $content = $excerpt === "" ? mb_substr( $this->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
813
- } else {
814
- $images[0] = '';
815
- $content = '';
816
- }
817
-
818
- /* required items */
819
- if ( !isset( $meta['schema_video_name']) ) $meta['schema_video_name'] = esc_html( $post->post_title );
820
- if ( !isset( $meta['schema_video_description'] ) ) $meta['schema_video_description'] = esc_html( $content );
821
- if ( !isset( $meta['schema_video_thumbnail_url'] ) ) $meta['schema_video_description'] = esc_html( $images[0] );
822
- if ( !isset( $meta['schema_video_upload_date'] ) ) $meta['schema_video_upload_date'] = get_post_modified_time( 'Y-m-d', __return_false(), $post->ID );
823
- if ( !isset( $meta['schema_video_upload_time'] ) ) $meta['schema_video_upload_time'] = get_post_modified_time( 'H:i:s', __return_false(), $post->ID );
824
-
825
- $args = array(
826
- "@context" => "http://schema.org",
827
- "@type" => "VideoObject",
828
- "name" => esc_html( $meta['schema_video_name'] ),
829
- "description" => esc_html( $meta['schema_video_description'] ),
830
- "thumbnailUrl" => esc_html( $meta['schema_video_thumbnail_url'] ),
831
- "uploadDate" => esc_html( $meta['schema_video_upload_date'] ) . 'T' . esc_html( $meta['schema_video_upload_time'] )
832
- );
833
-
834
- /* recommended items */
835
- if ( isset( $meta['schema_video_duration'] ) && $meta['schema_video_duration'] !== '' ) {
836
- $args["duration"] = esc_html( $meta['schema_video_duration'] );
837
- }
838
- if ( isset( $meta['schema_video_content_url'] ) && $meta['schema_video_content_url'] !== '' ) {
839
- $args["contentUrl"] = esc_url( $meta['schema_video_content_url'] );
840
- }
841
- if ( isset( $meta['schema_video_embed_url'] ) && $meta['schema_video_embed_url'] !== '' ) {
842
- $args["embedUrl"] = esc_url( $meta['schema_video_embed_url'] );
843
- }
844
- if ( isset( $meta['schema_video_interaction_count'] ) && $meta['schema_video_interaction_count'] !== '' ) {
845
- $args["interactionCount"] = esc_html( $meta['schema_video_interaction_count'] );
846
- }
847
- if ( isset( $meta['schema_video_expires_date'] ) && $meta['schema_video_expires_date'] !== '' && isset( $meta['schema_video_expires_time'] ) && $meta['schema_video_expires_time'] !== '' ) {
848
- $args["expires"] = esc_html( $meta['schema_video_expires_date'] ) . 'T' . esc_html( $meta['schema_video_expires_time'] );
849
- }
850
- $this->set_schema_json( $args );
851
- }
852
- }
853
-
854
- /**
855
- * Setting schema.org WebSite
856
- *
857
- * @version 3.1.0
858
- * @since 1.0.0
859
- * @param array $options
860
- */
861
- private function set_schema_website ( array $options ) {
862
- $args = array(
863
- "@context" => "http://schema.org",
864
- "@type" => "WebSite",
865
- "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
866
- "alternateName" => isset( $options['alternateName'] ) ? esc_html( $options['alternateName'] ) : "",
867
- "url" => isset( $options['url'] ) ? esc_url( $options['url'] ) : ""
868
- );
869
-
870
- $search_array = array();
871
-
872
- if ( isset( $options['potential_action'] ) && $options['potential_action'] === 'on' ) {
873
- $action_array = array(
874
- "@type" => "SearchAction",
875
- "target" => isset( $options['target'] ) ? esc_url( $options['target'] ) . "{search_term_string}" : "",
876
- "query-input" => isset( $options['target'] ) ? "required name=search_term_string" : ""
877
- );
878
- $search_array[] = $action_array;
879
- }
880
-
881
- if ( count( $search_array ) > 0 ) {
882
- if ( isset( $options['potential_action_app'] ) && $options['potential_action_app'] === 'on' ) {
883
- $action_array = array(
884
- "@type" => "SearchAction",
885
- "target" => isset( $options['target_app'] ) ? $options['target_app'] . "{search_term_string}" : "",
886
- "query-input" => isset( $options['target_app'] ) ? "required name=search_term_string" : ""
887
- );
888
- $search_array[] = $action_array;
889
- }
890
-
891
- $potential_action["potentialAction"] = $search_array;
892
- $args = array_merge( $args, $potential_action );
893
- }
894
-
895
- $this->set_schema_json( $args );
896
- }
897
  }
4
  *
5
  * @author Kazuya Takami
6
  * @author Justin Frydman
7
+ * @version 4.0.0
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
  }
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
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
  }
199
  echo '</script>', PHP_EOL;
200
  }
201
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  }
includes/wp-structuring-opening-hours.php CHANGED
@@ -134,8 +134,8 @@ class Structuring_Markup_Opening_Hours {
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
  /**
@@ -186,15 +186,15 @@ class Structuring_Markup_Opening_Hours {
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
  /**
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
  /**
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
  /**
includes/wp-structuring-short-code-breadcrumb.php CHANGED
@@ -62,7 +62,7 @@ class Structuring_Markup_ShortCode_Breadcrumb {
62
  /**
63
  * Breadcrumb array setting.
64
  *
65
- * @version 3.2.4
66
  * @since 2.0.0
67
  * @access public
68
  * @param array $options
@@ -72,7 +72,7 @@ class Structuring_Markup_ShortCode_Breadcrumb {
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' ) {
@@ -137,54 +137,37 @@ class Structuring_Markup_ShortCode_Breadcrumb {
137
  $item_array[] = $this->set_schema_breadcrumb_item( get_post_type_archive_link( get_post_type() ), post_type_archive_title( '', false) );
138
  }
139
  } elseif ( is_archive() ) {
140
- $taxonomies = get_the_taxonomies( $post->ID );
141
- if ( !empty( $taxonomies ) ) {
142
- foreach ( array_keys( $taxonomies ) as $key ) {
143
- $terms = get_the_terms( $post->ID, $key );
144
- for ( $i = 0; $i < count( $terms ); $i++) {
145
- $item_array[] = $this->set_schema_breadcrumb_item( get_term_link( $terms[$i]->term_id, $key ), $terms[$i]->name );
146
- }
147
- }
148
  }
149
- } elseif ( is_singular( 'post' ) ) {
150
- $terms = get_the_terms( $post->ID, 'category' );
151
- $term_bottom = array();
152
-
153
- if ( $terms && ! is_wp_error( $terms ) ) {
154
- $parent_ids = array();
155
-
156
- foreach ( $terms as $term ) {
157
- if ( $term->parent != 0 ) {
158
- $parent_ids[] = $term->parent;
159
- }
160
- }
161
- foreach ( $terms as $term ) {
162
- if ( !in_array( $term->term_id, $parent_ids ) ) {
163
- $term_bottom[] = $term->term_id;
164
  }
165
  }
 
166
  }
167
-
168
- if ( count( $term_bottom ) > 0 ) {
169
- $ancestors = array_reverse( get_ancestors( $term_bottom[0], 'category' ) );
170
- $ancestors[] = $term_bottom[0];
171
-
172
- foreach ( $ancestors as $ancestor ) {
173
- $item_array[] = $this->set_schema_breadcrumb_item( get_category_link( $ancestor ), get_cat_name( $ancestor ) );
174
- }
175
  }
176
  $item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
177
  } elseif ( is_single() ) {
178
  if ( get_post_type_archive_link( get_post_type() ) ) {
179
  $item_array[] = $this->set_schema_breadcrumb_item( get_post_type_archive_link( get_post_type() ), get_post_type_object( get_post_type() )->label );
180
  }
181
- $taxonomies = get_the_taxonomies( $post->ID );
182
- if ( !empty( $taxonomies ) ) {
183
- foreach ( array_keys( $taxonomies ) as $key ) {
184
- $terms = get_the_terms( $post->ID, $key );
185
- for ( $i = 0; $i < count( $terms ); $i++) {
186
- $item_array[] = $this->set_schema_breadcrumb_item( get_term_link( $terms[$i]->term_id, $key ), $terms[$i]->name );
187
- }
188
  }
189
  }
190
  $item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
@@ -193,6 +176,46 @@ class Structuring_Markup_ShortCode_Breadcrumb {
193
  return (array) $item_array;
194
  }
195
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  /**
197
  * Breadcrumb item settings
198
  *
62
  /**
63
  * Breadcrumb array setting.
64
  *
65
+ * @version 4.0.0
66
  * @since 2.0.0
67
  * @access public
68
  * @param 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' ) {
137
  $item_array[] = $this->set_schema_breadcrumb_item( get_post_type_archive_link( get_post_type() ), post_type_archive_title( '', false) );
138
  }
139
  } elseif ( is_archive() ) {
140
+ if ( get_post_type_archive_link( get_post_type() ) ) {
141
+ $item_array[] = $this->set_schema_breadcrumb_item( get_post_type_archive_link( get_post_type() ), get_post_type_object( get_post_type() )->label );
 
 
 
 
 
 
142
  }
143
+ if( is_tax() ){
144
+ $tax_slug = get_query_var( 'taxonomy' );
145
+ $term_slug = get_query_var( 'term' );
146
+ $term = get_term_by( "slug", $term_slug, $tax_slug );
147
+
148
+ if( $term->parent !== 0 ) {
149
+ $ancestors = array_reverse( get_ancestors( $term->term_taxonomy_id, $tax_slug ) );
150
+ foreach( $ancestors as $ancestor ) {
151
+ $item_array[] = $this->set_schema_breadcrumb_item( get_category_link( $ancestor ), get_cat_name( $ancestor ) );
 
 
 
 
 
 
152
  }
153
  }
154
+ $item_array[] = $this->set_schema_breadcrumb_item( get_term_link( $term_slug, $tax_slug ), esc_html( $term->name ) );
155
  }
156
+ } elseif ( is_singular( 'post' ) ) {
157
+ $args = $this->set_taxonomy_item( $post->ID, 'category' );
158
+ if ( count( $args ) > 0 ) {
159
+ $item_array = array_merge( $item_array, $args );
 
 
 
 
160
  }
161
  $item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
162
  } elseif ( is_single() ) {
163
  if ( get_post_type_archive_link( get_post_type() ) ) {
164
  $item_array[] = $this->set_schema_breadcrumb_item( get_post_type_archive_link( get_post_type() ), get_post_type_object( get_post_type() )->label );
165
  }
166
+ $taxonomy_names = get_post_taxonomies();
167
+ if ( count( $taxonomy_names ) > 0 ) {
168
+ $args = $this->set_taxonomy_item( $post->ID, $taxonomy_names[0] );
169
+ if ( count( $args ) > 0 ) {
170
+ $item_array = array_merge( $item_array, $args );
 
 
171
  }
172
  }
173
  $item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
176
  return (array) $item_array;
177
  }
178
 
179
+ /**
180
+ * taxonomy item settings
181
+ *
182
+ * @since 4.0.0
183
+ * @version 4.0.0
184
+ * @param int $id
185
+ * @param string $taxonomy
186
+ * @return array $args
187
+ */
188
+ private function set_taxonomy_item ( $id, $taxonomy ) {
189
+ $terms = get_the_terms( $id, $taxonomy );
190
+ $term_bottom = array();
191
+ $args = array();
192
+
193
+ if ( $terms && ! is_wp_error( $terms ) ) {
194
+ $parent_ids = array();
195
+
196
+ foreach ( $terms as $term ) {
197
+ if ( $term->parent != 0 ) {
198
+ $parent_ids[] = $term->parent;
199
+ }
200
+ }
201
+ foreach ( $terms as $term ) {
202
+ if ( !in_array( $term->term_id, $parent_ids ) ) {
203
+ $term_bottom[] = $term->term_id;
204
+ }
205
+ }
206
+ }
207
+
208
+ if ( count( $term_bottom ) > 0 ) {
209
+ $ancestors = array_reverse( get_ancestors( $term_bottom[0], $taxonomy ) );
210
+ $ancestors[] = $term_bottom[0];
211
+
212
+ foreach ( $ancestors as $ancestor ) {
213
+ $args[] = $this->set_schema_breadcrumb_item( get_category_link( $ancestor ), get_cat_name( $ancestor ) );
214
+ }
215
+ }
216
+ return (array) $args;
217
+ }
218
+
219
  /**
220
  * Breadcrumb item settings
221
  *
includes/wp-structuring-utility.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Utility
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.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
+ }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: miiitaka
3
  Tags: schema, schema.org, json, json-ld, seo, post, posts, google, shortcode, breadcrumb
4
  Requires at least: 4.3.1
5
  Tested up to: 4.7.5
6
- Stable tag: 3.2.6
7
 
8
  Allows you to include schema.org JSON-LD syntax markup on your website
9
 
@@ -54,6 +54,11 @@ if ( shortcode_exists( 'wp-structuring-markup-breadcrumb' ) ) {
54
 
55
  == Changelog ==
56
 
 
 
 
 
 
57
  = 3.2.6 (2017-05-20) =
58
  * Checked : WordPress version 4.7.5 operation check.
59
 
3
  Tags: schema, schema.org, json, json-ld, seo, post, posts, google, shortcode, breadcrumb
4
  Requires at least: 4.3.1
5
  Tested up to: 4.7.5
6
+ Stable tag: 4.0.0
7
 
8
  Allows you to include schema.org JSON-LD syntax markup on your website
9
 
54
 
55
  == Changelog ==
56
 
57
+ = 4.0.0 (2017-05-25) =
58
+ * Added : Hook point of AMP plug-ins (Automattic, Inc. release). https://wordpress.org/plugins/amp/
59
+ * Added : Site Navigation on only Home Page.
60
+ * Fixed : Problem with custom taxonomies.(BreadcrumbList)
61
+
62
  = 3.2.6 (2017-05-20) =
63
  * Checked : WordPress version 4.7.5 operation check.
64
 
trunk/css/style.css ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /** List Setting */
2
+ .schema-admin-table-list .schema-admin-table-list-status {
3
+ width: 10em;
4
+ }
5
+
6
+ .schema-admin-table-list .schema-admin-table-list-type {
7
+ width: 15%;
8
+ }
9
+
10
+ .schema-admin-table-list .schema-admin-table-list-output {
11
+ width: 30%;
12
+ }
13
+
14
+ .schema-admin-table-list td {
15
+ vertical-align: middle;
16
+ }
17
+
18
+ .schema-admin-table-list td:nth-child(1) span {
19
+ display: inline-block;
20
+ padding: 0 1em 0 1em;
21
+ text-align: center;
22
+ width: 8em;
23
+ }
24
+
25
+ .schema-admin-table-list td:nth-child(1) span.active {
26
+ background: #00a0d2;
27
+ color: #fff;
28
+ }
29
+
30
+ .schema-admin-table-list tr.active {
31
+ background: #ffffff;
32
+ }
33
+
34
+ .schema-admin-table-list tr.stop {
35
+ background: #efefef;
36
+ }
37
+
38
+ .schema-admin-table-list td:nth-child(1) span.stop {
39
+ background: #ddd;
40
+ }
41
+
42
+ /** Posts page */
43
+ .schema-admin-h1-span {
44
+ display: inline-block;
45
+ font-size: 80%;
46
+ margin: 0 0 0 10px;
47
+ }
48
+
49
+ .schema-admin-require::before {
50
+ color: #a00;
51
+ content: "*";
52
+ margin: 0 3px 0 0;
53
+ }
54
+
55
+ .schema-admin-table {
56
+ margin: 15px 0 15px 0;
57
+ }
58
+
59
+ .schema-admin-table caption {
60
+ border-left: solid 4px #00a0d2;
61
+ margin: 0 0 5px 0;
62
+ padding: 3px 0 3px 7px;
63
+ text-align: left;
64
+ }
65
+
66
+ .schema-admin-table th {
67
+ height: 2em;
68
+ padding: 0 5px 0 0;
69
+ text-align: right;
70
+ vertical-align: middle;
71
+ width: 200px;
72
+ }
73
+
74
+ .schema-admin-table th.require::before {
75
+ color: #a00;
76
+ content: "*";
77
+ margin: 0 3px 0 0;
78
+ }
79
+
80
+ .schema-admin-table td {
81
+ vertical-align: middle;
82
+ }
83
+
84
+ .schema-admin-table td label {
85
+ margin: 0 10px 0 0;
86
+ }
87
+
88
+ .schema-admin-table small {
89
+ display: block;
90
+ margin: 2px 0 2px 1px;
91
+ background: #ddd;
92
+ padding: 0 5px;
93
+ }
94
+
95
+ .schema-admin-table input[type="checkbox"] {
96
+ margin: 0 5px 0 0;
97
+ }
98
+
99
+ .schema-admin-table input:invalid {
100
+ box-shadow: 0 0 1px 1px #a00;
101
+ }
102
+
103
+ /** LocalBusiness */
104
+ .markup-time {
105
+ color: #999;
106
+ cursor: pointer;
107
+ width: 18px;
108
+ height: 18px;
109
+ line-height: 20px;
110
+ font-size: 14px;
111
+ border: solid 1px #bbb;
112
+ background-color: #fff;
113
+ border-radius: 100%;
114
+ margin-top: 5px;
115
+ }
116
+
117
+ .markup-time:hover {
118
+ color: #fff;
119
+ border-color: transparent;
120
+ }
121
+
122
+ .markup-time .plus:hover {
123
+ background-color: #00a0d2;
124
+ }
125
+
126
+ .markup-time .minus {
127
+ line-height: 18px;
128
+ }
129
+
130
+ .markup-time .minus:hover {
131
+ background-color: #f55e4f;
132
+ }
133
+
134
+ /** Media Uploader */
135
+ .schema-admin-media-button {
136
+ display: block;
137
+ margin: 3px 0 3px 1px;
138
+ padding: 5px 8px;
139
+ }
140
+
141
+ .schema-admin-media-button span {
142
+ display: inline-block;
143
+ margin: 0 0 0 5px;
144
+ vertical-align: middle;
145
+ }
trunk/includes/admin/wp-structuring-admin-db.php ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Admin DB Connection.
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.1.0
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 3.1.0
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 3.1.0
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
+ $args = array(
105
+ 'type' => $key,
106
+ 'activate' => $activate,
107
+ 'output' => $list->output,
108
+ 'options' => $list->options,
109
+ 'register_date' => date( "Y-m-d H:i:s" ),
110
+ 'update_date' => date( "Y-m-d H:i:s" )
111
+ );
112
+ }
113
+ }
114
+ $this->insert_options( $args );
115
+ }
116
+ }
117
+ }
118
+ }
119
+
120
+ /**
121
+ * Create table execute
122
+ *
123
+ * @version 2.1.1
124
+ * @since 2.0.0
125
+ * @param string $charset_collate
126
+ * @param string $text_domain
127
+ * @param string $version
128
+ */
129
+ private function create_table_execute ( $charset_collate, $text_domain, $version ) {
130
+ $query = " CREATE TABLE " . $this->table_name;
131
+ $query .= " (id MEDIUMINT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY";
132
+ $query .= ",type TINYTEXT NOT NULL";
133
+ $query .= ",activate TINYTEXT NOT NULL";
134
+ $query .= ",output TEXT NOT NULL";
135
+ $query .= ",options TEXT NOT NULL";
136
+ $query .= ",register_date DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL";
137
+ $query .= ",update_date DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL";
138
+ $query .= ",UNIQUE KEY id (id)) " . $charset_collate;
139
+
140
+ dbDelta( $query );
141
+
142
+ $options = array( 'version' => $version );
143
+ update_option( $text_domain, $options, 'yes' );
144
+ }
145
+
146
+ /**
147
+ * Get Data.
148
+ *
149
+ * @version 2.1.0
150
+ * @since 1.0.0
151
+ * @param integer $id
152
+ * @return array $results
153
+ */
154
+ public function get_options ( $id ) {
155
+ global $wpdb;
156
+
157
+ $query = "SELECT * FROM " . $this->table_name . " WHERE id = %d";
158
+ $data = array( esc_html( $id ) );
159
+ $prepared = $wpdb->prepare( $query, $data );
160
+ $args = $wpdb->get_row( $prepared );
161
+ $results = array();
162
+
163
+ if ( $args ) {
164
+ $results['id'] = $args->id;
165
+ $results['activate'] = isset( $args->activate ) ? $args->activate : "";
166
+ $results['type'] = $args->type;
167
+ $results['output'] = unserialize( $args->output );
168
+ $results['option'] = unserialize( $args->options );
169
+ }
170
+ return (array) $results;
171
+ }
172
+
173
+ /**
174
+ * Get All Data.
175
+ *
176
+ * @since 1.0.0
177
+ * @return array $results
178
+ */
179
+ public function get_list_options () {
180
+ global $wpdb;
181
+
182
+ $query = "SELECT * FROM " . $this->table_name . " ORDER BY type ASC";
183
+
184
+ return (array) $wpdb->get_results( $query );
185
+ }
186
+
187
+ /**
188
+ * Get Type Data.
189
+ *
190
+ * @version 2.1.0
191
+ * @since 2.0.0
192
+ * @param string $type
193
+ * @return array $results
194
+ */
195
+ public function get_type_options ( $type ) {
196
+ global $wpdb;
197
+
198
+ $query = "SELECT * FROM " . $this->table_name . " WHERE type = %s";
199
+ $data = array( esc_html( $type ) );
200
+ $prepared = $wpdb->prepare( $query, $data );
201
+ $args = $wpdb->get_row( $prepared );
202
+ $results = array();
203
+
204
+ if ( $args ) {
205
+ $results['id'] = $args->id;
206
+ $results['activate'] = isset( $args->activate ) ? $args->activate : "";
207
+ $results['type'] = $args->type;
208
+ $results['output'] = unserialize( $args->output );
209
+ $results['option'] = unserialize( $args->options );
210
+ }
211
+ return (array) $results;
212
+ }
213
+
214
+ /**
215
+ * Insert Data.
216
+ *
217
+ * @version 2.0.0
218
+ * @since 1.0.0
219
+ * @param array $args
220
+ */
221
+ private function insert_options ( array $args ) {
222
+ global $wpdb;
223
+
224
+ $prepared = array( '%s', '%s', '%s', '%s', '%s', '%s' );
225
+ $wpdb->insert( $this->table_name, $args, $prepared );
226
+ }
227
+
228
+ /**
229
+ * Update Data.
230
+ *
231
+ * @version 2.0.0
232
+ * @since 1.0.0
233
+ * @param array $post($_POST)
234
+ * @return integer $post['id']
235
+ */
236
+ public function update_options ( array $post ) {
237
+ global $wpdb;
238
+
239
+ $data = array(
240
+ 'type' => $post['type'],
241
+ 'activate' => isset( $post['activate'] ) ? $post['activate'] : "",
242
+ 'output' => serialize( $post['output'] ),
243
+ 'options' => isset( $post['option'] ) ? serialize( $post['option'] ) : "",
244
+ 'update_date' => date( "Y-m-d H:i:s" )
245
+ );
246
+ $key = array( 'id' => esc_html( $post['id'] ) );
247
+ $prepared = array( '%s', '%s', '%s', '%s', '%s' );
248
+ $key_prepared = array( '%d' );
249
+
250
+ $wpdb->update( $this->table_name, $data, $key, $prepared, $key_prepared );
251
+
252
+ return (integer) $post['id'];
253
+ }
254
+ }
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 3.2.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 3.2.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-status">' . esc_html__( 'Status', $this->text_domain ) . '</th>';
51
+ $html .= '<th scope="row" class="schema-admin-table-list-type">' . esc_html__( 'Schema.org Type', $this->text_domain ) . '</th>';
52
+ $html .= '<th scope="row" class="schema-admin-table-list-output">' . esc_html__( 'Output On', $this->text_domain ) . '</th>';
53
+ $html .= '<th scope="row">&nbsp;</th>';
54
+ $html .= '</tr>';
55
+ echo $html;
56
+
57
+ $db = new Structuring_Markup_Admin_Db();
58
+ $results = $db->get_list_options();
59
+ $type_array = $db->type_array;
60
+
61
+ if ( $results ) {
62
+ foreach ( $results as $row ) {
63
+ if ( $row->activate === 'on' ) {
64
+ $html = '<tr class="active"><td><span class="active">Enabled';
65
+ } else {
66
+ $html = '<tr class="stop"><td><span class="stop">Disabled';
67
+ }
68
+ $html .= '</span></td>';
69
+ $html .= '<td><a href="';
70
+ $html .= admin_url( $post_url . '&type=' . esc_html( $row->type ) . '&schema_post_id=' . esc_html( $row->id ) ) . '">' . $type_array[esc_html( $row->type )];
71
+ $html .= '</a></td>';
72
+ $html .= '<td>' . $this->unserialize_output( $row->output ) . '</td>';
73
+ $html .= '<td><a href="';
74
+ $html .= admin_url( $post_url . '&type=' . esc_html( $row->type ) . '&schema_post_id=' . esc_html( $row->id ) ) . '">' . esc_html__( 'Edit', $this->text_domain );
75
+ $html .= '</a></td>';
76
+ $html .= '</tr>';
77
+ echo $html;
78
+ }
79
+ } else {
80
+ echo '<td colspan="5">' . 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,369 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Admin Post
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.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 3.0.2
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
+ foreach ( $post_types as $post_type ) {
58
+ $this->post_args[] = array(
59
+ 'label' => esc_html( $post_type->label ),
60
+ 'value' => esc_html( $post_type->name )
61
+ );
62
+ }
63
+ $this->text_domain = $text_domain;
64
+ $this->nonce_name = "_wpnonce_" . $text_domain;
65
+ $this->nonce_action = "edit-" . $text_domain;
66
+
67
+ /**
68
+ * Update Status
69
+ *
70
+ * "ok" : Successful update
71
+ * "output" : Output No Check
72
+ */
73
+ $status = "";
74
+
75
+ /** DB Connect */
76
+ $db = new Structuring_Markup_Admin_Db();
77
+ $this->type_array = $db->type_array;
78
+
79
+ /** Set Default Parameter for Array */
80
+ $options = array(
81
+ "id" => "",
82
+ "type" => "",
83
+ "activate" => "",
84
+ "output" => array(),
85
+ "option" => array()
86
+ );
87
+
88
+ /** DataBase Update & Insert Mode */
89
+ if ( ! empty( $_POST ) && check_admin_referer( $this->nonce_action, $this->nonce_name ) ) {
90
+ if ( isset( $_POST['id'] ) && is_numeric( $_POST['id'] ) ) {
91
+ if ( isset( $_POST['output'] ) ) {
92
+ $options['id'] = $db->update_options( $_POST );
93
+ $status = "ok";
94
+ } else {
95
+ $status = "output";
96
+ }
97
+ }
98
+ }
99
+
100
+ /** Key Set */
101
+ if ( isset( $_GET['schema_post_id'] ) && is_numeric( $_GET['schema_post_id'] ) ) {
102
+ $options['id'] = esc_html( $_GET['schema_post_id'] );
103
+ }
104
+
105
+ /** Type Set */
106
+ if ( isset( $_GET['type'] ) && array_key_exists( $_GET['type'], $this->type_array) ) {
107
+ $options['type'] = esc_html( $_GET['type'] );
108
+ }
109
+
110
+ $options = $db->get_options( $options['id'] );
111
+ if ( $options['option'] === false ) {
112
+ $options['option'] = array();
113
+ }
114
+
115
+ $this->page_render( $options, $status );
116
+ }
117
+
118
+ /**
119
+ * Setting Page of the Admin Screen.
120
+ *
121
+ * @version 4.0.0
122
+ * @since 1.0.0
123
+ * @param array $options
124
+ * @param string $status
125
+ */
126
+ private function page_render ( array $options, $status ) {
127
+ $html = '';
128
+ $html .= '<div class="wrap">';
129
+ $html .= '<h1>' . esc_html__( 'Schema.org Register', $this->text_domain );
130
+ $html .= '<span class="schema-admin-h1-span">[ Schema Type : ' . esc_html( $this->type_array[$options['type']] ) . ' ]</span>';
131
+ $html .= '</h1>';
132
+ switch ( $status ) {
133
+ case "ok":
134
+ $html .= $this->information_render();
135
+ break;
136
+ case "output":
137
+ $html .= $this->output_error_render();
138
+ break;
139
+ default:
140
+ break;
141
+ }
142
+ echo $html;
143
+
144
+ /** Output Page Select */
145
+ $html = '<hr>';
146
+ $html .= '<p class="schema-admin-require">';
147
+ $html .= esc_html__( 'Please note that all fields followed by an asterisk must be filled in.', $this->text_domain );
148
+ $html .= '</p>';
149
+ $html .= '<form method="post" action="">';
150
+ echo $html;
151
+
152
+ wp_nonce_field( $this->nonce_action, $this->nonce_name );
153
+
154
+ $html = '<input type="hidden" name="id" value="' . esc_attr( $options['id'] ) . '">';
155
+ $html .= '<input type="hidden" name="type" value="' . esc_attr( $options['type'] ) . '">';
156
+ $html .= '<table class="schema-admin-table">';
157
+ $html .= '<tr><th class="require">Enabled : </th><td>';
158
+ $html .= '<input type="checkbox" name="activate" value="on"';
159
+ $html .= ( isset( $options['activate'] ) && $options['activate'] === "on" ) ? ' checked' : '';
160
+ $html .= '></td></tr>';
161
+ $html .= '<tr><th class="require">' . esc_html__( 'Output On', $this->text_domain ) . ' : </th><td>';
162
+ echo $html;
163
+
164
+ switch ( $options['type'] ) {
165
+ case 'article':
166
+ $html = $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
167
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
168
+ $html .= $this->output_checkbox_render( $options['output'], "amp", esc_html__( 'Posts(AMP)', $this->text_domain ) );
169
+ $html .= '</td></tr>';
170
+ $html .= $this->output_custom_posts_render( $options['output'] );
171
+ $html .= '</table><hr>';
172
+ echo $html;
173
+
174
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-article.php' );
175
+ new Structuring_Markup_Type_Article( $options['option'] );
176
+ break;
177
+ case 'blog_posting':
178
+ $html = $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
179
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
180
+ $html .= $this->output_checkbox_render( $options['output'], "amp", esc_html__( 'Posts(AMP)', $this->text_domain ) );
181
+ $html .= '</td></tr>';
182
+ $html .= $this->output_custom_posts_render( $options['output'] );
183
+ $html .= '</table><hr>';
184
+ echo $html;
185
+
186
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-blog-posting.php' );
187
+ new Structuring_Markup_Type_Blog_Posting( $options['option'] );
188
+ break;
189
+ case 'breadcrumb':
190
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
191
+ $html .= '</td></tr></table><hr>';
192
+ echo $html;
193
+
194
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-breadcrumb.php' );
195
+ new Structuring_Markup_Type_Breadcrumb( $options['option'] );
196
+ break;
197
+ case 'event':
198
+ $html = $this->output_checkbox_render( $options['output'], "event", esc_html__( 'Event Post Page', $this->text_domain ) );
199
+ $html .= '</td></tr></table><hr>';
200
+ echo $html;
201
+
202
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-event.php' );
203
+ new Structuring_Markup_Type_Event();
204
+ break;
205
+ case 'local_business':
206
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
207
+ $html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
208
+ $html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
209
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
210
+ $html .= '</td></tr>';
211
+ $html .= $this->output_custom_posts_render( $options['output'] );
212
+ $html .= '</table><hr>';
213
+
214
+ echo $html;
215
+
216
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-local-business.php' );
217
+ new Structuring_Markup_Type_LocalBusiness( $options['option'] );
218
+ break;
219
+ case 'news_article':
220
+ $html = $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
221
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
222
+ $html .= $this->output_checkbox_render( $options['output'], "amp", esc_html__( 'Posts(AMP)', $this->text_domain ) );
223
+ $html .= '</td></tr>';
224
+ $html .= $this->output_custom_posts_render( $options['output'] );
225
+ $html .= '</table><hr>';
226
+
227
+ echo $html;
228
+
229
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-news-article.php' );
230
+ new Structuring_Markup_Type_NewsArticle( $options['option'] );
231
+ break;
232
+ case 'organization':
233
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
234
+ $html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
235
+ $html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
236
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
237
+ $html .= '</td></tr>';
238
+ $html .= $this->output_custom_posts_render( $options['output'] );
239
+ $html .= '</table><hr>';
240
+
241
+ echo $html;
242
+
243
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-organization.php' );
244
+ new Structuring_Markup_Type_Organization( $options['option'] );
245
+ break;
246
+ case 'person':
247
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
248
+ $html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
249
+ $html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
250
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
251
+ $html .= '</td></tr>';
252
+ $html .= $this->output_custom_posts_render( $options['output'] );
253
+ $html .= '</table><hr>';
254
+
255
+ echo $html;
256
+
257
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-person.php' );
258
+ new Structuring_Markup_Type_Person( $options['option'] );
259
+ break;
260
+ case 'site_navigation':
261
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
262
+ $html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
263
+ $html .= '</td></tr></table><hr>';
264
+ echo $html;
265
+
266
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-site-navigation.php' );
267
+ new Structuring_Markup_Type_Site_Navigation( $options['option'] );
268
+ break;
269
+ case 'video':
270
+ $html = $this->output_checkbox_render( $options['output'], "video", esc_html__( 'Video Post Page', $this->text_domain ) );
271
+ $html .= '</td></tr></table><hr>';
272
+ echo $html;
273
+
274
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-video.php' );
275
+ new Structuring_Markup_Type_Videos();
276
+ break;
277
+ case 'website':
278
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
279
+ $html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
280
+ $html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
281
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
282
+ $html .= '</td></tr>';
283
+ $html .= $this->output_custom_posts_render( $options['output'] );
284
+ $html .= '</table><hr>';
285
+
286
+ echo $html;
287
+
288
+ require_once( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-website.php' );
289
+ new Structuring_Markup_Type_Website( $options['option'] );
290
+ break;
291
+ }
292
+
293
+ $html = '</form>';
294
+ $html .= '</div>';
295
+ echo $html;
296
+ }
297
+
298
+ /**
299
+ * CheckBox Build Render
300
+ *
301
+ * @version 2.5.0
302
+ * @since 1.0.0
303
+ * @param array $option['output']
304
+ * @param string $output
305
+ * @param string $value
306
+ * @return string $html
307
+ */
308
+ private function output_checkbox_render ( array $option, $output, $value ) {
309
+ $html = '<label>';
310
+ $html .= '<input type="checkbox" name="output[' . $output . ']" value="' . $value . '""';
311
+ $html .= isset( $option[$output] ) ? ' checked' : '';
312
+ $html .= '>' . $value . '</label>';
313
+
314
+ return (string) $html;
315
+ }
316
+
317
+ /**
318
+ * Custom Posts Build Render
319
+ *
320
+ * @version 2.5.0
321
+ * @since 2.5.0
322
+ * @param array $option['output']
323
+ * @return string $html
324
+ */
325
+ private function output_custom_posts_render ( array $option ) {
326
+ $html = '<tr><th>' . esc_html__( 'Output On(Custom Posts)', $this->text_domain ) . ' : </th><td>';
327
+ foreach ( $this->post_args as $post_type ) {
328
+ $html .= $this->output_checkbox_render( $option, $post_type['value'], $post_type['label'] );
329
+ }
330
+ $html .= '</td></tr>';
331
+ return (string) $html;
332
+ }
333
+
334
+ /**
335
+ * Information Message Render
336
+ *
337
+ * @version 2.0.0
338
+ * @since 1.0.0
339
+ * @return string $html
340
+ */
341
+ private function information_render () {
342
+ $html = '<div id="message" class="updated notice notice-success is-dismissible below-h2">';
343
+ $html .= '<p>Schema.org Information Update.</p>';
344
+ $html .= '<button type="button" class="notice-dismiss">';
345
+ $html .= '<span class="screen-reader-text">Dismiss this notice.</span>';
346
+ $html .= '</button>';
347
+ $html .= '</div>';
348
+
349
+ return (string) $html;
350
+ }
351
+
352
+ /**
353
+ * Error Message Render
354
+ *
355
+ * @version 2.0.0
356
+ * @since 1.0.0
357
+ * @return string $html
358
+ */
359
+ private function output_error_render () {
360
+ $html = '<div id="notice" class="notice notice-error is-dismissible below-h2">';
361
+ $html .= '<p>Output No Select.</p>';
362
+ $html .= '<button type="button" class="notice-dismiss">';
363
+ $html .= '<span class="screen-reader-text">Dismiss this notice.</span>';
364
+ $html .= '</button>';
365
+ $html .= '</div>';
366
+
367
+ return (string) $html;
368
+ }
369
+ }
trunk/includes/admin/wp-structuring-admin-type-article.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Article
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.2.2
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 3.2.2
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 .= '</table>';
63
+ echo $html;
64
+
65
+ $html = '<table class="schema-admin-table">';
66
+ $html .= '<caption>author</caption>';
67
+ $html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
68
+ $html .= '<tr><th>name :</th><td><small>Default : get_the_author_meta( "display_name", author )</small>';
69
+ $html .= '</td></tr>';
70
+ $html .= '</table>';
71
+ echo $html;
72
+
73
+ $html = '<table class="schema-admin-table">';
74
+ $html .= '<caption>publisher</caption>';
75
+ $html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
76
+ $html .= '<tr><th><label for="name">Organization Name :</label></th><td>';
77
+ $html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" value="' . esc_attr( $option['name'] ) . '">';
78
+ $html .= '<small>Default : bloginfo("name")</small>';
79
+ $html .= '</td></tr>';
80
+ $html .= '</table>';
81
+ echo $html;
82
+
83
+ $html = '<table class="schema-admin-table">';
84
+ $html .= '<caption>publisher.logo</caption>';
85
+ $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
86
+ $html .= '<tr><th><label for="logo">url :</label></th><td>';
87
+ $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
88
+ $html .= '<button id="media-upload" class="schema-admin-media-button dashicons-before dashicons-admin-media"><span>Add Media</span></button>';
89
+ $html .= '</td></tr>';
90
+ $html .= '<tr><th><label for="logo-width">width :</label></th><td>';
91
+ $html .= '<input type="number" name="option[' . "logo-width" . ']" id="logo-width" min="0" value="' . esc_attr( $option['logo-width'] ) . '">px';
92
+ $html .= '<small>height <= 600px.</small>';
93
+ $html .= '</td></tr>';
94
+ $html .= '<tr><th><label for="logo-height">height :</label></th><td>';
95
+ $html .= '<input type="number" name="option[' . "logo-height" . ']" id="logo-height" min="0" value="' . esc_attr( $option['logo-height'] ) . '">px';
96
+ $html .= '<small>height <= 60px.</small>';
97
+ $html .= '</td></tr>';
98
+ $html .= '</table>';
99
+ echo $html;
100
+
101
+ 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>';
102
+ submit_button();
103
+ }
104
+
105
+ /**
106
+ * Return the default options array
107
+ *
108
+ * @since 3.2.2
109
+ * @version 2.2.0
110
+ * @return array $args
111
+ */
112
+ private function get_default_options () {
113
+ $args['name'] = get_bloginfo('name');
114
+ $args['logo'] = "";
115
+ $args['logo-height'] = 0;
116
+ $args['logo-width'] = 0;
117
+
118
+ return (array) $args;
119
+ }
120
+ }
trunk/includes/admin/wp-structuring-admin-type-blog-posting.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type BlogPosting
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.2.2
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 3.2.2
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 .= '</table>';
63
+ echo $html;
64
+
65
+ $html = '<table class="schema-admin-table">';
66
+ $html .= '<caption>author</caption>';
67
+ $html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
68
+ $html .= '<tr><th>name :</th><td><small>Default : get_the_author_meta( "display_name", author )</small>';
69
+ $html .= '</td></tr>';
70
+ $html .= '</table>';
71
+ echo $html;
72
+
73
+ $html = '<table class="schema-admin-table">';
74
+ $html .= '<caption>publisher</caption>';
75
+ $html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
76
+ $html .= '<tr><th><label for="name">Organization Name :</label></th><td>';
77
+ $html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" value="' . esc_attr( $option['name'] ) . '">';
78
+ $html .= '<small>Default : bloginfo("name")</small>';
79
+ $html .= '</td></tr>';
80
+ $html .= '</table>';
81
+ echo $html;
82
+
83
+ $html = '<table class="schema-admin-table">';
84
+ $html .= '<caption>publisher.logo</caption>';
85
+ $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
86
+ $html .= '<tr><th><label for="logo">url :</label></th><td>';
87
+ $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
88
+ $html .= '<button id="media-upload" class="schema-admin-media-button dashicons-before dashicons-admin-media"><span>Add Media</span></button>';
89
+ $html .= '</td></tr>';
90
+ $html .= '<tr><th><label for="logo-width">width :</label></th><td>';
91
+ $html .= '<input type="number" name="option[' . "logo-width" . ']" id="logo-width" min="0" value="' . esc_attr( $option['logo-width'] ) . '">px';
92
+ $html .= '<small>height <= 600px.</small>';
93
+ $html .= '</td></tr>';
94
+ $html .= '<tr><th><label for="logo-height">height :</label></th><td>';
95
+ $html .= '<input type="number" name="option[' . "logo-height" . ']" id="logo-height" min="0" value="' . esc_attr( $option['logo-height'] ) . '">px';
96
+ $html .= '<small>height <= 60px.</small>';
97
+ $html .= '</td></tr>';
98
+ $html .= '</table>';
99
+ echo $html;
100
+
101
+ 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>';
102
+ submit_button();
103
+ }
104
+
105
+ /**
106
+ * Return the default options array
107
+ *
108
+ * @version 3.2.2
109
+ * @since 2.2.0
110
+ * @return array $args
111
+ */
112
+ private function get_default_options () {
113
+ $args['name'] = get_bloginfo('name');
114
+ $args['logo'] = "";
115
+ $args['logo-height'] = 0;
116
+ $args['logo-width'] = 0;
117
+
118
+ return (array) $args;
119
+ }
120
+ }
trunk/includes/admin/wp-structuring-admin-type-breadcrumb.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Breadcrumb
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.2.4
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
+ * @since 2.0.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.2.4
32
+ * @since 2.3.3
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><label for="home_on">Display Home Page :</label></th><td>';
39
+ $html .= '<input type="checkbox" name="option[' . "home_on" . ']" id="home_on" value="on"';
40
+ if ( isset( $option['home_on'] ) && $option['home_on'] === 'on' ) {
41
+ $html .= ' checked="checked"';
42
+ }
43
+ $html .= '>Enabled';
44
+ $html .= '<small>( Installed the HOME to breadcrumbs )</small>';
45
+ $html .= '</td></tr>';
46
+ $html .= '<tr><th><label for="home_name">Home Name :</label></th><td>';
47
+ $html .= '<input type="text" name="option[' . "home_name" . ']" id="home_name" class="regular-text" value="' . esc_attr( $option['home_name'] ) . '">';
48
+ $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>';
49
+ $html .= '</td></tr>';
50
+ $html .= '</table>';
51
+ echo $html;
52
+
53
+ $html = '<table class="schema-admin-table">';
54
+ $html .= '<caption>Short Code</caption>';
55
+ $html .= '<tr><th><label for="home_on">Short Code Copy :</label></th><td>';
56
+ $html .= '<input type="text" onfocus="this.select();" readonly="readonly" value="[wp-structuring-markup-breadcrumb]" class="large-text code">';
57
+ $html .= '<small>Option : id="id_name" and class="class_name" attribute additional ol element.</small>';
58
+ $html .= '</td></tr>';
59
+ $html .= '</table>';
60
+ echo $html;
61
+
62
+ 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>';
63
+ submit_button();
64
+ }
65
+
66
+ /**
67
+ * Return the default options array
68
+ *
69
+ * @version 2.0.2
70
+ * @since 2.0.0
71
+ * @param array $args
72
+ * @return array $args
73
+ */
74
+ private function get_default_options ( array $args ) {
75
+ $args['home_on'] = '';
76
+ $args['home_name'] = '';
77
+
78
+ return (array) $args;
79
+ }
80
+ }
trunk/includes/admin/wp-structuring-admin-type-event.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Event
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.2.4
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 3.2.4
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_place_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_place_name"</small></td></tr>';
55
+ $html .= '<tr><th class="require">priceCurrency :</th><td><small>Input a custom post: field name "schema_event_place_address"</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 .= '</table>';
58
+ echo $html;
59
+
60
+ echo '<p>Custom post name "schema_event_post"</p>';
61
+ echo '<p>Archive rewrite name "events"</p>';
62
+ 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>';
63
+
64
+ submit_button();
65
+ }
66
+ }
trunk/includes/admin/wp-structuring-admin-type-local-business.php ADDED
@@ -0,0 +1,523 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type LocalBusiness
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.0.5
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
+ * @since 2.3.0
19
+ */
20
+ /** LocalBusiness Type defined. */
21
+ private $business_type_array = array(
22
+ array( "type" => "LocalBusiness", "display" => "LocalBusiness" ),
23
+
24
+ array( "type" => "AnimalShelter", "display" => "- AnimalShelter" ),
25
+
26
+ array( "type" => "AutomotiveBusiness", "display" => "- AutomotiveBusiness" ),
27
+ array( "type" => "AutoBodyShop", "display" => "-- AutoBodyShop" ),
28
+ array( "type" => "AutoDealer", "display" => "-- AutoDealer" ),
29
+ array( "type" => "AutoPartsStore", "display" => "-- AutoPartsStore" ),
30
+ array( "type" => "AutoRental", "display" => "-- AutoRental" ),
31
+ array( "type" => "AutoRepair", "display" => "-- AutoRepair" ),
32
+ array( "type" => "AutoWash", "display" => "-- AutoWash" ),
33
+ array( "type" => "GasStation", "display" => "-- GasStation" ),
34
+ array( "type" => "MotorcycleDealer", "display" => "-- MotorcycleDealer" ),
35
+ array( "type" => "MotorcycleRepair", "display" => "-- MotorcycleRepair" ),
36
+
37
+ array( "type" => "ChildCare", "display" => "- ChildCare" ),
38
+
39
+ array( "type" => "DryCleaningOrLaundry", "display" => "- DryCleaningOrLaundry" ),
40
+
41
+ array( "type" => "EmergencyService", "display" => "- EmergencyService" ),
42
+ array( "type" => "FireStation", "display" => "-- FireStation" ),
43
+ array( "type" => "Hospital", "display" => "-- Hospital" ),
44
+ array( "type" => "PoliceStation", "display" => "-- PoliceStation" ),
45
+
46
+ array( "type" => "EmploymentAgency", "display" => "- EmploymentAgency" ),
47
+
48
+ array( "type" => "EntertainmentBusiness", "display" => "- EntertainmentBusiness" ),
49
+ array( "type" => "AdultEntertainment", "display" => "-- AdultEntertainment" ),
50
+ array( "type" => "AmusementPark", "display" => "-- AmusementPark" ),
51
+ array( "type" => "ArtGallery", "display" => "-- ArtGallery" ),
52
+ array( "type" => "Casino", "display" => "-- Casino" ),
53
+ array( "type" => "ComedyClub", "display" => "-- ComedyClub" ),
54
+ array( "type" => "MovieTheater", "display" => "-- MovieTheater" ),
55
+ array( "type" => "NightClub", "display" => "-- NightClub" ),
56
+
57
+ array( "type" => "FinancialService", "display" => "- FinancialService" ),
58
+ array( "type" => "AccountingService", "display" => "-- AccountingService" ),
59
+ array( "type" => "AutomatedTeller", "display" => "-- AutomatedTeller" ),
60
+ array( "type" => "BankOrCreditUnion", "display" => "-- BankOrCreditUnion" ),
61
+ array( "type" => "InsuranceAgency", "display" => "-- InsuranceAgency" ),
62
+
63
+ array( "type" => "FoodEstablishment", "display" => "- FoodEstablishment" ),
64
+ array( "type" => "Bakery", "display" => "-- Bakery" ),
65
+ array( "type" => "BarOrPub", "display" => "-- BarOrPub" ),
66
+ array( "type" => "Brewery", "display" => "-- Brewery" ),
67
+ array( "type" => "CafeOrCoffeeShop", "display" => "-- CafeOrCoffeeShop" ),
68
+ array( "type" => "FastFoodRestaurant", "display" => "-- FastFoodRestaurant" ),
69
+ array( "type" => "IceCreamShop", "display" => "-- IceCreamShop" ),
70
+ array( "type" => "Restaurant", "display" => "-- Restaurant" ),
71
+ array( "type" => "Winery", "display" => "-- Winery" ),
72
+
73
+ array( "type" => "GovernmentOffice", "display" => "- GovernmentOffice" ),
74
+ array( "type" => "PostOffice", "display" => "-- PostOffice" ),
75
+
76
+ array( "type" => "HealthAndBeautyBusiness", "display" => "- HealthAndBeautyBusiness" ),
77
+ array( "type" => "BeautySalon", "display" => "-- BeautySalon" ),
78
+ array( "type" => "DaySpa", "display" => "-- DaySpa" ),
79
+ array( "type" => "HairSalon", "display" => "-- HairSalon" ),
80
+ array( "type" => "HealthClub", "display" => "-- HealthClub" ),
81
+ array( "type" => "NailSalon", "display" => "-- NailSalon" ),
82
+ array( "type" => "TattooParlor", "display" => "-- TattooParlor" ),
83
+
84
+ array( "type" => "HomeAndConstructionBusiness", "display" => "- HomeAndConstructionBusiness" ),
85
+ array( "type" => "Electrician", "display" => "-- Electrician" ),
86
+ array( "type" => "GeneralContractor", "display" => "-- GeneralContractor" ),
87
+ array( "type" => "HVACBusiness", "display" => "-- HVACBusiness" ),
88
+ array( "type" => "HousePainter", "display" => "-- HousePainter" ),
89
+ array( "type" => "Locksmith", "display" => "-- Locksmith" ),
90
+ array( "type" => "MovingCompany", "display" => "-- MovingCompany" ),
91
+ array( "type" => "Plumber", "display" => "-- Plumber" ),
92
+ array( "type" => "RoofingContractor", "display" => "-- RoofingContractor" ),
93
+
94
+ array( "type" => "InternetCafe", "display" => "- InternetCafe" ),
95
+
96
+ array( "type" => "LegalService", "display" => "- LegalService" ),
97
+ array( "type" => "Attorney", "display" => "-- Attorney" ),
98
+ array( "type" => "Notary", "display" => "-- Notary" ),
99
+
100
+ array( "type" => "Library", "display" => "- Library" ),
101
+
102
+ array( "type" => "LodgingBusiness", "display" => "- LodgingBusiness" ),
103
+ array( "type" => "BedAndBreakfast", "display" => "-- BedAndBreakfast" ),
104
+ array( "type" => "Hostel", "display" => "-- Hostel" ),
105
+ array( "type" => "Hotel", "display" => "-- Hotel" ),
106
+ array( "type" => "Motel", "display" => "-- Motel" ),
107
+
108
+ array( "type" => "MedicalOrganization", "display" => "- MedicalOrganization" ),
109
+ array( "type" => "Dentist", "display" => "-- Dentist" ),
110
+ array( "type" => "DiagnosticLab", "display" => "-- DiagnosticLab" ),
111
+ array( "type" => "Hospital", "display" => "-- Hospital" ),
112
+ array( "type" => "MedicalClinic", "display" => "-- MedicalClinic" ),
113
+ array( "type" => "Optician", "display" => "-- Optician" ),
114
+ array( "type" => "Pharmacy", "display" => "-- Pharmacy" ),
115
+ array( "type" => "Physician", "display" => "-- Physician" ),
116
+ array( "type" => "VeterinaryCare", "display" => "-- VeterinaryCare" ),
117
+
118
+ array( "type" => "ProfessionalService", "display" => "- ProfessionalService" ),
119
+
120
+ array( "type" => "RadioStation", "display" => "- RadioStation" ),
121
+
122
+ array( "type" => "RealEstateAgent", "display" => "- RealEstateAgent" ),
123
+
124
+ array( "type" => "RecyclingCenter", "display" => "- RecyclingCenter" ),
125
+
126
+ array( "type" => "SelfStorage", "display" => "- SelfStorage" ),
127
+
128
+ array( "type" => "ShoppingCenter", "display" => "- ShoppingCenter" ),
129
+
130
+ array( "type" => "SportsActivityLocation", "display" => "- SportsActivityLocation" ),
131
+ array( "type" => "BowlingAlley", "display" => "-- BowlingAlley" ),
132
+ array( "type" => "ExerciseGym", "display" => "-- ExerciseGym" ),
133
+ array( "type" => "GolfCourse", "display" => "-- GolfCourse" ),
134
+ array( "type" => "HealthClub", "display" => "-- HealthClub" ),
135
+ array( "type" => "PublicSwimmingPool", "display" => "-- PublicSwimmingPool" ),
136
+ array( "type" => "SkiResort", "display" => "-- SkiResort" ),
137
+ array( "type" => "SportsClub", "display" => "-- SportsClub" ),
138
+ array( "type" => "StadiumOrArena", "display" => "-- StadiumOrArena" ),
139
+ array( "type" => "TennisComplex", "display" => "-- TennisComplex" ),
140
+
141
+ array( "type" => "Store", "display" => "- Store" ),
142
+ array( "type" => "AutoPartsStore", "display" => "-- AutoPartsStore" ),
143
+ array( "type" => "BikeStore", "display" => "-- BikeStore" ),
144
+ array( "type" => "BookStore", "display" => "-- BookStore" ),
145
+ array( "type" => "ClothingStore", "display" => "-- ClothingStore" ),
146
+ array( "type" => "ComputerStore", "display" => "-- ComputerStore" ),
147
+ array( "type" => "ConvenienceStore", "display" => "-- ConvenienceStore" ),
148
+ array( "type" => "DepartmentStore", "display" => "-- DepartmentStore" ),
149
+ array( "type" => "ElectronicsStore", "display" => "-- ElectronicsStore" ),
150
+ array( "type" => "Florist", "display" => "-- Florist" ),
151
+ array( "type" => "FurnitureStore", "display" => "-- FurnitureStore" ),
152
+ array( "type" => "GardenStore", "display" => "-- GardenStore" ),
153
+ array( "type" => "GroceryStore", "display" => "-- GroceryStore" ),
154
+ array( "type" => "HardwareStore", "display" => "-- HardwareStore" ),
155
+ array( "type" => "HobbyShop", "display" => "-- HobbyShop" ),
156
+ array( "type" => "HomeGoodsStore", "display" => "-- HomeGoodsStore" ),
157
+ array( "type" => "JewelryStore", "display" => "-- JewelryStore" ),
158
+ array( "type" => "LiquorStore", "display" => "-- LiquorStore" ),
159
+ array( "type" => "MensClothingStore", "display" => "-- MensClothingStore" ),
160
+ array( "type" => "MobilePhoneStore", "display" => "-- MobilePhoneStore" ),
161
+ array( "type" => "MovieRentalStore", "display" => "-- MovieRentalStore" ),
162
+ array( "type" => "MusicStore", "display" => "-- MusicStore" ),
163
+ array( "type" => "OfficeEquipmentStore", "display" => "-- OfficeEquipmentStore" ),
164
+ array( "type" => "OutletStore", "display" => "-- OutletStore" ),
165
+ array( "type" => "PawnShop", "display" => "-- PawnShop" ),
166
+ array( "type" => "PetStore", "display" => "-- PetStore" ),
167
+ array( "type" => "ShoeStore", "display" => "-- ShoeStore" ),
168
+ array( "type" => "SportingGoodsStore", "display" => "-- SportingGoodsStore" ),
169
+ array( "type" => "TireShop", "display" => "-- TireShop" ),
170
+ array( "type" => "ToyStore", "display" => "-- ToyStore" ),
171
+ array( "type" => "WholesaleStore", "display" => "-- WholesaleStore" ),
172
+
173
+ array( "type" => "TelevisionStation", "display" => "- TelevisionStation" ),
174
+
175
+ array( "type" => "TouristInformationCenter", "display" => "- TouristInformationCenter" ),
176
+
177
+ array( "type" => "TravelAgency", "display" => "- TravelAgency" )
178
+ );
179
+
180
+ /** weekType defined. */
181
+ private $week_array = array(
182
+ array("type" => "Mo", "display" => "Monday"),
183
+ array("type" => "Tu", "display" => "Tuesday"),
184
+ array("type" => "We", "display" => "Wednesday"),
185
+ array("type" => "Th", "display" => "Thursday"),
186
+ array("type" => "Fr", "display" => "Friday"),
187
+ array("type" => "Sa", "display" => "Saturday"),
188
+ array("type" => "Su", "display" => "Sunday")
189
+ );
190
+
191
+ /**
192
+ * Constructor Define.
193
+ *
194
+ * @version 3.1.4
195
+ * @since 2.3.0
196
+ * @param array $option
197
+ */
198
+ public function __construct ( array $option ) {
199
+ /** Default Value Set */
200
+ $option_array = $this->get_default_options();
201
+
202
+ if ( !empty( $option ) ) {
203
+ $option_array = array_merge( $option_array, $option );
204
+ }
205
+
206
+ $this->page_render( $option_array );
207
+ }
208
+
209
+ /**
210
+ * Form Layout Render
211
+ *
212
+ * @version 3.1.4
213
+ * @since 2.3.3
214
+ * @param array $option
215
+ */
216
+ private function page_render ( array $option ) {
217
+ /** Local Business Type */
218
+ $html = '<table class="schema-admin-table">';
219
+ $html .= '<caption>Local Business</caption>';
220
+ $html .= $this->set_form_select( 'business_type', 'Local Business Type', $option['business_type'], 'Default : "Local Business"' );
221
+ $html .= $this->set_form_text( 'image', 'An image of the business', $option['image'], true, 'Default : bloginfo("url")' );
222
+ $html .= $this->set_form_text( 'name', 'Business Name', $option['name'], true, 'Default : bloginfo("name")' );
223
+ $html .= $this->set_form_text( 'url', 'Url', $option['url'], true, 'Default : bloginfo("url")' );
224
+ $html .= $this->set_form_text( 'telephone', 'Telephone', $option['telephone'], false, 'e.g. : +1-880-555-1212' );
225
+ $html .= '</table>';
226
+ echo $html;
227
+
228
+ /** For food establishments */
229
+ $html = '<table class="schema-admin-table">';
230
+ $html .= '<caption>For food establishments</caption>';
231
+ $html .= $this->set_form_checkbox( 'food_active', 'Setting', $option['food_active'], 'Enabled' );
232
+ $html .= $this->set_form_text( 'menu', 'Menu url', $option['menu'], false, 'For food establishments, the fully-qualified URL of the menu.' );
233
+ $html .= $this->set_form_checkbox( 'accepts_reservations', 'Accepts Reservations', $option['accepts_reservations'], 'For food establishments, and whether it is possible to accept a reservation?' );
234
+ $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.' );
235
+ $html .= '</table>';
236
+ echo $html;
237
+
238
+ /** Postal Address */
239
+ $html = '<table class="schema-admin-table">';
240
+ $html .= '<caption>Postal Address</caption>';
241
+ $html .= $this->set_form_text( 'street_address', 'Street Address', $option['street_address'], true );
242
+ $html .= $this->set_form_text( 'address_locality', 'Address Locality', $option['address_locality'], true );
243
+ $html .= $this->set_form_text( 'address_region', 'Address Region', $option['address_region'], false );
244
+ $html .= $this->set_form_text( 'postal_code', 'Postal Code', $option['postal_code'], true );
245
+ $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>' );
246
+ $html .= '</table>';
247
+ echo $html;
248
+
249
+ /** Geo Circle */
250
+ $html = '<table class="schema-admin-table">';
251
+ $html .= '<caption>Geo Circle</caption>';
252
+ $html .= $this->set_form_checkbox( 'geo_circle_active', 'Setting', $option['geo_circle_active'], 'Enabled' );
253
+ $html .= $this->set_form_text( 'geo_circle_radius', 'geoRadius', $option['geo_circle_radius'], false );
254
+ $html .= '</table>';
255
+ echo $html;
256
+
257
+ /** Geo Coordinates */
258
+ $html = '<table class="schema-admin-table">';
259
+ $html .= '<caption>Geo Coordinates</caption>';
260
+ $html .= $this->set_form_checkbox( 'geo_active', 'Setting', $option['geo_active'], 'Enabled' );
261
+ $html .= $this->set_form_text( 'latitude', 'Latitude', $option['latitude'], false );
262
+ $html .= $this->set_form_text( 'longitude', 'Longitude', $option['longitude'], false );
263
+ $html .= '</table>';
264
+ echo $html;
265
+
266
+ /** Opening Hours Specification */
267
+ $html = '<table class="schema-admin-table">';
268
+ $html .= '<caption>Opening Hours Specification</caption>';
269
+
270
+ $i = 0;
271
+
272
+ foreach ( $this->week_array as $value ) {
273
+ if ( !isset( $option[$value['type']] ) ) {
274
+ $option[$value['type']] = "";
275
+ }
276
+
277
+ $html .= $this->set_form_checkbox( $value['type'], $value['display'], $option[$value['type']], 'Enabled' );
278
+
279
+ if ( isset( $option['week'][$value['type']] ) ) {
280
+ foreach ( $option['week'][$value['type']] as $type ) {
281
+ if ( !empty( $type['open'] ) ) {
282
+ $html .= $this->set_form_time( $value['type'], '', $type['open'], $type['close'], '', $i );
283
+ $i++;
284
+ } else {
285
+ $html .= $this->set_form_time( $value['type'], '', '', '', '', 0 );
286
+ break;
287
+ }
288
+ }
289
+ } else {
290
+ $html .= $this->set_form_time( $value['type'], '', '', '', '', 0 );
291
+ }
292
+
293
+ $i = 0;
294
+ }
295
+
296
+ $html .= '</table>';
297
+ echo $html;
298
+
299
+ /** Holiday Opening Hours */
300
+ $html = '<table class="schema-admin-table">';
301
+ $html .= '<caption>Holiday Opening Hours</caption>';
302
+ $html .= $this->set_form_checkbox( 'holiday_active', 'Setting', $option['holiday_active'], 'Enabled' );
303
+ $html .= $this->set_form_time_holiday( $option['holiday_open'], $option['holiday_close'] );
304
+ $html .= $this->set_form_date( 'holiday_valid_from', 'validFrom', $option['holiday_valid_from'], false );
305
+ $html .= $this->set_form_date( 'holiday_valid_through', 'validThrough', $option['holiday_valid_through'], false );
306
+
307
+ $html .= '</table>';
308
+ echo $html;
309
+
310
+ /** Price Range */
311
+ $html = '<table class="schema-admin-table">';
312
+ $html .= '<caption>Price Range</caption>';
313
+ $html .= $this->set_form_text( 'price_range', 'Price Range', $option['price_range'], false, 'The price range of the business, for example $$$.' );
314
+ $html .= '</table>';
315
+ echo $html;
316
+
317
+ 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>';
318
+ submit_button();
319
+ }
320
+
321
+ /**
322
+ * Return the default options array
323
+ *
324
+ * @since 3.1.4
325
+ * @version 2.5.0
326
+ * @return array $args
327
+ */
328
+ private function get_default_options () {
329
+ $args['business_type'] = 'local_business';
330
+ $args['name'] = get_bloginfo('name');
331
+ $args['image'] = get_bloginfo('url');
332
+ $args['url'] = get_bloginfo('url');
333
+ $args['telephone'] = '';
334
+ $args['food_active'] = '';
335
+ $args['menu'] = '';
336
+ $args['accepts_reservations'] = '';
337
+ $args['serves_cuisine'] = '';
338
+ $args['street_address'] = '';
339
+ $args['address_locality'] = '';
340
+ $args['address_region'] = '';
341
+ $args['postal_code'] = '';
342
+ $args['address_country'] = '';
343
+ $args['geo_circle_active'] = '';
344
+ $args['geo_circle_radius'] = '';
345
+ $args['geo_active'] = '';
346
+ $args['latitude'] = '';
347
+ $args['longitude'] = '';
348
+ $args['opening_active'] = '';
349
+
350
+ foreach ( $this->week_array as $value ) {
351
+ $args[$value['type']] = '';
352
+ $args['week'][$value['type']]['open'] = '';
353
+ $args['week'][$value['type']]['close'] = '';
354
+ }
355
+
356
+ $args['holiday_active'] = '';
357
+ $args['holiday_open'] = '';
358
+ $args['holiday_close'] = '';
359
+ $args['holiday_valid_from'] = '';
360
+ $args['holiday_valid_through'] = '';
361
+ $args['price_range'] = '';
362
+
363
+ return (array) $args;
364
+ }
365
+
366
+ /**
367
+ * Return the form text
368
+ *
369
+ * @version 3.0.5
370
+ * @since 2.3.0
371
+ * @param string $id
372
+ * @param string $display
373
+ * @param string $value
374
+ * @param boolean $required
375
+ * @param string $note
376
+ * @return string $html
377
+ */
378
+ private function set_form_text ( $id, $display, $value = "", $required = false, $note = "" ) {
379
+ $value = esc_attr( $value );
380
+
381
+ if ( $required ) {
382
+ $format = '<tr><th class="require"><label for=%s>%s :</label></th><td>';
383
+ } else {
384
+ $format = '<tr><th><label for=%s>%s :</label></th><td>';
385
+ }
386
+
387
+ $format .= '<input type="text" name="option[%s]" id="%s" class="regular-text" value="%s"';
388
+
389
+ if ( $required ) {
390
+ $format .= ' required';
391
+ }
392
+ $format .= '><small>%s</small></td></tr>';
393
+
394
+ return (string) sprintf( $format, $id, $display, $id, $id, $value, $note );
395
+ }
396
+
397
+ /**
398
+ * Return the form date
399
+ *
400
+ * @since 3.0.5
401
+ * @version 2.5.0
402
+ * @param string $id
403
+ * @param string $display
404
+ * @param string $value
405
+ * @param boolean $required
406
+ * @param string $note
407
+ * @return string $html
408
+ */
409
+ private function set_form_date ( $id, $display, $value = "", $required = false, $note = "" ) {
410
+ $value = esc_attr( $value );
411
+
412
+ $format = '<tr><th><label for=%s>%s :</label></th><td>';
413
+ $format .= '<input type="date" name="option[%s]" id="%s" value="%s"';
414
+ if ( $required ) {
415
+ $format .= ' required';
416
+ }
417
+ $format .= '><small>%s</small></td></tr>';
418
+
419
+ return (string) sprintf( $format, $id, $display, $id, $id, $value, $note );
420
+ }
421
+
422
+ /**
423
+ * Return the form checkbox
424
+ *
425
+ * @version 3.0.5
426
+ * @since 2.3.0
427
+ * @param string $id
428
+ * @param string $display
429
+ * @param string $value
430
+ * @param string $note
431
+ * @return string $html
432
+ */
433
+ private function set_form_checkbox ( $id, $display, $value = "", $note = "" ) {
434
+ $value = esc_attr( $value );
435
+
436
+ $format = '<tr><th><label for=%s>%s :</label></th><td>';
437
+ $format .= '<input type="checkbox" name="option[%s]" id="%s" value="on"';
438
+ if ( $value === 'on' ) {
439
+ $format .= ' checked="checked"';
440
+ }
441
+ $format .= '>%s</td></tr>';
442
+
443
+ return (string) sprintf( $format, $id, $display, $id, $id, $note );
444
+ }
445
+
446
+ /**
447
+ * Return the form select
448
+ *
449
+ * @since 2.3.0
450
+ * @param string $id
451
+ * @param string $display
452
+ * @param string $value
453
+ * @param string $note
454
+ * @return string $html
455
+ */
456
+ private function set_form_select ( $id, $display, $value = "", $note = "" ) {
457
+ $value = esc_attr( $value );
458
+
459
+ $format = '<tr><th class="require"><label for=%s>%s :</label></th><td>';
460
+ $format .= '<select id="%s" name="option[%s]">';
461
+ foreach ( $this->business_type_array as $args ) {
462
+ $format .= '<option value="' . $args['type'] . '"';
463
+ if ( $args['type'] === $value ) {
464
+ $format .= ' selected';
465
+ }
466
+ $format .= '>' . $args['display'] . '</option>';
467
+ }
468
+ $format .= '</select>';
469
+ $format .= '<small>%s</small></td></tr>';
470
+
471
+ return (string) sprintf( $format, $id, $display, $id, $id, $note );
472
+ }
473
+
474
+ /**
475
+ * Return the form time
476
+ *
477
+ * @version 3.0.5
478
+ * @since 2.3.0
479
+ * @param string $id
480
+ * @param string $display
481
+ * @param string $value1
482
+ * @param string $value2
483
+ * @param string $note
484
+ * @param int $count
485
+ * @return string $html
486
+ */
487
+ private function set_form_time ( $id, $display, $value1 = "", $value2 = "", $note = "", $count = 0 ) {
488
+ $value1 = esc_attr( $value1 );
489
+ $value2 = esc_attr( $value2 );
490
+
491
+ $format = '<tr class="opening-hours %s"><th><label for=%s>%s :</label></th><td>';
492
+ $format .= 'Open Time : <input type="time" name="option[week][%s][%d][open]" id="%s-open" value="%s">';
493
+ $format .= ' Close Time : <input type="time" name="option[week][%s][%d][close]" id="%s-close" value="%s">';
494
+ $format .= '%s<a class="dashicons dashicons-plus markup-time plus"></a>';
495
+ if( $count !== 0 ) {
496
+ $format .= '<a class="dashicons dashicons-minus markup-time minus"></a>';
497
+ }
498
+ $format .= '</td></tr>';
499
+
500
+ return (string) sprintf( $format, $id, $id, $display, $id, $count, $id, $value1, $id, $count, $id, $value2, $note );
501
+ }
502
+
503
+ /**
504
+ * Return the form time (Holiday)
505
+ *
506
+ * @since 2.5.0
507
+ * @version 2.5.0
508
+ * @param string $value1
509
+ * @param string $value2
510
+ * @return string $html
511
+ */
512
+ private function set_form_time_holiday ( $value1 = "", $value2 = "" ) {
513
+ $value1 = esc_attr( $value1 );
514
+ $value2 = esc_attr( $value2 );
515
+
516
+ $format = '<tr><th>Holiday Time :</th><td>';
517
+ $format .= 'Open Time : <input type="time" name="option[holiday_open]" value="%s">';
518
+ $format .= 'Close Time : <input type="time" name="option[holiday_close]" value="%s">';
519
+ $format .= '</td></tr>';
520
+
521
+ return (string) sprintf( $format, $value1, $value2 );
522
+ }
523
+ }
trunk/includes/admin/wp-structuring-admin-type-news-article.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type News Article
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.2.2
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 3.2.2
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 .= '</table>';
63
+ echo $html;
64
+
65
+ $html = '<table class="schema-admin-table">';
66
+ $html .= '<caption>author</caption>';
67
+ $html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
68
+ $html .= '<tr><th>name :</th><td><small>Default : get_the_author_meta( "display_name", author )</small>';
69
+ $html .= '</td></tr>';
70
+ $html .= '</table>';
71
+ echo $html;
72
+
73
+ $html = '<table class="schema-admin-table">';
74
+ $html .= '<caption>publisher</caption>';
75
+ $html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
76
+ $html .= '<tr><th><label for="name">Organization Name :</label></th><td>';
77
+ $html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" value="' . esc_attr( $option['name'] ) . '">';
78
+ $html .= '<small>Default : bloginfo("name")</small>';
79
+ $html .= '</td></tr>';
80
+ $html .= '</table>';
81
+ echo $html;
82
+
83
+ $html = '<table class="schema-admin-table">';
84
+ $html .= '<caption>publisher.logo</caption>';
85
+ $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
86
+ $html .= '<tr><th><label for="logo">url :</label></th><td>';
87
+ $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
88
+ $html .= '<button id="media-upload" class="schema-admin-media-button dashicons-before dashicons-admin-media"><span>Add Media</span></button>';
89
+ $html .= '</td></tr>';
90
+ $html .= '<tr><th><label for="logo-width">width :</label></th><td>';
91
+ $html .= '<input type="number" name="option[' . "logo-width" . ']" id="logo-width" min="0" value="' . esc_attr( $option['logo-width'] ) . '">px';
92
+ $html .= '<small>height <= 600px.</small>';
93
+ $html .= '</td></tr>';
94
+ $html .= '<tr><th><label for="logo-height">height :</label></th><td>';
95
+ $html .= '<input type="number" name="option[' . "logo-height" . ']" id="logo-height" min="0" value="' . esc_attr( $option['logo-height'] ) . '">px';
96
+ $html .= '<small>height <= 60px.</small>';
97
+ $html .= '</td></tr>';
98
+ $html .= '</table>';
99
+ echo $html;
100
+
101
+ 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>';
102
+ submit_button();
103
+ }
104
+
105
+ /**
106
+ * Return the default options array
107
+ *
108
+ * @since 3.2.2
109
+ * @version 2.2.0
110
+ * @return array $args
111
+ */
112
+ private function get_default_options () {
113
+ $args['name'] = get_bloginfo('name');
114
+ $args['logo'] = "";
115
+ $args['logo-height'] = 0;
116
+ $args['logo-width'] = 0;
117
+
118
+ return (array) $args;
119
+ }
120
+ }
trunk/includes/admin/wp-structuring-admin-type-organization.php ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Organization
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.1.4
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
+ * @since 1.0.0
52
+ * @param array $option
53
+ */
54
+ public function __construct ( array $option ) {
55
+ /** Default Value Set */
56
+ if ( empty( $option ) ) {
57
+ $option = $this->get_default_options( $option );
58
+ }
59
+ $this->page_render( $option );
60
+ }
61
+
62
+ /**
63
+ * Form Layout Render
64
+ *
65
+ * @version 3.2.0
66
+ * @since 1.0.0
67
+ * @param array $option
68
+ */
69
+ private function page_render ( array $option ) {
70
+ /** Logos */
71
+ $html = '<table class="schema-admin-table">';
72
+ $html .= '<caption>Logos</caption>';
73
+ $html .= '<tr><th class="require"><label for="name">Organization Name :</label></th><td>';
74
+ $html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" required value="' . esc_attr( $option['name'] ) . '">';
75
+ $html .= '<small>Default : bloginfo("name")</small>';
76
+ $html .= '</td></tr>';
77
+ $html .= '<tr><th class="require"><label for="url">url :</label></th><td>';
78
+ $html .= '<input type="text" name="option[' . "url" . ']" id="url" class="regular-text" required value="' . esc_attr( $option['url'] ) . '">';
79
+ $html .= '<small>Default : bloginfo("url")</small>';
80
+ $html .= '</td></tr>';
81
+ $html .= '<tr><th class="require"><label for="logo">logo :</label></th><td>';
82
+ $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" required value="' . esc_attr( $option['logo'] ) . '">';
83
+ $html .= '<button id="media-upload" class="schema-admin-media-button dashicons-before dashicons-admin-media"><span>Add Media</span></button>';
84
+ $html .= '<small>Default : bloginfo("url") + "/images/logo.png"</small>';
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'] ) . '">';
101
+ $html .= '<small>e.g. : +1-880-555-1212</small>';
102
+ $html .= '</td></tr>';
103
+ $html .= '<tr><th><label for="contact_type">contactType :</label></th><td>';
104
+ $html .= '<select id="contact_type" name="option[' . "contact_type" . ']">';
105
+ foreach ( $this->contact_type_array as $value ) {
106
+ $html .= '<option value="' . $value['type'] . '"';
107
+ if ( $value['type'] === $option['contact_type'] ) {
108
+ $html .= ' selected';
109
+ }
110
+ $html .= '>' . $value['display'] . '</option>';
111
+ }
112
+ $html .= '</select>';
113
+ $html .= '<small>Default : "customer service"</small>';
114
+ $html .= '</td></tr>';
115
+ $html .= '<tr><th><label for="email">email :</label></th><td>';
116
+ $html .= '<input type="email" name="option[' . "email" . ']" id="email" class="regular-text" value="' . esc_attr( $option['email'] ) . '">';
117
+ $html .= '<small>e.g. : info@example.com</small>';
118
+ $html .= '</td></tr>';
119
+ $html .= '<tr><th><label for="area_served">areaServed :</label></th><td>';
120
+ $html .= '<input type="text" name="option[' . "area_served" . ']" id="area_served" class="regular-text" value="' . esc_attr( $option['area_served'] ) . '">';
121
+ $html .= '<small>Default : "US"&nbsp;&nbsp;Multiple : "US,CA"</small>';
122
+ $html .= '</td></tr>';
123
+ $html .= '<tr><th>contactOption :</th><td>';
124
+ $html .= '<label><input type="checkbox" name="option[' . "contact_point_1" . ']" id="contact_point_1" value="on"';
125
+ if ( isset( $option['contact_point_1'] ) && $option['contact_point_1'] === 'on' ) {
126
+ $html .= ' checked="checked"';
127
+ }
128
+ $html .= '>HearingImpairedSupported</label><br>';
129
+ $html .= '<label><input type="checkbox" name="option[' . "contact_point_2" . ']" id="contact_point_2" value="on"';
130
+ if ( isset( $option['contact_point_2'] ) && $option['contact_point_2'] === 'on' ) {
131
+ $html .= ' checked="checked"';
132
+ }
133
+ $html .= '>TollFree</label><br>';
134
+ $html .= '</td></tr>';
135
+ $html .= '<tr><th><label for="available_language">available&nbsp;Language :</label></th><td>';
136
+ $html .= '<input type="text" name="option[' . "available_language" . ']" id="available_language" class="regular-text" value="' . esc_attr( $option['available_language'] ) . '">';
137
+ $html .= '<small>Default : "English"&nbsp;&nbsp;Multiple : "French,English"</small>';
138
+ $html .= '</td></tr>';
139
+ $html .= '</table>';
140
+ echo $html;
141
+
142
+ /** Social Profiles */
143
+ $html = '<table class="schema-admin-table">';
144
+ $html .= '<caption>Social Profiles</caption>';
145
+ foreach ( $this->social_array as $value ) {
146
+ $html .= '<tr><th><label for="' . $value['type'] . '">' . $value['display'] . ' :</label></th><td>';
147
+ $html .= '<input type="text" name="option[' . "social" . '][' . $value['type'] . ']" id="' . $value['type'] . '" class="regular-text" value="' . esc_attr( $option['social'][$value['type']] ) . '">';
148
+ $html .= '</td></tr>';
149
+ }
150
+ $html .= '</table>';
151
+ echo $html;
152
+
153
+ 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>';
154
+ submit_button();
155
+ }
156
+
157
+ /**
158
+ * Return the default options array
159
+ *
160
+ * @version 3.2.0
161
+ * @since 1.0.0
162
+ * @param array $args
163
+ * @return array $args
164
+ */
165
+ private function get_default_options ( array $args ) {
166
+ $args['name'] = get_bloginfo('name');
167
+ $args['url'] = get_bloginfo('url');
168
+ $args['logo'] = get_bloginfo('url') . '/images/logo.png';
169
+ $args['contact_point'] = '';
170
+ $args['telephone'] = '';
171
+ $args['contact_type'] = 'customer_service';
172
+ $args['email'] = '';
173
+ $args['area_served'] = 'US';
174
+ $args['contact_option_1'] = '';
175
+ $args['contact_option_2'] = '';
176
+ $args['available_language'] = 'English';
177
+
178
+ foreach ( $this->social_array as $value ) {
179
+ $args['social'][$value['type']] = '';
180
+ }
181
+
182
+ return (array) $args;
183
+ }
184
+ }
trunk/includes/admin/wp-structuring-admin-type-person.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Person
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.1.2
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 3.1.2
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 .= '<small>Default : bloginfo("name")</small>';
66
+ $html .= '</td></tr>';
67
+ $html .= '<tr><th class="require"><label for="url">url :</label></th><td>';
68
+ $html .= '<input type="text" name="option[' . "url" . ']" id="url" class="regular-text" required value="' . esc_attr( $option['url'] ) . '">';
69
+ $html .= '<small>Default : bloginfo("url")</small>';
70
+ $html .= '</td></tr>';
71
+ $html .= '</table>';
72
+ echo $html;
73
+
74
+ /** Place Settings */
75
+ $html = '<table class="schema-admin-table">';
76
+ $html .= '<caption>Place Settings</caption>';
77
+ $html .= '<tr><th class="require"><label for="addressCountry">addressCountry :</label></th><td>';
78
+ $html .= '<input type="text" name="option[' . "addressCountry" . ']" id="addressCountry" class="regular-text" required value="' . esc_attr( $option['addressCountry'] ) . '">';
79
+ $html .= '<small>e.g. Japan</small>';
80
+ $html .= '</td></tr>';
81
+ $html .= '</table>';
82
+ echo $html;
83
+
84
+ /** Social Profiles */
85
+ $html = '<table class="schema-admin-table">';
86
+ $html .= '<caption>Social Profiles</caption>';
87
+ foreach ( $this->social_array as $value ) {
88
+ $html .= '<tr><th><label for="' . $value['type'] . '">' . $value['display'] . ' :</label></th><td>';
89
+ $html .= '<input type="text" name="option[' . "social" . '][' . $value['type'] . ']" id="' . $value['type'] . '" class="regular-text" value="' . esc_attr( $option['social'][$value['type']] ) . '">';
90
+ $html .= '</td></tr>';
91
+ }
92
+ $html .= '</table>';
93
+ echo $html;
94
+
95
+ 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>';
96
+ submit_button();
97
+ }
98
+
99
+ /**
100
+ * Return the default options array
101
+ *
102
+ * @since 3.1.2
103
+ * @version 2.4.0
104
+ * @return array $args
105
+ */
106
+ private function get_default_options () {
107
+ $args['name'] = get_bloginfo('name');
108
+ $args['url'] = get_bloginfo('url');
109
+ $args['addressCountry'] = '';
110
+
111
+ foreach ( $this->social_array as $value ) {
112
+ $args['social'][$value['type']] = '';
113
+ }
114
+
115
+ return (array) $args;
116
+ }
117
+ }
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,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type WebSite
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.1.0
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 3.1.0
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 .= '<small>Default : bloginfo("name")</small>';
46
+ $html .= '</td></tr>';
47
+ $html .= '<tr><th><label for="alternateName">alternateName :</label></th><td>';
48
+ $html .= '<input type="text" name="option[' . "alternateName" . ']" id="alternateName" class="regular-text" value="' . esc_attr( $option['alternateName'] ) . '">';
49
+ $html .= '<small>Default : bloginfo("name")</small>';
50
+ $html .= '</td></tr>';
51
+ $html .= '<tr><th class="require"><label for="url">url :</label></th><td>';
52
+ $html .= '<input type="text" name="option[' . "url" . ']" id="url" class="regular-text" required value="' . esc_attr( $option['url'] ) . '">';
53
+ $html .= '<small>Default : bloginfo("url")</small>';
54
+ $html .= '</td></tr>';
55
+ $html .= '</table>';
56
+ echo $html;
57
+
58
+ $html = '<table class="schema-admin-table">';
59
+ $html .= '<caption>Sitelink Search Box [ Site ]</caption>';
60
+ $html .= '<tr><th><label for="potential_action">potentialAction Active :</label></th><td>';
61
+ $html .= '<input type="checkbox" name="option[' . "potential_action" . ']" id="potential_action" value="on"';
62
+ if ( isset( $option['potential_action'] ) && $option['potential_action'] === 'on' ) {
63
+ $html .= ' checked="checked"';
64
+ }
65
+ $html .= '>Enabled';
66
+ $html .= '</td></tr>';
67
+ $html .= '<tr><th><label for="target">target :</label></th><td>';
68
+ $html .= '<input type="text" name="option[' . "target" . ']" id="target" class="regular-text" value="' . esc_attr( $option['target'] ) . '">';
69
+ $html .= '<small>Default : bloginfo("url") + /?s=</small>';
70
+ $html .= '</td></tr>';
71
+ $html .= '</table>';
72
+ echo $html;
73
+
74
+ $html = '<table class="schema-admin-table">';
75
+ $html .= '<caption>Sitelink Search Box [ App ] *required Sitelink Search Box [ Site ]</caption>';
76
+ $html .= '<tr><th><label for="potential_action_app">potentialAction Active :</label></th><td>';
77
+ $html .= '<input type="checkbox" name="option[' . "potential_action_app" . ']" id="potential_action_app" value="on"';
78
+ if ( isset( $option['potential_action_app'] ) && $option['potential_action_app'] === 'on' ) {
79
+ $html .= ' checked="checked"';
80
+ }
81
+ $html .= '>Enabled';
82
+ $html .= '</td></tr>';
83
+ $html .= '<tr><th><label for="target_app">target :</label></th><td>';
84
+ $html .= '<input type="text" name="option[' . "target_app" . ']" id="target_app" class="regular-text" value="' . esc_attr( $option['target_app'] ) . '">';
85
+ $html .= '<small>e.g. android-app://com.example/https/query.example.com/search/?q=</small>';
86
+ $html .= '</td></tr>';
87
+ $html .= '</table>';
88
+ echo $html;
89
+
90
+ 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>';
91
+ submit_button();
92
+ }
93
+
94
+ /**
95
+ * Return the default options array
96
+ *
97
+ * @version 3.1.0
98
+ * @since 1.0.0
99
+ * @return array $args
100
+ */
101
+ private function get_default_options () {
102
+ $args = array();
103
+
104
+ $args['name'] = get_bloginfo('name');
105
+ $args['alternateName'] = $args['name'];
106
+ $args['url'] = get_bloginfo('url');
107
+ $args['potential_action'] = '';
108
+ $args['target'] = $args['url'] . '/?s=';
109
+ $args['potential_action_app'] = '';
110
+ $args['target_app'] = '';
111
+
112
+ return (array) $args;
113
+ }
114
+ }
trunk/includes/custom/wp-structuring-custom-post-event.php ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Custom Post "Event"
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.2.3
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
+ * Constructor Define.
52
+ *
53
+ * @version 3.1.6
54
+ * @since 2.1.0
55
+ * @param String $text_domain
56
+ */
57
+ public function __construct ( $text_domain ) {
58
+ $this->text_domain = $text_domain;
59
+
60
+ /** Custom post menu controls */
61
+ $show_flag = __return_false();
62
+ if ( isset( $_POST['type'] ) && $_POST['type'] === 'event' ) {
63
+ if ( isset( $_POST['activate'] ) && $_POST['activate'] === 'on' ) {
64
+ $show_flag = __return_true();
65
+ }
66
+ } else {
67
+ /** DB Connect */
68
+ $db = new Structuring_Markup_Admin_Db();
69
+ $results = $db->get_type_options('event');
70
+
71
+ if ( isset( $results['activate'] ) && $results['activate'] == 'on' ) {
72
+ $show_flag = __return_true();
73
+ }
74
+ }
75
+
76
+ register_post_type(
77
+ $this->custom_type,
78
+ array(
79
+ 'labels' => array(
80
+ 'name' => esc_html__( 'Event Posts', $this->text_domain ),
81
+ 'singular_name' => esc_html__( 'Event Posts', $this->text_domain ),
82
+ 'all_items' => esc_html__( 'All Event Posts', $this->text_domain )
83
+ ),
84
+ 'capability_type' => 'post',
85
+ 'has_archive' => true,
86
+ 'hierarchical' => false,
87
+ 'menu_position' => 5,
88
+ 'public' => $show_flag,
89
+ 'query_var' => false,
90
+ 'rewrite' => array( 'with_front' => true, 'slug' => 'events' ),
91
+ 'show_in_menu' => $show_flag,
92
+ 'show_ui' => $show_flag,
93
+ 'supports' => array( 'title', 'editor', 'author', 'thumbnail' )
94
+ )
95
+ );
96
+
97
+ if ( is_admin() ) {
98
+ add_action( 'admin_init', array( $this, 'admin_init' ) );
99
+ add_action( 'admin_menu', array( $this, 'admin_menu' ) );
100
+ }
101
+ }
102
+
103
+ /**
104
+ * admin init.
105
+ *
106
+ * @version 2.1.0
107
+ * @since 2.1.0
108
+ */
109
+ public function admin_init () {
110
+ add_action( 'save_post_' . $this->custom_type, array( $this, 'save_post' ) );
111
+ }
112
+
113
+ /**
114
+ * admin meta boxes.
115
+ *
116
+ * @version 2.1.0
117
+ * @since 2.1.0
118
+ */
119
+ public function admin_menu () {
120
+ $custom_field_title = esc_html__( 'Schema.org Type Event', $this->text_domain );
121
+ add_meta_box( $this->custom_type, $custom_field_title, array( $this, 'set_custom_fields' ), $this->custom_type, 'normal' );
122
+ }
123
+
124
+ /**
125
+ * Set custom fields.
126
+ *
127
+ * @version 3.2.3
128
+ * @since 2.1.0
129
+ */
130
+ public function set_custom_fields () {
131
+ $custom_array = get_post_meta( get_the_ID(), $this->custom_type, false );
132
+ $custom_array = isset( $custom_array[0] ) ? unserialize( $custom_array[0] ) : array();
133
+
134
+ /** Default Value Set */
135
+ $args = $this->get_default_options();
136
+
137
+ if ( !empty( $args ) ) {
138
+ $args = array_merge( $args, $custom_array );
139
+ }
140
+
141
+ $html = '';
142
+ $html .= '<table>';
143
+ $html .= '<tr><td><label for="schema_event_type">';
144
+ $html .= esc_html__( 'Event Type', $this->text_domain );
145
+ $html .= '&nbsp;(required)</label></td><td>';
146
+ $html .= '<select name="option[' . "schema_event_type" . ']" id="schema_event_type">';
147
+ foreach( $this->event_type as $value) {
148
+ $html .= '<option';
149
+ if ( $value === $args['schema_event_type'] ) {
150
+ $html .= ' selected="selected"';
151
+ }
152
+ $html .= ' value="' . $value . '">' . $value . '</option>';
153
+ }
154
+ $html .= '</select>';
155
+ $html .= '</td></tr>';
156
+ $html .= '<tr><td><label for="schema_event_name">';
157
+ $html .= esc_html__( 'Event Name', $this->text_domain );
158
+ $html .= '&nbsp;(required)</label></td><td>';
159
+ $html .= '<input type="text" name="option[' . "schema_event_name" . ']" id="schema_event_name" class="regular-text" required value="' . esc_attr( $args['schema_event_name'] ) . '">';
160
+ $html .= '</td></tr>';
161
+ $html .= '<tr><td><label for="schema_event_description">';
162
+ $html .= esc_html__( 'Event Description', $this->text_domain );
163
+ $html .= '&nbsp;(recommended)</label></td><td>';
164
+ $html .= '<textarea name="option[' . "schema_event_description" . ']" id="schema_event_description" class="large-text code" rows="3">' . esc_attr( $args['schema_event_description'] ) . '</textarea>';
165
+ $html .= '</td></tr>';
166
+ $html .= '<tr><td><label for="schema_event_image">';
167
+ $html .= esc_html__( 'Event Image', $this->text_domain );
168
+ $html .= '&nbsp;(recommended)</label></td><td>';
169
+ $html .= '<input type="text" name="option[' . "schema_event_image" . ']" id="schema_event_image" class="large-text" value="' . esc_attr( $args['schema_event_image'] ) . '">';
170
+ $html .= '</td></tr>';
171
+ $html .= '<tr><td><label for="schema_event_date">';
172
+ $html .= esc_html__( 'Start Date', $this->text_domain );
173
+ $html .= '&nbsp;(required)</label></td><td>';
174
+ $html .= '<input type="date" name="option[' . "schema_event_date" . ']" id="schema_event_date" required value="' . esc_attr( $args['schema_event_date'] ) . '">';
175
+ $html .= '<input type="time" name="option[' . "schema_event_time" . ']" id="schema_event_time" required value="' . esc_attr( $args['schema_event_time'] ) . '">';
176
+ $html .= '</td></tr>';
177
+ $html .= '<tr><td><label for="schema_event_date_end">';
178
+ $html .= esc_html__( 'End Date', $this->text_domain );
179
+ $html .= '&nbsp;(recommended)</label></td><td>';
180
+ $html .= '<input type="date" name="option[' . "schema_event_date_end" . ']" id="schema_event_date" value="' . esc_attr( $args['schema_event_date_end'] ) . '">';
181
+ $html .= '<input type="time" name="option[' . "schema_event_time_end" . ']" id="schema_event_time" value="' . esc_attr( $args['schema_event_time_end'] ) . '">';
182
+ $html .= '</td></tr>';
183
+ $html .= '<tr><td><label for="schema_event_url">';
184
+ $html .= esc_html__( 'Event URL', $this->text_domain );
185
+ $html .= '&nbsp;(required)</label></td><td>';
186
+ $html .= '<input type="text" name="option[' . "schema_event_url" . ']" id="schema_event_url" class="regular-text" required value="' . esc_attr( $args['schema_event_url'] ) . '">';
187
+ $html .= '</td></tr>';
188
+ $html .= '<tr><td><label for="schema_event_place_name">';
189
+ $html .= esc_html__( 'Place Name', $this->text_domain );
190
+ $html .= '&nbsp;(required)</label></td><td>';
191
+ $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'] ) . '">';
192
+ $html .= '</td></tr>';
193
+ $html .= '<tr><td><label for="schema_event_place_url">';
194
+ $html .= esc_html__( 'Place URL', $this->text_domain );
195
+ $html .= '&nbsp;(required)</label></td><td>';
196
+ $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'] ) . '">';
197
+ $html .= '</td></tr>';
198
+ $html .= '<tr><td><label for="schema_event_place_address">';
199
+ $html .= esc_html__( 'Place Address', $this->text_domain );
200
+ $html .= '&nbsp;(required)</label></td><td>';
201
+ $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'] ) . '">';
202
+ $html .= '</td></tr>';
203
+ $html .= '<tr><td><label for="schema_event_offers_price">';
204
+ $html .= esc_html__( 'Price', $this->text_domain );
205
+ $html .= '&nbsp;(required)</label></td><td>';
206
+ $html .= '<input type="number" name="option[' . "schema_event_offers_price" . ']" id="schema_event_offers_price" required value="' . esc_attr( $args['schema_event_offers_price'] ) . '">';
207
+ $html .= '</td></tr>';
208
+ $html .= '<tr><td><label for="schema_event_offers_currency">';
209
+ $html .= esc_html__( 'Currency', $this->text_domain );
210
+ $html .= '&nbsp;(required)</label></td><td>';
211
+ $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'] ) . '">';
212
+ $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>';
213
+ $html .= '</td></tr>';
214
+ $html .= '</table>';
215
+
216
+ echo $html;
217
+ }
218
+
219
+ /**
220
+ * Save custom post.
221
+ *
222
+ * @version 2.1.0
223
+ * @since 2.1.0
224
+ * @param integer $post_id The post ID.
225
+ */
226
+ public function save_post ( $post_id ) {
227
+ if ( isset( $_POST['option'] ) ) {
228
+ update_post_meta( $post_id, $this->custom_type, serialize( $_POST['option'] ) );
229
+ }
230
+ }
231
+
232
+ /**
233
+ * Return the default options array
234
+ *
235
+ * @version 3.2.3
236
+ * @since 3.2.3
237
+ * @return array $args
238
+ */
239
+ private function get_default_options () {
240
+ $args = array(
241
+ 'schema_event_type' => 'Event',
242
+ 'schema_event_name' => '',
243
+ 'schema_event_description' => '',
244
+ 'schema_event_image' => '',
245
+ 'schema_event_date' => date( 'Y-m-d' ),
246
+ 'schema_event_time' => date( 'h:i' ),
247
+ 'schema_event_date_end' => '',
248
+ 'schema_event_time_end' => '',
249
+ 'schema_event_url' => '',
250
+ 'schema_event_place_name' => '',
251
+ 'schema_event_place_url' => '',
252
+ 'schema_event_place_address' => '',
253
+ 'schema_event_offers_price' => 0,
254
+ 'schema_event_offers_currency' => esc_html__( 'USD', $this->text_domain )
255
+ );
256
+
257
+ return (array) $args;
258
+ }
259
+ }
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 3.2.3
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 3.2.3
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>';
115
+ $html .= '<tr><td><label for="schema_video_name">';
116
+ $html .= esc_html__( 'Video Name', $this->text_domain );
117
+ $html .= '&nbsp;(required)</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 for="schema_video_description">';
121
+ $html .= esc_html__( 'Video Description', $this->text_domain );
122
+ $html .= '&nbsp;(required)</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 for="schema_video_thumbnail_url">';
126
+ $html .= esc_html__( 'Thumbnail Url', $this->text_domain );
127
+ $html .= '&nbsp;(required)</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 for="schema_video_upload_date">';
131
+ $html .= esc_html__( 'Upload Date', $this->text_domain );
132
+ $html .= '&nbsp;(required)</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 for="schema_video_duration">';
137
+ $html .= esc_html__( 'duration', $this->text_domain );
138
+ $html .= '&nbsp;(recommended)</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 for="schema_video_content_url">';
142
+ $html .= esc_html__( 'contentURL', $this->text_domain );
143
+ $html .= '&nbsp;(recommended)</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 for="schema_video_embed_url">';
147
+ $html .= esc_html__( 'embedURL', $this->text_domain );
148
+ $html .= '&nbsp;(recommended)</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 for="schema_video_interaction_count">';
152
+ $html .= esc_html__( 'interactionCount', $this->text_domain );
153
+ $html .= '&nbsp;(recommended)</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 for="schema_video_expires_date">';
157
+ $html .= esc_html__( 'expires', $this->text_domain );
158
+ $html .= '&nbsp;(recommended)</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,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Article
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.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.0.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
+ }
75
+
76
+ $options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
77
+
78
+ if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
79
+ $publisher_args = array(
80
+ "publisher" => array(
81
+ "@type" => "Organization",
82
+ "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
83
+ "logo" => array(
84
+ "@type" => "ImageObject",
85
+ "url" => $options['logo'],
86
+ "width" => $logo['width'],
87
+ "height" => $logo['height']
88
+ )
89
+ )
90
+ );
91
+ $args = array_merge( $args, $publisher_args );
92
+ } else if ( !empty( $options['logo'] ) ) {
93
+ $publisher_args = array(
94
+ "publisher" => array(
95
+ "@type" => "Organization",
96
+ "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
97
+ "logo" => array(
98
+ "@type" => "ImageObject",
99
+ "url" => $options['logo'],
100
+ "width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
101
+ "height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
102
+ )
103
+ )
104
+ );
105
+ $args = array_merge( $args, $publisher_args );
106
+ }
107
+
108
+ return (array) $args;
109
+ }
110
+ }
trunk/includes/meta/wp-structuring-meta-blog-posting.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type BlogPosting
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.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.0.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
+ }
76
+
77
+ $options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
78
+ if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
79
+ $publisher_args = array(
80
+ "publisher" => array(
81
+ "@type" => "Organization",
82
+ "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
83
+ "logo" => array(
84
+ "@type" => "ImageObject",
85
+ "url" => $options['logo'],
86
+ "width" => $logo['width'],
87
+ "height" => $logo['height']
88
+ )
89
+ )
90
+ );
91
+ $args = array_merge( $args, $publisher_args );
92
+ } else if ( !empty( $options['logo'] ) ) {
93
+ $publisher_args = array(
94
+ "publisher" => array(
95
+ "@type" => "Organization",
96
+ "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
97
+ "logo" => array(
98
+ "@type" => "ImageObject",
99
+ "url" => $options['logo'],
100
+ "width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
101
+ "height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
102
+ )
103
+ )
104
+ );
105
+ $args = array_merge( $args, $publisher_args );
106
+ }
107
+
108
+ return (array) $args;
109
+ }
110
+ }
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,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Event
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.0
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.0
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
+ /* required items */
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
+ "offers" => array(
54
+ "@type" => "Offer",
55
+ "price" => esc_html( $meta['schema_event_offers_price'] ),
56
+ "priceCurrency" => esc_html( $meta['schema_event_offers_currency'] ),
57
+ "url" => esc_url( $meta['schema_event_url'] )
58
+ )
59
+ );
60
+
61
+ /* recommended items */
62
+ if ( isset( $meta['schema_event_description'] ) && $meta['schema_event_description'] !== '' ) {
63
+ $args['description'] = esc_html( $meta['schema_event_description'] );
64
+ }
65
+ if ( isset( $meta['schema_event_image'] ) && $meta['schema_event_image'] !== '' ) {
66
+ $args['image'] = esc_html( $meta['schema_event_image'] );
67
+ }
68
+ if ( isset( $meta['schema_event_date_end'] ) && $meta['schema_event_date_end'] !== '' && isset( $meta['schema_event_time_end'] ) && $meta['schema_event_time_end'] !== '' ) {
69
+ $args['endDate'] = esc_html( $meta['schema_event_date_end'] ) . 'T' . esc_html( $meta['schema_event_time_end'] );
70
+ }
71
+
72
+ return (array) $args;
73
+ }
74
+ }
75
+ }
trunk/includes/meta/wp-structuring-meta-local-business.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type LocalBusiness
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.0
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.0.0
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
+ "telephone" => isset( $options['telephone'] ) ? esc_html( $options['telephone'] ) : ""
43
+ );
44
+
45
+ if ( isset( $options['food_active'] ) && $options['food_active'] === 'on' ) {
46
+ if ( isset( $options['menu'] ) && $options['menu'] !== '' ) {
47
+ $args['menu'] = esc_url( $options['menu'] );
48
+ }
49
+ if ( isset( $options['accepts_reservations'] ) && $options['accepts_reservations'] === 'on' ) {
50
+ $args['acceptsReservations'] = "True";
51
+ } else {
52
+ $args['acceptsReservations'] = "False";
53
+ }
54
+ if ( isset( $options['serves_cuisine'] ) && $options['serves_cuisine'] !== '' ) {
55
+ $args['servesCuisine'] = esc_html( $options['serves_cuisine'] );
56
+ }
57
+ }
58
+
59
+ $address_array["address"] = array(
60
+ "@type" => "PostalAddress",
61
+ "streetAddress" => isset( $options['street_address'] ) ? esc_html( $options['street_address'] ) : "",
62
+ "addressLocality" => isset( $options['address_locality'] ) ? esc_html( $options['address_locality'] ) : "",
63
+ "addressRegion" => isset( $options['address_region'] ) ? esc_html( $options['address_region'] ) : "",
64
+ "postalCode" => isset( $options['postal_code'] ) ? esc_html( $options['postal_code'] ) : "",
65
+ "addressCountry" => isset( $options['address_country'] ) ? esc_html( $options['address_country'] ) : ""
66
+ );
67
+ $args = array_merge( $args, $address_array );
68
+ $geo_array = array();
69
+
70
+ if ( isset( $options['geo_active'] ) && $options['geo_active'] === 'on' ) {
71
+ $geo_array["geo"] = array(
72
+ "@type" => "GeoCoordinates",
73
+ "latitude" => isset( $options['latitude'] ) ? esc_html(floatval($options['latitude'])) : "",
74
+ "longitude" => isset( $options['longitude'] ) ? esc_html(floatval($options['longitude'])) : ""
75
+ );
76
+ }
77
+
78
+ if ( isset( $options['geo_circle_active'] ) && $options['geo_circle_active'] === 'on' ) {
79
+ $place_array["location"] = array( "@type" => "Place" );
80
+ $place_array["location"]["geo"] = array(
81
+ "@type" => "GeoCircle",
82
+ "geoRadius" => isset( $options['geo_circle_radius'] ) ? esc_html( floatval( $options['geo_circle_radius'] ) ) : ""
83
+ );
84
+ if ( isset( $options['geo_active'] ) && $options['geo_active'] === 'on' ) {
85
+ $place_array["location"]["geo"]["geoMidpoint"] = $geo_array["geo"];
86
+ }
87
+ $args = array_merge( $args, $place_array );
88
+ } else {
89
+ if ( isset( $options['geo_active'] ) && $options['geo_active'] === 'on' ) {
90
+ $args = array_merge( $args, $geo_array );
91
+ }
92
+ }
93
+
94
+ /* openingHours */
95
+ $active_days = array();
96
+ foreach ( $week_array as $value ) {
97
+ if ( isset( $options[$value['type']] ) && $options[$value['type']] === 'on' ) {
98
+ $active_days[$value['type']] = $options['week'][$value['type']];
99
+ }
100
+ }
101
+
102
+ if( !empty( $active_days ) ) {
103
+
104
+ $obj = new Structuring_Markup_Opening_Hours( $active_days );
105
+ $opening_hours = $obj->display();
106
+
107
+ $opening_array["openingHours"] = array();
108
+
109
+ foreach( $opening_hours as $value ) {
110
+ $opening_array["openingHours"][] = $value;
111
+ }
112
+
113
+ $args = array_merge( $args, $opening_array );
114
+
115
+ }
116
+
117
+ if ( isset( $options['holiday_active'] ) && $options['holiday_active'] === 'on' ) {
118
+ $holiday_array["openingHoursSpecification"] = array(
119
+ "@type" => "OpeningHoursSpecification",
120
+ "opens" => isset( $options['holiday_open'] ) ? esc_html( $options['holiday_open'] ) : "",
121
+ "closes" => isset( $options['holiday_close'] ) ? esc_html( $options['holiday_close'] ) : "",
122
+ "validFrom" => isset( $options['holiday_valid_from'] ) ? esc_html( $options['holiday_valid_from'] ) : "",
123
+ "validThrough" => isset( $options['holiday_valid_through'] ) ? esc_html( $options['holiday_valid_through'] ) : ""
124
+ );
125
+ $args = array_merge( $args, $holiday_array );
126
+ }
127
+
128
+ if ( isset( $options['price_range'] ) && $options['price_range'] !== '' ) {
129
+ $price_array["priceRange"] = $options['price_range'];
130
+ $args = array_merge( $args, $price_array );
131
+ }
132
+
133
+ return (array) $args;
134
+ }
135
+
136
+ }
trunk/includes/meta/wp-structuring-meta-news-article.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type News Article
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.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.0.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
+ }
76
+
77
+ $options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
78
+ if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
79
+ $publisher_args = array(
80
+ "publisher" => array(
81
+ "@type" => "Organization",
82
+ "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
83
+ "logo" => array(
84
+ "@type" => "ImageObject",
85
+ "url" => $options['logo'],
86
+ "width" => $logo['width'],
87
+ "height" => $logo['height']
88
+ )
89
+ )
90
+ );
91
+ $args = array_merge( $args, $publisher_args );
92
+ } else if ( !empty( $options['logo'] ) ) {
93
+ $publisher_args = array(
94
+ "publisher" => array(
95
+ "@type" => "Organization",
96
+ "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
97
+ "logo" => array(
98
+ "@type" => "ImageObject",
99
+ "url" => $options['logo'],
100
+ "width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
101
+ "height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
102
+ )
103
+ )
104
+ );
105
+ $args = array_merge( $args, $publisher_args );
106
+ }
107
+
108
+ return (array) $args;
109
+ }
110
+ }
trunk/includes/meta/wp-structuring-meta-organization.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Organization
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.0
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.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" => "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
+ $contact_point_data['areaServed'][] = isset( $options['area_served'] ) ? esc_html( $options['area_served'] ) : "";
44
+ }
45
+ if ( isset( $options['contact_point_1'] ) && $options['contact_point_1'] === 'on' ) {
46
+ $contact_point_data['contactOption'][] = 'HearingImpairedSupported';
47
+ }
48
+ if ( isset( $options['contact_point_2'] ) && $options['contact_point_2'] === 'on' ) {
49
+ $contact_point_data['contactOption'][] = 'TollFree';
50
+ }
51
+ if ( !empty( $options['available_language'] ) ) {
52
+ $contact_point_data['availableLanguage'][] = isset( $options['available_language'] ) ? esc_html( $options['available_language'] ) : "";
53
+ }
54
+
55
+ $contact_point["contactPoint"] = array( $contact_point_data );
56
+ $args = array_merge( $args, $contact_point );
57
+ }
58
+
59
+ /** Social Profiles */
60
+ if ( isset( $options['social'] ) ) {
61
+ $socials["sameAs"] = array();
62
+
63
+ foreach ( $options['social'] as $value ) {
64
+ if ( $value ) {
65
+ $socials["sameAs"][] = esc_url( $value );
66
+ }
67
+ }
68
+ if ( count( $socials["sameAs"] ) > 0 ) {
69
+ $args = array_merge( $args, $socials );
70
+ }
71
+ }
72
+ return (array) $args;
73
+ }
74
+ }
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-admin-db.php ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Admin DB Connection.
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.1.0
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 3.1.0
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 3.1.0
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
+ $args = array(
105
+ 'type' => $key,
106
+ 'activate' => $activate,
107
+ 'output' => $list->output,
108
+ 'options' => $list->options,
109
+ 'register_date' => date( "Y-m-d H:i:s" ),
110
+ 'update_date' => date( "Y-m-d H:i:s" )
111
+ );
112
+ }
113
+ }
114
+ $this->insert_options( $args );
115
+ }
116
+ }
117
+ }
118
+ }
119
+
120
+ /**
121
+ * Create table execute
122
+ *
123
+ * @version 2.1.1
124
+ * @since 2.0.0
125
+ * @param string $charset_collate
126
+ * @param string $text_domain
127
+ * @param string $version
128
+ */
129
+ private function create_table_execute ( $charset_collate, $text_domain, $version ) {
130
+ $query = " CREATE TABLE " . $this->table_name;
131
+ $query .= " (id MEDIUMINT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY";
132
+ $query .= ",type TINYTEXT NOT NULL";
133
+ $query .= ",activate TINYTEXT NOT NULL";
134
+ $query .= ",output TEXT NOT NULL";
135
+ $query .= ",options TEXT NOT NULL";
136
+ $query .= ",register_date DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL";
137
+ $query .= ",update_date DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL";
138
+ $query .= ",UNIQUE KEY id (id)) " . $charset_collate;
139
+
140
+ dbDelta( $query );
141
+
142
+ $options = array( 'version' => $version );
143
+ update_option( $text_domain, $options, 'yes' );
144
+ }
145
+
146
+ /**
147
+ * Get Data.
148
+ *
149
+ * @version 2.1.0
150
+ * @since 1.0.0
151
+ * @param integer $id
152
+ * @return array $results
153
+ */
154
+ public function get_options ( $id ) {
155
+ global $wpdb;
156
+
157
+ $query = "SELECT * FROM " . $this->table_name . " WHERE id = %d";
158
+ $data = array( esc_html( $id ) );
159
+ $prepared = $wpdb->prepare( $query, $data );
160
+ $args = $wpdb->get_row( $prepared );
161
+ $results = array();
162
+
163
+ if ( $args ) {
164
+ $results['id'] = $args->id;
165
+ $results['activate'] = isset( $args->activate ) ? $args->activate : "";
166
+ $results['type'] = $args->type;
167
+ $results['output'] = unserialize( $args->output );
168
+ $results['option'] = unserialize( $args->options );
169
+ }
170
+ return (array) $results;
171
+ }
172
+
173
+ /**
174
+ * Get All Data.
175
+ *
176
+ * @since 1.0.0
177
+ * @return array $results
178
+ */
179
+ public function get_list_options () {
180
+ global $wpdb;
181
+
182
+ $query = "SELECT * FROM " . $this->table_name . " ORDER BY type ASC";
183
+
184
+ return (array) $wpdb->get_results( $query );
185
+ }
186
+
187
+ /**
188
+ * Get Type Data.
189
+ *
190
+ * @version 2.1.0
191
+ * @since 2.0.0
192
+ * @param string $type
193
+ * @return array $results
194
+ */
195
+ public function get_type_options ( $type ) {
196
+ global $wpdb;
197
+
198
+ $query = "SELECT * FROM " . $this->table_name . " WHERE type = %s";
199
+ $data = array( esc_html( $type ) );
200
+ $prepared = $wpdb->prepare( $query, $data );
201
+ $args = $wpdb->get_row( $prepared );
202
+ $results = array();
203
+
204
+ if ( $args ) {
205
+ $results['id'] = $args->id;
206
+ $results['activate'] = isset( $args->activate ) ? $args->activate : "";
207
+ $results['type'] = $args->type;
208
+ $results['output'] = unserialize( $args->output );
209
+ $results['option'] = unserialize( $args->options );
210
+ }
211
+ return (array) $results;
212
+ }
213
+
214
+ /**
215
+ * Insert Data.
216
+ *
217
+ * @version 2.0.0
218
+ * @since 1.0.0
219
+ * @param array $args
220
+ */
221
+ private function insert_options ( array $args ) {
222
+ global $wpdb;
223
+
224
+ $prepared = array( '%s', '%s', '%s', '%s', '%s', '%s' );
225
+ $wpdb->insert( $this->table_name, $args, $prepared );
226
+ }
227
+
228
+ /**
229
+ * Update Data.
230
+ *
231
+ * @version 2.0.0
232
+ * @since 1.0.0
233
+ * @param array $post($_POST)
234
+ * @return integer $post['id']
235
+ */
236
+ public function update_options ( array $post ) {
237
+ global $wpdb;
238
+
239
+ $data = array(
240
+ 'type' => $post['type'],
241
+ 'activate' => isset( $post['activate'] ) ? $post['activate'] : "",
242
+ 'output' => serialize( $post['output'] ),
243
+ 'options' => isset( $post['option'] ) ? serialize( $post['option'] ) : "",
244
+ 'update_date' => date( "Y-m-d H:i:s" )
245
+ );
246
+ $key = array( 'id' => esc_html( $post['id'] ) );
247
+ $prepared = array( '%s', '%s', '%s', '%s', '%s' );
248
+ $key_prepared = array( '%d' );
249
+
250
+ $wpdb->update( $this->table_name, $data, $key, $prepared, $key_prepared );
251
+
252
+ return (integer) $post['id'];
253
+ }
254
+ }
trunk/includes/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 3.2.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 3.2.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-status">' . esc_html__( 'Status', $this->text_domain ) . '</th>';
51
+ $html .= '<th scope="row" class="schema-admin-table-list-type">' . esc_html__( 'Schema.org Type', $this->text_domain ) . '</th>';
52
+ $html .= '<th scope="row" class="schema-admin-table-list-output">' . esc_html__( 'Output On', $this->text_domain ) . '</th>';
53
+ $html .= '<th scope="row">&nbsp;</th>';
54
+ $html .= '</tr>';
55
+ echo $html;
56
+
57
+ $db = new Structuring_Markup_Admin_Db();
58
+ $results = $db->get_list_options();
59
+ $type_array = $db->type_array;
60
+
61
+ if ( $results ) {
62
+ foreach ( $results as $row ) {
63
+ if ( $row->activate === 'on' ) {
64
+ $html = '<tr class="active"><td><span class="active">Enabled';
65
+ } else {
66
+ $html = '<tr class="stop"><td><span class="stop">Disabled';
67
+ }
68
+ $html .= '</span></td>';
69
+ $html .= '<td><a href="';
70
+ $html .= admin_url( $post_url . '&type=' . esc_html( $row->type ) . '&schema_post_id=' . esc_html( $row->id ) ) . '">' . $type_array[esc_html( $row->type )];
71
+ $html .= '</a></td>';
72
+ $html .= '<td>' . $this->unserialize_output( $row->output ) . '</td>';
73
+ $html .= '<td><a href="';
74
+ $html .= admin_url( $post_url . '&type=' . esc_html( $row->type ) . '&schema_post_id=' . esc_html( $row->id ) ) . '">' . esc_html__( 'Edit', $this->text_domain );
75
+ $html .= '</a></td>';
76
+ $html .= '</tr>';
77
+ echo $html;
78
+ }
79
+ } else {
80
+ echo '<td colspan="5">' . 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/wp-structuring-admin-post.php ADDED
@@ -0,0 +1,365 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Admin Post
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.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 3.0.2
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
+ foreach ( $post_types as $post_type ) {
58
+ $this->post_args[] = array(
59
+ 'label' => esc_html( $post_type->label ),
60
+ 'value' => esc_html( $post_type->name )
61
+ );
62
+ }
63
+ $this->text_domain = $text_domain;
64
+ $this->nonce_name = "_wpnonce_" . $text_domain;
65
+ $this->nonce_action = "edit-" . $text_domain;
66
+
67
+ /**
68
+ * Update Status
69
+ *
70
+ * "ok" : Successful update
71
+ * "output" : Output No Check
72
+ */
73
+ $status = "";
74
+
75
+ /** DB Connect */
76
+ $db = new Structuring_Markup_Admin_Db();
77
+ $this->type_array = $db->type_array;
78
+
79
+ /** Set Default Parameter for Array */
80
+ $options = array(
81
+ "id" => "",
82
+ "type" => "",
83
+ "activate" => "",
84
+ "output" => array(),
85
+ "option" => array()
86
+ );
87
+
88
+ /** DataBase Update & Insert Mode */
89
+ if ( ! empty( $_POST ) && check_admin_referer( $this->nonce_action, $this->nonce_name ) ) {
90
+ if ( isset( $_POST['id'] ) && is_numeric( $_POST['id'] ) ) {
91
+ if ( isset( $_POST['output'] ) ) {
92
+ $options['id'] = $db->update_options( $_POST );
93
+ $status = "ok";
94
+ } else {
95
+ $status = "output";
96
+ }
97
+ }
98
+ }
99
+
100
+ /** Key Set */
101
+ if ( isset( $_GET['schema_post_id'] ) && is_numeric( $_GET['schema_post_id'] ) ) {
102
+ $options['id'] = esc_html( $_GET['schema_post_id'] );
103
+ }
104
+
105
+ /** Type Set */
106
+ if ( isset( $_GET['type'] ) && array_key_exists( $_GET['type'], $this->type_array) ) {
107
+ $options['type'] = esc_html( $_GET['type'] );
108
+ }
109
+
110
+ $options = $db->get_options( $options['id'] );
111
+ if ( $options['option'] === false ) {
112
+ $options['option'] = array();
113
+ }
114
+
115
+ $this->page_render( $options, $status );
116
+ }
117
+
118
+ /**
119
+ * Setting Page of the Admin Screen.
120
+ *
121
+ * @version 3.1.2
122
+ * @since 1.0.0
123
+ * @param array $options
124
+ * @param string $status
125
+ */
126
+ private function page_render ( array $options, $status ) {
127
+ $html = '';
128
+ $html .= '<div class="wrap">';
129
+ $html .= '<h1>' . esc_html__( 'Schema.org Register', $this->text_domain );
130
+ $html .= '<span class="schema-admin-h1-span">[ Schema Type : ' . esc_html( $this->type_array[$options['type']] ) . ' ]</span>';
131
+ $html .= '</h1>';
132
+ switch ( $status ) {
133
+ case "ok":
134
+ $html .= $this->information_render();
135
+ break;
136
+ case "output":
137
+ $html .= $this->output_error_render();
138
+ break;
139
+ default:
140
+ break;
141
+ }
142
+ echo $html;
143
+
144
+ /** Output Page Select */
145
+ $html = '<hr>';
146
+ $html .= '<p class="schema-admin-require">';
147
+ $html .= esc_html__( 'Please note that all fields followed by an asterisk must be filled in.', $this->text_domain );
148
+ $html .= '</p>';
149
+ $html .= '<form method="post" action="">';
150
+ echo $html;
151
+
152
+ wp_nonce_field( $this->nonce_action, $this->nonce_name );
153
+
154
+ $html = '<input type="hidden" name="id" value="' . esc_attr( $options['id'] ) . '">';
155
+ $html .= '<input type="hidden" name="type" value="' . esc_attr( $options['type'] ) . '">';
156
+ $html .= '<table class="schema-admin-table">';
157
+ $html .= '<tr><th class="require">Enabled : </th><td>';
158
+ $html .= '<input type="checkbox" name="activate" value="on"';
159
+ $html .= ( isset( $options['activate'] ) && $options['activate'] === "on" ) ? ' checked' : '';
160
+ $html .= '></td></tr>';
161
+ $html .= '<tr><th class="require">' . esc_html__( 'Output On', $this->text_domain ) . ' : </th><td>';
162
+ echo $html;
163
+
164
+ switch ( $options['type'] ) {
165
+ case 'article':
166
+ $html = $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
167
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
168
+ $html .= '</td></tr>';
169
+ $html .= $this->output_custom_posts_render( $options['output'] );
170
+ $html .= '</table><hr>';
171
+ echo $html;
172
+
173
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-article.php' );
174
+ new Structuring_Markup_Type_Article( $options['option'] );
175
+ break;
176
+ case 'blog_posting':
177
+ $html = $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
178
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
179
+ $html .= '</td></tr>';
180
+ $html .= $this->output_custom_posts_render( $options['output'] );
181
+ $html .= '</table><hr>';
182
+ echo $html;
183
+
184
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-blog-posting.php' );
185
+ new Structuring_Markup_Type_Blog_Posting( $options['option'] );
186
+ break;
187
+ case 'breadcrumb':
188
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
189
+ $html .= '</td></tr></table><hr>';
190
+ echo $html;
191
+
192
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-breadcrumb.php' );
193
+ new Structuring_Markup_Type_Breadcrumb( $options['option'] );
194
+ break;
195
+ case 'event':
196
+ $html = $this->output_checkbox_render( $options['output'], "event", esc_html__( 'Event Post Page', $this->text_domain ) );
197
+ $html .= '</td></tr></table><hr>';
198
+ echo $html;
199
+
200
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-event.php' );
201
+ new Structuring_Markup_Type_Event();
202
+ break;
203
+ case 'local_business':
204
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
205
+ $html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
206
+ $html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
207
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
208
+ $html .= '</td></tr>';
209
+ $html .= $this->output_custom_posts_render( $options['output'] );
210
+ $html .= '</table><hr>';
211
+
212
+ echo $html;
213
+
214
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-local-business.php' );
215
+ new Structuring_Markup_Type_LocalBusiness( $options['option'] );
216
+ break;
217
+ case 'news_article':
218
+ $html = $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
219
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
220
+ $html .= '</td></tr>';
221
+ $html .= $this->output_custom_posts_render( $options['output'] );
222
+ $html .= '</table><hr>';
223
+
224
+ echo $html;
225
+
226
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-news-article.php' );
227
+ new Structuring_Markup_Type_NewsArticle( $options['option'] );
228
+ break;
229
+ case 'organization':
230
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
231
+ $html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
232
+ $html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
233
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
234
+ $html .= '</td></tr>';
235
+ $html .= $this->output_custom_posts_render( $options['output'] );
236
+ $html .= '</table><hr>';
237
+
238
+ echo $html;
239
+
240
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-organization.php' );
241
+ new Structuring_Markup_Type_Organization( $options['option'] );
242
+ break;
243
+ case 'person':
244
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
245
+ $html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
246
+ $html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
247
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
248
+ $html .= '</td></tr>';
249
+ $html .= $this->output_custom_posts_render( $options['output'] );
250
+ $html .= '</table><hr>';
251
+
252
+ echo $html;
253
+
254
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-person.php' );
255
+ new Structuring_Markup_Type_Person( $options['option'] );
256
+ break;
257
+ case 'site_navigation':
258
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
259
+ $html .= '</td></tr></table><hr>';
260
+ echo $html;
261
+
262
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-site-navigation.php' );
263
+ new Structuring_Markup_Type_Site_Navigation( $options['option'] );
264
+ break;
265
+ case 'video':
266
+ $html = $this->output_checkbox_render( $options['output'], "video", esc_html__( 'Video Post Page', $this->text_domain ) );
267
+ $html .= '</td></tr></table><hr>';
268
+ echo $html;
269
+
270
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-video.php' );
271
+ new Structuring_Markup_Type_Videos();
272
+ break;
273
+ case 'website':
274
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
275
+ $html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
276
+ $html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
277
+ $html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
278
+ $html .= '</td></tr>';
279
+ $html .= $this->output_custom_posts_render( $options['output'] );
280
+ $html .= '</table><hr>';
281
+
282
+ echo $html;
283
+
284
+ require_once( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-website.php' );
285
+ new Structuring_Markup_Type_Website( $options['option'] );
286
+ break;
287
+ }
288
+
289
+ $html = '</form>';
290
+ $html .= '</div>';
291
+ echo $html;
292
+ }
293
+
294
+ /**
295
+ * CheckBox Build Render
296
+ *
297
+ * @version 2.5.0
298
+ * @since 1.0.0
299
+ * @param array $option['output']
300
+ * @param string $output
301
+ * @param string $value
302
+ * @return string $html
303
+ */
304
+ private function output_checkbox_render ( array $option, $output, $value ) {
305
+ $html = '<label>';
306
+ $html .= '<input type="checkbox" name="output[' . $output . ']" value="' . $value . '""';
307
+ $html .= isset( $option[$output] ) ? ' checked' : '';
308
+ $html .= '>' . $value . '</label>';
309
+
310
+ return (string) $html;
311
+ }
312
+
313
+ /**
314
+ * Custom Posts Build Render
315
+ *
316
+ * @version 2.5.0
317
+ * @since 2.5.0
318
+ * @param array $option['output']
319
+ * @return string $html
320
+ */
321
+ private function output_custom_posts_render ( array $option ) {
322
+ $html = '<tr><th>' . esc_html__( 'Output On(Custom Posts)', $this->text_domain ) . ' : </th><td>';
323
+ foreach ( $this->post_args as $post_type ) {
324
+ $html .= $this->output_checkbox_render( $option, $post_type['value'], $post_type['label'] );
325
+ }
326
+ $html .= '</td></tr>';
327
+ return (string) $html;
328
+ }
329
+
330
+ /**
331
+ * Information Message Render
332
+ *
333
+ * @version 2.0.0
334
+ * @since 1.0.0
335
+ * @return string $html
336
+ */
337
+ private function information_render () {
338
+ $html = '<div id="message" class="updated notice notice-success is-dismissible below-h2">';
339
+ $html .= '<p>Schema.org Information Update.</p>';
340
+ $html .= '<button type="button" class="notice-dismiss">';
341
+ $html .= '<span class="screen-reader-text">Dismiss this notice.</span>';
342
+ $html .= '</button>';
343
+ $html .= '</div>';
344
+
345
+ return (string) $html;
346
+ }
347
+
348
+ /**
349
+ * Error Message Render
350
+ *
351
+ * @version 2.0.0
352
+ * @since 1.0.0
353
+ * @return string $html
354
+ */
355
+ private function output_error_render () {
356
+ $html = '<div id="notice" class="notice notice-error is-dismissible below-h2">';
357
+ $html .= '<p>Output No Select.</p>';
358
+ $html .= '<button type="button" class="notice-dismiss">';
359
+ $html .= '<span class="screen-reader-text">Dismiss this notice.</span>';
360
+ $html .= '</button>';
361
+ $html .= '</div>';
362
+
363
+ return (string) $html;
364
+ }
365
+ }
trunk/includes/wp-structuring-admin-type-article.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Article
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.2.2
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 3.2.2
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 .= '</table>';
63
+ echo $html;
64
+
65
+ $html = '<table class="schema-admin-table">';
66
+ $html .= '<caption>author</caption>';
67
+ $html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
68
+ $html .= '<tr><th>name :</th><td><small>Default : get_the_author_meta( "display_name", author )</small>';
69
+ $html .= '</td></tr>';
70
+ $html .= '</table>';
71
+ echo $html;
72
+
73
+ $html = '<table class="schema-admin-table">';
74
+ $html .= '<caption>publisher</caption>';
75
+ $html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
76
+ $html .= '<tr><th><label for="name">Organization Name :</label></th><td>';
77
+ $html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" value="' . esc_attr( $option['name'] ) . '">';
78
+ $html .= '<small>Default : bloginfo("name")</small>';
79
+ $html .= '</td></tr>';
80
+ $html .= '</table>';
81
+ echo $html;
82
+
83
+ $html = '<table class="schema-admin-table">';
84
+ $html .= '<caption>publisher.logo</caption>';
85
+ $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
86
+ $html .= '<tr><th><label for="logo">url :</label></th><td>';
87
+ $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
88
+ $html .= '<button id="media-upload" class="schema-admin-media-button dashicons-before dashicons-admin-media"><span>Add Media</span></button>';
89
+ $html .= '</td></tr>';
90
+ $html .= '<tr><th><label for="logo-width">width :</label></th><td>';
91
+ $html .= '<input type="number" name="option[' . "logo-width" . ']" id="logo-width" min="0" value="' . esc_attr( $option['logo-width'] ) . '">px';
92
+ $html .= '<small>height <= 600px.</small>';
93
+ $html .= '</td></tr>';
94
+ $html .= '<tr><th><label for="logo-height">height :</label></th><td>';
95
+ $html .= '<input type="number" name="option[' . "logo-height" . ']" id="logo-height" min="0" value="' . esc_attr( $option['logo-height'] ) . '">px';
96
+ $html .= '<small>height <= 60px.</small>';
97
+ $html .= '</td></tr>';
98
+ $html .= '</table>';
99
+ echo $html;
100
+
101
+ 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>';
102
+ submit_button();
103
+ }
104
+
105
+ /**
106
+ * Return the default options array
107
+ *
108
+ * @since 3.2.2
109
+ * @version 2.2.0
110
+ * @return array $args
111
+ */
112
+ private function get_default_options () {
113
+ $args['name'] = get_bloginfo('name');
114
+ $args['logo'] = "";
115
+ $args['logo-height'] = 0;
116
+ $args['logo-width'] = 0;
117
+
118
+ return (array) $args;
119
+ }
120
+ }
trunk/includes/wp-structuring-admin-type-blog-posting.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type BlogPosting
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.2.2
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 3.2.2
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 .= '</table>';
63
+ echo $html;
64
+
65
+ $html = '<table class="schema-admin-table">';
66
+ $html .= '<caption>author</caption>';
67
+ $html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
68
+ $html .= '<tr><th>name :</th><td><small>Default : get_the_author_meta( "display_name", author )</small>';
69
+ $html .= '</td></tr>';
70
+ $html .= '</table>';
71
+ echo $html;
72
+
73
+ $html = '<table class="schema-admin-table">';
74
+ $html .= '<caption>publisher</caption>';
75
+ $html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
76
+ $html .= '<tr><th><label for="name">Organization Name :</label></th><td>';
77
+ $html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" value="' . esc_attr( $option['name'] ) . '">';
78
+ $html .= '<small>Default : bloginfo("name")</small>';
79
+ $html .= '</td></tr>';
80
+ $html .= '</table>';
81
+ echo $html;
82
+
83
+ $html = '<table class="schema-admin-table">';
84
+ $html .= '<caption>publisher.logo</caption>';
85
+ $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
86
+ $html .= '<tr><th><label for="logo">url :</label></th><td>';
87
+ $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
88
+ $html .= '<button id="media-upload" class="schema-admin-media-button dashicons-before dashicons-admin-media"><span>Add Media</span></button>';
89
+ $html .= '</td></tr>';
90
+ $html .= '<tr><th><label for="logo-width">width :</label></th><td>';
91
+ $html .= '<input type="number" name="option[' . "logo-width" . ']" id="logo-width" min="0" value="' . esc_attr( $option['logo-width'] ) . '">px';
92
+ $html .= '<small>height <= 600px.</small>';
93
+ $html .= '</td></tr>';
94
+ $html .= '<tr><th><label for="logo-height">height :</label></th><td>';
95
+ $html .= '<input type="number" name="option[' . "logo-height" . ']" id="logo-height" min="0" value="' . esc_attr( $option['logo-height'] ) . '">px';
96
+ $html .= '<small>height <= 60px.</small>';
97
+ $html .= '</td></tr>';
98
+ $html .= '</table>';
99
+ echo $html;
100
+
101
+ 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>';
102
+ submit_button();
103
+ }
104
+
105
+ /**
106
+ * Return the default options array
107
+ *
108
+ * @version 3.2.2
109
+ * @since 2.2.0
110
+ * @return array $args
111
+ */
112
+ private function get_default_options () {
113
+ $args['name'] = get_bloginfo('name');
114
+ $args['logo'] = "";
115
+ $args['logo-height'] = 0;
116
+ $args['logo-width'] = 0;
117
+
118
+ return (array) $args;
119
+ }
120
+ }
trunk/includes/wp-structuring-admin-type-breadcrumb.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Breadcrumb
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.2.4
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
+ * @since 2.0.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.2.4
32
+ * @since 2.3.3
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><label for="home_on">Display Home Page :</label></th><td>';
39
+ $html .= '<input type="checkbox" name="option[' . "home_on" . ']" id="home_on" value="on"';
40
+ if ( isset( $option['home_on'] ) && $option['home_on'] === 'on' ) {
41
+ $html .= ' checked="checked"';
42
+ }
43
+ $html .= '>Enabled';
44
+ $html .= '<small>( Installed the HOME to breadcrumbs )</small>';
45
+ $html .= '</td></tr>';
46
+ $html .= '<tr><th><label for="home_name">Home Name :</label></th><td>';
47
+ $html .= '<input type="text" name="option[' . "home_name" . ']" id="home_name" class="regular-text" value="' . esc_attr( $option['home_name'] ) . '">';
48
+ $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>';
49
+ $html .= '</td></tr>';
50
+ $html .= '</table>';
51
+ echo $html;
52
+
53
+ $html = '<table class="schema-admin-table">';
54
+ $html .= '<caption>Short Code</caption>';
55
+ $html .= '<tr><th><label for="home_on">Short Code Copy :</label></th><td>';
56
+ $html .= '<input type="text" onfocus="this.select();" readonly="readonly" value="[wp-structuring-markup-breadcrumb]" class="large-text code">';
57
+ $html .= '<small>Option : id="id_name" and class="class_name" attribute additional ol element.</small>';
58
+ $html .= '</td></tr>';
59
+ $html .= '</table>';
60
+ echo $html;
61
+
62
+ 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>';
63
+ submit_button();
64
+ }
65
+
66
+ /**
67
+ * Return the default options array
68
+ *
69
+ * @version 2.0.2
70
+ * @since 2.0.0
71
+ * @param array $args
72
+ * @return array $args
73
+ */
74
+ private function get_default_options ( array $args ) {
75
+ $args['home_on'] = '';
76
+ $args['home_name'] = '';
77
+
78
+ return (array) $args;
79
+ }
80
+ }
trunk/includes/wp-structuring-admin-type-event.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Event
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.2.4
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 3.2.4
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_place_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_place_name"</small></td></tr>';
55
+ $html .= '<tr><th class="require">priceCurrency :</th><td><small>Input a custom post: field name "schema_event_place_address"</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 .= '</table>';
58
+ echo $html;
59
+
60
+ echo '<p>Custom post name "schema_event_post"</p>';
61
+ echo '<p>Archive rewrite name "events"</p>';
62
+ 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>';
63
+
64
+ submit_button();
65
+ }
66
+ }
trunk/includes/wp-structuring-admin-type-local-business.php ADDED
@@ -0,0 +1,523 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Organization
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.0.5
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
+ * @since 2.3.0
19
+ */
20
+ /** LocalBusiness Type defined. */
21
+ private $business_type_array = array(
22
+ array( "type" => "LocalBusiness", "display" => "LocalBusiness" ),
23
+
24
+ array( "type" => "AnimalShelter", "display" => "- AnimalShelter" ),
25
+
26
+ array( "type" => "AutomotiveBusiness", "display" => "- AutomotiveBusiness" ),
27
+ array( "type" => "AutoBodyShop", "display" => "-- AutoBodyShop" ),
28
+ array( "type" => "AutoDealer", "display" => "-- AutoDealer" ),
29
+ array( "type" => "AutoPartsStore", "display" => "-- AutoPartsStore" ),
30
+ array( "type" => "AutoRental", "display" => "-- AutoRental" ),
31
+ array( "type" => "AutoRepair", "display" => "-- AutoRepair" ),
32
+ array( "type" => "AutoWash", "display" => "-- AutoWash" ),
33
+ array( "type" => "GasStation", "display" => "-- GasStation" ),
34
+ array( "type" => "MotorcycleDealer", "display" => "-- MotorcycleDealer" ),
35
+ array( "type" => "MotorcycleRepair", "display" => "-- MotorcycleRepair" ),
36
+
37
+ array( "type" => "ChildCare", "display" => "- ChildCare" ),
38
+
39
+ array( "type" => "DryCleaningOrLaundry", "display" => "- DryCleaningOrLaundry" ),
40
+
41
+ array( "type" => "EmergencyService", "display" => "- EmergencyService" ),
42
+ array( "type" => "FireStation", "display" => "-- FireStation" ),
43
+ array( "type" => "Hospital", "display" => "-- Hospital" ),
44
+ array( "type" => "PoliceStation", "display" => "-- PoliceStation" ),
45
+
46
+ array( "type" => "EmploymentAgency", "display" => "- EmploymentAgency" ),
47
+
48
+ array( "type" => "EntertainmentBusiness", "display" => "- EntertainmentBusiness" ),
49
+ array( "type" => "AdultEntertainment", "display" => "-- AdultEntertainment" ),
50
+ array( "type" => "AmusementPark", "display" => "-- AmusementPark" ),
51
+ array( "type" => "ArtGallery", "display" => "-- ArtGallery" ),
52
+ array( "type" => "Casino", "display" => "-- Casino" ),
53
+ array( "type" => "ComedyClub", "display" => "-- ComedyClub" ),
54
+ array( "type" => "MovieTheater", "display" => "-- MovieTheater" ),
55
+ array( "type" => "NightClub", "display" => "-- NightClub" ),
56
+
57
+ array( "type" => "FinancialService", "display" => "- FinancialService" ),
58
+ array( "type" => "AccountingService", "display" => "-- AccountingService" ),
59
+ array( "type" => "AutomatedTeller", "display" => "-- AutomatedTeller" ),
60
+ array( "type" => "BankOrCreditUnion", "display" => "-- BankOrCreditUnion" ),
61
+ array( "type" => "InsuranceAgency", "display" => "-- InsuranceAgency" ),
62
+
63
+ array( "type" => "FoodEstablishment", "display" => "- FoodEstablishment" ),
64
+ array( "type" => "Bakery", "display" => "-- Bakery" ),
65
+ array( "type" => "BarOrPub", "display" => "-- BarOrPub" ),
66
+ array( "type" => "Brewery", "display" => "-- Brewery" ),
67
+ array( "type" => "CafeOrCoffeeShop", "display" => "-- CafeOrCoffeeShop" ),
68
+ array( "type" => "FastFoodRestaurant", "display" => "-- FastFoodRestaurant" ),
69
+ array( "type" => "IceCreamShop", "display" => "-- IceCreamShop" ),
70
+ array( "type" => "Restaurant", "display" => "-- Restaurant" ),
71
+ array( "type" => "Winery", "display" => "-- Winery" ),
72
+
73
+ array( "type" => "GovernmentOffice", "display" => "- GovernmentOffice" ),
74
+ array( "type" => "PostOffice", "display" => "-- PostOffice" ),
75
+
76
+ array( "type" => "HealthAndBeautyBusiness", "display" => "- HealthAndBeautyBusiness" ),
77
+ array( "type" => "BeautySalon", "display" => "-- BeautySalon" ),
78
+ array( "type" => "DaySpa", "display" => "-- DaySpa" ),
79
+ array( "type" => "HairSalon", "display" => "-- HairSalon" ),
80
+ array( "type" => "HealthClub", "display" => "-- HealthClub" ),
81
+ array( "type" => "NailSalon", "display" => "-- NailSalon" ),
82
+ array( "type" => "TattooParlor", "display" => "-- TattooParlor" ),
83
+
84
+ array( "type" => "HomeAndConstructionBusiness", "display" => "- HomeAndConstructionBusiness" ),
85
+ array( "type" => "Electrician", "display" => "-- Electrician" ),
86
+ array( "type" => "GeneralContractor", "display" => "-- GeneralContractor" ),
87
+ array( "type" => "HVACBusiness", "display" => "-- HVACBusiness" ),
88
+ array( "type" => "HousePainter", "display" => "-- HousePainter" ),
89
+ array( "type" => "Locksmith", "display" => "-- Locksmith" ),
90
+ array( "type" => "MovingCompany", "display" => "-- MovingCompany" ),
91
+ array( "type" => "Plumber", "display" => "-- Plumber" ),
92
+ array( "type" => "RoofingContractor", "display" => "-- RoofingContractor" ),
93
+
94
+ array( "type" => "InternetCafe", "display" => "- InternetCafe" ),
95
+
96
+ array( "type" => "LegalService", "display" => "- LegalService" ),
97
+ array( "type" => "Attorney", "display" => "-- Attorney" ),
98
+ array( "type" => "Notary", "display" => "-- Notary" ),
99
+
100
+ array( "type" => "Library", "display" => "- Library" ),
101
+
102
+ array( "type" => "LodgingBusiness", "display" => "- LodgingBusiness" ),
103
+ array( "type" => "BedAndBreakfast", "display" => "-- BedAndBreakfast" ),
104
+ array( "type" => "Hostel", "display" => "-- Hostel" ),
105
+ array( "type" => "Hotel", "display" => "-- Hotel" ),
106
+ array( "type" => "Motel", "display" => "-- Motel" ),
107
+
108
+ array( "type" => "MedicalOrganization", "display" => "- MedicalOrganization" ),
109
+ array( "type" => "Dentist", "display" => "-- Dentist" ),
110
+ array( "type" => "DiagnosticLab", "display" => "-- DiagnosticLab" ),
111
+ array( "type" => "Hospital", "display" => "-- Hospital" ),
112
+ array( "type" => "MedicalClinic", "display" => "-- MedicalClinic" ),
113
+ array( "type" => "Optician", "display" => "-- Optician" ),
114
+ array( "type" => "Pharmacy", "display" => "-- Pharmacy" ),
115
+ array( "type" => "Physician", "display" => "-- Physician" ),
116
+ array( "type" => "VeterinaryCare", "display" => "-- VeterinaryCare" ),
117
+
118
+ array( "type" => "ProfessionalService", "display" => "- ProfessionalService" ),
119
+
120
+ array( "type" => "RadioStation", "display" => "- RadioStation" ),
121
+
122
+ array( "type" => "RealEstateAgent", "display" => "- RealEstateAgent" ),
123
+
124
+ array( "type" => "RecyclingCenter", "display" => "- RecyclingCenter" ),
125
+
126
+ array( "type" => "SelfStorage", "display" => "- SelfStorage" ),
127
+
128
+ array( "type" => "ShoppingCenter", "display" => "- ShoppingCenter" ),
129
+
130
+ array( "type" => "SportsActivityLocation", "display" => "- SportsActivityLocation" ),
131
+ array( "type" => "BowlingAlley", "display" => "-- BowlingAlley" ),
132
+ array( "type" => "ExerciseGym", "display" => "-- ExerciseGym" ),
133
+ array( "type" => "GolfCourse", "display" => "-- GolfCourse" ),
134
+ array( "type" => "HealthClub", "display" => "-- HealthClub" ),
135
+ array( "type" => "PublicSwimmingPool", "display" => "-- PublicSwimmingPool" ),
136
+ array( "type" => "SkiResort", "display" => "-- SkiResort" ),
137
+ array( "type" => "SportsClub", "display" => "-- SportsClub" ),
138
+ array( "type" => "StadiumOrArena", "display" => "-- StadiumOrArena" ),
139
+ array( "type" => "TennisComplex", "display" => "-- TennisComplex" ),
140
+
141
+ array( "type" => "Store", "display" => "- Store" ),
142
+ array( "type" => "AutoPartsStore", "display" => "-- AutoPartsStore" ),
143
+ array( "type" => "BikeStore", "display" => "-- BikeStore" ),
144
+ array( "type" => "BookStore", "display" => "-- BookStore" ),
145
+ array( "type" => "ClothingStore", "display" => "-- ClothingStore" ),
146
+ array( "type" => "ComputerStore", "display" => "-- ComputerStore" ),
147
+ array( "type" => "ConvenienceStore", "display" => "-- ConvenienceStore" ),
148
+ array( "type" => "DepartmentStore", "display" => "-- DepartmentStore" ),
149
+ array( "type" => "ElectronicsStore", "display" => "-- ElectronicsStore" ),
150
+ array( "type" => "Florist", "display" => "-- Florist" ),
151
+ array( "type" => "FurnitureStore", "display" => "-- FurnitureStore" ),
152
+ array( "type" => "GardenStore", "display" => "-- GardenStore" ),
153
+ array( "type" => "GroceryStore", "display" => "-- GroceryStore" ),
154
+ array( "type" => "HardwareStore", "display" => "-- HardwareStore" ),
155
+ array( "type" => "HobbyShop", "display" => "-- HobbyShop" ),
156
+ array( "type" => "HomeGoodsStore", "display" => "-- HomeGoodsStore" ),
157
+ array( "type" => "JewelryStore", "display" => "-- JewelryStore" ),
158
+ array( "type" => "LiquorStore", "display" => "-- LiquorStore" ),
159
+ array( "type" => "MensClothingStore", "display" => "-- MensClothingStore" ),
160
+ array( "type" => "MobilePhoneStore", "display" => "-- MobilePhoneStore" ),
161
+ array( "type" => "MovieRentalStore", "display" => "-- MovieRentalStore" ),
162
+ array( "type" => "MusicStore", "display" => "-- MusicStore" ),
163
+ array( "type" => "OfficeEquipmentStore", "display" => "-- OfficeEquipmentStore" ),
164
+ array( "type" => "OutletStore", "display" => "-- OutletStore" ),
165
+ array( "type" => "PawnShop", "display" => "-- PawnShop" ),
166
+ array( "type" => "PetStore", "display" => "-- PetStore" ),
167
+ array( "type" => "ShoeStore", "display" => "-- ShoeStore" ),
168
+ array( "type" => "SportingGoodsStore", "display" => "-- SportingGoodsStore" ),
169
+ array( "type" => "TireShop", "display" => "-- TireShop" ),
170
+ array( "type" => "ToyStore", "display" => "-- ToyStore" ),
171
+ array( "type" => "WholesaleStore", "display" => "-- WholesaleStore" ),
172
+
173
+ array( "type" => "TelevisionStation", "display" => "- TelevisionStation" ),
174
+
175
+ array( "type" => "TouristInformationCenter", "display" => "- TouristInformationCenter" ),
176
+
177
+ array( "type" => "TravelAgency", "display" => "- TravelAgency" )
178
+ );
179
+
180
+ /** weekType defined. */
181
+ private $week_array = array(
182
+ array("type" => "Mo", "display" => "Monday"),
183
+ array("type" => "Tu", "display" => "Tuesday"),
184
+ array("type" => "We", "display" => "Wednesday"),
185
+ array("type" => "Th", "display" => "Thursday"),
186
+ array("type" => "Fr", "display" => "Friday"),
187
+ array("type" => "Sa", "display" => "Saturday"),
188
+ array("type" => "Su", "display" => "Sunday")
189
+ );
190
+
191
+ /**
192
+ * Constructor Define.
193
+ *
194
+ * @version 3.1.4
195
+ * @since 2.3.0
196
+ * @param array $option
197
+ */
198
+ public function __construct ( array $option ) {
199
+ /** Default Value Set */
200
+ $option_array = $this->get_default_options();
201
+
202
+ if ( !empty( $option ) ) {
203
+ $option_array = array_merge( $option_array, $option );
204
+ }
205
+
206
+ $this->page_render( $option_array );
207
+ }
208
+
209
+ /**
210
+ * Form Layout Render
211
+ *
212
+ * @version 3.1.4
213
+ * @since 2.3.3
214
+ * @param array $option
215
+ */
216
+ private function page_render ( array $option ) {
217
+ /** Local Business Type */
218
+ $html = '<table class="schema-admin-table">';
219
+ $html .= '<caption>Local Business</caption>';
220
+ $html .= $this->set_form_select( 'business_type', 'Local Business Type', $option['business_type'], 'Default : "Local Business"' );
221
+ $html .= $this->set_form_text( 'image', 'An image of the business', $option['image'], true, 'Default : bloginfo("url")' );
222
+ $html .= $this->set_form_text( 'name', 'Business Name', $option['name'], true, 'Default : bloginfo("name")' );
223
+ $html .= $this->set_form_text( 'url', 'Url', $option['url'], true, 'Default : bloginfo("url")' );
224
+ $html .= $this->set_form_text( 'telephone', 'Telephone', $option['telephone'], false, 'e.g. : +1-880-555-1212' );
225
+ $html .= '</table>';
226
+ echo $html;
227
+
228
+ /** For food establishments */
229
+ $html = '<table class="schema-admin-table">';
230
+ $html .= '<caption>For food establishments</caption>';
231
+ $html .= $this->set_form_checkbox( 'food_active', 'Setting', $option['food_active'], 'Enabled' );
232
+ $html .= $this->set_form_text( 'menu', 'Menu url', $option['menu'], false, 'For food establishments, the fully-qualified URL of the menu.' );
233
+ $html .= $this->set_form_checkbox( 'accepts_reservations', 'Accepts Reservations', $option['accepts_reservations'], 'For food establishments, and whether it is possible to accept a reservation?' );
234
+ $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.' );
235
+ $html .= '</table>';
236
+ echo $html;
237
+
238
+ /** Postal Address */
239
+ $html = '<table class="schema-admin-table">';
240
+ $html .= '<caption>Postal Address</caption>';
241
+ $html .= $this->set_form_text( 'street_address', 'Street Address', $option['street_address'], true );
242
+ $html .= $this->set_form_text( 'address_locality', 'Address Locality', $option['address_locality'], true );
243
+ $html .= $this->set_form_text( 'address_region', 'Address Region', $option['address_region'], false );
244
+ $html .= $this->set_form_text( 'postal_code', 'Postal Code', $option['postal_code'], true );
245
+ $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>' );
246
+ $html .= '</table>';
247
+ echo $html;
248
+
249
+ /** Geo Circle */
250
+ $html = '<table class="schema-admin-table">';
251
+ $html .= '<caption>Geo Circle</caption>';
252
+ $html .= $this->set_form_checkbox( 'geo_circle_active', 'Setting', $option['geo_circle_active'], 'Enabled' );
253
+ $html .= $this->set_form_text( 'geo_circle_radius', 'geoRadius', $option['geo_circle_radius'], false );
254
+ $html .= '</table>';
255
+ echo $html;
256
+
257
+ /** Geo Coordinates */
258
+ $html = '<table class="schema-admin-table">';
259
+ $html .= '<caption>Geo Coordinates</caption>';
260
+ $html .= $this->set_form_checkbox( 'geo_active', 'Setting', $option['geo_active'], 'Enabled' );
261
+ $html .= $this->set_form_text( 'latitude', 'Latitude', $option['latitude'], false );
262
+ $html .= $this->set_form_text( 'longitude', 'Longitude', $option['longitude'], false );
263
+ $html .= '</table>';
264
+ echo $html;
265
+
266
+ /** Opening Hours Specification */
267
+ $html = '<table class="schema-admin-table">';
268
+ $html .= '<caption>Opening Hours Specification</caption>';
269
+
270
+ $i = 0;
271
+
272
+ foreach ( $this->week_array as $value ) {
273
+ if ( !isset( $option[$value['type']] ) ) {
274
+ $option[$value['type']] = "";
275
+ }
276
+
277
+ $html .= $this->set_form_checkbox( $value['type'], $value['display'], $option[$value['type']], 'Enabled' );
278
+
279
+ if ( isset( $option['week'][$value['type']] ) ) {
280
+ foreach ( $option['week'][$value['type']] as $type ) {
281
+ if ( !empty( $type['open'] ) ) {
282
+ $html .= $this->set_form_time( $value['type'], '', $type['open'], $type['close'], '', $i );
283
+ $i++;
284
+ } else {
285
+ $html .= $this->set_form_time( $value['type'], '', '', '', '', 0 );
286
+ break;
287
+ }
288
+ }
289
+ } else {
290
+ $html .= $this->set_form_time( $value['type'], '', '', '', '', 0 );
291
+ }
292
+
293
+ $i = 0;
294
+ }
295
+
296
+ $html .= '</table>';
297
+ echo $html;
298
+
299
+ /** Holiday Opening Hours */
300
+ $html = '<table class="schema-admin-table">';
301
+ $html .= '<caption>Holiday Opening Hours</caption>';
302
+ $html .= $this->set_form_checkbox( 'holiday_active', 'Setting', $option['holiday_active'], 'Enabled' );
303
+ $html .= $this->set_form_time_holiday( $option['holiday_open'], $option['holiday_close'] );
304
+ $html .= $this->set_form_date( 'holiday_valid_from', 'validFrom', $option['holiday_valid_from'], false );
305
+ $html .= $this->set_form_date( 'holiday_valid_through', 'validThrough', $option['holiday_valid_through'], false );
306
+
307
+ $html .= '</table>';
308
+ echo $html;
309
+
310
+ /** Price Range */
311
+ $html = '<table class="schema-admin-table">';
312
+ $html .= '<caption>Price Range</caption>';
313
+ $html .= $this->set_form_text( 'price_range', 'Price Range', $option['price_range'], false, 'The price range of the business, for example $$$.' );
314
+ $html .= '</table>';
315
+ echo $html;
316
+
317
+ 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>';
318
+ submit_button();
319
+ }
320
+
321
+ /**
322
+ * Return the default options array
323
+ *
324
+ * @since 3.1.4
325
+ * @version 2.5.0
326
+ * @return array $args
327
+ */
328
+ private function get_default_options () {
329
+ $args['business_type'] = 'local_business';
330
+ $args['name'] = get_bloginfo('name');
331
+ $args['image'] = get_bloginfo('url');
332
+ $args['url'] = get_bloginfo('url');
333
+ $args['telephone'] = '';
334
+ $args['food_active'] = '';
335
+ $args['menu'] = '';
336
+ $args['accepts_reservations'] = '';
337
+ $args['serves_cuisine'] = '';
338
+ $args['street_address'] = '';
339
+ $args['address_locality'] = '';
340
+ $args['address_region'] = '';
341
+ $args['postal_code'] = '';
342
+ $args['address_country'] = '';
343
+ $args['geo_circle_active'] = '';
344
+ $args['geo_circle_radius'] = '';
345
+ $args['geo_active'] = '';
346
+ $args['latitude'] = '';
347
+ $args['longitude'] = '';
348
+ $args['opening_active'] = '';
349
+
350
+ foreach ( $this->week_array as $value ) {
351
+ $args[$value['type']] = '';
352
+ $args['week'][$value['type']]['open'] = '';
353
+ $args['week'][$value['type']]['close'] = '';
354
+ }
355
+
356
+ $args['holiday_active'] = '';
357
+ $args['holiday_open'] = '';
358
+ $args['holiday_close'] = '';
359
+ $args['holiday_valid_from'] = '';
360
+ $args['holiday_valid_through'] = '';
361
+ $args['price_range'] = '';
362
+
363
+ return (array) $args;
364
+ }
365
+
366
+ /**
367
+ * Return the form text
368
+ *
369
+ * @version 3.0.5
370
+ * @since 2.3.0
371
+ * @param string $id
372
+ * @param string $display
373
+ * @param string $value
374
+ * @param boolean $required
375
+ * @param string $note
376
+ * @return string $html
377
+ */
378
+ private function set_form_text ( $id, $display, $value = "", $required = false, $note = "" ) {
379
+ $value = esc_attr( $value );
380
+
381
+ if ( $required ) {
382
+ $format = '<tr><th class="require"><label for=%s>%s :</label></th><td>';
383
+ } else {
384
+ $format = '<tr><th><label for=%s>%s :</label></th><td>';
385
+ }
386
+
387
+ $format .= '<input type="text" name="option[%s]" id="%s" class="regular-text" value="%s"';
388
+
389
+ if ( $required ) {
390
+ $format .= ' required';
391
+ }
392
+ $format .= '><small>%s</small></td></tr>';
393
+
394
+ return (string) sprintf( $format, $id, $display, $id, $id, $value, $note );
395
+ }
396
+
397
+ /**
398
+ * Return the form date
399
+ *
400
+ * @since 3.0.5
401
+ * @version 2.5.0
402
+ * @param string $id
403
+ * @param string $display
404
+ * @param string $value
405
+ * @param boolean $required
406
+ * @param string $note
407
+ * @return string $html
408
+ */
409
+ private function set_form_date ( $id, $display, $value = "", $required = false, $note = "" ) {
410
+ $value = esc_attr( $value );
411
+
412
+ $format = '<tr><th><label for=%s>%s :</label></th><td>';
413
+ $format .= '<input type="date" name="option[%s]" id="%s" value="%s"';
414
+ if ( $required ) {
415
+ $format .= ' required';
416
+ }
417
+ $format .= '><small>%s</small></td></tr>';
418
+
419
+ return (string) sprintf( $format, $id, $display, $id, $id, $value, $note );
420
+ }
421
+
422
+ /**
423
+ * Return the form checkbox
424
+ *
425
+ * @version 3.0.5
426
+ * @since 2.3.0
427
+ * @param string $id
428
+ * @param string $display
429
+ * @param string $value
430
+ * @param string $note
431
+ * @return string $html
432
+ */
433
+ private function set_form_checkbox ( $id, $display, $value = "", $note = "" ) {
434
+ $value = esc_attr( $value );
435
+
436
+ $format = '<tr><th><label for=%s>%s :</label></th><td>';
437
+ $format .= '<input type="checkbox" name="option[%s]" id="%s" value="on"';
438
+ if ( $value === 'on' ) {
439
+ $format .= ' checked="checked"';
440
+ }
441
+ $format .= '>%s</td></tr>';
442
+
443
+ return (string) sprintf( $format, $id, $display, $id, $id, $note );
444
+ }
445
+
446
+ /**
447
+ * Return the form select
448
+ *
449
+ * @since 2.3.0
450
+ * @param string $id
451
+ * @param string $display
452
+ * @param string $value
453
+ * @param string $note
454
+ * @return string $html
455
+ */
456
+ private function set_form_select ( $id, $display, $value = "", $note = "" ) {
457
+ $value = esc_attr( $value );
458
+
459
+ $format = '<tr><th class="require"><label for=%s>%s :</label></th><td>';
460
+ $format .= '<select id="%s" name="option[%s]">';
461
+ foreach ( $this->business_type_array as $args ) {
462
+ $format .= '<option value="' . $args['type'] . '"';
463
+ if ( $args['type'] === $value ) {
464
+ $format .= ' selected';
465
+ }
466
+ $format .= '>' . $args['display'] . '</option>';
467
+ }
468
+ $format .= '</select>';
469
+ $format .= '<small>%s</small></td></tr>';
470
+
471
+ return (string) sprintf( $format, $id, $display, $id, $id, $note );
472
+ }
473
+
474
+ /**
475
+ * Return the form time
476
+ *
477
+ * @version 3.0.5
478
+ * @since 2.3.0
479
+ * @param string $id
480
+ * @param string $display
481
+ * @param string $value1
482
+ * @param string $value2
483
+ * @param string $note
484
+ * @param int $count
485
+ * @return string $html
486
+ */
487
+ private function set_form_time ( $id, $display, $value1 = "", $value2 = "", $note = "", $count = 0 ) {
488
+ $value1 = esc_attr( $value1 );
489
+ $value2 = esc_attr( $value2 );
490
+
491
+ $format = '<tr class="opening-hours %s"><th><label for=%s>%s :</label></th><td>';
492
+ $format .= 'Open Time : <input type="time" name="option[week][%s][%d][open]" id="%s-open" value="%s">';
493
+ $format .= ' Close Time : <input type="time" name="option[week][%s][%d][close]" id="%s-close" value="%s">';
494
+ $format .= '%s<a class="dashicons dashicons-plus markup-time plus"></a>';
495
+ if( $count !== 0 ) {
496
+ $format .= '<a class="dashicons dashicons-minus markup-time minus"></a>';
497
+ }
498
+ $format .= '</td></tr>';
499
+
500
+ return (string) sprintf( $format, $id, $id, $display, $id, $count, $id, $value1, $id, $count, $id, $value2, $note );
501
+ }
502
+
503
+ /**
504
+ * Return the form time (Holiday)
505
+ *
506
+ * @since 2.5.0
507
+ * @version 2.5.0
508
+ * @param string $value1
509
+ * @param string $value2
510
+ * @return string $html
511
+ */
512
+ private function set_form_time_holiday ( $value1 = "", $value2 = "" ) {
513
+ $value1 = esc_attr( $value1 );
514
+ $value2 = esc_attr( $value2 );
515
+
516
+ $format = '<tr><th>Holiday Time :</th><td>';
517
+ $format .= 'Open Time : <input type="time" name="option[holiday_open]" value="%s">';
518
+ $format .= 'Close Time : <input type="time" name="option[holiday_close]" value="%s">';
519
+ $format .= '</td></tr>';
520
+
521
+ return (string) sprintf( $format, $value1, $value2 );
522
+ }
523
+ }
trunk/includes/wp-structuring-admin-type-news-article.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type News Article
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.2.2
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 3.2.2
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 .= '</table>';
63
+ echo $html;
64
+
65
+ $html = '<table class="schema-admin-table">';
66
+ $html .= '<caption>author</caption>';
67
+ $html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
68
+ $html .= '<tr><th>name :</th><td><small>Default : get_the_author_meta( "display_name", author )</small>';
69
+ $html .= '</td></tr>';
70
+ $html .= '</table>';
71
+ echo $html;
72
+
73
+ $html = '<table class="schema-admin-table">';
74
+ $html .= '<caption>publisher</caption>';
75
+ $html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
76
+ $html .= '<tr><th><label for="name">Organization Name :</label></th><td>';
77
+ $html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" value="' . esc_attr( $option['name'] ) . '">';
78
+ $html .= '<small>Default : bloginfo("name")</small>';
79
+ $html .= '</td></tr>';
80
+ $html .= '</table>';
81
+ echo $html;
82
+
83
+ $html = '<table class="schema-admin-table">';
84
+ $html .= '<caption>publisher.logo</caption>';
85
+ $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
86
+ $html .= '<tr><th><label for="logo">url :</label></th><td>';
87
+ $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
88
+ $html .= '<button id="media-upload" class="schema-admin-media-button dashicons-before dashicons-admin-media"><span>Add Media</span></button>';
89
+ $html .= '</td></tr>';
90
+ $html .= '<tr><th><label for="logo-width">width :</label></th><td>';
91
+ $html .= '<input type="number" name="option[' . "logo-width" . ']" id="logo-width" min="0" value="' . esc_attr( $option['logo-width'] ) . '">px';
92
+ $html .= '<small>height <= 600px.</small>';
93
+ $html .= '</td></tr>';
94
+ $html .= '<tr><th><label for="logo-height">height :</label></th><td>';
95
+ $html .= '<input type="number" name="option[' . "logo-height" . ']" id="logo-height" min="0" value="' . esc_attr( $option['logo-height'] ) . '">px';
96
+ $html .= '<small>height <= 60px.</small>';
97
+ $html .= '</td></tr>';
98
+ $html .= '</table>';
99
+ echo $html;
100
+
101
+ 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>';
102
+ submit_button();
103
+ }
104
+
105
+ /**
106
+ * Return the default options array
107
+ *
108
+ * @since 3.2.2
109
+ * @version 2.2.0
110
+ * @return array $args
111
+ */
112
+ private function get_default_options () {
113
+ $args['name'] = get_bloginfo('name');
114
+ $args['logo'] = "";
115
+ $args['logo-height'] = 0;
116
+ $args['logo-width'] = 0;
117
+
118
+ return (array) $args;
119
+ }
120
+ }
trunk/includes/wp-structuring-admin-type-organization.php ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Organization
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.1.4
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
+ * @since 1.0.0
52
+ * @param array $option
53
+ */
54
+ public function __construct ( array $option ) {
55
+ /** Default Value Set */
56
+ if ( empty( $option ) ) {
57
+ $option = $this->get_default_options( $option );
58
+ }
59
+ $this->page_render( $option );
60
+ }
61
+
62
+ /**
63
+ * Form Layout Render
64
+ *
65
+ * @version 3.2.0
66
+ * @since 1.0.0
67
+ * @param array $option
68
+ */
69
+ private function page_render ( array $option ) {
70
+ /** Logos */
71
+ $html = '<table class="schema-admin-table">';
72
+ $html .= '<caption>Logos</caption>';
73
+ $html .= '<tr><th class="require"><label for="name">Organization Name :</label></th><td>';
74
+ $html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" required value="' . esc_attr( $option['name'] ) . '">';
75
+ $html .= '<small>Default : bloginfo("name")</small>';
76
+ $html .= '</td></tr>';
77
+ $html .= '<tr><th class="require"><label for="url">url :</label></th><td>';
78
+ $html .= '<input type="text" name="option[' . "url" . ']" id="url" class="regular-text" required value="' . esc_attr( $option['url'] ) . '">';
79
+ $html .= '<small>Default : bloginfo("url")</small>';
80
+ $html .= '</td></tr>';
81
+ $html .= '<tr><th class="require"><label for="logo">logo :</label></th><td>';
82
+ $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" required value="' . esc_attr( $option['logo'] ) . '">';
83
+ $html .= '<button id="media-upload" class="schema-admin-media-button dashicons-before dashicons-admin-media"><span>Add Media</span></button>';
84
+ $html .= '<small>Default : bloginfo("url") + "/images/logo.png"</small>';
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'] ) . '">';
101
+ $html .= '<small>e.g. : +1-880-555-1212</small>';
102
+ $html .= '</td></tr>';
103
+ $html .= '<tr><th><label for="contact_type">contactType :</label></th><td>';
104
+ $html .= '<select id="contact_type" name="option[' . "contact_type" . ']">';
105
+ foreach ( $this->contact_type_array as $value ) {
106
+ $html .= '<option value="' . $value['type'] . '"';
107
+ if ( $value['type'] === $option['contact_type'] ) {
108
+ $html .= ' selected';
109
+ }
110
+ $html .= '>' . $value['display'] . '</option>';
111
+ }
112
+ $html .= '</select>';
113
+ $html .= '<small>Default : "customer service"</small>';
114
+ $html .= '</td></tr>';
115
+ $html .= '<tr><th><label for="email">email :</label></th><td>';
116
+ $html .= '<input type="email" name="option[' . "email" . ']" id="email" class="regular-text" value="' . esc_attr( $option['email'] ) . '">';
117
+ $html .= '<small>e.g. : info@example.com</small>';
118
+ $html .= '</td></tr>';
119
+ $html .= '<tr><th><label for="area_served">areaServed :</label></th><td>';
120
+ $html .= '<input type="text" name="option[' . "area_served" . ']" id="area_served" class="regular-text" value="' . esc_attr( $option['area_served'] ) . '">';
121
+ $html .= '<small>Default : "US"&nbsp;&nbsp;Multiple : "US,CA"</small>';
122
+ $html .= '</td></tr>';
123
+ $html .= '<tr><th>contactOption :</th><td>';
124
+ $html .= '<label><input type="checkbox" name="option[' . "contact_point_1" . ']" id="contact_point_1" value="on"';
125
+ if ( isset( $option['contact_point_1'] ) && $option['contact_point_1'] === 'on' ) {
126
+ $html .= ' checked="checked"';
127
+ }
128
+ $html .= '>HearingImpairedSupported</label><br>';
129
+ $html .= '<label><input type="checkbox" name="option[' . "contact_point_2" . ']" id="contact_point_2" value="on"';
130
+ if ( isset( $option['contact_point_2'] ) && $option['contact_point_2'] === 'on' ) {
131
+ $html .= ' checked="checked"';
132
+ }
133
+ $html .= '>TollFree</label><br>';
134
+ $html .= '</td></tr>';
135
+ $html .= '<tr><th><label for="available_language">available&nbsp;Language :</label></th><td>';
136
+ $html .= '<input type="text" name="option[' . "available_language" . ']" id="available_language" class="regular-text" value="' . esc_attr( $option['available_language'] ) . '">';
137
+ $html .= '<small>Default : "English"&nbsp;&nbsp;Multiple : "French,English"</small>';
138
+ $html .= '</td></tr>';
139
+ $html .= '</table>';
140
+ echo $html;
141
+
142
+ /** Social Profiles */
143
+ $html = '<table class="schema-admin-table">';
144
+ $html .= '<caption>Social Profiles</caption>';
145
+ foreach ( $this->social_array as $value ) {
146
+ $html .= '<tr><th><label for="' . $value['type'] . '">' . $value['display'] . ' :</label></th><td>';
147
+ $html .= '<input type="text" name="option[' . "social" . '][' . $value['type'] . ']" id="' . $value['type'] . '" class="regular-text" value="' . esc_attr( $option['social'][$value['type']] ) . '">';
148
+ $html .= '</td></tr>';
149
+ }
150
+ $html .= '</table>';
151
+ echo $html;
152
+
153
+ 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>';
154
+ submit_button();
155
+ }
156
+
157
+ /**
158
+ * Return the default options array
159
+ *
160
+ * @version 3.2.0
161
+ * @since 1.0.0
162
+ * @param array $args
163
+ * @return array $args
164
+ */
165
+ private function get_default_options ( array $args ) {
166
+ $args['name'] = get_bloginfo('name');
167
+ $args['url'] = get_bloginfo('url');
168
+ $args['logo'] = get_bloginfo('url') . '/images/logo.png';
169
+ $args['contact_point'] = '';
170
+ $args['telephone'] = '';
171
+ $args['contact_type'] = 'customer_service';
172
+ $args['email'] = '';
173
+ $args['area_served'] = 'US';
174
+ $args['contact_option_1'] = '';
175
+ $args['contact_option_2'] = '';
176
+ $args['available_language'] = 'English';
177
+
178
+ foreach ( $this->social_array as $value ) {
179
+ $args['social'][$value['type']] = '';
180
+ }
181
+
182
+ return (array) $args;
183
+ }
184
+ }
trunk/includes/wp-structuring-admin-type-person.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Person
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.1.2
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 3.1.2
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 .= '<small>Default : bloginfo("name")</small>';
66
+ $html .= '</td></tr>';
67
+ $html .= '<tr><th class="require"><label for="url">url :</label></th><td>';
68
+ $html .= '<input type="text" name="option[' . "url" . ']" id="url" class="regular-text" required value="' . esc_attr( $option['url'] ) . '">';
69
+ $html .= '<small>Default : bloginfo("url")</small>';
70
+ $html .= '</td></tr>';
71
+ $html .= '</table>';
72
+ echo $html;
73
+
74
+ /** Place Settings */
75
+ $html = '<table class="schema-admin-table">';
76
+ $html .= '<caption>Place Settings</caption>';
77
+ $html .= '<tr><th class="require"><label for="addressCountry">addressCountry :</label></th><td>';
78
+ $html .= '<input type="text" name="option[' . "addressCountry" . ']" id="addressCountry" class="regular-text" required value="' . esc_attr( $option['addressCountry'] ) . '">';
79
+ $html .= '<small>e.g. Japan</small>';
80
+ $html .= '</td></tr>';
81
+ $html .= '</table>';
82
+ echo $html;
83
+
84
+ /** Social Profiles */
85
+ $html = '<table class="schema-admin-table">';
86
+ $html .= '<caption>Social Profiles</caption>';
87
+ foreach ( $this->social_array as $value ) {
88
+ $html .= '<tr><th><label for="' . $value['type'] . '">' . $value['display'] . ' :</label></th><td>';
89
+ $html .= '<input type="text" name="option[' . "social" . '][' . $value['type'] . ']" id="' . $value['type'] . '" class="regular-text" value="' . esc_attr( $option['social'][$value['type']] ) . '">';
90
+ $html .= '</td></tr>';
91
+ }
92
+ $html .= '</table>';
93
+ echo $html;
94
+
95
+ 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>';
96
+ submit_button();
97
+ }
98
+
99
+ /**
100
+ * Return the default options array
101
+ *
102
+ * @since 3.1.2
103
+ * @version 2.4.0
104
+ * @return array $args
105
+ */
106
+ private function get_default_options () {
107
+ $args['name'] = get_bloginfo('name');
108
+ $args['url'] = get_bloginfo('url');
109
+ $args['addressCountry'] = '';
110
+
111
+ foreach ( $this->social_array as $value ) {
112
+ $args['social'][$value['type']] = '';
113
+ }
114
+
115
+ return (array) $args;
116
+ }
117
+ }
trunk/includes/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/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/wp-structuring-admin-type-website.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type WebSite
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.1.0
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 3.1.0
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 .= '<small>Default : bloginfo("name")</small>';
46
+ $html .= '</td></tr>';
47
+ $html .= '<tr><th><label for="alternateName">alternateName :</label></th><td>';
48
+ $html .= '<input type="text" name="option[' . "alternateName" . ']" id="alternateName" class="regular-text" value="' . esc_attr( $option['alternateName'] ) . '">';
49
+ $html .= '<small>Default : bloginfo("name")</small>';
50
+ $html .= '</td></tr>';
51
+ $html .= '<tr><th class="require"><label for="url">url :</label></th><td>';
52
+ $html .= '<input type="text" name="option[' . "url" . ']" id="url" class="regular-text" required value="' . esc_attr( $option['url'] ) . '">';
53
+ $html .= '<small>Default : bloginfo("url")</small>';
54
+ $html .= '</td></tr>';
55
+ $html .= '</table>';
56
+ echo $html;
57
+
58
+ $html = '<table class="schema-admin-table">';
59
+ $html .= '<caption>Sitelink Search Box [ Site ]</caption>';
60
+ $html .= '<tr><th><label for="potential_action">potentialAction Active :</label></th><td>';
61
+ $html .= '<input type="checkbox" name="option[' . "potential_action" . ']" id="potential_action" value="on"';
62
+ if ( isset( $option['potential_action'] ) && $option['potential_action'] === 'on' ) {
63
+ $html .= ' checked="checked"';
64
+ }
65
+ $html .= '>Enabled';
66
+ $html .= '</td></tr>';
67
+ $html .= '<tr><th><label for="target">target :</label></th><td>';
68
+ $html .= '<input type="text" name="option[' . "target" . ']" id="target" class="regular-text" value="' . esc_attr( $option['target'] ) . '">';
69
+ $html .= '<small>Default : bloginfo("url") + /?s=</small>';
70
+ $html .= '</td></tr>';
71
+ $html .= '</table>';
72
+ echo $html;
73
+
74
+ $html = '<table class="schema-admin-table">';
75
+ $html .= '<caption>Sitelink Search Box [ App ] *required Sitelink Search Box [ Site ]</caption>';
76
+ $html .= '<tr><th><label for="potential_action_app">potentialAction Active :</label></th><td>';
77
+ $html .= '<input type="checkbox" name="option[' . "potential_action_app" . ']" id="potential_action_app" value="on"';
78
+ if ( isset( $option['potential_action_app'] ) && $option['potential_action_app'] === 'on' ) {
79
+ $html .= ' checked="checked"';
80
+ }
81
+ $html .= '>Enabled';
82
+ $html .= '</td></tr>';
83
+ $html .= '<tr><th><label for="target_app">target :</label></th><td>';
84
+ $html .= '<input type="text" name="option[' . "target_app" . ']" id="target_app" class="regular-text" value="' . esc_attr( $option['target_app'] ) . '">';
85
+ $html .= '<small>e.g. android-app://com.example/https/query.example.com/search/?q=</small>';
86
+ $html .= '</td></tr>';
87
+ $html .= '</table>';
88
+ echo $html;
89
+
90
+ 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>';
91
+ submit_button();
92
+ }
93
+
94
+ /**
95
+ * Return the default options array
96
+ *
97
+ * @version 3.1.0
98
+ * @since 1.0.0
99
+ * @return array $args
100
+ */
101
+ private function get_default_options () {
102
+ $args = array();
103
+
104
+ $args['name'] = get_bloginfo('name');
105
+ $args['alternateName'] = $args['name'];
106
+ $args['url'] = get_bloginfo('url');
107
+ $args['potential_action'] = '';
108
+ $args['target'] = $args['url'] . '/?s=';
109
+ $args['potential_action_app'] = '';
110
+ $args['target_app'] = '';
111
+
112
+ return (array) $args;
113
+ }
114
+ }
trunk/includes/wp-structuring-custom-post-event.php ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Custom Post "Event"
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.2.3
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
+ * Constructor Define.
52
+ *
53
+ * @version 3.1.6
54
+ * @since 2.1.0
55
+ * @param String $text_domain
56
+ */
57
+ public function __construct ( $text_domain ) {
58
+ $this->text_domain = $text_domain;
59
+
60
+ /** Custom post menu controls */
61
+ $show_flag = __return_false();
62
+ if ( isset( $_POST['type'] ) && $_POST['type'] === 'event' ) {
63
+ if ( isset( $_POST['activate'] ) && $_POST['activate'] === 'on' ) {
64
+ $show_flag = __return_true();
65
+ }
66
+ } else {
67
+ /** DB Connect */
68
+ $db = new Structuring_Markup_Admin_Db();
69
+ $results = $db->get_type_options('event');
70
+
71
+ if ( isset( $results['activate'] ) && $results['activate'] == 'on' ) {
72
+ $show_flag = __return_true();
73
+ }
74
+ }
75
+
76
+ register_post_type(
77
+ $this->custom_type,
78
+ array(
79
+ 'labels' => array(
80
+ 'name' => esc_html__( 'Event Posts', $this->text_domain ),
81
+ 'singular_name' => esc_html__( 'Event Posts', $this->text_domain ),
82
+ 'all_items' => esc_html__( 'All Event Posts', $this->text_domain )
83
+ ),
84
+ 'capability_type' => 'post',
85
+ 'has_archive' => true,
86
+ 'hierarchical' => false,
87
+ 'menu_position' => 5,
88
+ 'public' => $show_flag,
89
+ 'query_var' => false,
90
+ 'rewrite' => array( 'with_front' => true, 'slug' => 'events' ),
91
+ 'show_in_menu' => $show_flag,
92
+ 'show_ui' => $show_flag,
93
+ 'supports' => array( 'title', 'editor', 'author', 'thumbnail' )
94
+ )
95
+ );
96
+
97
+ if ( is_admin() ) {
98
+ add_action( 'admin_init', array( $this, 'admin_init' ) );
99
+ add_action( 'admin_menu', array( $this, 'admin_menu' ) );
100
+ }
101
+ }
102
+
103
+ /**
104
+ * admin init.
105
+ *
106
+ * @version 2.1.0
107
+ * @since 2.1.0
108
+ */
109
+ public function admin_init () {
110
+ add_action( 'save_post_' . $this->custom_type, array( $this, 'save_post' ) );
111
+ }
112
+
113
+ /**
114
+ * admin meta boxes.
115
+ *
116
+ * @version 2.1.0
117
+ * @since 2.1.0
118
+ */
119
+ public function admin_menu () {
120
+ $custom_field_title = esc_html__( 'Schema.org Type Event', $this->text_domain );
121
+ add_meta_box( $this->custom_type, $custom_field_title, array( $this, 'set_custom_fields' ), $this->custom_type, 'normal' );
122
+ }
123
+
124
+ /**
125
+ * Set custom fields.
126
+ *
127
+ * @version 3.2.3
128
+ * @since 2.1.0
129
+ */
130
+ public function set_custom_fields () {
131
+ $custom_array = get_post_meta( get_the_ID(), $this->custom_type, false );
132
+ $custom_array = isset( $custom_array[0] ) ? unserialize( $custom_array[0] ) : array();
133
+
134
+ /** Default Value Set */
135
+ $args = $this->get_default_options();
136
+
137
+ if ( !empty( $args ) ) {
138
+ $args = array_merge( $args, $custom_array );
139
+ }
140
+
141
+ $html = '';
142
+ $html .= '<table>';
143
+ $html .= '<tr><td><label for="schema_event_type">';
144
+ $html .= esc_html__( 'Event Type', $this->text_domain );
145
+ $html .= '&nbsp;(required)</label></td><td>';
146
+ $html .= '<select name="option[' . "schema_event_type" . ']" id="schema_event_type">';
147
+ foreach( $this->event_type as $value) {
148
+ $html .= '<option';
149
+ if ( $value === $args['schema_event_type'] ) {
150
+ $html .= ' selected="selected"';
151
+ }
152
+ $html .= ' value="' . $value . '">' . $value . '</option>';
153
+ }
154
+ $html .= '</select>';
155
+ $html .= '</td></tr>';
156
+ $html .= '<tr><td><label for="schema_event_name">';
157
+ $html .= esc_html__( 'Event Name', $this->text_domain );
158
+ $html .= '&nbsp;(required)</label></td><td>';
159
+ $html .= '<input type="text" name="option[' . "schema_event_name" . ']" id="schema_event_name" class="regular-text" required value="' . esc_attr( $args['schema_event_name'] ) . '">';
160
+ $html .= '</td></tr>';
161
+ $html .= '<tr><td><label for="schema_event_description">';
162
+ $html .= esc_html__( 'Event Description', $this->text_domain );
163
+ $html .= '&nbsp;(recommended)</label></td><td>';
164
+ $html .= '<textarea name="option[' . "schema_event_description" . ']" id="schema_event_description" class="large-text code" rows="3">' . esc_attr( $args['schema_event_description'] ) . '</textarea>';
165
+ $html .= '</td></tr>';
166
+ $html .= '<tr><td><label for="schema_event_image">';
167
+ $html .= esc_html__( 'Event Image', $this->text_domain );
168
+ $html .= '&nbsp;(recommended)</label></td><td>';
169
+ $html .= '<input type="text" name="option[' . "schema_event_image" . ']" id="schema_event_image" class="large-text" value="' . esc_attr( $args['schema_event_image'] ) . '">';
170
+ $html .= '</td></tr>';
171
+ $html .= '<tr><td><label for="schema_event_date">';
172
+ $html .= esc_html__( 'Start Date', $this->text_domain );
173
+ $html .= '&nbsp;(required)</label></td><td>';
174
+ $html .= '<input type="date" name="option[' . "schema_event_date" . ']" id="schema_event_date" required value="' . esc_attr( $args['schema_event_date'] ) . '">';
175
+ $html .= '<input type="time" name="option[' . "schema_event_time" . ']" id="schema_event_time" required value="' . esc_attr( $args['schema_event_time'] ) . '">';
176
+ $html .= '</td></tr>';
177
+ $html .= '<tr><td><label for="schema_event_date_end">';
178
+ $html .= esc_html__( 'End Date', $this->text_domain );
179
+ $html .= '&nbsp;(recommended)</label></td><td>';
180
+ $html .= '<input type="date" name="option[' . "schema_event_date_end" . ']" id="schema_event_date" value="' . esc_attr( $args['schema_event_date_end'] ) . '">';
181
+ $html .= '<input type="time" name="option[' . "schema_event_time_end" . ']" id="schema_event_time" value="' . esc_attr( $args['schema_event_time_end'] ) . '">';
182
+ $html .= '</td></tr>';
183
+ $html .= '<tr><td><label for="schema_event_url">';
184
+ $html .= esc_html__( 'Event URL', $this->text_domain );
185
+ $html .= '&nbsp;(required)</label></td><td>';
186
+ $html .= '<input type="text" name="option[' . "schema_event_url" . ']" id="schema_event_url" class="regular-text" required value="' . esc_attr( $args['schema_event_url'] ) . '">';
187
+ $html .= '</td></tr>';
188
+ $html .= '<tr><td><label for="schema_event_place_name">';
189
+ $html .= esc_html__( 'Place Name', $this->text_domain );
190
+ $html .= '&nbsp;(required)</label></td><td>';
191
+ $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'] ) . '">';
192
+ $html .= '</td></tr>';
193
+ $html .= '<tr><td><label for="schema_event_place_url">';
194
+ $html .= esc_html__( 'Place URL', $this->text_domain );
195
+ $html .= '&nbsp;(required)</label></td><td>';
196
+ $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'] ) . '">';
197
+ $html .= '</td></tr>';
198
+ $html .= '<tr><td><label for="schema_event_place_address">';
199
+ $html .= esc_html__( 'Place Address', $this->text_domain );
200
+ $html .= '&nbsp;(required)</label></td><td>';
201
+ $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'] ) . '">';
202
+ $html .= '</td></tr>';
203
+ $html .= '<tr><td><label for="schema_event_offers_price">';
204
+ $html .= esc_html__( 'Price', $this->text_domain );
205
+ $html .= '&nbsp;(required)</label></td><td>';
206
+ $html .= '<input type="number" name="option[' . "schema_event_offers_price" . ']" id="schema_event_offers_price" required value="' . esc_attr( $args['schema_event_offers_price'] ) . '">';
207
+ $html .= '</td></tr>';
208
+ $html .= '<tr><td><label for="schema_event_offers_currency">';
209
+ $html .= esc_html__( 'Currency', $this->text_domain );
210
+ $html .= '&nbsp;(required)</label></td><td>';
211
+ $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'] ) . '">';
212
+ $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>';
213
+ $html .= '</td></tr>';
214
+ $html .= '</table>';
215
+
216
+ echo $html;
217
+ }
218
+
219
+ /**
220
+ * Save custom post.
221
+ *
222
+ * @version 2.1.0
223
+ * @since 2.1.0
224
+ * @param integer $post_id The post ID.
225
+ */
226
+ public function save_post ( $post_id ) {
227
+ if ( isset( $_POST['option'] ) ) {
228
+ update_post_meta( $post_id, $this->custom_type, serialize( $_POST['option'] ) );
229
+ }
230
+ }
231
+
232
+ /**
233
+ * Return the default options array
234
+ *
235
+ * @version 3.2.3
236
+ * @since 3.2.3
237
+ * @return array $args
238
+ */
239
+ private function get_default_options () {
240
+ $args = array(
241
+ 'schema_event_type' => 'Event',
242
+ 'schema_event_name' => '',
243
+ 'schema_event_description' => '',
244
+ 'schema_event_image' => '',
245
+ 'schema_event_date' => date( 'Y-m-d' ),
246
+ 'schema_event_time' => date( 'h:i' ),
247
+ 'schema_event_date_end' => '',
248
+ 'schema_event_time_end' => '',
249
+ 'schema_event_url' => '',
250
+ 'schema_event_place_name' => '',
251
+ 'schema_event_place_url' => '',
252
+ 'schema_event_place_address' => '',
253
+ 'schema_event_offers_price' => 0,
254
+ 'schema_event_offers_currency' => esc_html__( 'USD', $this->text_domain )
255
+ );
256
+
257
+ return (array) $args;
258
+ }
259
+ }
trunk/includes/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 3.2.3
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 3.2.3
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>';
115
+ $html .= '<tr><td><label for="schema_video_name">';
116
+ $html .= esc_html__( 'Video Name', $this->text_domain );
117
+ $html .= '&nbsp;(required)</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 for="schema_video_description">';
121
+ $html .= esc_html__( 'Video Description', $this->text_domain );
122
+ $html .= '&nbsp;(required)</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 for="schema_video_thumbnail_url">';
126
+ $html .= esc_html__( 'Thumbnail Url', $this->text_domain );
127
+ $html .= '&nbsp;(required)</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 for="schema_video_upload_date">';
131
+ $html .= esc_html__( 'Upload Date', $this->text_domain );
132
+ $html .= '&nbsp;(required)</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 for="schema_video_duration">';
137
+ $html .= esc_html__( 'duration', $this->text_domain );
138
+ $html .= '&nbsp;(recommended)</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 for="schema_video_content_url">';
142
+ $html .= esc_html__( 'contentURL', $this->text_domain );
143
+ $html .= '&nbsp;(recommended)</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 for="schema_video_embed_url">';
147
+ $html .= esc_html__( 'embedURL', $this->text_domain );
148
+ $html .= '&nbsp;(recommended)</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 for="schema_video_interaction_count">';
152
+ $html .= esc_html__( 'interactionCount', $this->text_domain );
153
+ $html .= '&nbsp;(recommended)</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 for="schema_video_expires_date">';
157
+ $html .= esc_html__( 'expires', $this->text_domain );
158
+ $html .= '&nbsp;(recommended)</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/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.0
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 3.0.0
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,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Breadcrumb ShortCode Settings
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.2.4
7
+ * @since 2.0.0
8
+ */
9
+ class Structuring_Markup_ShortCode_Breadcrumb {
10
+
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
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.0.0
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
+ $item_array[] = $this->set_schema_breadcrumb_item( $current_url, get_search_query() );
99
+ } elseif ( is_tag() ) {
100
+ $item_array[] = $this->set_schema_breadcrumb_item( $current_url, single_tag_title( '', false ) );
101
+ } elseif ( is_date() ) {
102
+ $item_array[] = $this->set_schema_breadcrumb_item( get_year_link( get_query_var( 'year' ) ), get_query_var( 'year' ) );
103
+ if ( get_query_var( 'day' ) !== 0 ) {
104
+ $item_array[] = $this->set_schema_breadcrumb_item( get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) ), get_query_var( 'monthnum' ) );
105
+ $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' ) );
106
+ } elseif ( get_query_var( 'monthnum' ) !== 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
+ }
109
+ } elseif ( is_category() ) {
110
+ $categories = get_queried_object();
111
+ if( $categories->parent !== 0 ) {
112
+ $ancestors = array_reverse( get_ancestors( $categories->cat_ID, 'category' ) );
113
+ foreach( $ancestors as $ancestor ) {
114
+ $item_array[] = $this->set_schema_breadcrumb_item( get_category_link( $ancestor ), get_cat_name( $ancestor ) );
115
+ }
116
+ }
117
+ $item_array[] = $this->set_schema_breadcrumb_item( get_category_link( $categories->term_id ), $categories->name );
118
+ } elseif ( is_author() ) {
119
+ $item_array[] = $this->set_schema_breadcrumb_item( $current_url, get_the_author_meta( 'display_name', get_query_var( 'author' ) ) );
120
+ } elseif ( is_page() && $front_page_id != $post->ID ) {
121
+ if( $post->post_parent !== 0 ) {
122
+ $ancestors = array_reverse( get_post_ancestors( $post->ID ) );
123
+ foreach( $ancestors as $ancestor ){
124
+ $item_array[] = $this->set_schema_breadcrumb_item( get_permalink( $ancestor ), get_the_title( $ancestor ) );
125
+ }
126
+ }
127
+ $item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
128
+ } elseif ( is_attachment() ) {
129
+ if ( $post->post_parent !== 0 ) {
130
+ $item_array[] = $this->set_schema_breadcrumb_item( get_permalink( $post->post_parent ), get_the_title( $post->post_parent ) );
131
+ }
132
+ $item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
133
+ } elseif ( is_404() ) {
134
+ $item_array[] = $this->set_schema_breadcrumb_item( $current_url, '404 Not Found' );
135
+ } elseif ( is_post_type_archive() ) {
136
+ if ( get_post_type_archive_link( get_post_type() ) ) {
137
+ $item_array[] = $this->set_schema_breadcrumb_item( get_post_type_archive_link( get_post_type() ), post_type_archive_title( '', false) );
138
+ }
139
+ } elseif ( is_archive() ) {
140
+ if ( get_post_type_archive_link( get_post_type() ) ) {
141
+ $item_array[] = $this->set_schema_breadcrumb_item( get_post_type_archive_link( get_post_type() ), get_post_type_object( get_post_type() )->label );
142
+ }
143
+ if( is_tax() ){
144
+ $tax_slug = get_query_var( 'taxonomy' );
145
+ $term_slug = get_query_var( 'term' );
146
+ $term = get_term_by( "slug", $term_slug, $tax_slug );
147
+
148
+ if( $term->parent !== 0 ) {
149
+ $ancestors = array_reverse( get_ancestors( $term->term_taxonomy_id, $tax_slug ) );
150
+ foreach( $ancestors as $ancestor ) {
151
+ $item_array[] = $this->set_schema_breadcrumb_item( get_category_link( $ancestor ), get_cat_name( $ancestor ) );
152
+ }
153
+ }
154
+ $item_array[] = $this->set_schema_breadcrumb_item( get_term_link( $term_slug, $tax_slug ), esc_html( $term->name ) );
155
+ }
156
+ } elseif ( is_singular( 'post' ) ) {
157
+ $args = $this->set_taxonomy_item( $post->ID, 'category' );
158
+ if ( count( $args ) > 0 ) {
159
+ $item_array = array_merge( $item_array, $args );
160
+ }
161
+ $item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
162
+ } elseif ( is_single() ) {
163
+ if ( get_post_type_archive_link( get_post_type() ) ) {
164
+ $item_array[] = $this->set_schema_breadcrumb_item( get_post_type_archive_link( get_post_type() ), get_post_type_object( get_post_type() )->label );
165
+ }
166
+ $taxonomy_names = get_post_taxonomies();
167
+ if ( count( $taxonomy_names ) > 0 ) {
168
+ $args = $this->set_taxonomy_item( $post->ID, $taxonomy_names[0] );
169
+ if ( count( $args ) > 0 ) {
170
+ $item_array = array_merge( $item_array, $args );
171
+ }
172
+ }
173
+ $item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
174
+ }
175
+
176
+ return (array) $item_array;
177
+ }
178
+
179
+ /**
180
+ * taxonomy item settings
181
+ *
182
+ * @since 4.0.0
183
+ * @version 4.0.0
184
+ * @param int $id
185
+ * @param string $taxonomy
186
+ * @return array $args
187
+ */
188
+ private function set_taxonomy_item ( $id, $taxonomy ) {
189
+ $terms = get_the_terms( $id, $taxonomy );
190
+ $term_bottom = array();
191
+ $args = array();
192
+
193
+ if ( $terms && ! is_wp_error( $terms ) ) {
194
+ $parent_ids = array();
195
+
196
+ foreach ( $terms as $term ) {
197
+ if ( $term->parent != 0 ) {
198
+ $parent_ids[] = $term->parent;
199
+ }
200
+ }
201
+ foreach ( $terms as $term ) {
202
+ if ( !in_array( $term->term_id, $parent_ids ) ) {
203
+ $term_bottom[] = $term->term_id;
204
+ }
205
+ }
206
+ }
207
+
208
+ if ( count( $term_bottom ) > 0 ) {
209
+ $ancestors = array_reverse( get_ancestors( $term_bottom[0], $taxonomy ) );
210
+ $ancestors[] = $term_bottom[0];
211
+
212
+ foreach ( $ancestors as $ancestor ) {
213
+ $args[] = $this->set_schema_breadcrumb_item( get_category_link( $ancestor ), get_cat_name( $ancestor ) );
214
+ }
215
+ }
216
+ return (array) $args;
217
+ }
218
+
219
+ /**
220
+ * Breadcrumb item settings
221
+ *
222
+ * @since 2.0.0
223
+ * @version 2.0.0
224
+ * @param string $id
225
+ * @param string $name
226
+ * @return array $args
227
+ */
228
+ private function set_schema_breadcrumb_item ( $id, $name ) {
229
+ $args = array(
230
+ "@id" => esc_url( $id ),
231
+ "name" => esc_html( $name )
232
+ );
233
+ return (array) $args;
234
+ }
235
+ }
trunk/includes/wp-structuring-utility.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Utility
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 4.0.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
+ }
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,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.7.5
6
+ Stable tag: 4.0.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.0.0 (2017-05-25) =
58
+ * Added : Hook point of AMP plug-ins (Automattic, Inc. release). https://wordpress.org/plugins/amp/
59
+ * Added : Site Navigation on only Home Page.
60
+ * Fixed : Problem with custom taxonomies.(BreadcrumbList)
61
+
62
+ = 3.2.6 (2017-05-20) =
63
+ * Checked : WordPress version 4.7.5 operation check.
64
+
65
+ = 3.2.5 (2017-04-24) =
66
+ * Checked : WordPress version 4.7.4 operation check.
67
+
68
+ = 3.2.4 (2017-03-30) =
69
+ * Fixed : BreadcrumbList - Ignore the Home setting when setting the head fixed page.
70
+ * Fixed : BreadcrumbList - Categories of two or more levels are not displayed.
71
+ * Fixed : Minor bug fixed.
72
+ * Updated : Article,BlogPosting and NewsArticle - Limit headline to 110 chars.
73
+
74
+ = 3.2.3 (2017-03-21) =
75
+ * Fixed : "Warning: Illegal string offset" error occurred on Video and Event Schema.org.
76
+ * Updated : Event Types add fields.
77
+ * Updated : Video Types add fields.
78
+ * Updated : Change selection method of SiteNavigation type.
79
+
80
+ = 3.2.2 (2017-03-09) =
81
+ * Fixed : Article, BlogPosting, and NewsArticle can not display the Publisher attribute.
82
+ * Added : Add media selection function to the field for inputting image path.
83
+ * Checked : WordPress version 4.7.3 operation check.
84
+
85
+ = 3.2.1 (2017-02-21) =
86
+ * Fixed : Call to undefined function imagecreatefromstring().
87
+
88
+ = 3.2.0 (2017-01-30) =
89
+ * Fixed : Invalid breadcrumb markup.
90
+ * Fixed : Some items are not displayed on "Organization schema.org".
91
+ * Added : Add items to e-mail to "Organization schema.org".
92
+ * Checked : WordPress version 4.7.2 operation check.
93
+
94
+ = 3.1.7 (2017-01-12) =
95
+ * Checked : WordPress version 4.7.1 operation check.
96
+
97
+ = 3.1.6 (2016-12-16) =
98
+ * Updated : Change ImageObject attribute of Schema.org type "Article", "BlogPosting", "NewsArticle" from "required" to "recommended".
99
+ * Fixed : Custom post menu control.
100
+
101
+ = 3.1.5 (2016-12-08) =
102
+ * Checked : WordPress version 4.7.0 operation check.
103
+
104
+ = 3.1.4 (2016-11-25) =
105
+ * Added : Schema.org type "LocalBusiness" item added. "Image", "priceRange" and "servesCuisine".
106
+ * Added : Print plugin version in comments.
107
+
108
+ = 3.1.3 (2016-11-22) =
109
+ * Updated : Event Type select item of Schema.org type "Event".
110
+ * Updated : Short Code display changed of Schema.org type "BreadcrumbList".
111
+
112
+ = 3.1.2 (2016-09-27) =
113
+ * Updated : homeLocation input item of Schema.org type "Person".
114
+
115
+ = 3.1.1 (2016-09-20) =
116
+ * Added : Schema.org type "SiteNavigation".
117
+ * Checked : WordPress version 4.6.1 operation check.
118
+ * Updated : Application URL input item of Schema.org type "WebSite".
119
+ * Fixed : LocalBusiness Convert data(In the case of version 2.3.x) Logic remove.
120
+
121
+ = 3.0.5 (2016-09-06) =
122
+ * Fixed : CSS & JavaScript version control.
123
+ * Fixed : Registration screen display adjustment.
124
+
125
+ = 3.0.4 (2016-08-17) =
126
+ * Fixed : Type Person and Organization Non-display case "sameAs" is empty.
127
+ * Checked : WordPress version 4.6.0 operation check.
128
+
129
+ = 3.0.3 (2016-07-27) =
130
+ * 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)
131
+
132
+ = 3.0.2 (2016-07-15) =
133
+ * Updated : Security measures of the update process.
134
+
135
+ = 3.0.1 (2016-06-25) =
136
+
137
+ * Checked : WordPress version 4.5.3 operation check.
138
+
139
+ = 3.0.0 (2016-06-20) =
140
+
141
+ * Added : Schema.org type "Video".
142
+ * Added : Display the cause of the JSON-LD is not output in HTML comments.
143
+ * Fixed : "Schema.org Event" solve the output of JSON-LD is a problem with the double in the custom posts.
144
+ * Fixed : Changes to the search of the array to remove the SQL statement to get the output page.
145
+ * Fixed : "Schema.org Organization" If you have not set up a Social Profiles, it does not show an empty array.
146
+ * Updated : Japanese translation.
147
+
148
+ = 2.5.1 (2016-05-09) =
149
+
150
+ * Checked : WordPress version 4.5.2 operation check.
151
+ * Checked : WordPress version 4.5.1 operation check.
152
+
153
+ = 2.5.0 (2016-04-19) =
154
+
155
+ * Updated : You can select a custom posts at the output page.
156
+ * Updated : Add the output on "Pages" in the "Article","BlogPosting" and "NewsArticle" Schema.org type.
157
+ * Updated : It added the Holiday Opening Hour of items to Schema.org Type "LocalBusiness".
158
+ * Updated : It added the GeoCircle of items to Schema.org Type "LocalBusiness".
159
+ * Updated : Japanese translation.
160
+ * Checked : WordPress version 4.5.0 operation check.
161
+
162
+ = 2.4.2 (2016-03-09) =
163
+
164
+ * Fixed : Updated image size detection to use curl first, as attachment_url_to_postid() hits the database
165
+ * Updated : Added a transient cache class to cache taxing operations
166
+ * Updated : Turkish translation.
167
+
168
+ = 2.4.1 (2016-03-01) =
169
+
170
+ * Updated : Japanese translation.
171
+
172
+ = 2.4.0 (2016-02-06) =
173
+
174
+ * Added : Schema.org type "Person".
175
+ * Updated : Schema.org type "LocalBusiness" OpenHours : shift time setting.
176
+ * Checked : WordPress version 4.4.2 operation check.
177
+
178
+ = 2.3.3 (2016-01-19) =
179
+
180
+ * Fixed : Improved wording on admin pages.
181
+ * Fixed : Added alternate methods to get image dimensions for systems running legacy SSL.
182
+
183
+ = 2.3.2 (2016-01-10) =
184
+
185
+ * Fixed : Fixed a bug that Organization type of display error of contactType comes out.
186
+ * Fixed : Fixed a bug that can not save LocalBusiness type of latitude and longitude.
187
+
188
+ = 2.3.1 (2016-01-07) =
189
+
190
+ * Checked : WordPress version 4.4.1 operation check.
191
+ * Added : Breadcrumb ShortCode option add.
192
+
193
+ = 2.3.0 (2016-01-03) =
194
+
195
+ * Added : Schema.org type "LocalBusiness".
196
+ * Fixed : Organization Definition minor bug fixed.
197
+
198
+ = 2.2.1 (2015-12-21) =
199
+
200
+ * Fixed : Breadcrumb ShortCode minor bug fixed.
201
+
202
+ = 2.2.0 (2015-12-16) =
203
+
204
+ * Updated : Updated on December 14, 2015 was structured data (Article) AMP correspondence. https://developers.google.com/structured-data/rich-snippets/articles?hl=ja
205
+
206
+ = 2.1.3 (2015-12-11) =
207
+
208
+ * Fixed : Minor bug fixed.
209
+
210
+ = 2.1.2 (2015-12-09) =
211
+
212
+ * Check : WordPress version 4.4 operation check.
213
+
214
+ = 2.1.1 (2015-12-04) =
215
+
216
+ * Added : Add the table update processing at the time of version up.
217
+
218
+ = 2.1.0 (2015-12-03) =
219
+
220
+ * Added : Schema.org type "Event" schema.org definition Add "Event" custom post output that works.
221
+
222
+ = 2.0.2 (2015-11-27) =
223
+
224
+ * Fixed : Breadcrumb ShortCode minor bug fixed.
225
+
226
+ = 2.0.1 (2015-11-25) =
227
+
228
+ * Fixed : Notice error fixed.
229
+
230
+ = 2.0.0 (2015-11-23) =
231
+
232
+ * Added : Schema.org type "BreadcrumbList" schema.org definition Add breadcrumbs short code output that works.
233
+ * Updated : Schema.org definition immobilization.
234
+
235
+ = 1.3.2 (2015-11-17) =
236
+
237
+ * Fixed : Fixed translation.
238
+ * Added : Additional output comment.
239
+
240
+ = 1.3.1 =
241
+
242
+ * Fixed : none-function fixed.
243
+
244
+ = 1.3.0 =
245
+
246
+ * Added : Localizing into Japanese.
247
+
248
+ = 1.2.1 =
249
+
250
+ * Updated : Read admin menu css -> wp_register_style setting
251
+ * Fixed : Typo Missing.
252
+
253
+ = 1.2.0 =
254
+
255
+ * Added : Schema.org type "BlogPosting".
256
+
257
+ = 1.1.3 =
258
+
259
+ * Fixed : To escape a newline code and the tag of the body attribute in Type "Article" and "NewsArticle".
260
+
261
+ = 1.1.2 =
262
+
263
+ * Updated : Schema.org type "Article" image attribute.
264
+
265
+ = 1.1.0 =
266
+
267
+ * Added : Schema.org type "Article".
268
+
269
+ = 1.0.1 - 1.0.8 =
270
+
271
+ * Fixed : Missing plugin path setting.
272
+
273
+ = 1.0.0 =
274
+
275
+ * First release of this plugin.
276
+
277
+ == Contact ==
278
+
279
+ * email to foundationmeister[at]outlook.com
280
+ * 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,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.0.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.0.0
22
+ * @since 1.0.0
23
+ */
24
+ class Structuring_Markup {
25
+
26
+ /**
27
+ * Variable definition version.
28
+ *
29
+ * @version 4.0.0
30
+ * @since 1.3.0
31
+ */
32
+ private $version = '4.0.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.0.0
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
+ } else {
60
+ add_action( 'wp_head', array( $this, 'wp_head' ) );
61
+ add_filter( 'amp_post_template_metadata', array( $this, 'amp_post_template_metadata' ), 9 );
62
+ }
63
+ }
64
+
65
+ /**
66
+ * Create table.
67
+ *
68
+ * @version 2.0.0
69
+ * @since 2.0.0
70
+ */
71
+ public function create_table() {
72
+ $db = new Structuring_Markup_Admin_Db();
73
+ $db->create_table( $this->text_domain, $this->version );
74
+ }
75
+
76
+ /**
77
+ * Breadcrumb ShortCode Register.
78
+ *
79
+ * @version 2.3.1
80
+ * @since 2.0.0
81
+ * @param string $args short code params
82
+ * @return string $html
83
+ */
84
+ public function short_code_init_breadcrumb ( $args ) {
85
+ $db = new Structuring_Markup_Admin_Db();
86
+ $results = $db->get_type_options( 'breadcrumb' );
87
+
88
+ if ( isset( $results['option'] ) ) {
89
+ $options = $results['option'];
90
+
91
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-short-code-breadcrumb.php');
92
+ $obj = new Structuring_Markup_ShortCode_Breadcrumb();
93
+ return $obj->short_code_display( $options, $args );
94
+ } else {
95
+ return __return_false();
96
+ }
97
+ }
98
+
99
+ /**
100
+ * i18n.
101
+ *
102
+ * @version 1.3.0
103
+ * @since 1.3.0
104
+ */
105
+ public function plugins_loaded () {
106
+ load_plugin_textdomain( $this->text_domain, __return_false(), dirname( plugin_basename( __FILE__ ) ) . '/languages' );
107
+ }
108
+
109
+ /**
110
+ * Create custom post type.
111
+ *
112
+ * @version 4.0.0
113
+ * @since 2.1.0
114
+ */
115
+ function create_post_type () {
116
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/custom/wp-structuring-custom-post-event.php' );
117
+ new Structuring_Markup_Custom_Post_Event( $this->text_domain );
118
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/custom/wp-structuring-custom-post-video.php' );
119
+ new Structuring_Markup_Custom_Post_Video( $this->text_domain );
120
+ }
121
+
122
+ /**
123
+ * admin init.
124
+ *
125
+ * @version 3.0.5
126
+ * @since 1.3.1
127
+ */
128
+ public function admin_init () {
129
+ /** version up check */
130
+ $options = get_option( $this->text_domain );
131
+ if ( !isset( $options['version'] ) || $options['version'] !== $this->version ) {
132
+ $this->create_table();
133
+ }
134
+
135
+ wp_register_style( 'wp-structuring-markup-admin-style', plugins_url( 'css/style.css', __FILE__ ), array(), $this->version );
136
+ }
137
+
138
+ /**
139
+ * Add Menu to the Admin Screen.
140
+ *
141
+ * @version 3.1.6
142
+ * @since 1.0.0
143
+ */
144
+ public function admin_menu () {
145
+ $list_page = add_menu_page(
146
+ esc_html__( 'Schema.org Settings', $this->text_domain ),
147
+ esc_html__( 'Schema.org Settings', $this->text_domain ),
148
+ 'manage_options',
149
+ plugin_basename( __FILE__ ),
150
+ array( $this, 'list_page_render' )
151
+ );
152
+ $post_page = add_submenu_page(
153
+ $this->text_domain . '-post',
154
+ esc_html__( 'Schema.org Setting Edit', $this->text_domain ),
155
+ esc_html__( 'Edit', $this->text_domain ),
156
+ 'manage_options',
157
+ $this->text_domain . '-post',
158
+ array( $this, 'post_page_render' )
159
+ );
160
+
161
+ /** Using registered $page handle to hook stylesheet loading */
162
+ add_action( 'admin_print_styles-' . $list_page, array( $this, 'add_style' ) );
163
+ add_action( 'admin_print_styles-' . $post_page, array( $this, 'add_style' ) );
164
+ add_action( 'admin_print_scripts-' . $post_page, array( $this, 'admin_scripts' ) );
165
+ }
166
+
167
+ /**
168
+ * CSS admin add.
169
+ *
170
+ * @version 1.3.1
171
+ * @since 1.3.1
172
+ */
173
+ public function add_style () {
174
+ wp_enqueue_style( 'wp-structuring-markup-admin-style' );
175
+ }
176
+
177
+ /**
178
+ * admin_scripts
179
+ *
180
+ * @author Justin Frydman
181
+ * @author Kazuya Takami
182
+ * @version 3.2.2
183
+ * @since 2.4.0
184
+ */
185
+ public function admin_scripts () {
186
+ if ( isset( $_GET["type"] ) && $_GET["type"] === 'local_business' ) {
187
+ wp_enqueue_script ( 'wp-structuring-markup-admin-main-js', plugins_url ( 'js/main.min.js', __FILE__ ), array( 'jquery' ), $this->version );
188
+ }
189
+ if ( isset( $_GET["type"] ) ) {
190
+ switch ( $_GET["type"] ) {
191
+ case "article":
192
+ case "blog_posting":
193
+ case "news_article":
194
+ case "organization":
195
+ wp_enqueue_script ( 'wp-structuring-markup-admin-media-js', plugins_url ( 'js/media-uploader-main.js', __FILE__ ), array( 'jquery' ), $this->version );
196
+ wp_enqueue_media();
197
+ break;
198
+ }
199
+ }
200
+ }
201
+
202
+ /**
203
+ * LIST Page Template Require.
204
+ *
205
+ * @version 4.0.0
206
+ * @since 1.0.0
207
+ */
208
+ public function list_page_render () {
209
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/admin/wp-structuring-admin-list.php' );
210
+ new Structuring_Markup_Admin_List( $this->text_domain );
211
+ }
212
+
213
+ /**
214
+ * POST Page Template Require.
215
+ *
216
+ * @version 4.0.0
217
+ * @since 1.0.0
218
+ */
219
+ public function post_page_render () {
220
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/admin/wp-structuring-admin-post.php' );
221
+ new Structuring_Markup_Admin_Post( $this->text_domain );
222
+ }
223
+
224
+ /**
225
+ * Display Page Template Require.
226
+ *
227
+ * @version 4.0.0
228
+ * @since 1.3.0
229
+ */
230
+ public function wp_head () {
231
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-display.php' );
232
+ new Structuring_Markup_Display( $this->version );
233
+ }
234
+
235
+ /**
236
+ * Display Page Template Require.
237
+ *
238
+ * @version 4.0.0
239
+ * @since 4.0.0
240
+ * @param array $metadata
241
+ * @return array $metadata
242
+ */
243
+ public function amp_post_template_metadata ( array $metadata ) {
244
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-display-amp.php' );
245
+ $amp = new Structuring_Markup_Display_Amp();
246
+
247
+ if ( !empty( $amp->json_ld ) ) {
248
+ $metadata = $amp->json_ld;
249
+ }
250
+ return (array) $metadata;
251
+ }
252
+ }
wp-structuring-markup.php CHANGED
@@ -3,14 +3,14 @@
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: 3.2.6
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/wp-structuring-admin-db.php' );
14
 
15
  new Structuring_Markup();
16
 
@@ -18,7 +18,7 @@ new Structuring_Markup();
18
  * Schema.org Basic Class
19
  *
20
  * @author Kazuya Takami
21
- * @version 3.2.6
22
  * @since 1.0.0
23
  */
24
  class Structuring_Markup {
@@ -26,10 +26,10 @@ class Structuring_Markup {
26
  /**
27
  * Variable definition version.
28
  *
29
- * @version 3.2.6
30
  * @since 1.3.0
31
  */
32
- private $version = '3.2.6';
33
 
34
  /**
35
  * Variable definition Text Domain.
@@ -42,7 +42,7 @@ class Structuring_Markup {
42
  /**
43
  * Constructor Define.
44
  *
45
- * @version 2.4.0
46
  * @since 1.0.0
47
  */
48
  public function __construct() {
@@ -58,6 +58,7 @@ class Structuring_Markup {
58
  add_action( 'admin_menu', array( $this, 'admin_menu' ) );
59
  } else {
60
  add_action( 'wp_head', array( $this, 'wp_head' ) );
 
61
  }
62
  }
63
 
@@ -108,13 +109,13 @@ class Structuring_Markup {
108
  /**
109
  * Create custom post type.
110
  *
111
- * @version 3.0.0
112
  * @since 2.1.0
113
  */
114
  function create_post_type () {
115
- require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-custom-post-event.php' );
116
  new Structuring_Markup_Custom_Post_Event( $this->text_domain );
117
- require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-custom-post-video.php' );
118
  new Structuring_Markup_Custom_Post_Video( $this->text_domain );
119
  }
120
 
@@ -201,34 +202,51 @@ class Structuring_Markup {
201
  /**
202
  * LIST Page Template Require.
203
  *
204
- * @version 1.3.0
205
  * @since 1.0.0
206
  */
207
  public function list_page_render () {
208
- require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-admin-list.php' );
209
  new Structuring_Markup_Admin_List( $this->text_domain );
210
  }
211
 
212
  /**
213
  * POST Page Template Require.
214
  *
215
- * @version 1.3.0
216
  * @since 1.0.0
217
  */
218
  public function post_page_render () {
219
- require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-admin-post.php' );
220
  new Structuring_Markup_Admin_Post( $this->text_domain );
221
  }
222
 
223
  /**
224
  * Display Page Template Require.
225
  *
226
- * @version 3.2.1
227
  * @since 1.3.0
228
  */
229
  public function wp_head () {
230
- require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-opening-hours.php' );
231
  require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-display.php' );
232
  new Structuring_Markup_Display( $this->version );
233
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  }
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.0.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
 
18
  * Schema.org Basic Class
19
  *
20
  * @author Kazuya Takami
21
+ * @version 4.0.0
22
  * @since 1.0.0
23
  */
24
  class Structuring_Markup {
26
  /**
27
  * Variable definition version.
28
  *
29
+ * @version 4.0.0
30
  * @since 1.3.0
31
  */
32
+ private $version = '4.0.0';
33
 
34
  /**
35
  * Variable definition Text Domain.
42
  /**
43
  * Constructor Define.
44
  *
45
+ * @version 4.0.0
46
  * @since 1.0.0
47
  */
48
  public function __construct() {
58
  add_action( 'admin_menu', array( $this, 'admin_menu' ) );
59
  } else {
60
  add_action( 'wp_head', array( $this, 'wp_head' ) );
61
+ add_filter( 'amp_post_template_metadata', array( $this, 'amp_post_template_metadata' ), 9 );
62
  }
63
  }
64
 
109
  /**
110
  * Create custom post type.
111
  *
112
+ * @version 4.0.0
113
  * @since 2.1.0
114
  */
115
  function create_post_type () {
116
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/custom/wp-structuring-custom-post-event.php' );
117
  new Structuring_Markup_Custom_Post_Event( $this->text_domain );
118
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/custom/wp-structuring-custom-post-video.php' );
119
  new Structuring_Markup_Custom_Post_Video( $this->text_domain );
120
  }
121
 
202
  /**
203
  * LIST Page Template Require.
204
  *
205
+ * @version 4.0.0
206
  * @since 1.0.0
207
  */
208
  public function list_page_render () {
209
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/admin/wp-structuring-admin-list.php' );
210
  new Structuring_Markup_Admin_List( $this->text_domain );
211
  }
212
 
213
  /**
214
  * POST Page Template Require.
215
  *
216
+ * @version 4.0.0
217
  * @since 1.0.0
218
  */
219
  public function post_page_render () {
220
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/admin/wp-structuring-admin-post.php' );
221
  new Structuring_Markup_Admin_Post( $this->text_domain );
222
  }
223
 
224
  /**
225
  * Display Page Template Require.
226
  *
227
+ * @version 4.0.0
228
  * @since 1.3.0
229
  */
230
  public function wp_head () {
 
231
  require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-display.php' );
232
  new Structuring_Markup_Display( $this->version );
233
  }
234
+
235
+ /**
236
+ * Display Page Template Require.
237
+ *
238
+ * @version 4.0.0
239
+ * @since 4.0.0
240
+ * @param array $metadata
241
+ * @return array $metadata
242
+ */
243
+ public function amp_post_template_metadata ( array $metadata ) {
244
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-display-amp.php' );
245
+ $amp = new Structuring_Markup_Display_Amp();
246
+
247
+ if ( !empty( $amp->json_ld ) ) {
248
+ $metadata = $amp->json_ld;
249
+ }
250
+ return (array) $metadata;
251
+ }
252
  }