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

Version Description

(2015-12-03) =

  • Added : Schema.org type "Event" schema.org definition Add "Event" custom post output that works
Download this release

Release Info

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

Code changes from version 2.0.2 to 2.1.0

includes/wp-structuring-admin-db.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author Kazuya Takami
6
  * @since 1.0.0
7
- * @version 2.0.0
8
  */
9
  class Structuring_Markup_Admin_Db {
10
 
@@ -12,7 +12,7 @@ class Structuring_Markup_Admin_Db {
12
  * Variable definition.
13
  *
14
  * @since 1.0.0
15
- * @version 2.0.0
16
  */
17
  private $table_name;
18
 
@@ -21,6 +21,7 @@ class Structuring_Markup_Admin_Db {
21
  "article" => "Article",
22
  "blog_posting" => "Blog Posting",
23
  "breadcrumb" => "Breadcrumb",
 
24
  "news_article" => "News Article",
25
  "organization" => "Organization",
26
  "website" => "Web Site"
@@ -32,7 +33,7 @@ class Structuring_Markup_Admin_Db {
32
  * @since 1.0.0
33
  * @version 1.3.2
34
  */
35
- public function __construct() {
36
  global $wpdb;
37
  $this->table_name = $wpdb->prefix . 'structuring_markup';
38
  }
@@ -41,9 +42,9 @@ class Structuring_Markup_Admin_Db {
41
  * Create Table.
42
  *
43
  * @since 1.0.0
44
- * @version 2.0.0
45
  */
46
- public function create_table() {
47
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
48
 
49
  global $wpdb;
@@ -68,12 +69,14 @@ class Structuring_Markup_Admin_Db {
68
  }
69
  } else {
70
  /**
71
- * version 1.x.x -> 2.0.0 migration process.
72
  *
73
- * @since 2.0.0
 
74
  * */
75
  $options = get_option( 'wp_structuring_markup' );
76
- if ( !isset( $options['version'] ) ) {
 
77
  $lists = $this->get_list_options();
78
 
79
  $wpdb->query( "DROP TABLE " . $this->table_name );
@@ -90,9 +93,11 @@ class Structuring_Markup_Admin_Db {
90
  );
91
  foreach ( $lists as $list ) {
92
  if ( $list->type === $key ) {
 
 
93
  $args = array(
94
  'type' => $key,
95
- 'activate' => "on",
96
  'output' => $list->output,
97
  'options' => $list->options,
98
  'register_date' => date( "Y-m-d H:i:s" ),
@@ -110,10 +115,10 @@ class Structuring_Markup_Admin_Db {
110
  * Create table execute
111
  *
112
  * @since 2.0.0
113
- * @version 2.0.0
114
  * @param string $charset_collate
115
  */
116
- private function create_table_execute( $charset_collate ) {
117
  $query = " CREATE TABLE " . $this->table_name;
118
  $query .= " (id MEDIUMINT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY";
119
  $query .= ",type TINYTEXT NOT NULL";
@@ -126,19 +131,19 @@ class Structuring_Markup_Admin_Db {
126
 
127
  dbDelta( $query );
128
 
129
- $options = array( 'version' => '2.0.0' );
130
- add_option( 'wp_structuring_markup', $options, false, 'yes' );
131
  }
132
 
133
  /**
134
  * Get Data.
135
  *
136
  * @since 1.0.0
137
- * @version 1.3.2
138
  * @param integer $id
139
  * @return array $results
140
  */
141
- public function get_options( $id ) {
142
  global $wpdb;
143
 
144
  $query = "SELECT * FROM " . $this->table_name . " WHERE id = %d";
@@ -149,7 +154,7 @@ class Structuring_Markup_Admin_Db {
149
 
150
  if ( $args ) {
151
  $results['id'] = $args->id;
152
- $results['activate'] = $args->activate;
153
  $results['type'] = $args->type;
154
  $results['output'] = unserialize( $args->output );
155
  $results['option'] = unserialize( $args->options );
@@ -163,7 +168,7 @@ class Structuring_Markup_Admin_Db {
163
  * @since 1.0.0
164
  * @return array $results
165
  */
166
- public function get_list_options() {
167
  global $wpdb;
168
 
169
  $query = "SELECT * FROM " . $this->table_name . " ORDER BY type ASC";
@@ -178,7 +183,7 @@ class Structuring_Markup_Admin_Db {
178
  * @param array $output
179
  * @return array $results
180
  */
181
- public function get_select_options( $output ) {
182
  global $wpdb;
183
 
184
  $query = "SELECT * FROM " . $this->table_name . " WHERE output LIKE '%%%s%%'";
@@ -193,11 +198,11 @@ class Structuring_Markup_Admin_Db {
193
  * Get Type Data.
194
  *
195
  * @since 2.0.0
196
- * @version 2.0.0
197
  * @param string $type
198
  * @return array $results
199
  */
200
- public function get_type_options( $type ) {
201
  global $wpdb;
202
 
203
  $query = "SELECT * FROM " . $this->table_name . " WHERE type = %s";
@@ -208,7 +213,7 @@ class Structuring_Markup_Admin_Db {
208
 
209
  if ( $args ) {
210
  $results['id'] = $args->id;
211
- $results['activate'] = $args->activate;
212
  $results['type'] = $args->type;
213
  $results['output'] = unserialize( $args->output );
214
  $results['option'] = unserialize( $args->options );
@@ -223,7 +228,7 @@ class Structuring_Markup_Admin_Db {
223
  * @version 2.0.0
224
  * @param array $args
225
  */
226
- private function insert_options( array $args ) {
227
  global $wpdb;
228
 
229
  $prepared = array( '%s', '%s', '%s', '%s', '%s', '%s' );
@@ -238,7 +243,7 @@ class Structuring_Markup_Admin_Db {
238
  * @param array $post($_POST)
239
  * @return integer $post['id']
240
  */
241
- public function update_options( array $post ) {
242
  global $wpdb;
243
 
244
  $data = array(
@@ -253,6 +258,7 @@ class Structuring_Markup_Admin_Db {
253
  $key_prepared = array( '%d' );
254
 
255
  $wpdb->update( $this->table_name, $data, $key, $prepared, $key_prepared );
 
256
  return (integer) $post['id'];
257
  }
258
  }
4
  *
5
  * @author Kazuya Takami
6
  * @since 1.0.0
7
+ * @version 2.1.0
8
  */
9
  class Structuring_Markup_Admin_Db {
10
 
12
  * Variable definition.
13
  *
14
  * @since 1.0.0
15
+ * @version 2.1.0
16
  */
17
  private $table_name;
18
 
21
  "article" => "Article",
22
  "blog_posting" => "Blog Posting",
23
  "breadcrumb" => "Breadcrumb",
24
+ "event" => "Event",
25
  "news_article" => "News Article",
26
  "organization" => "Organization",
27
  "website" => "Web Site"
33
  * @since 1.0.0
34
  * @version 1.3.2
35
  */
36
+ public function __construct () {
37
  global $wpdb;
38
  $this->table_name = $wpdb->prefix . 'structuring_markup';
39
  }
42
  * Create Table.
43
  *
44
  * @since 1.0.0
45
+ * @version 2.1.0
46
  */
47
+ public function create_table () {
48
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
49
 
50
  global $wpdb;
69
  }
70
  } else {
71
  /**
72
+ * version 1.x.x -> 2.1.0 migration process.
73
  *
74
+ * @since 2.0.0
75
+ * @version 2.1.0
76
  * */
77
  $options = get_option( 'wp_structuring_markup' );
78
+
79
+ if ( !isset( $options['version'] ) || $options['version'] === '2.0.0' ) {
80
  $lists = $this->get_list_options();
81
 
82
  $wpdb->query( "DROP TABLE " . $this->table_name );
93
  );
94
  foreach ( $lists as $list ) {
95
  if ( $list->type === $key ) {
96
+ $activate = isset( $list->activate ) ? $list->activate : "";
97
+
98
  $args = array(
99
  'type' => $key,
100
+ 'activate' => $activate,
101
  'output' => $list->output,
102
  'options' => $list->options,
103
  'register_date' => date( "Y-m-d H:i:s" ),
115
  * Create table execute
116
  *
117
  * @since 2.0.0
118
+ * @version 2.1.0
119
  * @param string $charset_collate
120
  */
121
+ private function create_table_execute ( $charset_collate ) {
122
  $query = " CREATE TABLE " . $this->table_name;
123
  $query .= " (id MEDIUMINT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY";
124
  $query .= ",type TINYTEXT NOT NULL";
131
 
132
  dbDelta( $query );
133
 
134
+ $options = array( 'version' => '2.1.0' );
135
+ update_option( 'wp_structuring_markup', $options, 'yes' );
136
  }
137
 
138
  /**
139
  * Get Data.
140
  *
141
  * @since 1.0.0
142
+ * @version 2.1.0
143
  * @param integer $id
144
  * @return array $results
145
  */
146
+ public function get_options ( $id ) {
147
  global $wpdb;
148
 
149
  $query = "SELECT * FROM " . $this->table_name . " WHERE id = %d";
154
 
155
  if ( $args ) {
156
  $results['id'] = $args->id;
157
+ $results['activate'] = isset( $args->activate ) ? $args->activate : "";
158
  $results['type'] = $args->type;
159
  $results['output'] = unserialize( $args->output );
160
  $results['option'] = unserialize( $args->options );
168
  * @since 1.0.0
169
  * @return array $results
170
  */
171
+ public function get_list_options () {
172
  global $wpdb;
173
 
174
  $query = "SELECT * FROM " . $this->table_name . " ORDER BY type ASC";
183
  * @param array $output
184
  * @return array $results
185
  */
186
+ public function get_select_options ( $output ) {
187
  global $wpdb;
188
 
189
  $query = "SELECT * FROM " . $this->table_name . " WHERE output LIKE '%%%s%%'";
198
  * Get Type Data.
199
  *
200
  * @since 2.0.0
201
+ * @version 2.1.0
202
  * @param string $type
203
  * @return array $results
204
  */
205
+ public function get_type_options ( $type ) {
206
  global $wpdb;
207
 
208
  $query = "SELECT * FROM " . $this->table_name . " WHERE type = %s";
213
 
214
  if ( $args ) {
215
  $results['id'] = $args->id;
216
+ $results['activate'] = isset( $args->activate ) ? $args->activate : "";
217
  $results['type'] = $args->type;
218
  $results['output'] = unserialize( $args->output );
219
  $results['option'] = unserialize( $args->options );
228
  * @version 2.0.0
229
  * @param array $args
230
  */
231
+ private function insert_options ( array $args ) {
232
  global $wpdb;
233
 
234
  $prepared = array( '%s', '%s', '%s', '%s', '%s', '%s' );
243
  * @param array $post($_POST)
244
  * @return integer $post['id']
245
  */
246
+ public function update_options ( array $post ) {
247
  global $wpdb;
248
 
249
  $data = array(
258
  $key_prepared = array( '%d' );
259
 
260
  $wpdb->update( $this->table_name, $data, $key, $prepared, $key_prepared );
261
+
262
  return (integer) $post['id'];
263
  }
264
  }
includes/wp-structuring-admin-list.php CHANGED
@@ -24,9 +24,9 @@ class Structuring_Markup_Admin_List {
24
  * @version 2.0.0
25
  * @param String $text_domain
26
  */
27
- function __construct( $text_domain ) {
28
  $this->text_domain = $text_domain;
29
- $this->page_render( );
30
  }
31
 
32
  /**
@@ -35,7 +35,7 @@ class Structuring_Markup_Admin_List {
35
  * @since 1.0.0
36
  * @version 2.0.0
37
  */
38
- private function page_render( ) {
39
  $post_url = 'admin.php?page=' . $this->text_domain . '-post';
40
 
41
  $html = '';
@@ -62,10 +62,10 @@ class Structuring_Markup_Admin_List {
62
  if ( $results ) {
63
  foreach ( $results as $row ) {
64
  $html = '<tr><td>';
65
- $html .= ( $row->activate === 'on' ) ? '<span class="active">Activate' : '<span class="stop">Stop';
66
  $html .= '</span></td>';
67
  $html .= '<td><a href="';
68
- $html .= admin_url( $post_url . '&type=' . esc_html( $row->type ) . '&schema_post_id=' . esc_html( $row->id ) ). '">' . $type_array[esc_html( $row->type )];
69
  $html .= '</a></td>';
70
  $html .= '<td>' . $this->unserialize_output( $row->output ) . '</td>';
71
  $html .= '<td>';
@@ -78,7 +78,7 @@ class Structuring_Markup_Admin_List {
78
  $html .= '</td>';
79
 
80
  $html .= '<td><a href="';
81
- $html .= $post_url . '&type=' . esc_html( $row->type ) . '&schema_post_id=' . esc_html( $row->id ) . '">' . esc_html__( 'Edit', $this->text_domain );
82
  $html .= '</a></td>';
83
  $html .= '</tr>';
84
  echo $html;
@@ -100,7 +100,7 @@ class Structuring_Markup_Admin_List {
100
  * @param string $obj
101
  * @return string $output
102
  */
103
- private function unserialize_output( $obj ) {
104
  $output = implode( ",", unserialize( $obj ) );
105
  return (string) $output;
106
  }
24
  * @version 2.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
  /**
35
  * @since 1.0.0
36
  * @version 2.0.0
37
  */
38
+ private function page_render () {
39
  $post_url = 'admin.php?page=' . $this->text_domain . '-post';
40
 
41
  $html = '';
62
  if ( $results ) {
63
  foreach ( $results as $row ) {
64
  $html = '<tr><td>';
65
+ $html .= $row->activate === 'on' ? '<span class="active">Activate' : '<span class="stop">Deactivate';
66
  $html .= '</span></td>';
67
  $html .= '<td><a href="';
68
+ $html .= admin_url( $post_url . '&type=' . esc_html( $row->type ) . '&schema_post_id=' . esc_html( $row->id ) ) . '">' . $type_array[esc_html( $row->type )];
69
  $html .= '</a></td>';
70
  $html .= '<td>' . $this->unserialize_output( $row->output ) . '</td>';
71
  $html .= '<td>';
78
  $html .= '</td>';
79
 
80
  $html .= '<td><a href="';
81
+ $html .= admin_url( $post_url . '&type=' . esc_html( $row->type ) . '&schema_post_id=' . esc_html( $row->id ) ) . '">' . esc_html__( 'Edit', $this->text_domain );
82
  $html .= '</a></td>';
83
  $html .= '</tr>';
84
  echo $html;
100
  * @param string $obj
101
  * @return string $output
102
  */
103
+ private function unserialize_output ( $obj ) {
104
  $output = implode( ",", unserialize( $obj ) );
105
  return (string) $output;
106
  }
includes/wp-structuring-admin-post.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author Kazuya Takami
6
  * @since 1.0.0
7
- * @version 2.0.0
8
  */
9
  class Structuring_Markup_Admin_Post {
10
 
@@ -24,7 +24,7 @@ class Structuring_Markup_Admin_Post {
24
  * @version 2.0.0
25
  * @param String $text_domain
26
  */
27
- public function __construct( $text_domain ) {
28
  $this->text_domain = $text_domain;
29
 
30
  /**
@@ -69,6 +69,7 @@ class Structuring_Markup_Admin_Post {
69
  }
70
 
71
  $options = $db->get_options( $options['id'] );
 
72
  $this->page_render( $options, $status );
73
  }
74
 
@@ -76,11 +77,11 @@ class Structuring_Markup_Admin_Post {
76
  * Setting Page of the Admin Screen.
77
  *
78
  * @since 1.0.0
79
- * @version 2.0.0
80
- * @param array $options
81
- * @param string $status
82
  */
83
- private function page_render( array $options, $status ) {
84
  $html = '';
85
  $html .= '<div class="wrap">';
86
  $html .= '<h1>' . esc_html__( 'Schema.org Register', $this->text_domain );
@@ -106,7 +107,7 @@ class Structuring_Markup_Admin_Post {
106
  $html .= '<table class="schema-admin-table">';
107
  $html .= '<tr><th>Activate : </th><td><label>';
108
  $html .= '<input type="checkbox" name="activate" value="on"';
109
- $html .= ( $options['activate'] === "on" ) ? ' checked' : '';
110
  $html .= '>Activate</label></td></tr>';
111
  $html .= '<tr><th>' . esc_html__( 'Output Page', $this->text_domain ) . ' : </th><td>';
112
  echo $html;
@@ -136,6 +137,14 @@ class Structuring_Markup_Admin_Post {
136
  require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-breadcrumb.php' );
137
  new Structuring_Markup_Type_Breadcrumb( $options['option'] );
138
  break;
 
 
 
 
 
 
 
 
139
  case 'news_article':
140
  $html = $this->output_checkbox_render( $options['output'], "post", "Post", esc_html__( 'Post Page', $this->text_domain ) );
141
  $html .= '</td></tr></table><hr>';
@@ -184,7 +193,7 @@ class Structuring_Markup_Admin_Post {
184
  * @param string $display
185
  * @return string $html
186
  */
187
- private function output_checkbox_render( array $option, $output, $value, $display ) {
188
  $html = '<label>';
189
  $html .= '<input type="checkbox" name="output[' . $output . ']" value="' . $value . '""';
190
  $html .= isset( $option[$output] ) ? ' checked' : '';
@@ -200,7 +209,7 @@ class Structuring_Markup_Admin_Post {
200
  * @version 2.0.0
201
  * @return string $html
202
  */
203
- private function information_render() {
204
  $html = '<div id="message" class="updated notice notice-success is-dismissible below-h2">';
205
  $html .= '<p>Schema.org Information Update.</p>';
206
  $html .= '<button type="button" class="notice-dismiss">';
@@ -218,7 +227,7 @@ class Structuring_Markup_Admin_Post {
218
  * @version 2.0.0
219
  * @return string $html
220
  */
221
- private function output_error_render() {
222
  $html = '<div id="notice" class="notice notice-error is-dismissible below-h2">';
223
  $html .= '<p>Output No Select.</p>';
224
  $html .= '<button type="button" class="notice-dismiss">';
4
  *
5
  * @author Kazuya Takami
6
  * @since 1.0.0
7
+ * @version 2.1.0
8
  */
9
  class Structuring_Markup_Admin_Post {
10
 
24
  * @version 2.0.0
25
  * @param String $text_domain
26
  */
27
+ public function __construct ( $text_domain ) {
28
  $this->text_domain = $text_domain;
29
 
30
  /**
69
  }
70
 
71
  $options = $db->get_options( $options['id'] );
72
+
73
  $this->page_render( $options, $status );
74
  }
75
 
77
  * Setting Page of the Admin Screen.
78
  *
79
  * @since 1.0.0
80
+ * @version 2.1.0
81
+ * @param array $options
82
+ * @param string $status
83
  */
84
+ private function page_render ( array $options, $status ) {
85
  $html = '';
86
  $html .= '<div class="wrap">';
87
  $html .= '<h1>' . esc_html__( 'Schema.org Register', $this->text_domain );
107
  $html .= '<table class="schema-admin-table">';
108
  $html .= '<tr><th>Activate : </th><td><label>';
109
  $html .= '<input type="checkbox" name="activate" value="on"';
110
+ $html .= ( isset( $options['activate'] ) && $options['activate'] === "on" ) ? ' checked' : '';
111
  $html .= '>Activate</label></td></tr>';
112
  $html .= '<tr><th>' . esc_html__( 'Output Page', $this->text_domain ) . ' : </th><td>';
113
  echo $html;
137
  require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-breadcrumb.php' );
138
  new Structuring_Markup_Type_Breadcrumb( $options['option'] );
139
  break;
140
+ case 'event':
141
+ $html = $this->output_checkbox_render( $options['output'], "event", "Event Post", esc_html__( 'Event Post Page', $this->text_domain ) );
142
+ $html .= '</td></tr></table><hr>';
143
+ echo $html;
144
+
145
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-event.php' );
146
+ new Structuring_Markup_Type_Event();
147
+ break;
148
  case 'news_article':
149
  $html = $this->output_checkbox_render( $options['output'], "post", "Post", esc_html__( 'Post Page', $this->text_domain ) );
150
  $html .= '</td></tr></table><hr>';
193
  * @param string $display
194
  * @return string $html
195
  */
196
+ private function output_checkbox_render ( array $option, $output, $value, $display ) {
197
  $html = '<label>';
198
  $html .= '<input type="checkbox" name="output[' . $output . ']" value="' . $value . '""';
199
  $html .= isset( $option[$output] ) ? ' checked' : '';
209
  * @version 2.0.0
210
  * @return string $html
211
  */
212
+ private function information_render () {
213
  $html = '<div id="message" class="updated notice notice-success is-dismissible below-h2">';
214
  $html .= '<p>Schema.org Information Update.</p>';
215
  $html .= '<button type="button" class="notice-dismiss">';
227
  * @version 2.0.0
228
  * @return string $html
229
  */
230
+ private function output_error_render () {
231
  $html = '<div id="notice" class="notice notice-error is-dismissible below-h2">';
232
  $html .= '<p>Output No Select.</p>';
233
  $html .= '<button type="button" class="notice-dismiss">';
includes/wp-structuring-admin-type-article.php CHANGED
@@ -7,6 +7,7 @@
7
  * @since 1.1.0
8
  * @see wp-structuring-admin-db.php
9
  * @link http://schema.org/Article
 
10
  */
11
  class Structuring_Markup_Type_Article {
12
 
@@ -15,7 +16,7 @@ class Structuring_Markup_Type_Article {
15
  *
16
  * @since 1.1.0
17
  */
18
- public function __construct() {
19
  $this->page_render();
20
  }
21
 
@@ -24,7 +25,7 @@ class Structuring_Markup_Type_Article {
24
  *
25
  * @since 1.1.0
26
  */
27
- private function page_render() {
28
  $html = '<table class="schema-admin-table">';
29
  $html .= '<caption>Basic Setting( Post Page Only )</caption>';
30
  $html .= '<tr><th>headline :</th><td><small>Default : post_title</small></td></tr>';
7
  * @since 1.1.0
8
  * @see wp-structuring-admin-db.php
9
  * @link http://schema.org/Article
10
+ * @link https://developers.google.com/structured-data/rich-snippets/articles
11
  */
12
  class Structuring_Markup_Type_Article {
13
 
16
  *
17
  * @since 1.1.0
18
  */
19
+ public function __construct () {
20
  $this->page_render();
21
  }
22
 
25
  *
26
  * @since 1.1.0
27
  */
28
+ private function page_render () {
29
  $html = '<table class="schema-admin-table">';
30
  $html .= '<caption>Basic Setting( Post Page Only )</caption>';
31
  $html .= '<tr><th>headline :</th><td><small>Default : post_title</small></td></tr>';
includes/wp-structuring-admin-type-blog-posting.php CHANGED
@@ -7,6 +7,7 @@
7
  * @since 1.2.0
8
  * @see wp-structuring-admin-db.php
9
  * @link http://schema.org/BlogPosting
 
10
  */
11
  class Structuring_Markup_Type_Blog_Posting {
12
 
@@ -15,7 +16,7 @@ class Structuring_Markup_Type_Blog_Posting {
15
  *
16
  * @since 1.2.0
17
  */
18
- public function __construct() {
19
  $this->page_render();
20
  }
21
 
@@ -24,7 +25,7 @@ class Structuring_Markup_Type_Blog_Posting {
24
  *
25
  * @since 1.2.0
26
  */
27
- private function page_render() {
28
  $html = '<table class="schema-admin-table">';
29
  $html .= '<caption>Basic Setting( Post Page Only )</caption>';
30
  $html .= '<tr><th>headline :</th><td><small>Default : post_title</small></td></tr>';
7
  * @since 1.2.0
8
  * @see wp-structuring-admin-db.php
9
  * @link http://schema.org/BlogPosting
10
+ * @link https://developers.google.com/structured-data/rich-snippets/articles
11
  */
12
  class Structuring_Markup_Type_Blog_Posting {
13
 
16
  *
17
  * @since 1.2.0
18
  */
19
+ public function __construct () {
20
  $this->page_render();
21
  }
22
 
25
  *
26
  * @since 1.2.0
27
  */
28
+ private function page_render () {
29
  $html = '<table class="schema-admin-table">';
30
  $html .= '<caption>Basic Setting( Post Page Only )</caption>';
31
  $html .= '<tr><th>headline :</th><td><small>Default : post_title</small></td></tr>';
includes/wp-structuring-admin-type-breadcrumb.php CHANGED
@@ -17,7 +17,7 @@ class Structuring_Markup_Type_Breadcrumb {
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 );
@@ -31,7 +31,7 @@ class Structuring_Markup_Type_Breadcrumb {
31
  * @since 2.0.0
32
  * @param array $option
33
  */
34
- private function page_render( array $option ) {
35
  $html = '<table class="schema-admin-table">';
36
  $html .= '<caption>Basic Setting</caption>';
37
  $html .= '<tr><th><label for="home_on">Home Display :</label></th><td>';
@@ -61,7 +61,7 @@ class Structuring_Markup_Type_Breadcrumb {
61
  * @param array $args
62
  * @return array $args
63
  */
64
- private function get_default_options( array $args ) {
65
  $args['home_on'] = '';
66
  $args['home_name'] = '';
67
 
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 );
31
  * @since 2.0.0
32
  * @param array $option
33
  */
34
+ private function page_render ( array $option ) {
35
  $html = '<table class="schema-admin-table">';
36
  $html .= '<caption>Basic Setting</caption>';
37
  $html .= '<tr><th><label for="home_on">Home Display :</label></th><td>';
61
  * @param array $args
62
  * @return array $args
63
  */
64
+ private function get_default_options ( array $args ) {
65
  $args['home_on'] = '';
66
  $args['home_name'] = '';
67
 
includes/wp-structuring-admin-type-event.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Event
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 2.1.0
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/structured-data/events/
13
+ * @link https://developers.google.com/structured-data/rich-snippets/events
14
+ */
15
+ class Structuring_Markup_Type_Event {
16
+
17
+ /**
18
+ * Constructor Define.
19
+ *
20
+ * @since 2.1.0
21
+ */
22
+ public function __construct () {
23
+ $this->page_render();
24
+ }
25
+
26
+ /**
27
+ * Form Layout Render
28
+ *
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>name :</th><td><small>Input a custom post: field name "schema_event_name"</small></td></tr>';
35
+ $html .= '<tr><th>startDate :</th><td><small>Input a custom post: field name "schema_event_date" & "schema_event_time"</small></td></tr>';
36
+ $html .= '<tr><th>url :</th><td><small>Input a custom post: field name "schema_event_url"</small></td></tr>';
37
+ $html .= '</table>';
38
+ echo $html;
39
+
40
+ $html = '<table class="schema-admin-table">';
41
+ $html .= '<caption>Location Type "Place" Setting</caption>';
42
+ $html .= '<tr><th>name :</th><td><small>Input a custom post: field name "schema_event_place_name"</small></td></tr>';
43
+ $html .= '<tr><th>url(sameAs) :</th><td><small>Input a custom post: field name "schema_event_place_url"</small></td></tr>';
44
+ $html .= '<tr><th>address :</th><td><small>Input a custom post: field name "schema_event_place_address"</small></td></tr>';
45
+ $html .= '</table>';
46
+ echo $html;
47
+
48
+ $html = '<table class="schema-admin-table">';
49
+ $html .= '<caption>Location Type "Offers" Setting</caption>';
50
+ $html .= '<tr><th>price :</th><td><small>Input a custom post: field name "schema_event_place_name"</small></td></tr>';
51
+ $html .= '<tr><th>priceCurrency :</th><td><small>Input a custom post: field name "schema_event_place_address"</small></td></tr>';
52
+ $html .= '<tr><th>url :</th><td><small>Input a custom post: field name "schema_event_place_url"</small></td></tr>';
53
+ $html .= '</table>';
54
+ echo $html;
55
+
56
+ echo '<p>Custom post name "schema_event_post"</p>';
57
+ echo '<p>Setting Knowledge : <a href="https://developers.google.com/structured-data/rich-snippets/events" target="_blank">https://developers.google.com/structured-data/rich-snippets/events</a></p>';
58
+
59
+ submit_button();
60
+ }
61
+ }
includes/wp-structuring-admin-type-news-article.php CHANGED
@@ -16,7 +16,7 @@ class Structuring_Markup_Type_NewsArticle {
16
  *
17
  * @since 1.0.0
18
  */
19
- public function __construct() {
20
  $this->page_render();
21
  }
22
 
@@ -25,7 +25,7 @@ class Structuring_Markup_Type_NewsArticle {
25
  *
26
  * @since 1.0.0
27
  */
28
- private function page_render() {
29
  $html = '<table class="schema-admin-table">';
30
  $html .= '<caption>Basic Setting( Post Page Only )</caption>';
31
  $html .= '<tr><th>headline :</th><td><small>Default : post_title</small></td></tr>';
16
  *
17
  * @since 1.0.0
18
  */
19
+ public function __construct () {
20
  $this->page_render();
21
  }
22
 
25
  *
26
  * @since 1.0.0
27
  */
28
+ private function page_render () {
29
  $html = '<table class="schema-admin-table">';
30
  $html .= '<caption>Basic Setting( Post Page Only )</caption>';
31
  $html .= '<tr><th>headline :</th><td><small>Default : post_title</small></td></tr>';
includes/wp-structuring-admin-type-organization.php CHANGED
@@ -48,7 +48,7 @@ class Structuring_Markup_Type_Organization {
48
  * @since 1.0.0
49
  * @param array $option
50
  */
51
- public function __construct( array $option ) {
52
  /** Default Value Set */
53
  if ( empty( $option ) ) {
54
  $option = $this->get_default_options( $option );
@@ -62,7 +62,7 @@ class Structuring_Markup_Type_Organization {
62
  * @since 1.0.0
63
  * @param array $option
64
  */
65
- private function page_render( array $option ) {
66
  /** Logos */
67
  $html = '<table class="schema-admin-table">';
68
  $html .= '<caption>Logos</caption>';
@@ -153,7 +153,7 @@ class Structuring_Markup_Type_Organization {
153
  * @param array $args
154
  * @return array $args
155
  */
156
- private function get_default_options( array $args ) {
157
  $args['name'] = get_bloginfo('name');
158
  $args['url'] = get_bloginfo('url');
159
  $args['logo'] = get_bloginfo('url') . '/images/logo.png';
48
  * @since 1.0.0
49
  * @param array $option
50
  */
51
+ public function __construct ( array $option ) {
52
  /** Default Value Set */
53
  if ( empty( $option ) ) {
54
  $option = $this->get_default_options( $option );
62
  * @since 1.0.0
63
  * @param array $option
64
  */
65
+ private function page_render ( array $option ) {
66
  /** Logos */
67
  $html = '<table class="schema-admin-table">';
68
  $html .= '<caption>Logos</caption>';
153
  * @param array $args
154
  * @return array $args
155
  */
156
+ private function get_default_options ( array $args ) {
157
  $args['name'] = get_bloginfo('name');
158
  $args['url'] = get_bloginfo('url');
159
  $args['logo'] = get_bloginfo('url') . '/images/logo.png';
includes/wp-structuring-admin-type-website.php CHANGED
@@ -18,7 +18,7 @@ class Structuring_Markup_Type_Website {
18
  * @since 1.0.0
19
  * @param array $option
20
  */
21
- public function __construct( array $option ) {
22
  /** Default Value Set */
23
  if ( empty( $option ) ) {
24
  $option = $this->get_default_options( $option );
@@ -32,7 +32,7 @@ class Structuring_Markup_Type_Website {
32
  * @since 1.0.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><label for="name">name :</label></th><td>';
@@ -78,7 +78,7 @@ class Structuring_Markup_Type_Website {
78
  * @param array $args
79
  * @return array $args
80
  */
81
- private function get_default_options( array $args ) {
82
  $args['name'] = get_bloginfo('name');
83
  $args['alternateName'] = $args['name'];
84
  $args['url'] = get_bloginfo('url');
18
  * @since 1.0.0
19
  * @param array $option
20
  */
21
+ public function __construct ( array $option ) {
22
  /** Default Value Set */
23
  if ( empty( $option ) ) {
24
  $option = $this->get_default_options( $option );
32
  * @since 1.0.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><label for="name">name :</label></th><td>';
78
  * @param array $args
79
  * @return array $args
80
  */
81
+ private function get_default_options ( array $args ) {
82
  $args['name'] = get_bloginfo('name');
83
  $args['alternateName'] = $args['name'];
84
  $args['url'] = get_bloginfo('url');
includes/wp-structuring-custom-post-event.php ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Custom Post "Event"
4
+ *
5
+ * @author Kazuya Takami
6
+ * @since 2.1.0
7
+ * @version 2.1.0
8
+ */
9
+ class Structuring_Markup_Custom_Post_Event {
10
+
11
+ /**
12
+ * Variable definition.
13
+ *
14
+ * @since 2.1.0
15
+ * @version 2.1.0
16
+ */
17
+ private $text_domain;
18
+ private $custom_type = 'schema_event_post';
19
+
20
+ /**
21
+ * Constructor Define.
22
+ *
23
+ * @since 2.1.0
24
+ * @version 2.1.0
25
+ * @param String $text_domain
26
+ */
27
+ public function __construct ( $text_domain ) {
28
+ $this->text_domain = $text_domain;
29
+
30
+ register_post_type(
31
+ $this->custom_type,
32
+ array(
33
+ 'labels' => array(
34
+ 'name' => esc_html__( 'Event Posts', $this->text_domain ),
35
+ 'singular_name' => esc_html__( 'Event Posts', $this->text_domain )
36
+ ),
37
+ 'public' => true,
38
+ 'menu_position' => 5,
39
+ 'has_archive' => true,
40
+ 'supports' => array( 'title', 'editor', 'author', 'thumbnail' ),
41
+ 'rewrite' => array( 'slug' => 'events' ),
42
+ )
43
+ );
44
+
45
+ if ( is_admin() ) {
46
+ add_action( 'admin_init', array( $this, 'admin_init' ) );
47
+ add_action( 'admin_menu', array( $this, 'admin_menu' ) );
48
+ }
49
+ }
50
+
51
+ /**
52
+ * admin init.
53
+ *
54
+ * @since 2.1.0
55
+ * @version 2.1.0
56
+ */
57
+ public function admin_init () {
58
+ add_action( 'save_post_' . $this->custom_type, array( $this, 'save_post' ) );
59
+ }
60
+
61
+ /**
62
+ * admin meta boxes.
63
+ *
64
+ * @since 2.1.0
65
+ * @version 2.1.0
66
+ */
67
+ public function admin_menu () {
68
+ $custom_field_title = esc_html__( 'Schema.org Type Event', $this->text_domain );
69
+ add_meta_box( $this->custom_type, $custom_field_title, array( $this, 'set_custom_fields' ), $this->custom_type, 'normal' );
70
+ }
71
+
72
+ /**
73
+ * Set custom fields.
74
+ *
75
+ * @since 2.1.0
76
+ * @version 2.1.0
77
+ */
78
+ public function set_custom_fields () {
79
+ $args = get_post_meta( get_the_ID(), $this->custom_type, false );
80
+ $args = isset( $args[0] ) ? unserialize( $args[0] ) : "";
81
+
82
+ if ( !isset( $args['schema_event_name'] ) ) $args['schema_event_name'] = '';
83
+ if ( !isset( $args['schema_event_date'] ) ) $args['schema_event_date'] = date( 'Y-m-d' );
84
+ if ( !isset( $args['schema_event_time'] ) ) $args['schema_event_time'] = date( 'h:i' );
85
+ if ( !isset( $args['schema_event_url'] ) ) $args['schema_event_url'] = '';
86
+ if ( !isset( $args['schema_event_place_name'] ) ) $args['schema_event_place_name'] = '';
87
+ if ( !isset( $args['schema_event_place_url'] ) ) $args['schema_event_place_url'] = '';
88
+ if ( !isset( $args['schema_event_place_address'] ) ) $args['schema_event_place_address'] = '';
89
+ if ( !isset( $args['schema_event_offers_price'] ) ) $args['schema_event_offers_price'] = 0;
90
+ if ( !isset( $args['schema_event_offers_currency'] ) ) $args['schema_event_offers_currency'] = esc_html__( 'USD', $this->text_domain );
91
+
92
+ $html = '';
93
+ $html .= '<table>';
94
+ $html .= '<tr><th><label for="schema_event_name">';
95
+ $html .= esc_html__( 'Event Name', $this->text_domain );
96
+ $html .= '</label></th><td>';
97
+ $html .= '<input type="text" name="option[' . "schema_event_name" . ']" id="schema_event_name" class="regular-text" required value="' . esc_attr( $args['schema_event_name'] ) . '">';
98
+ $html .= '</td></tr>';
99
+ $html .= '<tr><th><label for="schema_event_date">';
100
+ $html .= esc_html__( 'Start Date', $this->text_domain );
101
+ $html .= '</label></th><td>';
102
+ $html .= '<input type="date" name="option[' . "schema_event_date" . ']" id="schema_event_date" required value="' . esc_attr( $args['schema_event_date'] ) . '">';
103
+ $html .= '<input type="time" name="option[' . "schema_event_time" . ']" id="schema_event_time" required value="' . esc_attr( $args['schema_event_time'] ) . '">';
104
+ $html .= '</td></tr>';
105
+ $html .= '<tr><th><label for="schema_event_url">';
106
+ $html .= esc_html__( 'Event URL', $this->text_domain );
107
+ $html .= '</label></th><td>';
108
+ $html .= '<input type="text" name="option[' . "schema_event_url" . ']" id="schema_event_url" class="regular-text" required value="' . esc_attr( $args['schema_event_url'] ) . '">';
109
+ $html .= '</td></tr>';
110
+ $html .= '<tr><th><label for="schema_event_place_name">';
111
+ $html .= esc_html__( 'Place Name', $this->text_domain );
112
+ $html .= '</label></th><td>';
113
+ $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'] ) . '">';
114
+ $html .= '</td></tr>';
115
+ $html .= '<tr><th><label for="schema_event_place_url">';
116
+ $html .= esc_html__( 'Place URL', $this->text_domain );
117
+ $html .= '</label></th><td>';
118
+ $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'] ) . '">';
119
+ $html .= '</td></tr>';
120
+ $html .= '<tr><th><label for="schema_event_place_address">';
121
+ $html .= esc_html__( 'Place Address', $this->text_domain );
122
+ $html .= '</label></th><td>';
123
+ $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'] ) . '">';
124
+ $html .= '</td></tr>';
125
+ $html .= '<tr><th><label for="schema_event_offers_price">';
126
+ $html .= esc_html__( 'Price', $this->text_domain );
127
+ $html .= '</label></th><td>';
128
+ $html .= '<input type="number" name="option[' . "schema_event_offers_price" . ']" id="schema_event_offers_price" required value="' . esc_attr( $args['schema_event_offers_price'] ) . '">';
129
+ $html .= '</td></tr>';
130
+ $html .= '<tr><th><label for="schema_event_offers_currency">';
131
+ $html .= esc_html__( 'Currency', $this->text_domain );
132
+ $html .= '</label></th><td>';
133
+ $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'] ) . '">';
134
+ $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>';
135
+ $html .= '</td></tr>';
136
+ $html .= '</table>';
137
+
138
+ echo $html;
139
+ }
140
+
141
+ /**
142
+ * Save custom post.
143
+ *
144
+ * @since 2.1.0
145
+ * @version 2.1.0
146
+ * @param integer $post_id The post ID.
147
+ */
148
+ public function save_post ( $post_id ) {
149
+ if ( isset( $_POST['option'] ) ) {
150
+ update_post_meta( $post_id, $this->custom_type, serialize( $_POST['option'] ) );
151
+ }
152
+ }
153
+ }
includes/wp-structuring-display.php CHANGED
@@ -3,7 +3,7 @@
3
  * Schema.org Display
4
  *
5
  * @author Kazuya Takami
6
- * @version 2.0.1
7
  * @since 1.0.0
8
  */
9
  class Structuring_Markup_Display {
@@ -13,7 +13,7 @@ class Structuring_Markup_Display {
13
  *
14
  * @since 1.0.0
15
  */
16
- public function __construct() {
17
  $db = new Structuring_Markup_Admin_Db();
18
  $this->set_schema( $db );
19
  }
@@ -22,18 +22,21 @@ class Structuring_Markup_Display {
22
  * Setting schema.org
23
  *
24
  * @since 1.0.0
25
- * @version 2.0.0
26
  * @param Structuring_Markup_Admin_Db $db
27
  */
28
- private function set_schema( Structuring_Markup_Admin_Db $db ) {
29
  echo '<!-- Markup (JSON-LD) structured in schema.org START -->' . PHP_EOL;
30
  $this->get_schema_data( $db, 'all' );
31
  if ( is_home() ) {
32
  $this->get_schema_data( $db, 'home' );
33
  }
34
- if ( is_single() ) {
35
  $this->get_schema_data( $db, 'post' );
36
  }
 
 
 
37
  if ( is_page() ) {
38
  $this->get_schema_data( $db, 'page' );
39
  }
@@ -44,11 +47,11 @@ class Structuring_Markup_Display {
44
  * Setting JSON-LD Template
45
  *
46
  * @since 1.0.0
47
- * @version 2.0.1
48
  * @param Structuring_Markup_Admin_Db $db
49
  * @param string $output
50
  */
51
- private function get_schema_data( Structuring_Markup_Admin_Db $db, $output ) {
52
  $results = $db->get_select_options( $output );
53
 
54
  if ( isset( $results ) ) {
@@ -66,6 +69,9 @@ class Structuring_Markup_Display {
66
  $this->set_schema_breadcrumb(unserialize($row->options));
67
  }
68
  break;
 
 
 
69
  case 'news_article':
70
  $this->set_schema_news_article();
71
  break;
@@ -91,7 +97,7 @@ class Structuring_Markup_Display {
91
  * @since 1.0.0
92
  * @param array $args
93
  */
94
- private function set_schema_json( array $args ) {
95
  echo '<script type="application/ld+json">' , PHP_EOL;
96
  echo json_encode( $args, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ) , PHP_EOL;
97
  echo '</script>' , PHP_EOL;
@@ -105,7 +111,7 @@ class Structuring_Markup_Display {
105
  * @param string $text
106
  * @return string $text
107
  */
108
- private function escape_text_tags( $text ) {
109
  return (string) str_replace( array( "\r", "\n" ), '', strip_tags( $text ) );
110
  }
111
 
@@ -115,7 +121,7 @@ class Structuring_Markup_Display {
115
  * @since 1.1.0
116
  * @version 1.1.3
117
  */
118
- private function set_schema_article() {
119
  global $post;
120
  if ( has_post_thumbnail( $post->ID ) ) {
121
  $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
@@ -139,7 +145,7 @@ class Structuring_Markup_Display {
139
  * @since 1.2.0
140
  * @version 1.2.0
141
  */
142
- private function set_schema_blog_posting() {
143
  global $post;
144
  if ( has_post_thumbnail( $post->ID ) ) {
145
  $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
@@ -165,7 +171,7 @@ class Structuring_Markup_Display {
165
  * @version 2.0.0
166
  * @param array $options
167
  */
168
- private function set_schema_breadcrumb( array $options ) {
169
  require_once( plugin_dir_path( __FILE__ ) . 'wp-structuring-short-code-breadcrumb.php' );
170
  $obj = new Structuring_Markup_ShortCode_Breadcrumb();
171
  $item_array = $obj->breadcrumb_array_setting( $options );
@@ -194,13 +200,59 @@ class Structuring_Markup_Display {
194
  }
195
  }
196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  /**
198
  * Setting schema.org NewsArticle
199
  *
200
  * @since 1.0.0
201
  * @version 1.1.3
202
  */
203
- private function set_schema_news_article() {
204
  global $post;
205
  if ( has_post_thumbnail( $post->ID ) ) {
206
  $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
@@ -224,7 +276,7 @@ class Structuring_Markup_Display {
224
  * @version 1.2.1
225
  * @param array $options
226
  */
227
- private function set_schema_organization( array $options ) {
228
  /** Logos */
229
  $args = array(
230
  "@context" => "http://schema.org",
@@ -266,7 +318,7 @@ class Structuring_Markup_Display {
266
  * @since 1.0.0
267
  * @param array $options
268
  */
269
- private function set_schema_website( array $options ) {
270
  $args = array(
271
  "@context" => "http://schema.org",
272
  "@type" => "WebSite",
3
  * Schema.org Display
4
  *
5
  * @author Kazuya Takami
6
+ * @version 2.1.0
7
  * @since 1.0.0
8
  */
9
  class Structuring_Markup_Display {
13
  *
14
  * @since 1.0.0
15
  */
16
+ public function __construct () {
17
  $db = new Structuring_Markup_Admin_Db();
18
  $this->set_schema( $db );
19
  }
22
  * Setting schema.org
23
  *
24
  * @since 1.0.0
25
+ * @version 2.1.0
26
  * @param Structuring_Markup_Admin_Db $db
27
  */
28
+ private function set_schema ( Structuring_Markup_Admin_Db $db ) {
29
  echo '<!-- Markup (JSON-LD) structured in schema.org START -->' . PHP_EOL;
30
  $this->get_schema_data( $db, 'all' );
31
  if ( is_home() ) {
32
  $this->get_schema_data( $db, 'home' );
33
  }
34
+ if ( is_single() && get_post_type() === 'post' ) {
35
  $this->get_schema_data( $db, 'post' );
36
  }
37
+ if ( is_singular( 'schema_event_post' ) ) {
38
+ $this->get_schema_data( $db, 'event' );
39
+ }
40
  if ( is_page() ) {
41
  $this->get_schema_data( $db, 'page' );
42
  }
47
  * Setting JSON-LD Template
48
  *
49
  * @since 1.0.0
50
+ * @version 2.1.0
51
  * @param Structuring_Markup_Admin_Db $db
52
  * @param string $output
53
  */
54
+ private function get_schema_data ( Structuring_Markup_Admin_Db $db, $output ) {
55
  $results = $db->get_select_options( $output );
56
 
57
  if ( isset( $results ) ) {
69
  $this->set_schema_breadcrumb(unserialize($row->options));
70
  }
71
  break;
72
+ case 'event':
73
+ $this->set_schema_event();
74
+ break;
75
  case 'news_article':
76
  $this->set_schema_news_article();
77
  break;
97
  * @since 1.0.0
98
  * @param array $args
99
  */
100
+ private function set_schema_json ( array $args ) {
101
  echo '<script type="application/ld+json">' , PHP_EOL;
102
  echo json_encode( $args, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ) , PHP_EOL;
103
  echo '</script>' , PHP_EOL;
111
  * @param string $text
112
  * @return string $text
113
  */
114
+ private function escape_text_tags ( $text ) {
115
  return (string) str_replace( array( "\r", "\n" ), '', strip_tags( $text ) );
116
  }
117
 
121
  * @since 1.1.0
122
  * @version 1.1.3
123
  */
124
+ private function set_schema_article () {
125
  global $post;
126
  if ( has_post_thumbnail( $post->ID ) ) {
127
  $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
145
  * @since 1.2.0
146
  * @version 1.2.0
147
  */
148
+ private function set_schema_blog_posting () {
149
  global $post;
150
  if ( has_post_thumbnail( $post->ID ) ) {
151
  $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
171
  * @version 2.0.0
172
  * @param array $options
173
  */
174
+ private function set_schema_breadcrumb ( array $options ) {
175
  require_once( plugin_dir_path( __FILE__ ) . 'wp-structuring-short-code-breadcrumb.php' );
176
  $obj = new Structuring_Markup_ShortCode_Breadcrumb();
177
  $item_array = $obj->breadcrumb_array_setting( $options );
200
  }
201
  }
202
 
203
+ /**
204
+ * Setting schema.org Event
205
+ *
206
+ * @since 2.1.0
207
+ * @version 2.1.0
208
+ */
209
+ private function set_schema_event () {
210
+ global $post;
211
+ $meta = get_post_meta( $post->ID, 'schema_event_post', false );
212
+
213
+ if ( isset( $meta[0] ) ) {
214
+ $meta = unserialize( $meta[0] );
215
+
216
+ if ( !isset( $meta['schema_event_name']) ) $meta['schema_event_name'] = '';
217
+ if ( !isset( $meta['schema_event_date']) ) $meta['schema_event_date'] = date('Y-m-d');
218
+ if ( !isset( $meta['schema_event_time']) ) $meta['schema_event_time'] = date('h:i');
219
+ if ( !isset( $meta['schema_event_url']) ) $meta['schema_event_url'] = '';
220
+ if ( !isset( $meta['schema_event_place_name'] ) ) $meta['schema_event_place_name'] = '';
221
+ if ( !isset( $meta['schema_event_place_url'] ) ) $meta['schema_event_place_url'] = '';
222
+ if ( !isset( $meta['schema_event_place_address'] ) ) $meta['schema_event_place_address'] = '';
223
+ if ( !isset( $meta['schema_event_offers_price'] ) ) $meta['schema_event_offers_price'] = 0;
224
+ if ( !isset( $meta['schema_event_offers_currency'] ) ) $meta['schema_event_offers_currency'] = '';
225
+
226
+ $args = array(
227
+ "@context" => "http://schema.org",
228
+ "@type" => "Event",
229
+ "name" => $this->escape_text_tags( $meta['schema_event_name'] ),
230
+ "startDate" => $this->escape_text_tags( $meta['schema_event_date'] ) . 'T' . $this->escape_text_tags( $meta['schema_event_time'] ),
231
+ "url" => esc_url( $meta['schema_event_url'] ),
232
+ "location" => array(
233
+ "@type" => "Place",
234
+ "sameAs" => esc_url( $meta['schema_event_place_url'] ),
235
+ "name" => $this->escape_text_tags( $meta['schema_event_place_name'] ),
236
+ "address" => $this->escape_text_tags( $meta['schema_event_place_address'] )
237
+ ),
238
+ "offers" => array(
239
+ "@type" => "Offer",
240
+ "price" => $this->escape_text_tags( $meta['schema_event_offers_price'] ),
241
+ "priceCurrency" => $this->escape_text_tags( $meta['schema_event_offers_currency'] ),
242
+ "url" => esc_url( $meta['schema_event_url'] )
243
+ )
244
+ );
245
+ $this->set_schema_json( $args );
246
+ }
247
+ }
248
+
249
  /**
250
  * Setting schema.org NewsArticle
251
  *
252
  * @since 1.0.0
253
  * @version 1.1.3
254
  */
255
+ private function set_schema_news_article () {
256
  global $post;
257
  if ( has_post_thumbnail( $post->ID ) ) {
258
  $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
276
  * @version 1.2.1
277
  * @param array $options
278
  */
279
+ private function set_schema_organization ( array $options ) {
280
  /** Logos */
281
  $args = array(
282
  "@context" => "http://schema.org",
318
  * @since 1.0.0
319
  * @param array $options
320
  */
321
+ private function set_schema_website ( array $options ) {
322
  $args = array(
323
  "@context" => "http://schema.org",
324
  "@type" => "WebSite",
includes/wp-structuring-short-code-breadcrumb.php CHANGED
@@ -3,7 +3,7 @@
3
  * Breadcrumb ShortCode Settings
4
  *
5
  * @author Kazuya Takami
6
- * @version 2.0.2
7
  * @since 2.0.0
8
  */
9
  class Structuring_Markup_ShortCode_Breadcrumb {
@@ -16,7 +16,7 @@ class Structuring_Markup_ShortCode_Breadcrumb {
16
  * @param array $options
17
  * @return string $html
18
  */
19
- public function short_code_display( array $options ) {
20
  $item_array = $this->breadcrumb_array_setting( $options );
21
  $html = '';
22
 
@@ -40,13 +40,13 @@ class Structuring_Markup_ShortCode_Breadcrumb {
40
  /**
41
  * Breadcrumb array setting.
42
  *
43
- * @version 2.0.2
44
  * @since 2.0.0
45
  * @access public
46
  * @param array $options
47
  * @return array $item_array
48
  */
49
- public function breadcrumb_array_setting( array $options ) {
50
  global $post;
51
 
52
  /** item build */
@@ -99,15 +99,17 @@ class Structuring_Markup_ShortCode_Breadcrumb {
99
  $item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
100
  } elseif ( is_single() ) {
101
  $categories = get_the_category($post->ID);
102
- $cat = $categories[0];
 
103
 
104
- if( $cat->parent !== 0){
105
- $ancestors = array_reverse( get_ancestors( $cat->cat_ID, 'category' ) );
106
- foreach( $ancestors as $ancestor ){
107
- $item_array[] = $this->set_schema_breadcrumb_item( get_category_link( $ancestor ), get_cat_name( $ancestor ) );
 
108
  }
 
109
  }
110
- $item_array[] = $this->set_schema_breadcrumb_item( get_category_link( $cat->term_id ), $cat->name );
111
  $item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
112
  }
113
 
@@ -123,7 +125,7 @@ class Structuring_Markup_ShortCode_Breadcrumb {
123
  * @param string $name
124
  * @return array $args
125
  */
126
- private function set_schema_breadcrumb_item( $id, $name ) {
127
  $args = array(
128
  "@id" => esc_html( $id ),
129
  "name" => esc_html( $name )
3
  * Breadcrumb ShortCode Settings
4
  *
5
  * @author Kazuya Takami
6
+ * @version 2.1.0
7
  * @since 2.0.0
8
  */
9
  class Structuring_Markup_ShortCode_Breadcrumb {
16
  * @param array $options
17
  * @return string $html
18
  */
19
+ public function short_code_display ( array $options ) {
20
  $item_array = $this->breadcrumb_array_setting( $options );
21
  $html = '';
22
 
40
  /**
41
  * Breadcrumb array setting.
42
  *
43
+ * @version 2.1.0
44
  * @since 2.0.0
45
  * @access public
46
  * @param array $options
47
  * @return array $item_array
48
  */
49
+ public function breadcrumb_array_setting ( array $options ) {
50
  global $post;
51
 
52
  /** item build */
99
  $item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
100
  } elseif ( is_single() ) {
101
  $categories = get_the_category($post->ID);
102
+ if ( isset($categories[0]) ) {
103
+ $cat = $categories[0];
104
 
105
+ if ( $cat->parent !== 0 ) {
106
+ $ancestors = array_reverse( get_ancestors( $cat->cat_ID, 'category' ) );
107
+ foreach ( $ancestors as $ancestor ) {
108
+ $item_array[] = $this->set_schema_breadcrumb_item( get_category_link( $ancestor ), get_cat_name( $ancestor ) );
109
+ }
110
  }
111
+ $item_array[] = $this->set_schema_breadcrumb_item( get_category_link( $cat->term_id ), $cat->name);
112
  }
 
113
  $item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
114
  }
115
 
125
  * @param string $name
126
  * @return array $args
127
  */
128
+ private function set_schema_breadcrumb_item ( $id, $name ) {
129
  $args = array(
130
  "@id" => esc_html( $id ),
131
  "name" => esc_html( $name )
languages/wp-structuring-markup-ja.mo CHANGED
Binary file
languages/wp-structuring-markup-ja.po CHANGED
@@ -2,10 +2,9 @@
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.0.0\n"
6
- "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-structuring-"
7
- "markup\n"
8
- "POT-Creation-Date: 2015-11-23 00:21:34+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -19,22 +18,22 @@ msgstr "Schema.org 設定一覧"
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 Type"
26
- msgstr ""
27
 
28
  #: includes/wp-structuring-admin-list.php:52
29
- #: includes/wp-structuring-admin-post.php:111
30
  msgid "Output Page"
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:116
38
  msgid "Edit"
39
  msgstr "編集"
40
 
@@ -42,49 +41,99 @@ msgstr "編集"
42
  msgid "Without registration."
43
  msgstr "登録されていません。"
44
 
45
- #: includes/wp-structuring-admin-post.php:86
46
  msgid "Schema.org Register"
47
- msgstr ""
48
 
49
- #: includes/wp-structuring-admin-post.php:116
50
- #: includes/wp-structuring-admin-post.php:124
51
- #: includes/wp-structuring-admin-post.php:140
52
- #: includes/wp-structuring-admin-post.php:150
53
- #: includes/wp-structuring-admin-post.php:161
54
  msgid "Post Page"
55
  msgstr "投稿ページ"
56
 
57
- #: includes/wp-structuring-admin-post.php:132
58
- #: includes/wp-structuring-admin-post.php:148
59
- #: includes/wp-structuring-admin-post.php:159
60
  msgid "All Page"
61
  msgstr "全てのページ"
62
 
63
- #: includes/wp-structuring-admin-post.php:149
64
- #: includes/wp-structuring-admin-post.php:160
 
 
 
 
65
  msgid "Top Page"
66
  msgstr "トップページ"
67
 
68
- #: includes/wp-structuring-admin-post.php:151
69
- #: includes/wp-structuring-admin-post.php:162
70
  msgid "Fixed Page"
71
  msgstr "固定ページ"
72
 
73
- #: wp-structuring-markup.php:107 wp-structuring-markup.php:108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  msgid "Schema.org Settings"
75
  msgstr "Schema.org 設定"
76
 
77
- #: wp-structuring-markup.php:115
78
  msgid "Schema.org Setting Edit"
79
- msgstr "Schema.org 編集"
80
 
81
  #. Plugin Name of the plugin/theme
82
  msgid "Markup (JSON-LD) structured in schema.org"
83
- msgstr ""
84
 
85
  #. Plugin URI of the plugin/theme
86
  msgid "https://wordpress.org/plugins/wp-structuring-markup/"
87
- msgstr ""
88
 
89
  #. Description of the plugin/theme
90
  msgid ""
@@ -94,8 +143,8 @@ msgstr "このプラグインは、投稿ページ、固定ページなどにsch
94
 
95
  #. Author of the plugin/theme
96
  msgid "Kazuya Takami"
97
- msgstr ""
98
 
99
  #. Author URI of the plugin/theme
100
  msgid "http://programp.com/"
101
- msgstr ""
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.1.0\n"
6
+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-structuring-markup\n"
7
+ "POT-Creation-Date: 2015-12-03 08:59:46+00:00\n"
 
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
18
 
19
  #: includes/wp-structuring-admin-list.php:50
20
  msgid "Status"
21
+ msgstr "Status"
22
 
23
  #: includes/wp-structuring-admin-list.php:51
24
  msgid "Schema Type"
25
+ msgstr "Schema タイプ"
26
 
27
  #: includes/wp-structuring-admin-list.php:52
28
+ #: includes/wp-structuring-admin-post.php:112
29
  msgid "Output Page"
30
+ msgstr "出力ページ"
31
 
32
  #: includes/wp-structuring-admin-list.php:53
33
  msgid "ShortCode"
34
+ msgstr "ショートコード"
35
 
36
+ #: includes/wp-structuring-admin-list.php:81 wp-structuring-markup.php:134
37
  msgid "Edit"
38
  msgstr "編集"
39
 
41
  msgid "Without registration."
42
  msgstr "登録されていません。"
43
 
44
+ #: includes/wp-structuring-admin-post.php:87
45
  msgid "Schema.org Register"
46
+ msgstr "Schema.org 登録"
47
 
48
+ #: includes/wp-structuring-admin-post.php:117
49
+ #: includes/wp-structuring-admin-post.php:125
50
+ #: includes/wp-structuring-admin-post.php:149
51
+ #: includes/wp-structuring-admin-post.php:159
52
+ #: includes/wp-structuring-admin-post.php:170
53
  msgid "Post Page"
54
  msgstr "投稿ページ"
55
 
56
+ #: includes/wp-structuring-admin-post.php:133
57
+ #: includes/wp-structuring-admin-post.php:157
58
+ #: includes/wp-structuring-admin-post.php:168
59
  msgid "All Page"
60
  msgstr "全てのページ"
61
 
62
+ #: includes/wp-structuring-admin-post.php:141
63
+ msgid "Event Post Page"
64
+ msgstr "イベント投稿ページ"
65
+
66
+ #: includes/wp-structuring-admin-post.php:158
67
+ #: includes/wp-structuring-admin-post.php:169
68
  msgid "Top Page"
69
  msgstr "トップページ"
70
 
71
+ #: includes/wp-structuring-admin-post.php:160
72
+ #: includes/wp-structuring-admin-post.php:171
73
  msgid "Fixed Page"
74
  msgstr "固定ページ"
75
 
76
+ #: includes/wp-structuring-custom-post-event.php:34
77
+ #: includes/wp-structuring-custom-post-event.php:35
78
+ msgid "Event Posts"
79
+ msgstr "イベント投稿"
80
+
81
+ #: includes/wp-structuring-custom-post-event.php:68
82
+ msgid "Schema.org Type Event"
83
+ msgstr "Schema.org Type Event"
84
+
85
+ #: includes/wp-structuring-custom-post-event.php:90
86
+ #: includes/wp-structuring-display.php:224
87
+ msgid "USD"
88
+ msgstr "JPY"
89
+
90
+ #: includes/wp-structuring-custom-post-event.php:95
91
+ msgid "Event Name"
92
+ msgstr "イベント名"
93
+
94
+ #: includes/wp-structuring-custom-post-event.php:100
95
+ msgid "Start Date"
96
+ msgstr "開始日"
97
+
98
+ #: includes/wp-structuring-custom-post-event.php:106
99
+ msgid "Event URL"
100
+ msgstr "イベントURL"
101
+
102
+ #: includes/wp-structuring-custom-post-event.php:111
103
+ msgid "Place Name"
104
+ msgstr "場所名"
105
+
106
+ #: includes/wp-structuring-custom-post-event.php:116
107
+ msgid "Place URL"
108
+ msgstr "会場URL"
109
+
110
+ #: includes/wp-structuring-custom-post-event.php:121
111
+ msgid "Place Address"
112
+ msgstr "会場住所"
113
+
114
+ #: includes/wp-structuring-custom-post-event.php:126
115
+ msgid "Price"
116
+ msgstr "参加料"
117
+
118
+ #: includes/wp-structuring-custom-post-event.php:131
119
+ msgid "Currency"
120
+ msgstr "通貨"
121
+
122
+ #: wp-structuring-markup.php:125 wp-structuring-markup.php:126
123
  msgid "Schema.org Settings"
124
  msgstr "Schema.org 設定"
125
 
126
+ #: wp-structuring-markup.php:133
127
  msgid "Schema.org Setting Edit"
128
+ msgstr "Schema.org 設定編集"
129
 
130
  #. Plugin Name of the plugin/theme
131
  msgid "Markup (JSON-LD) structured in schema.org"
132
+ msgstr "Markup (JSON-LD) structured in schema.org"
133
 
134
  #. Plugin URI of the plugin/theme
135
  msgid "https://wordpress.org/plugins/wp-structuring-markup/"
136
+ msgstr "https://wordpress.org/plugins/wp-structuring-markup/"
137
 
138
  #. Description of the plugin/theme
139
  msgid ""
143
 
144
  #. Author of the plugin/theme
145
  msgid "Kazuya Takami"
146
+ msgstr "Kazuya Takami"
147
 
148
  #. Author URI of the plugin/theme
149
  msgid "http://programp.com/"
150
+ msgstr "http://programp.com/"
languages/wp-structuring-markup.pot CHANGED
@@ -2,10 +2,10 @@
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.0.0\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-structuring-"
7
  "markup\n"
8
- "POT-Creation-Date: 2015-11-23 00:32:54+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -26,7 +26,7 @@ msgid "Schema Type"
26
  msgstr ""
27
 
28
  #: includes/wp-structuring-admin-list.php:52
29
- #: includes/wp-structuring-admin-post.php:111
30
  msgid "Output Page"
31
  msgstr ""
32
 
@@ -34,7 +34,7 @@ msgstr ""
34
  msgid "ShortCode"
35
  msgstr ""
36
 
37
- #: includes/wp-structuring-admin-list.php:81 wp-structuring-markup.php:116
38
  msgid "Edit"
39
  msgstr ""
40
 
@@ -42,39 +42,89 @@ msgstr ""
42
  msgid "Without registration."
43
  msgstr ""
44
 
45
- #: includes/wp-structuring-admin-post.php:86
46
  msgid "Schema.org Register"
47
  msgstr ""
48
 
49
- #: includes/wp-structuring-admin-post.php:116
50
- #: includes/wp-structuring-admin-post.php:124
51
- #: includes/wp-structuring-admin-post.php:140
52
- #: includes/wp-structuring-admin-post.php:150
53
- #: includes/wp-structuring-admin-post.php:161
54
  msgid "Post Page"
55
  msgstr ""
56
 
57
- #: includes/wp-structuring-admin-post.php:132
58
- #: includes/wp-structuring-admin-post.php:148
59
- #: includes/wp-structuring-admin-post.php:159
60
  msgid "All Page"
61
  msgstr ""
62
 
63
- #: includes/wp-structuring-admin-post.php:149
64
- #: includes/wp-structuring-admin-post.php:160
 
 
 
 
65
  msgid "Top Page"
66
  msgstr ""
67
 
68
- #: includes/wp-structuring-admin-post.php:151
69
- #: includes/wp-structuring-admin-post.php:162
70
  msgid "Fixed Page"
71
  msgstr ""
72
 
73
- #: wp-structuring-markup.php:107 wp-structuring-markup.php:108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  msgid "Schema.org Settings"
75
  msgstr ""
76
 
77
- #: wp-structuring-markup.php:115
78
  msgid "Schema.org Setting Edit"
79
  msgstr ""
80
 
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.1.0\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-structuring-"
7
  "markup\n"
8
+ "POT-Creation-Date: 2015-12-03 08:59:46+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
26
  msgstr ""
27
 
28
  #: includes/wp-structuring-admin-list.php:52
29
+ #: includes/wp-structuring-admin-post.php:112
30
  msgid "Output Page"
31
  msgstr ""
32
 
34
  msgid "ShortCode"
35
  msgstr ""
36
 
37
+ #: includes/wp-structuring-admin-list.php:81 wp-structuring-markup.php:134
38
  msgid "Edit"
39
  msgstr ""
40
 
42
  msgid "Without registration."
43
  msgstr ""
44
 
45
+ #: includes/wp-structuring-admin-post.php:87
46
  msgid "Schema.org Register"
47
  msgstr ""
48
 
49
+ #: includes/wp-structuring-admin-post.php:117
50
+ #: includes/wp-structuring-admin-post.php:125
51
+ #: includes/wp-structuring-admin-post.php:149
52
+ #: includes/wp-structuring-admin-post.php:159
53
+ #: includes/wp-structuring-admin-post.php:170
54
  msgid "Post Page"
55
  msgstr ""
56
 
57
+ #: includes/wp-structuring-admin-post.php:133
58
+ #: includes/wp-structuring-admin-post.php:157
59
+ #: includes/wp-structuring-admin-post.php:168
60
  msgid "All Page"
61
  msgstr ""
62
 
63
+ #: includes/wp-structuring-admin-post.php:141
64
+ msgid "Event Post Page"
65
+ msgstr ""
66
+
67
+ #: includes/wp-structuring-admin-post.php:158
68
+ #: includes/wp-structuring-admin-post.php:169
69
  msgid "Top Page"
70
  msgstr ""
71
 
72
+ #: includes/wp-structuring-admin-post.php:160
73
+ #: includes/wp-structuring-admin-post.php:171
74
  msgid "Fixed Page"
75
  msgstr ""
76
 
77
+ #: includes/wp-structuring-custom-post-event.php:34
78
+ #: includes/wp-structuring-custom-post-event.php:35
79
+ msgid "Event Posts"
80
+ msgstr ""
81
+
82
+ #: includes/wp-structuring-custom-post-event.php:68
83
+ msgid "Schema.org Type Event"
84
+ msgstr ""
85
+
86
+ #: includes/wp-structuring-custom-post-event.php:90
87
+ #: includes/wp-structuring-display.php:224
88
+ msgid "USD"
89
+ msgstr ""
90
+
91
+ #: includes/wp-structuring-custom-post-event.php:95
92
+ msgid "Event Name"
93
+ msgstr ""
94
+
95
+ #: includes/wp-structuring-custom-post-event.php:100
96
+ msgid "Start Date"
97
+ msgstr ""
98
+
99
+ #: includes/wp-structuring-custom-post-event.php:106
100
+ msgid "Event URL"
101
+ msgstr ""
102
+
103
+ #: includes/wp-structuring-custom-post-event.php:111
104
+ msgid "Place Name"
105
+ msgstr ""
106
+
107
+ #: includes/wp-structuring-custom-post-event.php:116
108
+ msgid "Place URL"
109
+ msgstr ""
110
+
111
+ #: includes/wp-structuring-custom-post-event.php:121
112
+ msgid "Place Address"
113
+ msgstr ""
114
+
115
+ #: includes/wp-structuring-custom-post-event.php:126
116
+ msgid "Price"
117
+ msgstr ""
118
+
119
+ #: includes/wp-structuring-custom-post-event.php:131
120
+ msgid "Currency"
121
+ msgstr ""
122
+
123
+ #: wp-structuring-markup.php:125 wp-structuring-markup.php:126
124
  msgid "Schema.org Settings"
125
  msgstr ""
126
 
127
+ #: wp-structuring-markup.php:133
128
  msgid "Schema.org Setting Edit"
129
  msgstr ""
130
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: miiitaka
3
  Tags: schema, schema.org, json, json-ld, seo, post, posts, google
4
  Requires at least: 4.3.1
5
  Tested up to: 4.3.1
6
- Stable tag: 2.0.2
7
 
8
  It is plug in to implement structured markup (JSON-LD syntax) by schema.org definition on an post page, fixed page and etc.
9
 
@@ -12,14 +12,12 @@ It is plug in to implement structured markup (JSON-LD syntax) by schema.org defi
12
  It is plug in to implement structured markup (JSON-LD syntax) by schema.org definition on an post page, fixed page and etc.
13
  Base knowledge is "https://schema.org/" and "https://developers.google.com/structured-data/"
14
 
15
- このプラグインは、投稿ページ、固定ページなどにschema.org定義の構造化マークアップ(JSON-LDの構文)を実装するプラグインです。
16
- 基本知識は、https://schema.org/ や https://developers.google.com/structured-data/ を参考にしてください。
17
-
18
  = Schema.org Type =
19
 
20
  * Article: http://schema.org/Article
21
  * BlogPosting: http://schema.org/BlogPosting
22
  * BreadcrumbList: https://schema.org/BreadcrumbList
 
23
  * NewsArticle: http://schema.org/NewsArticle
24
  * Organization: https://schema.org/Organization
25
  * Website: https://schema.org/WebSite
@@ -28,8 +26,6 @@ Base knowledge is "https://schema.org/" and "https://developers.google.com/struc
28
 
29
  You can display the breadcrumbs in the short code. Breadcrumb definition is available even if not active.
30
 
31
- ショートコードでパンくずリストを表示することができます。Breadcrumb定義がアクティブでなくても使用可能です。
32
-
33
  `[wp-structuring-markup-breadcrumb]`
34
 
35
  == Installation ==
@@ -41,20 +37,24 @@ You can display the breadcrumbs in the short code. Breadcrumb definition is avai
41
 
42
  == Changelog ==
43
 
44
- = 2.0.2 (2015/11/27)=
 
 
 
 
45
 
46
  * Fixed : Breadcrumb ShortCode minor bug fixed.
47
 
48
- = 2.0.1 (2015/11/25) =
49
 
50
  * Fixed : Notice error fixed.
51
 
52
- = 2.0.0 (2015/11/23) =
53
 
54
- * Added : Schema.org type "BreadcrumbList" Breadcrumbs schema.org definition Add breadcrumbs short code output that works
55
  * Updated : Schema.org definition immobilization.
56
 
57
- = 1.3.2 (2015/11/17) =
58
 
59
  * Fixed : Fixed translation.
60
  * Added : Additional output comment.
3
  Tags: schema, schema.org, json, json-ld, seo, post, posts, google
4
  Requires at least: 4.3.1
5
  Tested up to: 4.3.1
6
+ Stable tag: 2.1.0
7
 
8
  It is plug in to implement structured markup (JSON-LD syntax) by schema.org definition on an post page, fixed page and etc.
9
 
12
  It is plug in to implement structured markup (JSON-LD syntax) by schema.org definition on an post page, fixed page and etc.
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
  * NewsArticle: http://schema.org/NewsArticle
22
  * Organization: https://schema.org/Organization
23
  * Website: https://schema.org/WebSite
26
 
27
  You can display the breadcrumbs in the short code. Breadcrumb definition is available even if not active.
28
 
 
 
29
  `[wp-structuring-markup-breadcrumb]`
30
 
31
  == Installation ==
37
 
38
  == Changelog ==
39
 
40
+ = 2.1.0 (2015-12-03) =
41
+
42
+ * Added : Schema.org type "Event" schema.org definition Add "Event" custom post output that works
43
+
44
+ = 2.0.2 (2015-11-27) =
45
 
46
  * Fixed : Breadcrumb ShortCode minor bug fixed.
47
 
48
+ = 2.0.1 (2015-11-25) =
49
 
50
  * Fixed : Notice error fixed.
51
 
52
+ = 2.0.0 (2015-11-23) =
53
 
54
+ * Added : Schema.org type "BreadcrumbList" schema.org definition Add breadcrumbs short code output that works
55
  * Updated : Schema.org definition immobilization.
56
 
57
+ = 1.3.2 (2015-11-17) =
58
 
59
  * Fixed : Fixed translation.
60
  * Added : Additional output comment.
uninstall.php CHANGED
@@ -8,30 +8,76 @@ new Structuring_Markup_Uninstall();
8
  * Schema.org Plugin Uninstall
9
  *
10
  * @author Kazuya Takami
11
- * @version 1.0.0
12
  * @since 1.0.0
13
  */
14
  class Structuring_Markup_Uninstall {
15
 
 
 
 
 
 
 
 
 
16
  /**
17
  * Constructor Define.
18
  *
19
  * @since 1.0.0
20
  * @version 2.0.0
21
  */
22
- function __construct() {
23
- $this->drop_table();
 
 
24
  delete_option( 'wp_structuring_markup' );
25
  }
26
 
27
  /**
28
  * Drop Table.
29
  *
30
- * @since 1.0.0
 
 
31
  */
32
- private function drop_table() {
33
  global $wpdb;
34
- $table_name = $wpdb->prefix . "structuring_markup";
35
  $wpdb->query( "DROP TABLE IF EXISTS " . $table_name );
36
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  }
8
  * Schema.org Plugin Uninstall
9
  *
10
  * @author Kazuya Takami
11
+ * @version 2.1.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 2.1.0
21
+ */
22
+ private $custom_type = 'schema_event_post';
23
+
24
  /**
25
  * Constructor Define.
26
  *
27
  * @since 1.0.0
28
  * @version 2.0.0
29
  */
30
+ public function __construct () {
31
+ $this->drop_table( 'structuring_markup' );
32
+ $this->delete_custom_post( $this->custom_type );
33
+ $this->delete_post_meta( $this->custom_type );
34
  delete_option( 'wp_structuring_markup' );
35
  }
36
 
37
  /**
38
  * Drop Table.
39
  *
40
+ * @since 1.0.0
41
+ * @version 2.1.0
42
+ * @param string $table_name
43
  */
44
+ private function drop_table ( $table_name = null ) {
45
  global $wpdb;
46
+ $table_name = $wpdb->prefix . $table_name;
47
  $wpdb->query( "DROP TABLE IF EXISTS " . $table_name );
48
  }
49
+
50
+ /**
51
+ * Delete custom post.
52
+ *
53
+ * @since 2.1.0
54
+ * @version 2.1.0
55
+ * @param string $custom_type
56
+ */
57
+ private function delete_custom_post ( $custom_type = null ) {
58
+ global $wpdb;
59
+ $table_name = $wpdb->prefix . "posts";
60
+
61
+ $key = array( 'post_type' => $custom_type );
62
+ $key_prepared = array( '%s' );
63
+
64
+ $wpdb->delete( $table_name, $key, $key_prepared );
65
+ }
66
+
67
+ /**
68
+ * Delete post meta.
69
+ *
70
+ * @since 2.1.0
71
+ * @version 2.1.0
72
+ * @param string $custom_type
73
+ */
74
+ private function delete_post_meta ( $custom_type = null ) {
75
+ global $wpdb;
76
+ $table_name = $wpdb->prefix . "postmeta";
77
+
78
+ $key = array( 'meta_key' => $custom_type );
79
+ $key_prepared = array( '%s' );
80
+
81
+ $wpdb->delete( $table_name, $key, $key_prepared );
82
+ }
83
  }
wp-structuring-markup.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Markup (JSON-LD) structured in schema.org
4
  Plugin URI: https://wordpress.org/plugins/wp-structuring-markup/
5
  Description: It is plug in to implement structured markup (JSON-LD syntax) by schema.org definition on an article or the fixed page.
6
- Version: 2.0.2
7
  Author: Kazuya Takami
8
  Author URI: http://programp.com/
9
  License: GPLv2 or later
@@ -19,7 +19,7 @@ new Structuring_Markup();
19
  *
20
  * @author Kazuya Takami
21
  * @since 1.0.0
22
- * @version 2.0.0
23
  */
24
  class Structuring_Markup {
25
 
@@ -34,12 +34,15 @@ class Structuring_Markup {
34
  * Constructor Define.
35
  *
36
  * @since 1.0.0
37
- * @version 2.0.0
38
  */
39
  public function __construct() {
40
  register_activation_hook( __FILE__, array( $this, 'create_table' ) );
 
41
  add_shortcode( $this->text_domain . '-breadcrumb', array( $this, 'short_code_init_breadcrumb' ) );
 
42
  add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
 
43
 
44
  if ( is_admin() ) {
45
  add_action( 'admin_init', array( $this, 'admin_init' ) );
@@ -52,7 +55,8 @@ class Structuring_Markup {
52
  /**
53
  * Create table.
54
  *
55
- * @since 2.0.0
 
56
  */
57
  public function create_table() {
58
  $db = new Structuring_Markup_Admin_Db();
@@ -62,18 +66,21 @@ class Structuring_Markup {
62
  /**
63
  * Breadcrumb ShortCode Register.
64
  *
65
- * @since 2.0.0
66
- * @return string $html
 
67
  */
68
  public function short_code_init_breadcrumb () {
69
- /** DB Connect */
70
  $db = new Structuring_Markup_Admin_Db();
71
  $results = $db->get_type_options( 'breadcrumb' );
72
- $options = $results['option'];
73
 
74
- require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-short-code-breadcrumb.php' );
75
- $obj = new Structuring_Markup_ShortCode_Breadcrumb();
76
- return $obj->short_code_display( $options );
 
 
 
 
77
  }
78
 
79
  /**
@@ -82,17 +89,28 @@ class Structuring_Markup {
82
  * @since 1.3.0
83
  * @version 1.3.0
84
  */
85
- public function plugins_loaded() {
86
  load_plugin_textdomain( $this->text_domain, false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
87
  }
88
 
 
 
 
 
 
 
 
 
 
 
 
89
  /**
90
  * admin init.
91
  *
92
  * @since 1.3.1
93
  * @version 1.3.1
94
  */
95
- public function admin_init() {
96
  wp_register_style( 'wp-structuring-markup-admin-style', plugins_url( 'css/style.css', __FILE__ ) );
97
  }
98
 
@@ -102,7 +120,7 @@ class Structuring_Markup {
102
  * @since 1.0.0
103
  * @version 2.0.0
104
  */
105
- public function admin_menu() {
106
  $list_page = add_menu_page(
107
  esc_html__( 'Schema.org Settings', $this->text_domain ),
108
  esc_html__( 'Schema.org Settings', $this->text_domain ),
@@ -122,6 +140,24 @@ class Structuring_Markup {
122
  /** Using registered $page handle to hook stylesheet loading */
123
  add_action( 'admin_print_styles-' . $list_page, array( $this, 'add_style' ) );
124
  add_action( 'admin_print_styles-' . $post_page, array( $this, 'add_style' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  }
126
 
127
  /**
@@ -130,7 +166,7 @@ class Structuring_Markup {
130
  * @since 1.3.1
131
  * @version 1.3.1
132
  */
133
- public function add_style() {
134
  wp_enqueue_style( 'wp-structuring-markup-admin-style' );
135
  }
136
 
@@ -140,7 +176,7 @@ class Structuring_Markup {
140
  * @since 1.0.0
141
  * @version 1.3.0
142
  */
143
- public function list_page_render() {
144
  require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-admin-list.php' );
145
  new Structuring_Markup_Admin_List( $this->text_domain );
146
  }
@@ -151,7 +187,7 @@ class Structuring_Markup {
151
  * @since 1.0.0
152
  * @version 1.3.0
153
  */
154
- public function post_page_render() {
155
  require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-admin-post.php' );
156
  new Structuring_Markup_Admin_Post( $this->text_domain );
157
  }
@@ -162,7 +198,7 @@ class Structuring_Markup {
162
  * @since 1.3.0
163
  * @version 1.3.0
164
  */
165
- public function wp_head() {
166
  require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-display.php' );
167
  new Structuring_Markup_Display();
168
  }
3
  Plugin Name: Markup (JSON-LD) structured in schema.org
4
  Plugin URI: https://wordpress.org/plugins/wp-structuring-markup/
5
  Description: It is plug in to implement structured markup (JSON-LD syntax) by schema.org definition on an article or the fixed page.
6
+ Version: 2.1.0
7
  Author: Kazuya Takami
8
  Author URI: http://programp.com/
9
  License: GPLv2 or later
19
  *
20
  * @author Kazuya Takami
21
  * @since 1.0.0
22
+ * @version 2.1.0
23
  */
24
  class Structuring_Markup {
25
 
34
  * Constructor Define.
35
  *
36
  * @since 1.0.0
37
+ * @version 2.1.0
38
  */
39
  public function __construct() {
40
  register_activation_hook( __FILE__, array( $this, 'create_table' ) );
41
+
42
  add_shortcode( $this->text_domain . '-breadcrumb', array( $this, 'short_code_init_breadcrumb' ) );
43
+
44
  add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
45
+ add_action( 'init', array( $this, 'create_post_type_event' ) );
46
 
47
  if ( is_admin() ) {
48
  add_action( 'admin_init', array( $this, 'admin_init' ) );
55
  /**
56
  * Create table.
57
  *
58
+ * @since 2.0.0
59
+ * @version 2.0.0
60
  */
61
  public function create_table() {
62
  $db = new Structuring_Markup_Admin_Db();
66
  /**
67
  * Breadcrumb ShortCode Register.
68
  *
69
+ * @since 2.0.0
70
+ * @version 2.0.0
71
+ * @return string $html
72
  */
73
  public function short_code_init_breadcrumb () {
 
74
  $db = new Structuring_Markup_Admin_Db();
75
  $results = $db->get_type_options( 'breadcrumb' );
 
76
 
77
+ if ( isset( $results['option'] ) ) {
78
+ $options = $results['option'];
79
+
80
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-short-code-breadcrumb.php');
81
+ $obj = new Structuring_Markup_ShortCode_Breadcrumb();
82
+ return $obj->short_code_display( $options );
83
+ }
84
  }
85
 
86
  /**
89
  * @since 1.3.0
90
  * @version 1.3.0
91
  */
92
+ public function plugins_loaded () {
93
  load_plugin_textdomain( $this->text_domain, false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
94
  }
95
 
96
+ /**
97
+ * Create custom post type "event".
98
+ *
99
+ * @since 2.1.0
100
+ * @version 2.1.0
101
+ */
102
+ function create_post_type_event () {
103
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-custom-post-event.php' );
104
+ new Structuring_Markup_Custom_Post_Event( $this->text_domain );
105
+ }
106
+
107
  /**
108
  * admin init.
109
  *
110
  * @since 1.3.1
111
  * @version 1.3.1
112
  */
113
+ public function admin_init () {
114
  wp_register_style( 'wp-structuring-markup-admin-style', plugins_url( 'css/style.css', __FILE__ ) );
115
  }
116
 
120
  * @since 1.0.0
121
  * @version 2.0.0
122
  */
123
+ public function admin_menu () {
124
  $list_page = add_menu_page(
125
  esc_html__( 'Schema.org Settings', $this->text_domain ),
126
  esc_html__( 'Schema.org Settings', $this->text_domain ),
140
  /** Using registered $page handle to hook stylesheet loading */
141
  add_action( 'admin_print_styles-' . $list_page, array( $this, 'add_style' ) );
142
  add_action( 'admin_print_styles-' . $post_page, array( $this, 'add_style' ) );
143
+
144
+ /** Custom post menu controls */
145
+ if ( isset( $_GET['page'] ) && $_GET['page'] === $this->text_domain . '-post' && !empty( $_POST ) ) {
146
+ if ( isset( $_POST['activate'] ) && $_POST['activate'] === 'on' ) {
147
+ flush_rewrite_rules();
148
+ }
149
+ if ( !isset( $_POST['activate'] ) ) {
150
+ remove_menu_page('edit.php?post_type=schema_event_post');
151
+ }
152
+ } else {
153
+ /** DB Connect */
154
+ $db = new Structuring_Markup_Admin_Db();
155
+ $results = $db->get_type_options('event');
156
+
157
+ if ( !isset( $results['activate'] ) || $results['activate'] !== 'on' ) {
158
+ remove_menu_page( 'edit.php?post_type=schema_event_post' );
159
+ }
160
+ }
161
  }
162
 
163
  /**
166
  * @since 1.3.1
167
  * @version 1.3.1
168
  */
169
+ public function add_style () {
170
  wp_enqueue_style( 'wp-structuring-markup-admin-style' );
171
  }
172
 
176
  * @since 1.0.0
177
  * @version 1.3.0
178
  */
179
+ public function list_page_render () {
180
  require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-admin-list.php' );
181
  new Structuring_Markup_Admin_List( $this->text_domain );
182
  }
187
  * @since 1.0.0
188
  * @version 1.3.0
189
  */
190
+ public function post_page_render () {
191
  require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-admin-post.php' );
192
  new Structuring_Markup_Admin_Post( $this->text_domain );
193
  }
198
  * @since 1.3.0
199
  * @version 1.3.0
200
  */
201
+ public function wp_head () {
202
  require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-display.php' );
203
  new Structuring_Markup_Display();
204
  }