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

Version Description

(2017-03-09) = * Fixed : Article, BlogPosting, and NewsArticle can not display the Publisher attribute. * Added : Add media selection function to the field for inputting image path. * Checked : WordPress version 4.7.3 operation check.

Download this release

Release Info

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

Code changes from version 3.2.1 to 3.2.2

css/style.css CHANGED
@@ -125,4 +125,17 @@
125
 
126
  .markup-time .minus:hover {
127
  background-color: #f55e4f;
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  }
125
 
126
  .markup-time .minus:hover {
127
  background-color: #f55e4f;
128
+ }
129
+
130
+ /** Media Uploader */
131
+ .schema-admin-media-button {
132
+ display: block;
133
+ margin: 3px 0 3px 1px;
134
+ padding: 5px 8px;
135
+ }
136
+
137
+ .schema-admin-media-button span {
138
+ display: inline-block;
139
+ margin: 0 0 0 5px;
140
+ vertical-align: middle;
141
  }
includes/wp-structuring-admin-type-article.php CHANGED
@@ -3,7 +3,7 @@
3
  * Schema.org Type Article
4
  *
5
  * @author Kazuya Takami
6
- * @version 3.1.6
7
  * @since 1.1.0
8
  * @see wp-structuring-admin-db.php
9
  * @link http://schema.org/Article
@@ -14,22 +14,25 @@ class Structuring_Markup_Type_Article {
14
  /**
15
  * Constructor Define.
16
  *
17
- * @version 2.2.0
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 );
 
 
25
  }
26
- $this->page_render( $option );
 
27
  }
28
 
29
  /**
30
  * Form Layout Render
31
  *
32
- * @version 3.1.6
33
  * @since 1.1.0
34
  * @param array $option
35
  */
@@ -53,7 +56,7 @@ class Structuring_Markup_Type_Article {
53
  $html = '<table class="schema-admin-table">';
54
  $html .= '<caption>image</caption>';
55
  $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
56
- $html .= '<tr><th>url :</th><td><small>Default : thumbnail</small></td></tr>';
57
  $html .= '<tr><th>height :</th><td><small>Auto : The height of the image, in pixels.</small></td></tr>';
58
  $html .= '<tr><th>width :</th><td><small>Auto : The width of the image, in pixels. Images should be at least 696 pixels wide.</small></td></tr>';
59
  $html .= '</table>';
@@ -82,10 +85,16 @@ class Structuring_Markup_Type_Article {
82
  $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
83
  $html .= '<tr><th><label for="logo">url :</label></th><td>';
84
  $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
85
- $html .= '<small>Logos should be no wider than 600px, and no taller than 60px.</small>';
 
 
 
 
 
 
 
 
86
  $html .= '</td></tr>';
87
- $html .= '<tr><th>height :</th><td><small>Auto : height <= 60px.</small></td></tr>';
88
- $html .= '<tr><th>width :</th><td><small>Auto : width <= 600px.</small></td></tr>';
89
  $html .= '</table>';
90
  echo $html;
91
 
@@ -96,14 +105,15 @@ class Structuring_Markup_Type_Article {
96
  /**
97
  * Return the default options array
98
  *
99
- * @since 3.1.6
100
  * @version 2.2.0
101
- * @param array $args
102
  * @return array $args
103
  */
104
- private function get_default_options ( array $args ) {
105
- $args['name'] = get_bloginfo('name');
106
- $args['logo'] = "";
 
 
107
 
108
  return (array) $args;
109
  }
3
  * Schema.org Type Article
4
  *
5
  * @author Kazuya Takami
6
+ * @version 3.2.2
7
  * @since 1.1.0
8
  * @see wp-structuring-admin-db.php
9
  * @link http://schema.org/Article
14
  /**
15
  * Constructor Define.
16
  *
17
+ * @version 3.2.2
18
  * @since 1.0.0
19
  * @param array $option
20
  */
21
  public function __construct ( array $option ) {
22
  /** Default Value Set */
23
+ $option_array = $this->get_default_options();
24
+
25
+ if ( !empty( $option ) ) {
26
+ $option_array = array_merge( $option_array, $option );
27
  }
28
+
29
+ $this->page_render( $option_array );
30
  }
31
 
32
  /**
33
  * Form Layout Render
34
  *
35
+ * @version 3.2.2
36
  * @since 1.1.0
37
  * @param array $option
38
  */
56
  $html = '<table class="schema-admin-table">';
57
  $html .= '<caption>image</caption>';
58
  $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
59
+ $html .= '<tr><th>url :</th><td><small>Default : Featured Image</small></td></tr>';
60
  $html .= '<tr><th>height :</th><td><small>Auto : The height of the image, in pixels.</small></td></tr>';
61
  $html .= '<tr><th>width :</th><td><small>Auto : The width of the image, in pixels. Images should be at least 696 pixels wide.</small></td></tr>';
62
  $html .= '</table>';
85
  $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
86
  $html .= '<tr><th><label for="logo">url :</label></th><td>';
87
  $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
88
+ $html .= '<button id="media-upload" class="schema-admin-media-button dashicons-before dashicons-admin-media"><span>Add Media</span></button>';
89
+ $html .= '</td></tr>';
90
+ $html .= '<tr><th><label for="logo-width">width :</label></th><td>';
91
+ $html .= '<input type="number" name="option[' . "logo-width" . ']" id="logo-width" min="0" value="' . esc_attr( $option['logo-width'] ) . '">px';
92
+ $html .= '<small>height <= 600px.</small>';
93
+ $html .= '</td></tr>';
94
+ $html .= '<tr><th><label for="logo-height">height :</label></th><td>';
95
+ $html .= '<input type="number" name="option[' . "logo-height" . ']" id="logo-height" min="0" value="' . esc_attr( $option['logo-height'] ) . '">px';
96
+ $html .= '<small>height <= 60px.</small>';
97
  $html .= '</td></tr>';
 
 
98
  $html .= '</table>';
99
  echo $html;
100
 
105
  /**
106
  * Return the default options array
107
  *
108
+ * @since 3.2.2
109
  * @version 2.2.0
 
110
  * @return array $args
111
  */
112
+ private function get_default_options () {
113
+ $args['name'] = get_bloginfo('name');
114
+ $args['logo'] = "";
115
+ $args['logo-height'] = 0;
116
+ $args['logo-width'] = 0;
117
 
118
  return (array) $args;
119
  }
includes/wp-structuring-admin-type-blog-posting.php CHANGED
@@ -3,7 +3,7 @@
3
  * Schema.org Type BlogPosting
4
  *
5
  * @author Kazuya Takami
6
- * @version 3.1.6
7
  * @since 1.2.0
8
  * @see wp-structuring-admin-db.php
9
  * @link http://schema.org/BlogPosting
@@ -14,22 +14,25 @@ class Structuring_Markup_Type_Blog_Posting {
14
  /**
15
  * Constructor Define.
16
  *
17
- * @version 2.2.0
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 );
 
 
25
  }
26
- $this->page_render( $option );
 
27
  }
28
 
29
  /**
30
  * Form Layout Render
31
  *
32
- * @version 3.1.6
33
  * @since 1.2.0
34
  * @param array $option
35
  */
@@ -53,7 +56,7 @@ class Structuring_Markup_Type_Blog_Posting {
53
  $html = '<table class="schema-admin-table">';
54
  $html .= '<caption>image</caption>';
55
  $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
56
- $html .= '<tr><th>url :</th><td><small>Default : thumbnail</small></td></tr>';
57
  $html .= '<tr><th>height :</th><td><small>Auto : The height of the image, in pixels.</small></td></tr>';
58
  $html .= '<tr><th>width :</th><td><small>Auto : The width of the image, in pixels. Images should be at least 696 pixels wide.</small></td></tr>';
59
  $html .= '</table>';
@@ -82,10 +85,16 @@ class Structuring_Markup_Type_Blog_Posting {
82
  $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
83
  $html .= '<tr><th><label for="logo">url :</label></th><td>';
84
  $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
85
- $html .= '<small>Logos should be no wider than 600px, and no taller than 60px.</small>';
 
 
 
 
 
 
 
 
86
  $html .= '</td></tr>';
87
- $html .= '<tr><th>height :</th><td><small>Auto : height <= 60px.</small></td></tr>';
88
- $html .= '<tr><th>width :</th><td><small>Auto : width <= 600px.</small></td></tr>';
89
  $html .= '</table>';
90
  echo $html;
91
 
@@ -96,14 +105,15 @@ class Structuring_Markup_Type_Blog_Posting {
96
  /**
97
  * Return the default options array
98
  *
99
- * @version 3.1.6
100
  * @since 2.2.0
101
- * @param array $args
102
  * @return array $args
103
  */
104
- private function get_default_options ( array $args ) {
105
- $args['name'] = get_bloginfo('name');
106
- $args['logo'] = "";
 
 
107
 
108
  return (array) $args;
109
  }
3
  * Schema.org Type BlogPosting
4
  *
5
  * @author Kazuya Takami
6
+ * @version 3.2.2
7
  * @since 1.2.0
8
  * @see wp-structuring-admin-db.php
9
  * @link http://schema.org/BlogPosting
14
  /**
15
  * Constructor Define.
16
  *
17
+ * @version 3.2.2
18
  * @since 1.0.0
19
  * @param array $option
20
  */
21
  public function __construct ( array $option ) {
22
  /** Default Value Set */
23
+ $option_array = $this->get_default_options();
24
+
25
+ if ( !empty( $option ) ) {
26
+ $option_array = array_merge( $option_array, $option );
27
  }
28
+
29
+ $this->page_render( $option_array );
30
  }
31
 
32
  /**
33
  * Form Layout Render
34
  *
35
+ * @version 3.2.2
36
  * @since 1.2.0
37
  * @param array $option
38
  */
56
  $html = '<table class="schema-admin-table">';
57
  $html .= '<caption>image</caption>';
58
  $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
59
+ $html .= '<tr><th>url :</th><td><small>Default : Featured Image</small></td></tr>';
60
  $html .= '<tr><th>height :</th><td><small>Auto : The height of the image, in pixels.</small></td></tr>';
61
  $html .= '<tr><th>width :</th><td><small>Auto : The width of the image, in pixels. Images should be at least 696 pixels wide.</small></td></tr>';
62
  $html .= '</table>';
85
  $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
86
  $html .= '<tr><th><label for="logo">url :</label></th><td>';
87
  $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
88
+ $html .= '<button id="media-upload" class="schema-admin-media-button dashicons-before dashicons-admin-media"><span>Add Media</span></button>';
89
+ $html .= '</td></tr>';
90
+ $html .= '<tr><th><label for="logo-width">width :</label></th><td>';
91
+ $html .= '<input type="number" name="option[' . "logo-width" . ']" id="logo-width" min="0" value="' . esc_attr( $option['logo-width'] ) . '">px';
92
+ $html .= '<small>height <= 600px.</small>';
93
+ $html .= '</td></tr>';
94
+ $html .= '<tr><th><label for="logo-height">height :</label></th><td>';
95
+ $html .= '<input type="number" name="option[' . "logo-height" . ']" id="logo-height" min="0" value="' . esc_attr( $option['logo-height'] ) . '">px';
96
+ $html .= '<small>height <= 60px.</small>';
97
  $html .= '</td></tr>';
 
 
98
  $html .= '</table>';
99
  echo $html;
100
 
105
  /**
106
  * Return the default options array
107
  *
108
+ * @version 3.2.2
109
  * @since 2.2.0
 
110
  * @return array $args
111
  */
112
+ private function get_default_options () {
113
+ $args['name'] = get_bloginfo('name');
114
+ $args['logo'] = "";
115
+ $args['logo-height'] = 0;
116
+ $args['logo-width'] = 0;
117
 
118
  return (array) $args;
119
  }
includes/wp-structuring-admin-type-news-article.php CHANGED
@@ -3,7 +3,7 @@
3
  * Schema.org Type News Article
4
  *
5
  * @author Kazuya Takami
6
- * @version 3.1.6
7
  * @since 1.0.0
8
  * @see wp-structuring-admin-db.php
9
  * @link http://schema.org/NewsArticle
@@ -14,22 +14,25 @@ class Structuring_Markup_Type_NewsArticle {
14
  /**
15
  * Constructor Define.
16
  *
17
- * @version 2.2.0
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 );
 
 
25
  }
26
- $this->page_render( $option );
 
27
  }
28
 
29
  /**
30
  * Form Layout Render
31
  *
32
- * @version 3.1.6
33
  * @since 1.0.0
34
  * @param array $option
35
  */
@@ -82,10 +85,16 @@ class Structuring_Markup_Type_NewsArticle {
82
  $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
83
  $html .= '<tr><th><label for="logo">url :</label></th><td>';
84
  $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
85
- $html .= '<small>Logos should be no wider than 600px, and no taller than 60px.</small>';
 
 
 
 
 
 
 
 
86
  $html .= '</td></tr>';
87
- $html .= '<tr><th>height :</th><td><small>Auto : height <= 60px.</small></td></tr>';
88
- $html .= '<tr><th>width :</th><td><small>Auto : width <= 600px.</small></td></tr>';
89
  $html .= '</table>';
90
  echo $html;
91
 
@@ -96,14 +105,15 @@ class Structuring_Markup_Type_NewsArticle {
96
  /**
97
  * Return the default options array
98
  *
99
- * @since 3.1.6
100
  * @version 2.2.0
101
- * @param array $args
102
  * @return array $args
103
  */
104
- private function get_default_options ( array $args ) {
105
- $args['name'] = get_bloginfo('name');
106
- $args['logo'] = "";
 
 
107
 
108
  return (array) $args;
109
  }
3
  * Schema.org Type News Article
4
  *
5
  * @author Kazuya Takami
6
+ * @version 3.2.2
7
  * @since 1.0.0
8
  * @see wp-structuring-admin-db.php
9
  * @link http://schema.org/NewsArticle
14
  /**
15
  * Constructor Define.
16
  *
17
+ * @version 3.2.2
18
  * @since 1.0.0
19
  * @param array $option
20
  */
21
  public function __construct ( array $option ) {
22
  /** Default Value Set */
23
+ $option_array = $this->get_default_options();
24
+
25
+ if ( !empty( $option ) ) {
26
+ $option_array = array_merge( $option_array, $option );
27
  }
28
+
29
+ $this->page_render( $option_array );
30
  }
31
 
32
  /**
33
  * Form Layout Render
34
  *
35
+ * @version 3.2.2
36
  * @since 1.0.0
37
  * @param array $option
38
  */
85
  $html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
86
  $html .= '<tr><th><label for="logo">url :</label></th><td>';
87
  $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
88
+ $html .= '<button id="media-upload" class="schema-admin-media-button dashicons-before dashicons-admin-media"><span>Add Media</span></button>';
89
+ $html .= '</td></tr>';
90
+ $html .= '<tr><th><label for="logo-width">width :</label></th><td>';
91
+ $html .= '<input type="number" name="option[' . "logo-width" . ']" id="logo-width" min="0" value="' . esc_attr( $option['logo-width'] ) . '">px';
92
+ $html .= '<small>height <= 600px.</small>';
93
+ $html .= '</td></tr>';
94
+ $html .= '<tr><th><label for="logo-height">height :</label></th><td>';
95
+ $html .= '<input type="number" name="option[' . "logo-height" . ']" id="logo-height" min="0" value="' . esc_attr( $option['logo-height'] ) . '">px';
96
+ $html .= '<small>height <= 60px.</small>';
97
  $html .= '</td></tr>';
 
 
98
  $html .= '</table>';
99
  echo $html;
100
 
105
  /**
106
  * Return the default options array
107
  *
108
+ * @since 3.2.2
109
  * @version 2.2.0
 
110
  * @return array $args
111
  */
112
+ private function get_default_options () {
113
+ $args['name'] = get_bloginfo('name');
114
+ $args['logo'] = "";
115
+ $args['logo-height'] = 0;
116
+ $args['logo-width'] = 0;
117
 
118
  return (array) $args;
119
  }
includes/wp-structuring-admin-type-organization.php CHANGED
@@ -80,6 +80,7 @@ class Structuring_Markup_Type_Organization {
80
  $html .= '</td></tr>';
81
  $html .= '<tr><th class="require"><label for="logo">logo :</label></th><td>';
82
  $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" required value="' . esc_attr( $option['logo'] ) . '">';
 
83
  $html .= '<small>Default : bloginfo("url") + "/images/logo.png"</small>';
84
  $html .= '</td></tr>';
85
  $html .= '</table>';
80
  $html .= '</td></tr>';
81
  $html .= '<tr><th class="require"><label for="logo">logo :</label></th><td>';
82
  $html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" required value="' . esc_attr( $option['logo'] ) . '">';
83
+ $html .= '<button id="media-upload" class="schema-admin-media-button dashicons-before dashicons-admin-media"><span>Add Media</span></button>';
84
  $html .= '<small>Default : bloginfo("url") + "/images/logo.png"</small>';
85
  $html .= '</td></tr>';
86
  $html .= '</table>';
includes/wp-structuring-display.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author Kazuya Takami
6
  * @author Justin Frydman
7
- * @version 3.2.1
8
  * @since 1.0.0
9
  */
10
  class Structuring_Markup_Display {
@@ -212,7 +212,7 @@ class Structuring_Markup_Display {
212
  /**
213
  * Setting schema.org Article
214
  *
215
- * @version 3.2.1
216
  * @since 1.1.0
217
  * @param array $options
218
  */
@@ -252,7 +252,7 @@ class Structuring_Markup_Display {
252
  $args = array_merge( $args, $images_args );
253
  }
254
 
255
- $options['logo'] = isset( $options['logo'] ) ? esc_url( $options['logo'] ) : "";
256
  if ( $logo = $this->get_image_dimensions( $options['logo'] ) ) {
257
  $publisher_args = array(
258
  "publisher" => array(
@@ -267,6 +267,20 @@ class Structuring_Markup_Display {
267
  )
268
  );
269
  $args = array_merge( $args, $publisher_args );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  }
271
 
272
  $this->set_schema_json( $args );
@@ -275,7 +289,7 @@ class Structuring_Markup_Display {
275
  /**
276
  * Setting schema.org BlogPosting
277
  *
278
- * @version 3.2.1
279
  * @since 1.2.0
280
  * @param array $options
281
  */
@@ -316,7 +330,7 @@ class Structuring_Markup_Display {
316
  $args = array_merge( $args, $images_args );
317
  }
318
 
319
- $options['logo'] = isset( $options['logo'] ) ? esc_url( $options['logo'] ) : "";
320
  if ( $logo = $this->get_image_dimensions( $options['logo'] ) ) {
321
  $publisher_args = array(
322
  "publisher" => array(
@@ -331,6 +345,20 @@ class Structuring_Markup_Display {
331
  )
332
  );
333
  $args = array_merge( $args, $publisher_args );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  }
335
 
336
  $this->set_schema_json( $args );
@@ -543,7 +571,7 @@ class Structuring_Markup_Display {
543
  /**
544
  * Setting schema.org NewsArticle
545
  *
546
- * @version 3.2.1
547
  * @since 1.0.0
548
  * @param array $options
549
  */
@@ -584,7 +612,7 @@ class Structuring_Markup_Display {
584
  $args = array_merge( $args, $images_args );
585
  }
586
 
587
- $options['logo'] = isset( $options['logo'] ) ? esc_url( $options['logo'] ) : "";
588
  if ( $logo = $this->get_image_dimensions( $options['logo'] ) ) {
589
  $publisher_args = array(
590
  "publisher" => array(
@@ -599,7 +627,22 @@ class Structuring_Markup_Display {
599
  )
600
  );
601
  $args = array_merge( $args, $publisher_args );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
602
  }
 
603
  $this->set_schema_json( $args );
604
  }
605
 
4
  *
5
  * @author Kazuya Takami
6
  * @author Justin Frydman
7
+ * @version 3.2.2
8
  * @since 1.0.0
9
  */
10
  class Structuring_Markup_Display {
212
  /**
213
  * Setting schema.org Article
214
  *
215
+ * @version 3.2.2
216
  * @since 1.1.0
217
  * @param array $options
218
  */
252
  $args = array_merge( $args, $images_args );
253
  }
254
 
255
+ $options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
256
  if ( $logo = $this->get_image_dimensions( $options['logo'] ) ) {
257
  $publisher_args = array(
258
  "publisher" => array(
267
  )
268
  );
269
  $args = array_merge( $args, $publisher_args );
270
+ } else if ( !empty( $options['logo'] ) ) {
271
+ $publisher_args = array(
272
+ "publisher" => array(
273
+ "@type" => "Organization",
274
+ "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
275
+ "logo" => array(
276
+ "@type" => "ImageObject",
277
+ "url" => $options['logo'],
278
+ "width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
279
+ "height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
280
+ )
281
+ )
282
+ );
283
+ $args = array_merge( $args, $publisher_args );
284
  }
285
 
286
  $this->set_schema_json( $args );
289
  /**
290
  * Setting schema.org BlogPosting
291
  *
292
+ * @version 3.2.2
293
  * @since 1.2.0
294
  * @param array $options
295
  */
330
  $args = array_merge( $args, $images_args );
331
  }
332
 
333
+ $options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
334
  if ( $logo = $this->get_image_dimensions( $options['logo'] ) ) {
335
  $publisher_args = array(
336
  "publisher" => array(
345
  )
346
  );
347
  $args = array_merge( $args, $publisher_args );
348
+ } else if ( !empty( $options['logo'] ) ) {
349
+ $publisher_args = array(
350
+ "publisher" => array(
351
+ "@type" => "Organization",
352
+ "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
353
+ "logo" => array(
354
+ "@type" => "ImageObject",
355
+ "url" => $options['logo'],
356
+ "width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
357
+ "height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
358
+ )
359
+ )
360
+ );
361
+ $args = array_merge( $args, $publisher_args );
362
  }
363
 
364
  $this->set_schema_json( $args );
571
  /**
572
  * Setting schema.org NewsArticle
573
  *
574
+ * @version 3.2.2
575
  * @since 1.0.0
576
  * @param array $options
577
  */
612
  $args = array_merge( $args, $images_args );
613
  }
614
 
615
+ $options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
616
  if ( $logo = $this->get_image_dimensions( $options['logo'] ) ) {
617
  $publisher_args = array(
618
  "publisher" => array(
627
  )
628
  );
629
  $args = array_merge( $args, $publisher_args );
630
+ } else if ( !empty( $options['logo'] ) ) {
631
+ $publisher_args = array(
632
+ "publisher" => array(
633
+ "@type" => "Organization",
634
+ "name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
635
+ "logo" => array(
636
+ "@type" => "ImageObject",
637
+ "url" => $options['logo'],
638
+ "width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
639
+ "height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
640
+ )
641
+ )
642
+ );
643
+ $args = array_merge( $args, $publisher_args );
644
  }
645
+
646
  $this->set_schema_json( $args );
647
  }
648
 
js/media-uploader-main.js ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($) {
2
+ $(function() {
3
+ var custom_uploader = wp.media({
4
+ title: 'Choose Image',
5
+ library: {
6
+ type: 'image'
7
+ },
8
+ button: {
9
+ text: 'Choose Image'
10
+ },
11
+ multiple: false
12
+ });
13
+
14
+ custom_uploader.on("select", function () {
15
+ var images = custom_uploader.state().get('selection');
16
+
17
+ images.each(function(file) {
18
+ $("#logo").val(file.toJSON().url);
19
+ $("#logo-width").val(file.toJSON().width);
20
+ $("#logo-height").val(file.toJSON().height);
21
+ });
22
+ });
23
+
24
+ $("#media-upload").on("click", function(e) {
25
+ e.preventDefault();
26
+ custom_uploader.open();
27
+ });
28
+ });
29
+ })(jQuery);
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: miiitaka
3
  Tags: schema, schema.org, json, json-ld, seo, post, posts, google, shortcode, breadcrumb
4
  Requires at least: 4.3.1
5
- Tested up to: 4.7.2
6
- Stable tag: 3.2.1
7
 
8
  Allows you to include schema.org JSON-LD syntax markup on your website
9
 
@@ -54,6 +54,11 @@ if ( shortcode_exists( 'wp-structuring-markup-breadcrumb' ) ) {
54
 
55
  == Changelog ==
56
 
 
 
 
 
 
57
  = 3.2.1 (2017-02-21) =
58
  * Fixed : Call to undefined function imagecreatefromstring().
59
 
2
  Contributors: miiitaka
3
  Tags: schema, schema.org, json, json-ld, seo, post, posts, google, shortcode, breadcrumb
4
  Requires at least: 4.3.1
5
+ Tested up to: 4.7.3
6
+ Stable tag: 3.2.2
7
 
8
  Allows you to include schema.org JSON-LD syntax markup on your website
9
 
54
 
55
  == Changelog ==
56
 
57
+ = 3.2.2 (2017-03-09) =
58
+ * Fixed : Article, BlogPosting, and NewsArticle can not display the Publisher attribute.
59
+ * Added : Add media selection function to the field for inputting image path.
60
+ * Checked : WordPress version 4.7.3 operation check.
61
+
62
  = 3.2.1 (2017-02-21) =
63
  * Fixed : Call to undefined function imagecreatefromstring().
64
 
wp-structuring-markup.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Markup (JSON-LD) structured in schema.org
4
  Plugin URI: https://github.com/miiitaka/wp-structuring-markup
5
  Description: Allows you to include schema.org JSON-LD syntax markup on your website
6
- Version: 3.2.1
7
  Author: Kazuya Takami
8
  Author URI: https://www.terakoya.work/
9
  License: GPLv2 or later
@@ -18,7 +18,7 @@ new Structuring_Markup();
18
  * Schema.org Basic Class
19
  *
20
  * @author Kazuya Takami
21
- * @version 3.2.1
22
  * @since 1.0.0
23
  */
24
  class Structuring_Markup {
@@ -26,11 +26,11 @@ class Structuring_Markup {
26
  /**
27
  * Variable definition.
28
  *
29
- * @version 3.2.1
30
  * @since 1.3.0
31
  */
32
  private $text_domain = 'wp-structuring-markup';
33
- private $version = '3.2.1';
34
 
35
  /**
36
  * Constructor Define.
@@ -127,20 +127,6 @@ class Structuring_Markup {
127
  wp_register_style( 'wp-structuring-markup-admin-style', plugins_url( 'css/style.css', __FILE__ ), array(), $this->version );
128
  }
129
 
130
- /**
131
- * admin_scripts
132
- *
133
- * @author Justin Frydman
134
- * @author Kazuya Takami
135
- * @version 3.0.5
136
- * @since 2.4.0
137
- */
138
- public function admin_scripts () {
139
- if ( isset( $_GET["type"] ) && $_GET["type"] === 'local_business' ) {
140
- wp_enqueue_script ( 'wp-structuring-markup-admin-main-js', plugins_url ( 'js/main.min.js', __FILE__ ), array( 'jquery' ), $this->version );
141
- }
142
- }
143
-
144
  /**
145
  * Add Menu to the Admin Screen.
146
  *
@@ -180,6 +166,31 @@ class Structuring_Markup {
180
  wp_enqueue_style( 'wp-structuring-markup-admin-style' );
181
  }
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  /**
184
  * LIST Page Template Require.
185
  *
3
  Plugin Name: Markup (JSON-LD) structured in schema.org
4
  Plugin URI: https://github.com/miiitaka/wp-structuring-markup
5
  Description: Allows you to include schema.org JSON-LD syntax markup on your website
6
+ Version: 3.2.2
7
  Author: Kazuya Takami
8
  Author URI: https://www.terakoya.work/
9
  License: GPLv2 or later
18
  * Schema.org Basic Class
19
  *
20
  * @author Kazuya Takami
21
+ * @version 3.2.2
22
  * @since 1.0.0
23
  */
24
  class Structuring_Markup {
26
  /**
27
  * Variable definition.
28
  *
29
+ * @version 3.2.2
30
  * @since 1.3.0
31
  */
32
  private $text_domain = 'wp-structuring-markup';
33
+ private $version = '3.2.2';
34
 
35
  /**
36
  * Constructor Define.
127
  wp_register_style( 'wp-structuring-markup-admin-style', plugins_url( 'css/style.css', __FILE__ ), array(), $this->version );
128
  }
129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  /**
131
  * Add Menu to the Admin Screen.
132
  *
166
  wp_enqueue_style( 'wp-structuring-markup-admin-style' );
167
  }
168
 
169
+ /**
170
+ * admin_scripts
171
+ *
172
+ * @author Justin Frydman
173
+ * @author Kazuya Takami
174
+ * @version 3.2.2
175
+ * @since 2.4.0
176
+ */
177
+ public function admin_scripts () {
178
+ if ( isset( $_GET["type"] ) && $_GET["type"] === 'local_business' ) {
179
+ wp_enqueue_script ( 'wp-structuring-markup-admin-main-js', plugins_url ( 'js/main.min.js', __FILE__ ), array( 'jquery' ), $this->version );
180
+ }
181
+ if ( isset( $_GET["type"] ) ) {
182
+ switch ( $_GET["type"] ) {
183
+ case "article":
184
+ case "blog_posting":
185
+ case "news_article":
186
+ case "organization":
187
+ wp_enqueue_script ( 'wp-structuring-markup-admin-media-js', plugins_url ( 'js/media-uploader-main.js', __FILE__ ), array( 'jquery' ), $this->version );
188
+ wp_enqueue_media();
189
+ break;
190
+ }
191
+ }
192
+ }
193
+
194
  /**
195
  * LIST Page Template Require.
196
  *