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

Version Description

(2016-06-20) =

  • Added : Schema.org type "Video".
  • Added : Display the cause of the JSON-LD is not output in HTML comments.
  • Fixed : "Schema.org Event" solve the output of JSON-LD is a problem with the double in the custom posts.
  • Fixed : Changes to the search of the array to remove the SQL statement to get the output page.
  • Fixed : "Schema.org Organization" If you have not set up a Social Profiles, it does not show an empty array.
  • Updated : Japanese translation.
Download this release

Release Info

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

Code changes from version 2.5.1 to 3.0.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.5.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.4.0
16
  */
17
  private $table_name;
18
 
@@ -26,6 +26,7 @@ class Structuring_Markup_Admin_Db {
26
  "news_article" => "News Article",
27
  "organization" => "Organization",
28
  "person" => "Person",
 
29
  "website" => "Web Site"
30
  );
31
 
@@ -108,7 +109,7 @@ class Structuring_Markup_Admin_Db {
108
  'update_date' => date( "Y-m-d H:i:s" )
109
  );
110
 
111
- // LocalBusiness Convert data(In the case of version 2.3.x)
112
  if ( $key === 'local_business' && $activate === 'on' && strpos( $options['version'], '2.3.' ) !== false ) {
113
  $args['options'] = $this->convert_local_business( $list->options );
114
  }
@@ -224,25 +225,6 @@ class Structuring_Markup_Admin_Db {
224
  return (array) $wpdb->get_results( $query );
225
  }
226
 
227
- /**
228
- * Get Select Data.
229
- *
230
- * @since 1.0.0
231
- * @version 2.5.0
232
- * @param array $output
233
- * @return array $results
234
- */
235
- public function get_select_options ( $output ) {
236
- global $wpdb;
237
-
238
- $query = "SELECT * FROM " . $this->table_name . " WHERE output LIKE '%%\"%s\"%%'";
239
- $data = array( $output );
240
- $prepared = $wpdb->prepare( $query, $data );
241
- $results = $wpdb->get_results( $prepared );
242
-
243
- return (array) $results;
244
- }
245
-
246
  /**
247
  * Get Type Data.
248
  *
@@ -275,7 +257,7 @@ class Structuring_Markup_Admin_Db {
275
  *
276
  * @since 1.0.0
277
  * @version 2.0.0
278
- * @param array $args
279
  */
280
  private function insert_options ( array $args ) {
281
  global $wpdb;
@@ -289,7 +271,7 @@ class Structuring_Markup_Admin_Db {
289
  *
290
  * @since 1.0.0
291
  * @version 2.0.0
292
- * @param array $post($_POST)
293
  * @return integer $post['id']
294
  */
295
  public function update_options ( array $post ) {
4
  *
5
  * @author Kazuya Takami
6
  * @since 1.0.0
7
+ * @version 3.0.0
8
  */
9
  class Structuring_Markup_Admin_Db {
10
 
12
  * Variable definition.
13
  *
14
  * @since 1.0.0
15
+ * @version 3.0.0
16
  */
17
  private $table_name;
18
 
26
  "news_article" => "News Article",
27
  "organization" => "Organization",
28
  "person" => "Person",
29
+ "video" => "Video",
30
  "website" => "Web Site"
31
  );
32
 
109
  'update_date' => date( "Y-m-d H:i:s" )
110
  );
111
 
112
+ /** LocalBusiness Convert data(In the case of version 2.3.x) */
113
  if ( $key === 'local_business' && $activate === 'on' && strpos( $options['version'], '2.3.' ) !== false ) {
114
  $args['options'] = $this->convert_local_business( $list->options );
115
  }
225
  return (array) $wpdb->get_results( $query );
226
  }
227
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  /**
229
  * Get Type Data.
230
  *
257
  *
258
  * @since 1.0.0
259
  * @version 2.0.0
260
+ * @param array $args
261
  */
262
  private function insert_options ( array $args ) {
263
  global $wpdb;
271
  *
272
  * @since 1.0.0
273
  * @version 2.0.0
274
+ * @param array $post($_POST)
275
  * @return integer $post['id']
276
  */
277
  public function update_options ( array $post ) {
includes/wp-structuring-admin-list.php CHANGED
@@ -104,4 +104,4 @@ class Structuring_Markup_Admin_List {
104
  $output = implode( ",", unserialize( $obj ) );
105
  return (string) $output;
106
  }
107
- }
104
  $output = implode( ",", unserialize( $obj ) );
105
  return (string) $output;
106
  }
107
+ }
includes/wp-structuring-admin-post.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author Kazuya Takami
6
  * @since 1.0.0
7
- * @version 2.5.0
8
  */
9
  class Structuring_Markup_Admin_Post {
10
 
@@ -107,7 +107,7 @@ class Structuring_Markup_Admin_Post {
107
  * Setting Page of the Admin Screen.
108
  *
109
  * @since 1.0.0
110
- * @version 2.5.0
111
  * @param array $options
112
  * @param string $status
113
  */
@@ -235,6 +235,14 @@ class Structuring_Markup_Admin_Post {
235
  require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-person.php' );
236
  new Structuring_Markup_Type_Person( $options['option'] );
237
  break;
 
 
 
 
 
 
 
 
238
  case 'website':
239
  $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
240
  $html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
4
  *
5
  * @author Kazuya Takami
6
  * @since 1.0.0
7
+ * @version 3.0.0
8
  */
9
  class Structuring_Markup_Admin_Post {
10
 
107
  * Setting Page of the Admin Screen.
108
  *
109
  * @since 1.0.0
110
+ * @version 3.0.0
111
  * @param array $options
112
  * @param string $status
113
  */
235
  require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-person.php' );
236
  new Structuring_Markup_Type_Person( $options['option'] );
237
  break;
238
+ case 'video':
239
+ $html = $this->output_checkbox_render( $options['output'], "video", esc_html__( 'Video Post Page', $this->text_domain ) );
240
+ $html .= '</td></tr></table><hr>';
241
+ echo $html;
242
+
243
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-video.php' );
244
+ new Structuring_Markup_Type_Videos();
245
+ break;
246
  case 'website':
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 ) );
includes/wp-structuring-admin-type-article.php CHANGED
@@ -7,7 +7,7 @@
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
 
@@ -81,7 +81,7 @@ class Structuring_Markup_Type_Article {
81
  $html .= '</table>';
82
  echo $html;
83
 
84
- echo '<p>Setting Knowledge : <a href="https://developers.google.com/structured-data/rich-snippets/articles" target="_blank">https://developers.google.com/structured-data/rich-snippets/articles</a></p>';
85
  submit_button();
86
  }
87
 
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
 
81
  $html .= '</table>';
82
  echo $html;
83
 
84
+ 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>';
85
  submit_button();
86
  }
87
 
includes/wp-structuring-admin-type-blog-posting.php CHANGED
@@ -7,7 +7,7 @@
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
 
@@ -81,7 +81,7 @@ class Structuring_Markup_Type_Blog_Posting {
81
  $html .= '</table>';
82
  echo $html;
83
 
84
- echo '<p>Setting Knowledge : <a href="https://developers.google.com/structured-data/rich-snippets/articles" target="_blank">https://developers.google.com/structured-data/rich-snippets/articles</a></p>';
85
  submit_button();
86
  }
87
 
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
 
81
  $html .= '</table>';
82
  echo $html;
83
 
84
+ 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>';
85
  submit_button();
86
  }
87
 
includes/wp-structuring-admin-type-breadcrumb.php CHANGED
@@ -7,7 +7,7 @@
7
  * @since 2.0.0
8
  * @see wp-structuring-admin-db.php
9
  * @link https://schema.org/BreadcrumbList
10
- * @link https://developers.google.com/structured-data/breadcrumbs
11
  */
12
  class Structuring_Markup_Type_Breadcrumb {
13
 
@@ -50,7 +50,7 @@ class Structuring_Markup_Type_Breadcrumb {
50
  $html .= '</table>';
51
  echo $html;
52
 
53
- echo '<p>Setting Knowledge : <a href="https://developers.google.com/structured-data/slsb-overview" target="_blank">https://developers.google.com/structured-data/slsb-overview</a></p>';
54
  submit_button();
55
  }
56
 
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
 
50
  $html .= '</table>';
51
  echo $html;
52
 
53
+ 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>';
54
  submit_button();
55
  }
56
 
includes/wp-structuring-admin-type-event.php CHANGED
@@ -9,8 +9,7 @@
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
 
@@ -55,7 +54,7 @@ class Structuring_Markup_Type_Event {
55
 
56
  echo '<p>Custom post name "schema_event_post"</p>';
57
  echo '<p>Archive rewrite name "events"</p>';
58
- 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>';
59
 
60
  submit_button();
61
  }
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
 
54
 
55
  echo '<p>Custom post name "schema_event_post"</p>';
56
  echo '<p>Archive rewrite name "events"</p>';
57
+ 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>';
58
 
59
  submit_button();
60
  }
includes/wp-structuring-admin-type-local-business.php CHANGED
@@ -8,7 +8,7 @@
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/structured-data/local-businesses/
12
  */
13
  class Structuring_Markup_Type_LocalBusiness {
14
 
@@ -331,7 +331,7 @@ class Structuring_Markup_Type_LocalBusiness {
331
  $html .= '</table>';
332
  echo $html;
333
 
334
- echo '<p>Setting Knowledge : <a href="https://developers.google.com/structured-data/local-businesses/" target="_blank">https://developers.google.com/structured-data/local-businesses/</a></p>';
335
  submit_button();
336
  }
337
 
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/guides/intro-structured-data
12
  */
13
  class Structuring_Markup_Type_LocalBusiness {
14
 
331
  $html .= '</table>';
332
  echo $html;
333
 
334
+ echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/guides/intro-structured-data" target="_blank">https://developers.google.com/search/docs/guides/intro-structured-data</a></p>';
335
  submit_button();
336
  }
337
 
includes/wp-structuring-admin-type-news-article.php CHANGED
@@ -7,7 +7,7 @@
7
  * @since 1.0.0
8
  * @see wp-structuring-admin-db.php
9
  * @link http://schema.org/NewsArticle
10
- * @link https://developers.google.com/structured-data/rich-snippets/articles
11
  */
12
  class Structuring_Markup_Type_NewsArticle {
13
 
@@ -81,7 +81,7 @@ class Structuring_Markup_Type_NewsArticle {
81
  $html .= '</table>';
82
  echo $html;
83
 
84
- echo '<p>Setting Knowledge : <a href="https://developers.google.com/structured-data/rich-snippets/articles" target="_blank">https://developers.google.com/structured-data/rich-snippets/articles</a></p>';
85
  submit_button();
86
  }
87
 
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
 
81
  $html .= '</table>';
82
  echo $html;
83
 
84
+ 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>';
85
  submit_button();
86
  }
87
 
includes/wp-structuring-admin-type-organization.php CHANGED
@@ -7,10 +7,7 @@
7
  * @since 1.0.0
8
  * @see wp-structuring-admin-db.php
9
  * @link https://schema.org/Organization
10
- * @link https://developers.google.com/structured-data/customize/overview
11
- * @link https://developers.google.com/structured-data/customize/logos
12
- * @link https://developers.google.com/structured-data/customize/contact-points
13
- * @link https://developers.google.com/structured-data/customize/social-profiles
14
  */
15
  class Structuring_Markup_Type_Organization {
16
 
@@ -148,7 +145,7 @@ class Structuring_Markup_Type_Organization {
148
  $html .= '</table>';
149
  echo $html;
150
 
151
- echo '<p>Setting Knowledge : <a href="https://developers.google.com/structured-data/customize/overview" target="_blank">https://developers.google.com/structured-data/customize/overview</a></p>';
152
  submit_button();
153
  }
154
 
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
 
145
  $html .= '</table>';
146
  echo $html;
147
 
148
+ 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>';
149
  submit_button();
150
  }
151
 
includes/wp-structuring-admin-type-person.php CHANGED
@@ -7,7 +7,7 @@
7
  * @since 2.4.0
8
  * @see wp-structuring-admin-db.php
9
  * @link https://schema.org/Person
10
- * @link https://developers.google.com/structured-data/customize/social-profiles
11
  */
12
  class Structuring_Markup_Type_Person {
13
 
@@ -79,7 +79,7 @@ class Structuring_Markup_Type_Person {
79
  $html .= '</table>';
80
  echo $html;
81
 
82
- echo '<p>Setting Knowledge : <a href="https://developers.google.com/structured-data/customize/social-profiles" target="_blank">https://developers.google.com/structured-data/customize/social-profiles</a></p>';
83
  submit_button();
84
  }
85
 
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
 
79
  $html .= '</table>';
80
  echo $html;
81
 
82
+ 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>';
83
  submit_button();
84
  }
85
 
includes/wp-structuring-admin-type-video.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Type Video
4
+ *
5
+ * @author Kazuya Takami
6
+ * @version 3.0.0
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
+ * @since 3.0.0
27
+ */
28
+ private function page_render () {
29
+ $html = '<table class="schema-admin-table">';
30
+ $html .= '<caption>Basic Setting</caption>';
31
+ $html .= '<tr><th>name :</th><td><small>Post Title</small></td></tr>';
32
+ $html .= '<tr><th>Description :</th><td><small>Post Description</small></td></tr>';
33
+ $html .= '<tr><th>thumbnailUrl :</th><td><small>Featured Image URL</small></td></tr>';
34
+ $html .= '<tr><th>uploadDate :</th><td><small>Update Date</small></td></tr>';
35
+ $html .= '<tr><th>duration :</th><td><small>Input a custom post: field name "schema_video_duration"</small></td></tr>';
36
+ $html .= '<tr><th>contentUrl :</th><td><small>Input a custom post: field name "schema_video_content_url"</small></td></tr>';
37
+ $html .= '<tr><th>embedUrl :</th><td><small>Input a custom post: field name "schema_video_embed_url"</small></td></tr>';
38
+ $html .= '<tr><th>interactionCount :</th><td><small>Input a custom post: field name "schema_video_interaction_count"</small></td></tr>';
39
+ $html .= '<tr><th>expires :</th><td><small>Input a custom post: field name "schema_video_expires_date" & "schema_video_expires_time"</small></td></tr>';
40
+ $html .= '</table>';
41
+ echo $html;
42
+
43
+ echo '<p>Custom post name "schema_video_post"</p>';
44
+ echo '<p>Archive rewrite name "videos"</p>';
45
+ 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>';
46
+
47
+ submit_button();
48
+ }
49
+ }
includes/wp-structuring-admin-type-website.php CHANGED
@@ -7,8 +7,8 @@
7
  * @since 1.0.0
8
  * @see wp-structuring-admin-db.php
9
  * @link https://schema.org/WebSite
10
- * @link https://developers.google.com/structured-data/slsb-overview
11
- * @link https://developers.google.com/structured-data/site-name
12
  */
13
  class Structuring_Markup_Type_Website {
14
 
@@ -66,7 +66,7 @@ class Structuring_Markup_Type_Website {
66
  $html .= '</table>';
67
  echo $html;
68
 
69
- echo '<p>Setting Knowledge : <a href="https://developers.google.com/structured-data/slsb-overview" target="_blank">https://developers.google.com/structured-data/slsb-overview</a></p>';
70
  submit_button();
71
  }
72
 
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
 
66
  $html .= '</table>';
67
  echo $html;
68
 
69
+ 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>';
70
  submit_button();
71
  }
72
 
includes/wp-structuring-custom-post-event.php CHANGED
@@ -21,7 +21,7 @@ class Structuring_Markup_Custom_Post_Event {
21
  * Constructor Define.
22
  *
23
  * @since 2.1.0
24
- * @version 2.2.1
25
  * @param String $text_domain
26
  */
27
  public function __construct ( $text_domain ) {
@@ -31,8 +31,9 @@ class Structuring_Markup_Custom_Post_Event {
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
  'capability_type' => 'post',
38
  'has_archive' => true,
21
  * Constructor Define.
22
  *
23
  * @since 2.1.0
24
+ * @version 3.0.0
25
  * @param String $text_domain
26
  */
27
  public function __construct ( $text_domain ) {
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
+ 'all_items' => esc_html__( 'All Event Posts', $this->text_domain )
37
  ),
38
  'capability_type' => 'post',
39
  'has_archive' => true,
includes/wp-structuring-custom-post-video.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Schema.org Custom Post "Video"
4
+ *
5
+ * @author Kazuya Takami
6
+ * @since 3.0.0
7
+ * @version 3.0.0
8
+ */
9
+ class Structuring_Markup_Custom_Post_Video {
10
+
11
+ /**
12
+ * Variable definition.
13
+ *
14
+ * @since 3.0.0
15
+ * @version 3.0.0
16
+ */
17
+ private $text_domain;
18
+ private $custom_type = 'schema_video_post';
19
+
20
+ /**
21
+ * Constructor Define.
22
+ *
23
+ * @since 3.0.0
24
+ * @version 3.0.0
25
+ * @param String $text_domain
26
+ */
27
+ public function __construct ( $text_domain ) {
28
+ $this->text_domain = $text_domain;
29
+
30
+ register_post_type(
31
+ $this->custom_type,
32
+ array(
33
+ 'labels' => array(
34
+ 'name' => esc_html__( 'Video Posts', $this->text_domain ),
35
+ 'singular_name' => esc_html__( 'Video Posts', $this->text_domain ),
36
+ 'all_items' => esc_html__( 'All Video Posts', $this->text_domain )
37
+ ),
38
+ 'capability_type' => 'post',
39
+ 'has_archive' => true,
40
+ 'hierarchical' => false,
41
+ 'menu_position' => 5,
42
+ 'public' => true,
43
+ 'query_var' => false,
44
+ 'rewrite' => array( 'with_front' => true, 'slug' => 'videos' ),
45
+ 'show_in_menu' => true,
46
+ 'show_ui' => true,
47
+ 'supports' => array( 'title', 'editor', 'author', 'thumbnail' )
48
+ )
49
+ );
50
+
51
+ if ( is_admin() ) {
52
+ add_action( 'admin_init', array( $this, 'admin_init' ) );
53
+ add_action( 'admin_menu', array( $this, 'admin_menu' ) );
54
+ }
55
+ }
56
+
57
+ /**
58
+ * admin init.
59
+ *
60
+ * @since 3.0.0
61
+ * @version 3.0.0
62
+ */
63
+ public function admin_init () {
64
+ add_action( 'save_post_' . $this->custom_type, array( $this, 'save_post' ) );
65
+ }
66
+
67
+ /**
68
+ * admin meta boxes.
69
+ *
70
+ * @since 3.0.0
71
+ * @version 3.0.0
72
+ */
73
+ public function admin_menu () {
74
+ $custom_field_title = esc_html__( 'Schema.org Type Video', $this->text_domain );
75
+ add_meta_box( $this->custom_type, $custom_field_title, array( $this, 'set_custom_fields' ), $this->custom_type, 'normal' );
76
+ }
77
+
78
+ /**
79
+ * Set custom fields.
80
+ *
81
+ * @since 3.0.0
82
+ * @version 3.0.0
83
+ */
84
+ public function set_custom_fields () {
85
+ $args = get_post_meta( get_the_ID(), $this->custom_type, false );
86
+ $args = isset( $args[0] ) ? unserialize( $args[0] ) : "";
87
+
88
+ if ( !isset( $args['schema_video_duration'] ) ) $args['schema_video_duration'] = '';
89
+ if ( !isset( $args['schema_video_content_url'] ) ) $args['schema_video_content_url'] = '';
90
+ if ( !isset( $args['schema_video_embed_url'] ) ) $args['schema_video_embed_url'] = '';
91
+ if ( !isset( $args['schema_video_interaction_count'] ) ) $args['schema_video_interaction_count'] = '';
92
+ if ( !isset( $args['schema_video_expires_date'] ) ) $args['schema_video_expires_date'] = '';
93
+ if ( !isset( $args['schema_video_expires_time'] ) ) $args['schema_video_expires_time'] = '';
94
+
95
+ $html = '';
96
+ $html .= '<table>';
97
+ $html .= '<tr><th><label for="schema_video_duration">';
98
+ $html .= esc_html__( 'duration', $this->text_domain );
99
+ $html .= '</label></th><td>';
100
+ $html .= '<input type="text" name="option[' . "schema_video_duration" . ']" id="schema_video_duration" class="regular-text" value="' . esc_attr( $args['schema_video_duration'] ) . '">';
101
+ $html .= '</td></tr>';
102
+ $html .= '<tr><th><label for="schema_video_content_url">';
103
+ $html .= esc_html__( 'contentURL', $this->text_domain );
104
+ $html .= '</label></th><td>';
105
+ $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'] ) . '">';
106
+ $html .= '</td></tr>';
107
+ $html .= '<tr><th><label for="schema_video_embed_url">';
108
+ $html .= esc_html__( 'embedURL', $this->text_domain );
109
+ $html .= '</label></th><td>';
110
+ $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'] ) . '">';
111
+ $html .= '</td></tr>';
112
+ $html .= '<tr><th><label for="schema_video_interaction_count">';
113
+ $html .= esc_html__( 'interactionCount', $this->text_domain );
114
+ $html .= '</label></th><td>';
115
+ $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'] ) . '">';
116
+ $html .= '</td></tr>';
117
+ $html .= '<tr><th><label for="schema_video_expires_date">';
118
+ $html .= esc_html__( 'expires', $this->text_domain );
119
+ $html .= '</label></th><td>';
120
+ $html .= '<input type="date" name="option[' . "schema_video_expires_date" . ']" id="schema_video_expires_date" value="' . esc_attr( $args['schema_video_expires_date'] ) . '">';
121
+ $html .= '<input type="time" name="option[' . "schema_video_expires_time" . ']" id="schema_video_expires_time" value="' . esc_attr( $args['schema_video_expires_time'] ) . '">';
122
+ $html .= '</td></tr>';
123
+ $html .= '</table>';
124
+
125
+ echo $html;
126
+ }
127
+
128
+ /**
129
+ * Save custom post.
130
+ *
131
+ * @since 3.0.0
132
+ * @version 3.0.0
133
+ * @param integer $post_id The post ID.
134
+ */
135
+ public function save_post ( $post_id ) {
136
+ if ( isset( $_POST['option'] ) ) {
137
+ update_post_meta( $post_id, $this->custom_type, serialize( $_POST['option'] ) );
138
+ }
139
+ }
140
+ }
includes/wp-structuring-display.php CHANGED
@@ -4,11 +4,19 @@
4
  *
5
  * @author Kazuya Takami
6
  * @author Justin Frydman
7
- * @version 2.5.0
8
  * @since 1.0.0
9
  */
10
  class Structuring_Markup_Display {
11
 
 
 
 
 
 
 
 
 
12
  /**
13
  * Constructor Define.
14
  *
@@ -23,33 +31,42 @@ class Structuring_Markup_Display {
23
  * Setting schema.org
24
  *
25
  * @since 1.0.0
26
- * @version 2.5.0
27
  * @param Structuring_Markup_Admin_Db $db
28
  */
29
  private function set_schema ( Structuring_Markup_Admin_Db $db ) {
 
 
30
  echo '<!-- Markup (JSON-LD) structured in schema.org START -->' . PHP_EOL;
31
 
32
- $this->get_schema_data( $db, 'all' );
33
  if ( is_home() ) {
34
- $this->get_schema_data( $db, 'home' );
35
  }
36
  if ( is_single() && get_post_type() === 'post' ) {
37
- $this->get_schema_data( $db, 'post' );
38
  }
39
  if ( is_singular( 'schema_event_post' ) ) {
40
- $this->get_schema_data( $db, 'event' );
 
 
 
41
  }
42
  if ( is_page() ) {
43
- $this->get_schema_data( $db, 'page' );
44
  }
45
  $args = array(
46
  'public' => true,
47
  '_builtin' => false
48
  );
49
  $post_types = get_post_types( $args, 'objects' );
 
 
 
 
50
  foreach ( $post_types as $post_type ) {
51
  if ( is_singular( $post_type->name ) ) {
52
- $this->get_schema_data( $db, $post_type->name );
53
  }
54
  }
55
  echo '<!-- Markup (JSON-LD) structured in schema.org END -->' . PHP_EOL;
@@ -59,15 +76,18 @@ class Structuring_Markup_Display {
59
  * Setting JSON-LD Template
60
  *
61
  * @since 1.0.0
62
- * @version 2.4.0
63
- * @param Structuring_Markup_Admin_Db $db
64
  * @param string $output
 
65
  */
66
- private function get_schema_data ( Structuring_Markup_Admin_Db $db, $output ) {
67
- $results = $db->get_select_options( $output );
68
 
69
- if ( isset( $results ) ) {
70
- foreach ( $results as $row ) {
 
 
 
 
71
  if ( isset( $row->type ) && isset( $row->activate ) && $row->activate === 'on' ) {
72
  switch ( $row->type ) {
73
  case 'article':
@@ -108,6 +128,9 @@ class Structuring_Markup_Display {
108
  $this->set_schema_person( unserialize( $row->options ) );
109
  }
110
  break;
 
 
 
111
  case 'website':
112
  if ( isset( $row->options ) && $row->options ) {
113
  $this->set_schema_website( unserialize( $row->options ) );
@@ -123,12 +146,23 @@ class Structuring_Markup_Display {
123
  * Setting JSON-LD Template
124
  *
125
  * @since 1.0.0
126
- * @param array $args
 
 
127
  */
128
- private function set_schema_json ( array $args ) {
129
- echo '<script type="application/ld+json">' , PHP_EOL;
130
- echo json_encode( $args, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ) , PHP_EOL;
131
- echo '</script>' , PHP_EOL;
 
 
 
 
 
 
 
 
 
132
  }
133
 
134
  /**
@@ -155,7 +189,7 @@ class Structuring_Markup_Display {
155
  private function get_image_dimensions ( $url ) {
156
  $cache = new Structuring_Markup_Cache( $url );
157
 
158
- // check for cached dimensions
159
  if( $cache->get() !== false ) {
160
  return $cache->get();
161
  }
@@ -179,7 +213,7 @@ class Structuring_Markup_Display {
179
 
180
  $dimensions = array( $width, $height );
181
 
182
- // cache for an hour
183
  $cache->set( $dimensions, HOUR_IN_SECONDS );
184
 
185
  return $dimensions;
@@ -189,7 +223,7 @@ class Structuring_Markup_Display {
189
  if( $image = @getimagesize( $url ) ) {
190
  $dimensions = array( $image[0], $image[1] );
191
 
192
- // cache for an hour
193
  $cache->set( $dimensions, HOUR_IN_SECONDS );
194
 
195
  return $dimensions;
@@ -198,13 +232,13 @@ class Structuring_Markup_Display {
198
  if( $image = @getimagesize( str_replace( 'https://', 'http://', $url ) ) ) {
199
  $dimensions = array( $image[0], $image[1] );
200
 
201
- // cache for an hour
202
  $cache->set( $dimensions, HOUR_IN_SECONDS );
203
 
204
  return $dimensions;
205
  }
206
 
207
- // this hits the database and be very slow if the user is using a URL that doesn't exist in the WP Library
208
  if( $image = wp_get_attachment_image_src( attachment_url_to_postid( $url ), 'full' ) ) {
209
  $dimensions = array( $image[1], $image[2] );
210
 
@@ -221,22 +255,24 @@ class Structuring_Markup_Display {
221
  * Setting schema.org Article
222
  *
223
  * @since 1.1.0
224
- * @version 2.3.3
225
  * @param array $options
226
  */
227
  private function set_schema_article ( array $options ) {
228
  global $post;
229
 
230
  $options['logo'] = isset( $options['logo'] ) ? esc_url( $options['logo'] ) : "";
 
 
 
 
231
 
232
  if ( has_post_thumbnail( $post->ID ) && $logo = $this->get_image_dimensions( $options['logo'] ) ) {
233
  $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
234
  $excerpt = $this->escape_text_tags( $post->post_excerpt );
235
  $content = $excerpt === "" ? mb_substr( $this->escape_text_tags( $post->post_content ), 0, 110 ) : $excerpt;
236
 
237
- $args = array(
238
- "@context" => "http://schema.org",
239
- "@type" => "Article",
240
  "mainEntityOfPage" => array(
241
  "@type" => "WebPage",
242
  "@id" => get_permalink( $post->ID )
@@ -266,7 +302,16 @@ class Structuring_Markup_Display {
266
  ),
267
  "description" => $content
268
  );
 
269
  $this->set_schema_json( $args );
 
 
 
 
 
 
 
 
270
  }
271
  }
272
 
@@ -274,22 +319,24 @@ class Structuring_Markup_Display {
274
  * Setting schema.org BlogPosting
275
  *
276
  * @since 1.2.0
277
- * @version 2.3.3
278
  * @param array $options
279
  */
280
  private function set_schema_blog_posting ( array $options ) {
281
  global $post;
282
 
283
  $options['logo'] = isset( $options['logo'] ) ? esc_url( $options['logo'] ) : "";
 
 
 
 
284
 
285
  if ( has_post_thumbnail( $post->ID ) && $logo = $this->get_image_dimensions( $options['logo'] ) ) {
286
  $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
287
  $excerpt = $this->escape_text_tags( $post->post_excerpt );
288
  $content = $excerpt === "" ? mb_substr( $this->escape_text_tags( $post->post_content ), 0, 110 ) : $excerpt;
289
 
290
- $args = array(
291
- "@context" => "http://schema.org",
292
- "@type" => "BlogPosting",
293
  "mainEntityOfPage" => array(
294
  "@type" => "WebPage",
295
  "@id" => get_permalink( $post->ID )
@@ -319,16 +366,25 @@ class Structuring_Markup_Display {
319
  ),
320
  "description" => $content
321
  );
 
322
  $this->set_schema_json( $args );
 
 
 
 
 
 
 
 
323
  }
324
  }
325
 
326
  /**
327
  * Setting schema.org Breadcrumb
328
  *
329
- * @since 2.0.0
330
- * version 2.0.0
331
- * @param array $options
332
  */
333
  private function set_schema_breadcrumb ( array $options ) {
334
  require_once( plugin_dir_path( __FILE__ ) . 'wp-structuring-short-code-breadcrumb.php' );
@@ -363,7 +419,7 @@ class Structuring_Markup_Display {
363
  * Setting schema.org Event
364
  *
365
  * @since 2.1.0
366
- * @version 2.1.0
367
  */
368
  private function set_schema_event () {
369
  global $post;
@@ -372,10 +428,10 @@ class Structuring_Markup_Display {
372
  if ( isset( $meta[0] ) ) {
373
  $meta = unserialize( $meta[0] );
374
 
375
- if ( !isset( $meta['schema_event_name']) ) $meta['schema_event_name'] = '';
376
- if ( !isset( $meta['schema_event_date']) ) $meta['schema_event_date'] = date('Y-m-d');
377
- if ( !isset( $meta['schema_event_time']) ) $meta['schema_event_time'] = date('h:i');
378
- if ( !isset( $meta['schema_event_url']) ) $meta['schema_event_url'] = '';
379
  if ( !isset( $meta['schema_event_place_name'] ) ) $meta['schema_event_place_name'] = '';
380
  if ( !isset( $meta['schema_event_place_url'] ) ) $meta['schema_event_place_url'] = '';
381
  if ( !isset( $meta['schema_event_place_address'] ) ) $meta['schema_event_place_address'] = '';
@@ -383,23 +439,23 @@ class Structuring_Markup_Display {
383
  if ( !isset( $meta['schema_event_offers_currency'] ) ) $meta['schema_event_offers_currency'] = '';
384
 
385
  $args = array(
386
- "@context" => "http://schema.org",
387
- "@type" => "Event",
388
- "name" => $this->escape_text_tags( $meta['schema_event_name'] ),
389
- "startDate" => $this->escape_text_tags( $meta['schema_event_date'] ) . 'T' . $this->escape_text_tags( $meta['schema_event_time'] ),
390
- "url" => esc_url( $meta['schema_event_url'] ),
391
- "location" => array(
392
- "@type" => "Place",
393
- "sameAs" => esc_url( $meta['schema_event_place_url'] ),
394
- "name" => $this->escape_text_tags( $meta['schema_event_place_name'] ),
395
- "address" => $this->escape_text_tags( $meta['schema_event_place_address'] )
396
- ),
397
- "offers" => array(
398
- "@type" => "Offer",
399
- "price" => $this->escape_text_tags( $meta['schema_event_offers_price'] ),
400
- "priceCurrency" => $this->escape_text_tags( $meta['schema_event_offers_currency'] ),
401
- "url" => esc_url( $meta['schema_event_url'] )
402
- )
403
  );
404
  $this->set_schema_json( $args );
405
  }
@@ -409,20 +465,20 @@ class Structuring_Markup_Display {
409
  * Setting schema.org LocalBusiness
410
  *
411
  * @since 2.3.0
412
- * @version 2.5.0
413
  * @param array $options
414
  */
415
  private function set_schema_local_business ( array $options ) {
416
 
417
  /** weekType defined. */
418
  $week_array = array(
419
- array("type" => "Mo", "display" => "Monday"),
420
- array("type" => "Tu", "display" => "Tuesday"),
421
- array("type" => "We", "display" => "Wednesday"),
422
- array("type" => "Th", "display" => "Thursday"),
423
- array("type" => "Fr", "display" => "Friday"),
424
- array("type" => "Sa", "display" => "Saturday"),
425
- array("type" => "Su", "display" => "Sunday")
426
  );
427
 
428
  $args = array(
@@ -520,22 +576,24 @@ class Structuring_Markup_Display {
520
  * Setting schema.org NewsArticle
521
  *
522
  * @since 1.0.0
523
- * @version 2.3.3
524
  * @param array $options
525
  */
526
  private function set_schema_news_article ( array $options ) {
527
  global $post;
528
 
529
  $options['logo'] = isset( $options['logo'] ) ? esc_url( $options['logo'] ) : "";
 
 
 
 
530
 
531
  if ( has_post_thumbnail( $post->ID ) && $logo = $this->get_image_dimensions( $options['logo'] ) ) {
532
  $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
533
  $excerpt = $this->escape_text_tags( $post->post_excerpt );
534
  $content = $excerpt === "" ? mb_substr( $this->escape_text_tags( $post->post_content ), 0, 110 ) : $excerpt;
535
 
536
- $args = array(
537
- "@context" => "http://schema.org",
538
- "@type" => "NewsArticle",
539
  "mainEntityOfPage" => array(
540
  "@type" => "WebPage",
541
  "@id" => get_permalink( $post->ID )
@@ -565,16 +623,25 @@ class Structuring_Markup_Display {
565
  ),
566
  "description" => $content
567
  );
 
568
  $this->set_schema_json( $args );
 
 
 
 
 
 
 
 
569
  }
570
  }
571
 
572
  /**
573
  * Setting schema.org Organization
574
  *
575
- * @since 1.0.0
576
- * version 2.2.0
577
- * @param array $options
578
  */
579
  private function set_schema_organization ( array $options ) {
580
  /** Logos */
@@ -603,11 +670,13 @@ class Structuring_Markup_Display {
603
  $socials["sameAs"] = array();
604
 
605
  foreach ( $options['social'] as $value ) {
606
- if ( !empty( $value ) ) {
607
- $socials["sameAs"][] = esc_html( $value );
608
  }
609
  }
610
- $args = array_merge( $args, $socials );
 
 
611
  }
612
  $this->set_schema_json( $args );
613
  }
@@ -615,9 +684,9 @@ class Structuring_Markup_Display {
615
  /**
616
  * Setting schema.org Person
617
  *
618
- * @since 2.4.0
619
- * version 2.4.0
620
- * @param array $options
621
  */
622
  private function set_schema_person ( array $options ) {
623
  /** Logos */
@@ -641,6 +710,64 @@ class Structuring_Markup_Display {
641
  }
642
  $this->set_schema_json( $args );
643
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
644
 
645
  /**
646
  * Setting schema.org WebSite
@@ -669,4 +796,4 @@ class Structuring_Markup_Display {
669
 
670
  $this->set_schema_json( $args );
671
  }
672
- }
4
  *
5
  * @author Kazuya Takami
6
  * @author Justin Frydman
7
+ * @version 3.0.0
8
  * @since 1.0.0
9
  */
10
  class Structuring_Markup_Display {
11
 
12
+ /**
13
+ * Text Domain
14
+ *
15
+ * @since 3.0.0
16
+ * @version 3.0.0
17
+ */
18
+ private $text_domain = 'wp-structuring-markup';
19
+
20
  /**
21
  * Constructor Define.
22
  *
31
  * Setting schema.org
32
  *
33
  * @since 1.0.0
34
+ * @version 3.0.0
35
  * @param Structuring_Markup_Admin_Db $db
36
  */
37
  private function set_schema ( Structuring_Markup_Admin_Db $db ) {
38
+ $structuring_markup_args = $db->get_list_options();
39
+
40
  echo '<!-- Markup (JSON-LD) structured in schema.org START -->' . PHP_EOL;
41
 
42
+ $this->get_schema_data( 'all', $structuring_markup_args );
43
  if ( is_home() ) {
44
+ $this->get_schema_data( 'home', $structuring_markup_args );
45
  }
46
  if ( is_single() && get_post_type() === 'post' ) {
47
+ $this->get_schema_data( 'post', $structuring_markup_args );
48
  }
49
  if ( is_singular( 'schema_event_post' ) ) {
50
+ $this->get_schema_data( 'event', $structuring_markup_args );
51
+ }
52
+ if ( is_singular( 'schema_video_post' ) ) {
53
+ $this->get_schema_data( 'video', $structuring_markup_args );
54
  }
55
  if ( is_page() ) {
56
+ $this->get_schema_data( 'page', $structuring_markup_args );
57
  }
58
  $args = array(
59
  'public' => true,
60
  '_builtin' => false
61
  );
62
  $post_types = get_post_types( $args, 'objects' );
63
+
64
+ unset($post_types['schema_event_post']);
65
+ unset($post_types['schema_video_post']);
66
+
67
  foreach ( $post_types as $post_type ) {
68
  if ( is_singular( $post_type->name ) ) {
69
+ $this->get_schema_data( $post_type->name, $structuring_markup_args );
70
  }
71
  }
72
  echo '<!-- Markup (JSON-LD) structured in schema.org END -->' . PHP_EOL;
76
  * Setting JSON-LD Template
77
  *
78
  * @since 1.0.0
79
+ * @version 3.0.0
 
80
  * @param string $output
81
+ * @param array $structuring_markup_args
82
  */
83
+ private function get_schema_data ( $output, array $structuring_markup_args ) {
 
84
 
85
+ foreach ($structuring_markup_args as $row) {
86
+ /** Output page check. */
87
+ $output_args = unserialize( $row->output );
88
+ if ( array_key_exists( $output, $output_args ) ) {
89
+
90
+ /** Activate check. */
91
  if ( isset( $row->type ) && isset( $row->activate ) && $row->activate === 'on' ) {
92
  switch ( $row->type ) {
93
  case 'article':
128
  $this->set_schema_person( unserialize( $row->options ) );
129
  }
130
  break;
131
+ case 'video':
132
+ $this->set_schema_video();
133
+ break;
134
  case 'website':
135
  if ( isset( $row->options ) && $row->options ) {
136
  $this->set_schema_website( unserialize( $row->options ) );
146
  * Setting JSON-LD Template
147
  *
148
  * @since 1.0.0
149
+ * @since 3.0.0
150
+ * @param array $args
151
+ * @param boolean $error
152
  */
153
+ private function set_schema_json ( array $args, $error = false ) {
154
+ if ( $error ) {
155
+ /** Error Display */
156
+ if ( isset( $args["@type"] ) ) {
157
+ foreach ( $args["message"] as $message ) {
158
+ echo "<!-- Schema.org ", $args["@type"], " : ", $message, " -->", PHP_EOL;
159
+ }
160
+ }
161
+ } else {
162
+ echo '<script type="application/ld+json">', PHP_EOL;
163
+ echo json_encode( $args, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ), PHP_EOL;
164
+ echo '</script>', PHP_EOL;
165
+ }
166
  }
167
 
168
  /**
189
  private function get_image_dimensions ( $url ) {
190
  $cache = new Structuring_Markup_Cache( $url );
191
 
192
+ /** check for cached dimensions */
193
  if( $cache->get() !== false ) {
194
  return $cache->get();
195
  }
213
 
214
  $dimensions = array( $width, $height );
215
 
216
+ /** cache for an hour */
217
  $cache->set( $dimensions, HOUR_IN_SECONDS );
218
 
219
  return $dimensions;
223
  if( $image = @getimagesize( $url ) ) {
224
  $dimensions = array( $image[0], $image[1] );
225
 
226
+ /** cache for an hour */
227
  $cache->set( $dimensions, HOUR_IN_SECONDS );
228
 
229
  return $dimensions;
232
  if( $image = @getimagesize( str_replace( 'https://', 'http://', $url ) ) ) {
233
  $dimensions = array( $image[0], $image[1] );
234
 
235
+ /** cache for an hour */
236
  $cache->set( $dimensions, HOUR_IN_SECONDS );
237
 
238
  return $dimensions;
239
  }
240
 
241
+ /** this hits the database and be very slow if the user is using a URL that doesn't exist in the WP Library */
242
  if( $image = wp_get_attachment_image_src( attachment_url_to_postid( $url ), 'full' ) ) {
243
  $dimensions = array( $image[1], $image[2] );
244
 
255
  * Setting schema.org Article
256
  *
257
  * @since 1.1.0
258
+ * @version 3.0.0
259
  * @param array $options
260
  */
261
  private function set_schema_article ( array $options ) {
262
  global $post;
263
 
264
  $options['logo'] = isset( $options['logo'] ) ? esc_url( $options['logo'] ) : "";
265
+ $args = array(
266
+ "@context" => "http://schema.org",
267
+ "@type" => "Article"
268
+ );
269
 
270
  if ( has_post_thumbnail( $post->ID ) && $logo = $this->get_image_dimensions( $options['logo'] ) ) {
271
  $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
272
  $excerpt = $this->escape_text_tags( $post->post_excerpt );
273
  $content = $excerpt === "" ? mb_substr( $this->escape_text_tags( $post->post_content ), 0, 110 ) : $excerpt;
274
 
275
+ $schema_args = array(
 
 
276
  "mainEntityOfPage" => array(
277
  "@type" => "WebPage",
278
  "@id" => get_permalink( $post->ID )
302
  ),
303
  "description" => $content
304
  );
305
+ $args = array_merge( $args, $schema_args );
306
  $this->set_schema_json( $args );
307
+ } else {
308
+ if ( !has_post_thumbnail( $post->ID ) ) {
309
+ $args["message"][] = __( "Featured Image not set.", $this->text_domain );
310
+ }
311
+ if ( !$this->get_image_dimensions( $options['logo'] ) ) {
312
+ $args["message"][] = __( "Logo Image not set.", $this->text_domain );
313
+ }
314
+ $this->set_schema_json( $args, __return_true() );
315
  }
316
  }
317
 
319
  * Setting schema.org BlogPosting
320
  *
321
  * @since 1.2.0
322
+ * @version 3.0.0
323
  * @param array $options
324
  */
325
  private function set_schema_blog_posting ( array $options ) {
326
  global $post;
327
 
328
  $options['logo'] = isset( $options['logo'] ) ? esc_url( $options['logo'] ) : "";
329
+ $args = array(
330
+ "@context" => "http://schema.org",
331
+ "@type" => "BlogPosting"
332
+ );
333
 
334
  if ( has_post_thumbnail( $post->ID ) && $logo = $this->get_image_dimensions( $options['logo'] ) ) {
335
  $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
336
  $excerpt = $this->escape_text_tags( $post->post_excerpt );
337
  $content = $excerpt === "" ? mb_substr( $this->escape_text_tags( $post->post_content ), 0, 110 ) : $excerpt;
338
 
339
+ $schema_args = array(
 
 
340
  "mainEntityOfPage" => array(
341
  "@type" => "WebPage",
342
  "@id" => get_permalink( $post->ID )
366
  ),
367
  "description" => $content
368
  );
369
+ $args = array_merge( $args, $schema_args );
370
  $this->set_schema_json( $args );
371
+ } else {
372
+ if ( !has_post_thumbnail( $post->ID ) ) {
373
+ $args["message"][] = __( "Featured Image not set.", $this->text_domain );
374
+ }
375
+ if ( !$this->get_image_dimensions( $options['logo'] ) ) {
376
+ $args["message"][] = __( "Logo Image not set.", $this->text_domain );
377
+ }
378
+ $this->set_schema_json( $args, __return_true() );
379
  }
380
  }
381
 
382
  /**
383
  * Setting schema.org Breadcrumb
384
  *
385
+ * @since 2.0.0
386
+ * @version 2.0.0
387
+ * @param array $options
388
  */
389
  private function set_schema_breadcrumb ( array $options ) {
390
  require_once( plugin_dir_path( __FILE__ ) . 'wp-structuring-short-code-breadcrumb.php' );
419
  * Setting schema.org Event
420
  *
421
  * @since 2.1.0
422
+ * @version 3.0.0
423
  */
424
  private function set_schema_event () {
425
  global $post;
428
  if ( isset( $meta[0] ) ) {
429
  $meta = unserialize( $meta[0] );
430
 
431
+ if ( !isset( $meta['schema_event_name']) ) $meta['schema_event_name'] = '';
432
+ if ( !isset( $meta['schema_event_date']) ) $meta['schema_event_date'] = date('Y-m-d');
433
+ if ( !isset( $meta['schema_event_time']) ) $meta['schema_event_time'] = date('h:i');
434
+ if ( !isset( $meta['schema_event_url']) ) $meta['schema_event_url'] = '';
435
  if ( !isset( $meta['schema_event_place_name'] ) ) $meta['schema_event_place_name'] = '';
436
  if ( !isset( $meta['schema_event_place_url'] ) ) $meta['schema_event_place_url'] = '';
437
  if ( !isset( $meta['schema_event_place_address'] ) ) $meta['schema_event_place_address'] = '';
439
  if ( !isset( $meta['schema_event_offers_currency'] ) ) $meta['schema_event_offers_currency'] = '';
440
 
441
  $args = array(
442
+ "@context" => "http://schema.org",
443
+ "@type" => "Event",
444
+ "name" => $this->escape_text_tags( $meta['schema_event_name'] ),
445
+ "startDate" => $this->escape_text_tags( $meta['schema_event_date'] ) . 'T' . $this->escape_text_tags( $meta['schema_event_time'] ),
446
+ "url" => esc_url( $meta['schema_event_url'] ),
447
+ "location" => array(
448
+ "@type" => "Place",
449
+ "sameAs" => esc_url( $meta['schema_event_place_url'] ),
450
+ "name" => $this->escape_text_tags( $meta['schema_event_place_name'] ),
451
+ "address" => $this->escape_text_tags( $meta['schema_event_place_address'] )
452
+ ),
453
+ "offers" => array(
454
+ "@type" => "Offer",
455
+ "price" => $this->escape_text_tags( $meta['schema_event_offers_price'] ),
456
+ "priceCurrency" => $this->escape_text_tags( $meta['schema_event_offers_currency'] ),
457
+ "url" => esc_url( $meta['schema_event_url'] )
458
+ )
459
  );
460
  $this->set_schema_json( $args );
461
  }
465
  * Setting schema.org LocalBusiness
466
  *
467
  * @since 2.3.0
468
+ * @version 3.0.0
469
  * @param array $options
470
  */
471
  private function set_schema_local_business ( array $options ) {
472
 
473
  /** weekType defined. */
474
  $week_array = array(
475
+ array( "type" => "Mo", "display" => "Monday" ),
476
+ array( "type" => "Tu", "display" => "Tuesday" ),
477
+ array( "type" => "We", "display" => "Wednesday" ),
478
+ array( "type" => "Th", "display" => "Thursday" ),
479
+ array( "type" => "Fr", "display" => "Friday" ),
480
+ array( "type" => "Sa", "display" => "Saturday" ),
481
+ array( "type" => "Su", "display" => "Sunday" )
482
  );
483
 
484
  $args = array(
576
  * Setting schema.org NewsArticle
577
  *
578
  * @since 1.0.0
579
+ * @version 3.0.0
580
  * @param array $options
581
  */
582
  private function set_schema_news_article ( array $options ) {
583
  global $post;
584
 
585
  $options['logo'] = isset( $options['logo'] ) ? esc_url( $options['logo'] ) : "";
586
+ $args = array(
587
+ "@context" => "http://schema.org",
588
+ "@type" => "NewsArticle"
589
+ );
590
 
591
  if ( has_post_thumbnail( $post->ID ) && $logo = $this->get_image_dimensions( $options['logo'] ) ) {
592
  $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
593
  $excerpt = $this->escape_text_tags( $post->post_excerpt );
594
  $content = $excerpt === "" ? mb_substr( $this->escape_text_tags( $post->post_content ), 0, 110 ) : $excerpt;
595
 
596
+ $schema_args = array(
 
 
597
  "mainEntityOfPage" => array(
598
  "@type" => "WebPage",
599
  "@id" => get_permalink( $post->ID )
623
  ),
624
  "description" => $content
625
  );
626
+ $args = array_merge( $args, $schema_args );
627
  $this->set_schema_json( $args );
628
+ } else {
629
+ if ( !has_post_thumbnail( $post->ID ) ) {
630
+ $args["message"][] = __( "Featured Image not set.", $this->text_domain );
631
+ }
632
+ if ( !$this->get_image_dimensions( $options['logo'] ) ) {
633
+ $args["message"][] = __( "Logo Image not set.", $this->text_domain );
634
+ }
635
+ $this->set_schema_json( $args, __return_true() );
636
  }
637
  }
638
 
639
  /**
640
  * Setting schema.org Organization
641
  *
642
+ * @since 1.0.0
643
+ * @version 3.0.0
644
+ * @param array $options
645
  */
646
  private function set_schema_organization ( array $options ) {
647
  /** Logos */
670
  $socials["sameAs"] = array();
671
 
672
  foreach ( $options['social'] as $value ) {
673
+ if ( $value ) {
674
+ $socials["sameAs"][] = esc_url( $value );
675
  }
676
  }
677
+ if ( !empty( $socials["sameAs"] ) ) {
678
+ $args = array_merge( $args, $socials );
679
+ }
680
  }
681
  $this->set_schema_json( $args );
682
  }
684
  /**
685
  * Setting schema.org Person
686
  *
687
+ * @since 2.4.0
688
+ * @version 2.4.0
689
+ * @param array $options
690
  */
691
  private function set_schema_person ( array $options ) {
692
  /** Logos */
710
  }
711
  $this->set_schema_json( $args );
712
  }
713
+
714
+ /**
715
+ * Setting schema.org Video
716
+ *
717
+ * @since 3.0.0
718
+ * @version 3.0.0
719
+ */
720
+ private function set_schema_video () {
721
+ global $post;
722
+ $meta = get_post_meta( $post->ID, 'schema_video_post', false );
723
+
724
+ $args = array(
725
+ "@context" => "http://schema.org",
726
+ "@type" => "VideoObject"
727
+ );
728
+
729
+ if ( has_post_thumbnail( $post->ID ) ) {
730
+ $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
731
+ $excerpt = $this->escape_text_tags( $post->post_excerpt );
732
+ $content = $excerpt === "" ? mb_substr( $this->escape_text_tags( $post->post_content ), 0, 110 ) : $excerpt;
733
+
734
+ if ( isset( $meta[0] ) ) {
735
+ $meta = unserialize( $meta[0] );
736
+
737
+ if ( !isset( $meta['schema_video_duration'] ) ) $meta['schema_video_duration'] = '';
738
+ if ( !isset( $meta['schema_video_content_url'] ) ) $meta['schema_video_content_url'] = '';
739
+ if ( !isset( $meta['schema_video_embed_url'] ) ) $meta['schema_video_embed_url'] = '';
740
+ if ( !isset( $meta['schema_video_interaction_count'] ) ) $meta['schema_video_interaction_count'] = '';
741
+ if ( !isset( $meta['schema_video_expires_date'] ) ) $meta['schema_video_expires_date'] = '';
742
+ if ( !isset( $meta['schema_video_expires_time'] ) ) $meta['schema_video_expires_time'] = '';
743
+
744
+ $args["name"] = $this->escape_text_tags( $post->post_title );
745
+ $args["description"] = $content;
746
+ $args["thumbnailUrl"] = $images[0];
747
+ $args["uploadDate"] = get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID );
748
+
749
+ if ( !empty( $meta['schema_video_duration'] ) ) {
750
+ $args["duration"] = esc_html( $meta['schema_video_duration'] );
751
+ }
752
+ if ( !empty( $meta['schema_video_content_url'] ) ) {
753
+ $args["contentUrl"] = esc_url( $meta['schema_video_content_url'] );
754
+ }
755
+ if ( empty( $meta['schema_video_embed_url'] ) ) {
756
+ $args["embedUrl"] = esc_url( $meta['schema_video_embed_url'] );
757
+ }
758
+ if ( !empty( $meta['schema_video_interaction_count'] ) ) {
759
+ $args["interactionCount"] = esc_html( $meta['schema_video_interaction_count'] );
760
+ }
761
+ if ( !empty( $meta['schema_video_expires_date'] ) && !empty( $meta['schema_video_expires_time'] ) ) {
762
+ $args["expires"] = $this->escape_text_tags( $meta['schema_video_expires_date'] ) . 'T' . $this->escape_text_tags( $meta['schema_video_expires_time'] );
763
+ }
764
+ $this->set_schema_json( $args );
765
+ }
766
+ } else {
767
+ $args["message"][] = __( "Featured Image not set.", $this->text_domain );
768
+ $this->set_schema_json( $args, __return_true() );
769
+ }
770
+ }
771
 
772
  /**
773
  * Setting schema.org WebSite
796
 
797
  $this->set_schema_json( $args );
798
  }
799
+ }
languages/wp-structuring-markup-ja.mo CHANGED
Binary file
languages/wp-structuring-markup-ja.po CHANGED
@@ -2,9 +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.5.0\n"
6
- "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-structuring-markup\n"
7
- "POT-Creation-Date: 2016-04-19 12:08:30+00:00\n"
 
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -33,7 +34,7 @@ msgstr "出力ページ"
33
  msgid "ShortCode"
34
  msgstr "ショートコード"
35
 
36
- #: includes/wp-structuring-admin-list.php:81 wp-structuring-markup.php:155
37
  msgid "Edit"
38
  msgstr "編集"
39
 
@@ -51,7 +52,7 @@ msgstr "Schema.org 登録"
51
  #: includes/wp-structuring-admin-post.php:199
52
  #: includes/wp-structuring-admin-post.php:213
53
  #: includes/wp-structuring-admin-post.php:227
54
- #: includes/wp-structuring-admin-post.php:241
55
  msgid "Posts"
56
  msgstr "投稿ページ"
57
 
@@ -61,7 +62,7 @@ msgstr "投稿ページ"
61
  #: includes/wp-structuring-admin-post.php:200
62
  #: includes/wp-structuring-admin-post.php:214
63
  #: includes/wp-structuring-admin-post.php:228
64
- #: includes/wp-structuring-admin-post.php:242
65
  msgid "Pages"
66
  msgstr "固定ページ"
67
 
@@ -69,7 +70,7 @@ msgstr "固定ページ"
69
  #: includes/wp-structuring-admin-post.php:185
70
  #: includes/wp-structuring-admin-post.php:211
71
  #: includes/wp-structuring-admin-post.php:225
72
- #: includes/wp-structuring-admin-post.php:239
73
  msgid "All Pages (In Header)"
74
  msgstr "全てのページ(ヘッダー)"
75
 
@@ -80,11 +81,15 @@ msgstr "イベント投稿ページ"
80
  #: includes/wp-structuring-admin-post.php:186
81
  #: includes/wp-structuring-admin-post.php:212
82
  #: includes/wp-structuring-admin-post.php:226
83
- #: includes/wp-structuring-admin-post.php:240
84
  msgid "Homepage"
85
  msgstr "ホームページ"
86
 
87
- #: includes/wp-structuring-admin-post.php:287
 
 
 
 
88
  msgid "Output On(Custom Posts)"
89
  msgstr "出力ページ(カスタム投稿)"
90
 
@@ -93,51 +98,101 @@ msgstr "出力ページ(カスタム投稿)"
93
  msgid "Event Posts"
94
  msgstr "イベント投稿"
95
 
96
- #: includes/wp-structuring-custom-post-event.php:73
 
 
 
 
97
  msgid "Schema.org Type Event"
98
  msgstr "Schema.org Type Event"
99
 
100
- #: includes/wp-structuring-custom-post-event.php:95
101
  msgid "USD"
102
  msgstr "JPY"
103
 
104
- #: includes/wp-structuring-custom-post-event.php:100
105
  msgid "Event Name"
106
  msgstr "イベント名"
107
 
108
- #: includes/wp-structuring-custom-post-event.php:105
109
  msgid "Start Date"
110
  msgstr "開始日"
111
 
112
- #: includes/wp-structuring-custom-post-event.php:111
113
  msgid "Event URL"
114
  msgstr "イベントURL"
115
 
116
- #: includes/wp-structuring-custom-post-event.php:116
117
  msgid "Place Name"
118
  msgstr "場所名"
119
 
120
- #: includes/wp-structuring-custom-post-event.php:121
121
  msgid "Place URL"
122
  msgstr "会場URL"
123
 
124
- #: includes/wp-structuring-custom-post-event.php:126
125
  msgid "Place Address"
126
  msgstr "会場住所"
127
 
128
- #: includes/wp-structuring-custom-post-event.php:131
129
  msgid "Price"
130
  msgstr "参加費"
131
 
132
- #: includes/wp-structuring-custom-post-event.php:136
133
  msgid "Currency"
134
  msgstr "通貨"
135
 
136
- #: wp-structuring-markup.php:146 wp-structuring-markup.php:147
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  msgid "Schema.org Settings"
138
  msgstr "Schema.org 設定"
139
 
140
- #: wp-structuring-markup.php:154
141
  msgid "Schema.org Setting Edit"
142
  msgstr "Schema.org 設定編集"
143
 
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"
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
 
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
 
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
 
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
 
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
 
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
 
languages/wp-structuring-markup.pot CHANGED
@@ -2,14 +2,15 @@
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.5.0\n"
6
- "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-structuring-markup\n"
7
- "POT-Creation-Date: 2016-04-19 12:08:30+00:00\n"
 
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
  "PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
12
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
  #: includes/wp-structuring-admin-list.php:43
@@ -33,7 +34,7 @@ msgstr ""
33
  msgid "ShortCode"
34
  msgstr ""
35
 
36
- #: includes/wp-structuring-admin-list.php:81 wp-structuring-markup.php:155
37
  msgid "Edit"
38
  msgstr ""
39
 
@@ -51,7 +52,7 @@ msgstr ""
51
  #: includes/wp-structuring-admin-post.php:199
52
  #: includes/wp-structuring-admin-post.php:213
53
  #: includes/wp-structuring-admin-post.php:227
54
- #: includes/wp-structuring-admin-post.php:241
55
  msgid "Posts"
56
  msgstr ""
57
 
@@ -61,7 +62,7 @@ msgstr ""
61
  #: includes/wp-structuring-admin-post.php:200
62
  #: includes/wp-structuring-admin-post.php:214
63
  #: includes/wp-structuring-admin-post.php:228
64
- #: includes/wp-structuring-admin-post.php:242
65
  msgid "Pages"
66
  msgstr ""
67
 
@@ -69,7 +70,7 @@ msgstr ""
69
  #: includes/wp-structuring-admin-post.php:185
70
  #: includes/wp-structuring-admin-post.php:211
71
  #: includes/wp-structuring-admin-post.php:225
72
- #: includes/wp-structuring-admin-post.php:239
73
  msgid "All Pages (In Header)"
74
  msgstr ""
75
 
@@ -80,11 +81,15 @@ msgstr ""
80
  #: includes/wp-structuring-admin-post.php:186
81
  #: includes/wp-structuring-admin-post.php:212
82
  #: includes/wp-structuring-admin-post.php:226
83
- #: includes/wp-structuring-admin-post.php:240
84
  msgid "Homepage"
85
  msgstr ""
86
 
87
- #: includes/wp-structuring-admin-post.php:287
 
 
 
 
88
  msgid "Output On(Custom Posts)"
89
  msgstr ""
90
 
@@ -93,51 +98,101 @@ msgstr ""
93
  msgid "Event Posts"
94
  msgstr ""
95
 
96
- #: includes/wp-structuring-custom-post-event.php:73
 
 
 
 
97
  msgid "Schema.org Type Event"
98
  msgstr ""
99
 
100
- #: includes/wp-structuring-custom-post-event.php:95
101
  msgid "USD"
102
  msgstr ""
103
 
104
- #: includes/wp-structuring-custom-post-event.php:100
105
  msgid "Event Name"
106
  msgstr ""
107
 
108
- #: includes/wp-structuring-custom-post-event.php:105
109
  msgid "Start Date"
110
  msgstr ""
111
 
112
- #: includes/wp-structuring-custom-post-event.php:111
113
  msgid "Event URL"
114
  msgstr ""
115
 
116
- #: includes/wp-structuring-custom-post-event.php:116
117
  msgid "Place Name"
118
  msgstr ""
119
 
120
- #: includes/wp-structuring-custom-post-event.php:121
121
  msgid "Place URL"
122
  msgstr ""
123
 
124
- #: includes/wp-structuring-custom-post-event.php:126
125
  msgid "Place Address"
126
  msgstr ""
127
 
128
- #: includes/wp-structuring-custom-post-event.php:131
129
  msgid "Price"
130
  msgstr ""
131
 
132
- #: includes/wp-structuring-custom-post-event.php:136
133
  msgid "Currency"
134
  msgstr ""
135
 
136
- #: wp-structuring-markup.php:146 wp-structuring-markup.php:147
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  msgid "Schema.org Settings"
138
  msgstr ""
139
 
140
- #: wp-structuring-markup.php:154
141
  msgid "Schema.org Setting Edit"
142
  msgstr ""
143
 
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
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
 
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
 
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
 
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
 
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
 
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
 
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.5.2
6
- Stable tag: 2.5.1
7
 
8
  Allows you to include schema.org JSON-LD syntax markup on your website
9
 
@@ -22,6 +22,7 @@ Base knowledge is "https://schema.org/" and "https://developers.google.com/struc
22
  * NewsArticle: http://schema.org/NewsArticle
23
  * Organization: https://schema.org/Organization
24
  * Person: https://schema.org/Person
 
25
  * Website: https://schema.org/WebSite
26
 
27
  = Breadcrumb =
@@ -52,6 +53,15 @@ if ( shortcode_exists( 'wp-structuring-markup-breadcrumb' ) ) {
52
 
53
  == Changelog ==
54
 
 
 
 
 
 
 
 
 
 
55
  = 2.5.1 (2016-05-09) =
56
 
57
  * Checked : WordPress version 4.5.2 operation check.
3
  Tags: schema, schema.org, json, json-ld, seo, post, posts, google, shortcode, breadcrumb
4
  Requires at least: 4.3.1
5
  Tested up to: 4.5.2
6
+ Stable tag: 3.0.0
7
 
8
  Allows you to include schema.org JSON-LD syntax markup on your website
9
 
22
  * NewsArticle: http://schema.org/NewsArticle
23
  * Organization: https://schema.org/Organization
24
  * Person: https://schema.org/Person
25
+ * Video: https://schema.org/Video
26
  * Website: https://schema.org/WebSite
27
 
28
  = Breadcrumb =
53
 
54
  == Changelog ==
55
 
56
+ = 3.0.0 (2016-06-20) =
57
+
58
+ * Added : Schema.org type "Video".
59
+ * Added : Display the cause of the JSON-LD is not output in HTML comments.
60
+ * Fixed : "Schema.org Event" solve the output of JSON-LD is a problem with the double in the custom posts.
61
+ * Fixed : Changes to the search of the array to remove the SQL statement to get the output page.
62
+ * Fixed : "Schema.org Organization" If you have not set up a Social Profiles, it does not show an empty array.
63
+ * Updated : Japanese translation.
64
+
65
  = 2.5.1 (2016-05-09) =
66
 
67
  * Checked : WordPress version 4.5.2 operation check.
uninstall.php CHANGED
@@ -8,7 +8,7 @@ new Structuring_Markup_Uninstall();
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 {
@@ -17,20 +17,23 @@ class Structuring_Markup_Uninstall {
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
 
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 {
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
 
wp-structuring-markup.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Markup (JSON-LD) structured in schema.org
4
  Plugin URI: https://wordpress.org/plugins/wp-structuring-markup/
5
  Description: Allows you to include schema.org JSON-LD syntax markup on your website
6
- Version: 2.5.1
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.5.1
23
  */
24
  class Structuring_Markup {
25
 
@@ -27,10 +27,10 @@ class Structuring_Markup {
27
  * Variable definition.
28
  *
29
  * @since 1.3.0
30
- * @version 2.5.1
31
  */
32
  private $text_domain = 'wp-structuring-markup';
33
- private $version = '2.5.1';
34
 
35
  /**
36
  * Constructor Define.
@@ -44,7 +44,7 @@ class Structuring_Markup {
44
  add_shortcode( $this->text_domain . '-breadcrumb', array( $this, 'short_code_init_breadcrumb' ) );
45
 
46
  add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
47
- add_action( 'init', array( $this, 'create_post_type_event' ) );
48
 
49
  if ( is_admin() ) {
50
  add_action( 'admin_init', array( $this, 'admin_init' ) );
@@ -84,6 +84,8 @@ class Structuring_Markup {
84
  require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-short-code-breadcrumb.php');
85
  $obj = new Structuring_Markup_ShortCode_Breadcrumb();
86
  return $obj->short_code_display( $options, $args );
 
 
87
  }
88
  }
89
 
@@ -94,18 +96,20 @@ class Structuring_Markup {
94
  * @version 1.3.0
95
  */
96
  public function plugins_loaded () {
97
- load_plugin_textdomain( $this->text_domain, false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
98
  }
99
 
100
  /**
101
- * Create custom post type "event".
102
  *
103
  * @since 2.1.0
104
- * @version 2.1.0
105
  */
106
- function create_post_type_event () {
107
  require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-custom-post-event.php' );
108
  new Structuring_Markup_Custom_Post_Event( $this->text_domain );
 
 
109
  }
110
 
111
  /**
@@ -127,9 +131,9 @@ class Structuring_Markup {
127
  /**
128
  * admin_scripts
129
  *
130
- * @since 2.4.0
131
  * @version 2.4.0
132
- * @author Justin Frydman
133
  */
134
  public function admin_scripts () {
135
  wp_enqueue_script( 'wp-structuring-markup-admin-main-js', plugins_url( 'js/main.min.js', __FILE__ ), array('jquery'), '1.0' );
@@ -167,9 +171,12 @@ class Structuring_Markup {
167
  if ( isset( $_POST['activate'] ) && $_POST['activate'] === 'on' ) {
168
  flush_rewrite_rules();
169
  }
170
- if ( !isset( $_POST['activate'] ) ) {
171
  remove_menu_page('edit.php?post_type=schema_event_post');
172
  }
 
 
 
173
  } else {
174
  /** DB Connect */
175
  $db = new Structuring_Markup_Admin_Db();
@@ -178,6 +185,12 @@ class Structuring_Markup {
178
  if ( !isset( $results['activate'] ) || $results['activate'] !== 'on' ) {
179
  remove_menu_page( 'edit.php?post_type=schema_event_post' );
180
  }
 
 
 
 
 
 
181
  }
182
  }
183
 
3
  Plugin Name: Markup (JSON-LD) structured in schema.org
4
  Plugin URI: https://wordpress.org/plugins/wp-structuring-markup/
5
  Description: Allows you to include schema.org JSON-LD syntax markup on your website
6
+ Version: 3.0.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 3.0.0
23
  */
24
  class Structuring_Markup {
25
 
27
  * Variable definition.
28
  *
29
  * @since 1.3.0
30
+ * @version 3.0.0
31
  */
32
  private $text_domain = 'wp-structuring-markup';
33
+ private $version = '3.0.0';
34
 
35
  /**
36
  * Constructor Define.
44
  add_shortcode( $this->text_domain . '-breadcrumb', array( $this, 'short_code_init_breadcrumb' ) );
45
 
46
  add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
47
+ add_action( 'init', array( $this, 'create_post_type' ) );
48
 
49
  if ( is_admin() ) {
50
  add_action( 'admin_init', array( $this, 'admin_init' ) );
84
  require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-short-code-breadcrumb.php');
85
  $obj = new Structuring_Markup_ShortCode_Breadcrumb();
86
  return $obj->short_code_display( $options, $args );
87
+ } else {
88
+ return __return_false();
89
  }
90
  }
91
 
96
  * @version 1.3.0
97
  */
98
  public function plugins_loaded () {
99
+ load_plugin_textdomain( $this->text_domain, __return_false(), dirname( plugin_basename( __FILE__ ) ) . '/languages' );
100
  }
101
 
102
  /**
103
+ * Create custom post type.
104
  *
105
  * @since 2.1.0
106
+ * @version 3.0.0
107
  */
108
+ function create_post_type () {
109
  require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-custom-post-event.php' );
110
  new Structuring_Markup_Custom_Post_Event( $this->text_domain );
111
+ require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-custom-post-video.php' );
112
+ new Structuring_Markup_Custom_Post_Video( $this->text_domain );
113
  }
114
 
115
  /**
131
  /**
132
  * admin_scripts
133
  *
134
+ * @since 2.4.0
135
  * @version 2.4.0
136
+ * @author Justin Frydman
137
  */
138
  public function admin_scripts () {
139
  wp_enqueue_script( 'wp-structuring-markup-admin-main-js', plugins_url( 'js/main.min.js', __FILE__ ), array('jquery'), '1.0' );
171
  if ( isset( $_POST['activate'] ) && $_POST['activate'] === 'on' ) {
172
  flush_rewrite_rules();
173
  }
174
+ if ( !isset( $_POST['activate'] ) && isset( $_GET['type'] ) && $_GET['type'] === 'event' ) {
175
  remove_menu_page('edit.php?post_type=schema_event_post');
176
  }
177
+ if ( !isset( $_POST['activate'] ) && isset( $_GET['type'] ) && $_GET['type'] === 'video' ) {
178
+ remove_menu_page('edit.php?post_type=schema_video_post');
179
+ }
180
  } else {
181
  /** DB Connect */
182
  $db = new Structuring_Markup_Admin_Db();
185
  if ( !isset( $results['activate'] ) || $results['activate'] !== 'on' ) {
186
  remove_menu_page( 'edit.php?post_type=schema_event_post' );
187
  }
188
+
189
+ $results = $db->get_type_options('video');
190
+
191
+ if ( !isset( $results['activate'] ) || $results['activate'] !== 'on' ) {
192
+ remove_menu_page( 'edit.php?post_type=schema_video_post' );
193
+ }
194
  }
195
  }
196