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

Version Description

(2016-09-20) = * Added : Schema.org type "SiteNavigation". * Checked : WordPress version 4.6.1 operation check. * Updated : Application URL input item of Schema.org type "WebSite". * Fixed : LocalBusiness Convert data(In the case of version 2.3.x) Logic remove.

Download this release

Release Info

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

Code changes from version 3.0.5 to 3.1.0

includes/wp-structuring-admin-db.php CHANGED
@@ -3,16 +3,16 @@
3
  * Schema.org Admin DB Connection.
4
  *
5
  * @author Kazuya Takami
 
6
  * @since 1.0.0
7
- * @version 3.0.0
8
  */
9
  class Structuring_Markup_Admin_Db {
10
 
11
  /**
12
  * Variable definition.
13
  *
 
14
  * @since 1.0.0
15
- * @version 3.0.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
  "video" => "Video",
30
  "website" => "Web Site"
31
  );
@@ -33,8 +34,8 @@ class Structuring_Markup_Admin_Db {
33
  /**
34
  * Constructor Define.
35
  *
36
- * @since 1.0.0
37
  * @version 1.3.2
 
38
  */
39
  public function __construct () {
40
  global $wpdb;
@@ -44,8 +45,8 @@ class Structuring_Markup_Admin_Db {
44
  /**
45
  * Create Table.
46
  *
 
47
  * @since 1.0.0
48
- * @version 2.1.1
49
  * @param string $text_domain
50
  * @param string $version
51
  */
@@ -76,8 +77,8 @@ class Structuring_Markup_Admin_Db {
76
  /**
77
  * version up process.
78
  *
 
79
  * @since 2.0.0
80
- * @version 2.1.1
81
  * */
82
  $options = get_option( $text_domain );
83
 
@@ -108,11 +109,6 @@ class Structuring_Markup_Admin_Db {
108
  'register_date' => date( "Y-m-d H:i:s" ),
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
- }
116
  }
117
  }
118
  $this->insert_options( $args );
@@ -121,48 +117,11 @@ class Structuring_Markup_Admin_Db {
121
  }
122
  }
123
 
124
- /**
125
- * To convert the data for the new version of the "LocalBusiness".
126
- * version 2.3.3 -> 2.4.0
127
- *
128
- * @since 2.4.0
129
- * @param string $options
130
- * @return string $convert
131
- */
132
- private function convert_local_business( $options ) {
133
- $options = unserialize( $options );
134
- $convert = $options;
135
-
136
- $convert['Mo'] = isset( $options['mon'] ) ? $options['mon'] : "";
137
- $convert['week']['Mo'][0]['open'] = isset( $options['mon-open'] ) ? $options['mon-open'] : "";
138
- $convert['week']['Mo'][0]['close'] = isset( $options['mon-close'] ) ? $options['mon-close'] : "";
139
- $convert['Tu'] = isset( $options['tue'] ) ? $options['tue'] : "";
140
- $convert['week']['Tu'][0]['open'] = isset( $options['tue-open'] ) ? $options['tue-open'] : "";
141
- $convert['week']['Tu'][0]['close'] = isset( $options['tue-close'] ) ? $options['tue-close'] : "";
142
- $convert['We'] = isset( $options['wed'] ) ? $options['wed'] : "";
143
- $convert['week']['We'][0]['open'] = isset( $options['wed-open'] ) ? $options['wed-open'] : "";
144
- $convert['week']['We'][0]['close'] = isset( $options['wed-close'] ) ? $options['wed-close'] : "";
145
- $convert['Th'] = isset( $options['thu'] ) ? $options['mon'] : "";
146
- $convert['week']['Th'][0]['open'] = isset( $options['thu-open'] ) ? $options['thu-open'] : "";
147
- $convert['week']['Th'][0]['close'] = isset( $options['thu-close'] ) ? $options['thu-close'] : "";
148
- $convert['Fr'] = isset( $options['fri'] ) ? $options['fri'] : "";
149
- $convert['week']['Fr'][0]['open'] = isset( $options['fri-open'] ) ? $options['fri-open'] : "";
150
- $convert['week']['Fr'][0]['close'] = isset( $options['fri-close'] ) ? $options['fri-close'] : "";
151
- $convert['Sa'] = isset( $options['sat'] ) ? $options['sat'] : "";
152
- $convert['week']['Sa'][0]['open'] = isset( $options['sat-open'] ) ? $options['sat-open'] : "";
153
- $convert['week']['Sa'][0]['close'] = isset( $options['sat-close'] ) ? $options['sat-close'] : "";
154
- $convert['Su'] = isset( $options['sun'] ) ? $options['sun'] : "";
155
- $convert['week']['Su'][0]['open'] = isset( $options['sun-open'] ) ? $options['sun-open'] : "";
156
- $convert['week']['Su'][0]['close'] = isset( $options['sun-close'] ) ? $options['sun-close'] : "";
157
-
158
- return (string) serialize( $convert );
159
- }
160
-
161
  /**
162
  * Create table execute
163
  *
164
- * @since 2.0.0
165
  * @version 2.1.1
 
166
  * @param string $charset_collate
167
  * @param string $text_domain
168
  * @param string $version
@@ -187,8 +146,8 @@ class Structuring_Markup_Admin_Db {
187
  /**
188
  * Get Data.
189
  *
190
- * @since 1.0.0
191
  * @version 2.1.0
 
192
  * @param integer $id
193
  * @return array $results
194
  */
@@ -228,8 +187,8 @@ class Structuring_Markup_Admin_Db {
228
  /**
229
  * Get Type Data.
230
  *
231
- * @since 2.0.0
232
  * @version 2.1.0
 
233
  * @param string $type
234
  * @return array $results
235
  */
@@ -255,8 +214,8 @@ class Structuring_Markup_Admin_Db {
255
  /**
256
  * Insert Data.
257
  *
258
- * @since 1.0.0
259
  * @version 2.0.0
 
260
  * @param array $args
261
  */
262
  private function insert_options ( array $args ) {
@@ -269,8 +228,8 @@ class Structuring_Markup_Admin_Db {
269
  /**
270
  * Update Data.
271
  *
272
- * @since 1.0.0
273
  * @version 2.0.0
 
274
  * @param array $post($_POST)
275
  * @return integer $post['id']
276
  */
3
  * Schema.org Admin DB Connection.
4
  *
5
  * @author Kazuya Takami
6
+ * @version 3.1.0
7
  * @since 1.0.0
 
8
  */
9
  class Structuring_Markup_Admin_Db {
10
 
11
  /**
12
  * Variable definition.
13
  *
14
+ * @version 3.1.0
15
  * @since 1.0.0
 
16
  */
17
  private $table_name;
18
 
26
  "news_article" => "News Article",
27
  "organization" => "Organization",
28
  "person" => "Person",
29
+ "site_navigation"=> "Site Navigation",
30
  "video" => "Video",
31
  "website" => "Web Site"
32
  );
34
  /**
35
  * Constructor Define.
36
  *
 
37
  * @version 1.3.2
38
+ * @since 1.0.0
39
  */
40
  public function __construct () {
41
  global $wpdb;
45
  /**
46
  * Create Table.
47
  *
48
+ * @version 3.1.0
49
  * @since 1.0.0
 
50
  * @param string $text_domain
51
  * @param string $version
52
  */
77
  /**
78
  * version up process.
79
  *
80
+ * @version 3.1.0
81
  * @since 2.0.0
 
82
  * */
83
  $options = get_option( $text_domain );
84
 
109
  'register_date' => date( "Y-m-d H:i:s" ),
110
  'update_date' => date( "Y-m-d H:i:s" )
111
  );
 
 
 
 
 
112
  }
113
  }
114
  $this->insert_options( $args );
117
  }
118
  }
119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  /**
121
  * Create table execute
122
  *
 
123
  * @version 2.1.1
124
+ * @since 2.0.0
125
  * @param string $charset_collate
126
  * @param string $text_domain
127
  * @param string $version
146
  /**
147
  * Get Data.
148
  *
 
149
  * @version 2.1.0
150
+ * @since 1.0.0
151
  * @param integer $id
152
  * @return array $results
153
  */
187
  /**
188
  * Get Type Data.
189
  *
 
190
  * @version 2.1.0
191
+ * @since 2.0.0
192
  * @param string $type
193
  * @return array $results
194
  */
214
  /**
215
  * Insert Data.
216
  *
 
217
  * @version 2.0.0
218
+ * @since 1.0.0
219
  * @param array $args
220
  */
221
  private function insert_options ( array $args ) {
228
  /**
229
  * Update Data.
230
  *
 
231
  * @version 2.0.0
232
+ * @since 1.0.0
233
  * @param array $post($_POST)
234
  * @return integer $post['id']
235
  */
includes/wp-structuring-admin-post.php CHANGED
@@ -3,7 +3,7 @@
3
  * Schema.org Admin Post
4
  *
5
  * @author Kazuya Takami
6
- * @version 3.0.5
7
  * @since 1.0.0
8
  */
9
  class Structuring_Markup_Admin_Post {
@@ -11,32 +11,32 @@ class Structuring_Markup_Admin_Post {
11
  /**
12
  * Variable definition.
13
  *
14
- * @since 1.3.0
15
  * @version 2.0.0
 
16
  */
17
  private $text_domain;
18
 
19
  /**
20
  * Variable definition.
21
  *
22
- * @since 1.3.0
23
  * @version 2.0.0
 
24
  */
25
  private $type_array;
26
 
27
  /**
28
  * Variable definition.
29
  *
30
- * @since 2.5.0
31
  * @version 2.5.0
 
32
  */
33
  private $post_args = array();
34
 
35
  /**
36
  * Defined nonce.
37
  *
38
- * @since 3.0.2
39
  * @version 3.0.2
 
40
  */
41
  private $nonce_name;
42
  private $nonce_action;
@@ -44,8 +44,8 @@ class Structuring_Markup_Admin_Post {
44
  /**
45
  * Constructor Define.
46
  *
47
- * @since 1.0.0
48
  * @version 3.0.2
 
49
  * @param String $text_domain
50
  */
51
  public function __construct ( $text_domain ) {
@@ -118,7 +118,7 @@ class Structuring_Markup_Admin_Post {
118
  /**
119
  * Setting Page of the Admin Screen.
120
  *
121
- * @version 3.0.5
122
  * @since 1.0.0
123
  * @param array $options
124
  * @param string $status
@@ -254,6 +254,14 @@ class Structuring_Markup_Admin_Post {
254
  require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-person.php' );
255
  new Structuring_Markup_Type_Person( $options['option'] );
256
  break;
 
 
 
 
 
 
 
 
257
  case 'video':
258
  $html = $this->output_checkbox_render( $options['output'], "video", esc_html__( 'Video Post Page', $this->text_domain ) );
259
  $html .= '</td></tr></table><hr>';
@@ -286,8 +294,8 @@ class Structuring_Markup_Admin_Post {
286
  /**
287
  * CheckBox Build Render
288
  *
289
- * @since 1.0.0
290
  * @version 2.5.0
 
291
  * @param array $option['output']
292
  * @param string $output
293
  * @param string $value
@@ -305,8 +313,8 @@ class Structuring_Markup_Admin_Post {
305
  /**
306
  * Custom Posts Build Render
307
  *
308
- * @since 2.5.0
309
  * @version 2.5.0
 
310
  * @param array $option['output']
311
  * @return string $html
312
  */
@@ -322,8 +330,8 @@ class Structuring_Markup_Admin_Post {
322
  /**
323
  * Information Message Render
324
  *
325
- * @since 1.0.0
326
  * @version 2.0.0
 
327
  * @return string $html
328
  */
329
  private function information_render () {
@@ -340,8 +348,8 @@ class Structuring_Markup_Admin_Post {
340
  /**
341
  * Error Message Render
342
  *
343
- * @since 1.0.0
344
  * @version 2.0.0
 
345
  * @return string $html
346
  */
347
  private function output_error_render () {
3
  * Schema.org Admin Post
4
  *
5
  * @author Kazuya Takami
6
+ * @version 3.1.0
7
  * @since 1.0.0
8
  */
9
  class Structuring_Markup_Admin_Post {
11
  /**
12
  * Variable definition.
13
  *
 
14
  * @version 2.0.0
15
+ * @since 1.3.0
16
  */
17
  private $text_domain;
18
 
19
  /**
20
  * Variable definition.
21
  *
 
22
  * @version 2.0.0
23
+ * @since 1.3.0
24
  */
25
  private $type_array;
26
 
27
  /**
28
  * Variable definition.
29
  *
 
30
  * @version 2.5.0
31
+ * @since 2.5.0
32
  */
33
  private $post_args = array();
34
 
35
  /**
36
  * Defined nonce.
37
  *
 
38
  * @version 3.0.2
39
+ * @since 3.0.2
40
  */
41
  private $nonce_name;
42
  private $nonce_action;
44
  /**
45
  * Constructor Define.
46
  *
 
47
  * @version 3.0.2
48
+ * @since 1.0.0
49
  * @param String $text_domain
50
  */
51
  public function __construct ( $text_domain ) {
118
  /**
119
  * Setting Page of the Admin Screen.
120
  *
121
+ * @version 3.1.0
122
  * @since 1.0.0
123
  * @param array $options
124
  * @param string $status
254
  require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-person.php' );
255
  new Structuring_Markup_Type_Person( $options['option'] );
256
  break;
257
+ case 'site_navigation':
258
+ $html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
259
+ $html .= '</td></tr></table><hr>';
260
+ echo $html;
261
+
262
+ require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-site-navigation.php' );
263
+ new Structuring_Markup_Type_Site_Navigation( $options['option'] );
264
+ break;
265
  case 'video':
266
  $html = $this->output_checkbox_render( $options['output'], "video", esc_html__( 'Video Post Page', $this->text_domain ) );
267
  $html .= '</td></tr></table><hr>';
294
  /**
295
  * CheckBox Build Render
296
  *
 
297
  * @version 2.5.0
298
+ * @since 1.0.0
299
  * @param array $option['output']
300
  * @param string $output
301
  * @param string $value
313
  /**
314
  * Custom Posts Build Render
315
  *
 
316
  * @version 2.5.0
317
+ * @since 2.5.0
318
  * @param array $option['output']
319
  * @return string $html
320
  */
330
  /**
331
  * Information Message Render
332
  *
 
333
  * @version 2.0.0
334
+ * @since 1.0.0
335
  * @return string $html
336
  */
337
  private function information_render () {
348
  /**
349
  * Error Message Render
350
  *
 
351
  * @version 2.0.0
352
+ * @since 1.0.0
353
  * @return string $html
354
  */
355
  private function output_error_render () {
includes/wp-structuring-admin-type-website.php CHANGED
@@ -3,7 +3,7 @@
3
  * Schema.org Type WebSite
4
  *
5
  * @author Kazuya Takami
6
- * @version 3.0.5
7
  * @since 1.0.0
8
  * @see wp-structuring-admin-db.php
9
  * @link https://schema.org/WebSite
@@ -15,21 +15,25 @@ class Structuring_Markup_Type_Website {
15
  /**
16
  * Constructor Define.
17
  *
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.0.5
33
  * @since 2.3.3
34
  * @param array $option
35
  */
@@ -52,7 +56,7 @@ class Structuring_Markup_Type_Website {
52
  echo $html;
53
 
54
  $html = '<table class="schema-admin-table">';
55
- $html .= '<caption>Sitelink Search Box</caption>';
56
  $html .= '<tr><th><label for="potential_action">potentialAction Active :</label></th><td>';
57
  $html .= '<input type="checkbox" name="option[' . "potential_action" . ']" id="potential_action" value="on"';
58
  if ( isset( $option['potential_action'] ) && $option['potential_action'] === 'on' ) {
@@ -67,6 +71,22 @@ class Structuring_Markup_Type_Website {
67
  $html .= '</table>';
68
  echo $html;
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  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>';
71
  submit_button();
72
  }
@@ -74,17 +94,20 @@ class Structuring_Markup_Type_Website {
74
  /**
75
  * Return the default options array
76
  *
77
- * @version 2.0.0
78
  * @since 1.0.0
79
- * @param array $args
80
  * @return array $args
81
  */
82
- private function get_default_options ( array $args ) {
83
- $args['name'] = get_bloginfo('name');
84
- $args['alternateName'] = $args['name'];
85
- $args['url'] = get_bloginfo('url');
86
- $args['potential_action'] = '';
87
- $args['target'] = $args['url'] . '/?s=';
 
 
 
 
88
 
89
  return (array) $args;
90
  }
3
  * Schema.org Type WebSite
4
  *
5
  * @author Kazuya Takami
6
+ * @version 3.1.0
7
  * @since 1.0.0
8
  * @see wp-structuring-admin-db.php
9
  * @link https://schema.org/WebSite
15
  /**
16
  * Constructor Define.
17
  *
18
+ * @version 3.1.0
19
+ * @since 1.0.0
20
+ * @param array $option
21
  */
22
  public function __construct ( array $option ) {
23
  /** Default Value Set */
24
+ $option_array = $this->get_default_options();
25
+
26
+ if ( !empty( $option ) ) {
27
+ $option_array = array_merge( $option_array, $option );
28
  }
29
+
30
+ $this->page_render( $option_array );
31
  }
32
 
33
  /**
34
  * Form Layout Render
35
  *
36
+ * @version 3.1.0
37
  * @since 2.3.3
38
  * @param array $option
39
  */
56
  echo $html;
57
 
58
  $html = '<table class="schema-admin-table">';
59
+ $html .= '<caption>Sitelink Search Box [ Site ]</caption>';
60
  $html .= '<tr><th><label for="potential_action">potentialAction Active :</label></th><td>';
61
  $html .= '<input type="checkbox" name="option[' . "potential_action" . ']" id="potential_action" value="on"';
62
  if ( isset( $option['potential_action'] ) && $option['potential_action'] === 'on' ) {
71
  $html .= '</table>';
72
  echo $html;
73
 
74
+ $html = '<table class="schema-admin-table">';
75
+ $html .= '<caption>Sitelink Search Box [ App ] *required Sitelink Search Box [ Site ]</caption>';
76
+ $html .= '<tr><th><label for="potential_action_app">potentialAction Active :</label></th><td>';
77
+ $html .= '<input type="checkbox" name="option[' . "potential_action_app" . ']" id="potential_action_app" value="on"';
78
+ if ( isset( $option['potential_action_app'] ) && $option['potential_action_app'] === 'on' ) {
79
+ $html .= ' checked="checked"';
80
+ }
81
+ $html .= '>Enabled';
82
+ $html .= '</td></tr>';
83
+ $html .= '<tr><th><label for="target_app">target :</label></th><td>';
84
+ $html .= '<input type="text" name="option[' . "target_app" . ']" id="target_app" class="regular-text" value="' . esc_attr( $option['target_app'] ) . '">';
85
+ $html .= '<small>e.g. android-app://com.example/https/query.example.com/search/?q=</small>';
86
+ $html .= '</td></tr>';
87
+ $html .= '</table>';
88
+ echo $html;
89
+
90
  echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/data-types/sitename" target="_blank">https://developers.google.com/search/docs/data-types/sitename</a></p>';
91
  submit_button();
92
  }
94
  /**
95
  * Return the default options array
96
  *
97
+ * @version 3.1.0
98
  * @since 1.0.0
 
99
  * @return array $args
100
  */
101
+ private function get_default_options () {
102
+ $args = array();
103
+
104
+ $args['name'] = get_bloginfo('name');
105
+ $args['alternateName'] = $args['name'];
106
+ $args['url'] = get_bloginfo('url');
107
+ $args['potential_action'] = '';
108
+ $args['target'] = $args['url'] . '/?s=';
109
+ $args['potential_action_app'] = '';
110
+ $args['target_app'] = '';
111
 
112
  return (array) $args;
113
  }
includes/wp-structuring-display.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author Kazuya Takami
6
  * @author Justin Frydman
7
- * @version 3.0.4
8
  * @since 1.0.0
9
  */
10
  class Structuring_Markup_Display {
@@ -12,8 +12,8 @@ class Structuring_Markup_Display {
12
  /**
13
  * Text Domain
14
  *
15
- * @since 3.0.0
16
  * @version 3.0.0
 
17
  */
18
  private $text_domain = 'wp-structuring-markup';
19
 
@@ -30,8 +30,8 @@ class Structuring_Markup_Display {
30
  /**
31
  * Setting schema.org
32
  *
 
33
  * @since 1.0.0
34
- * @version 3.0.3
35
  * @param Structuring_Markup_Admin_Db $db
36
  */
37
  private function set_schema ( Structuring_Markup_Admin_Db $db ) {
@@ -61,8 +61,8 @@ class Structuring_Markup_Display {
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 ) ) {
@@ -75,14 +75,14 @@ class Structuring_Markup_Display {
75
  /**
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 ) ) {
@@ -128,6 +128,11 @@ class Structuring_Markup_Display {
128
  $this->set_schema_person( unserialize( $row->options ) );
129
  }
130
  break;
 
 
 
 
 
131
  case 'video':
132
  $this->set_schema_video();
133
  break;
@@ -145,8 +150,8 @@ class Structuring_Markup_Display {
145
  /**
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
  */
@@ -168,20 +173,24 @@ class Structuring_Markup_Display {
168
  /**
169
  * Setting JSON-LD Template
170
  *
 
171
  * @since 1.1.3
172
- * @version 2.0.0
173
  * @param string $text
174
  * @return string $text
175
  */
176
- private function escape_text_tags ( $text ) {
177
- return (string) str_replace( array( "\r", "\n" ), '', strip_tags( $text ) );
 
 
 
 
178
  }
179
 
180
  /**
181
  * Return image dimensions
182
  *
183
- * @since 2.3.3
184
  * @version 2.4.2
 
185
  * @author Justin Frydman
186
  * @param string $url
187
  * @return array $dimensions
@@ -254,14 +263,14 @@ class Structuring_Markup_Display {
254
  /**
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"
@@ -269,15 +278,15 @@ class Structuring_Markup_Display {
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 )
279
  ),
280
- "headline" => $this->escape_text_tags( $post->post_title ),
281
  "image" => array(
282
  "@type" => "ImageObject",
283
  "url" => $images[0],
@@ -288,7 +297,7 @@ class Structuring_Markup_Display {
288
  "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
289
  "author" => array(
290
  "@type" => "Person",
291
- "name" => $this->escape_text_tags( get_the_author_meta( 'display_name', $post->post_author ) )
292
  ),
293
  "publisher" => array(
294
  "@type" => "Organization",
@@ -318,8 +327,8 @@ class Structuring_Markup_Display {
318
  /**
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 ) {
@@ -333,15 +342,15 @@ class Structuring_Markup_Display {
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 )
343
  ),
344
- "headline" => $this->escape_text_tags( $post->post_title ),
345
  "image" => array(
346
  "@type" => "ImageObject",
347
  "url" => $images[0],
@@ -352,7 +361,7 @@ class Structuring_Markup_Display {
352
  "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
353
  "author" => array(
354
  "@type" => "Person",
355
- "name" => $this->escape_text_tags( get_the_author_meta( 'display_name', $post->post_author ) )
356
  ),
357
  "publisher" => array(
358
  "@type" => "Organization",
@@ -382,8 +391,8 @@ class Structuring_Markup_Display {
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 ) {
@@ -406,8 +415,8 @@ class Structuring_Markup_Display {
406
 
407
  /** Breadcrumb Schema build */
408
  $args = array(
409
- "@context" => "http://schema.org",
410
- "@type" => "BreadcrumbList",
411
  "itemListElement" => $item_list_element
412
  );
413
 
@@ -418,8 +427,8 @@ class Structuring_Markup_Display {
418
  /**
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;
@@ -441,19 +450,19 @@ class Structuring_Markup_Display {
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
  );
@@ -464,8 +473,8 @@ class Structuring_Markup_Display {
464
  /**
465
  * Setting schema.org LocalBusiness
466
  *
467
- * @since 2.3.0
468
  * @version 3.0.4
 
469
  * @param array $options
470
  */
471
  private function set_schema_local_business ( array $options ) {
@@ -575,8 +584,8 @@ class Structuring_Markup_Display {
575
  /**
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 ) {
@@ -590,15 +599,15 @@ class Structuring_Markup_Display {
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 )
600
  ),
601
- "headline" => $this->escape_text_tags( $post->post_title ),
602
  "image" => array(
603
  "@type" => "ImageObject",
604
  "url" => $images[0],
@@ -609,7 +618,7 @@ class Structuring_Markup_Display {
609
  "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
610
  "author" => array(
611
  "@type" => "Person",
612
- "name" => $this->escape_text_tags( get_the_author_meta( 'display_name', $post->post_author ) )
613
  ),
614
  "publisher" => array(
615
  "@type" => "Organization",
@@ -639,8 +648,8 @@ class Structuring_Markup_Display {
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 ) {
@@ -658,7 +667,7 @@ class Structuring_Markup_Display {
658
  $contact_point["contactPoint"] = array(
659
  array(
660
  "@type" => "ContactPoint",
661
- "telephone" => isset( $options['telephone'] ) ? esc_html( $options['telephone'] ) : "",
662
  "contactType" => isset( $options['contact_type'] ) ? esc_html( $options['contact_type'] ) : ""
663
  )
664
  );
@@ -684,8 +693,8 @@ class Structuring_Markup_Display {
684
  /**
685
  * Setting schema.org Person
686
  *
687
- * @since 2.4.0
688
  * @version 3.0.4
 
689
  * @param array $options
690
  */
691
  private function set_schema_person ( array $options ) {
@@ -712,12 +721,44 @@ class Structuring_Markup_Display {
712
  }
713
  $this->set_schema_json( $args );
714
  }
715
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
716
  /**
717
  * Setting schema.org Video
718
  *
 
719
  * @since 3.0.0
720
- * @version 3.0.0
721
  */
722
  private function set_schema_video () {
723
  global $post;
@@ -725,13 +766,13 @@ class Structuring_Markup_Display {
725
 
726
  $args = array(
727
  "@context" => "http://schema.org",
728
- "@type" => "VideoObject"
729
  );
730
 
731
  if ( has_post_thumbnail( $post->ID ) ) {
732
  $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
733
- $excerpt = $this->escape_text_tags( $post->post_excerpt );
734
- $content = $excerpt === "" ? mb_substr( $this->escape_text_tags( $post->post_content ), 0, 110 ) : $excerpt;
735
 
736
  if ( isset( $meta[0] ) ) {
737
  $meta = unserialize( $meta[0] );
@@ -743,7 +784,7 @@ class Structuring_Markup_Display {
743
  if ( !isset( $meta['schema_video_expires_date'] ) ) $meta['schema_video_expires_date'] = '';
744
  if ( !isset( $meta['schema_video_expires_time'] ) ) $meta['schema_video_expires_time'] = '';
745
 
746
- $args["name"] = $this->escape_text_tags( $post->post_title );
747
  $args["description"] = $content;
748
  $args["thumbnailUrl"] = $images[0];
749
  $args["uploadDate"] = get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID );
@@ -761,7 +802,7 @@ class Structuring_Markup_Display {
761
  $args["interactionCount"] = esc_html( $meta['schema_video_interaction_count'] );
762
  }
763
  if ( !empty( $meta['schema_video_expires_date'] ) && !empty( $meta['schema_video_expires_time'] ) ) {
764
- $args["expires"] = $this->escape_text_tags( $meta['schema_video_expires_date'] ) . 'T' . $this->escape_text_tags( $meta['schema_video_expires_time'] );
765
  }
766
  $this->set_schema_json( $args );
767
  }
@@ -774,8 +815,8 @@ class Structuring_Markup_Display {
774
  /**
775
  * Setting schema.org WebSite
776
  *
 
777
  * @since 1.0.0
778
- * @version 2.2.0
779
  * @param array $options
780
  */
781
  private function set_schema_website ( array $options ) {
@@ -787,12 +828,28 @@ class Structuring_Markup_Display {
787
  "url" => isset( $options['url'] ) ? esc_url( $options['url'] ) : ""
788
  );
789
 
 
 
790
  if ( isset( $options['potential_action'] ) && $options['potential_action'] === 'on' ) {
791
- $potential_action["potentialAction"] = array(
792
  "@type" => "SearchAction",
793
  "target" => isset( $options['target'] ) ? esc_url( $options['target'] ) . "{search_term_string}" : "",
794
  "query-input" => isset( $options['target'] ) ? "required name=search_term_string" : ""
795
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
796
  $args = array_merge( $args, $potential_action );
797
  }
798
 
4
  *
5
  * @author Kazuya Takami
6
  * @author Justin Frydman
7
+ * @version 3.1.0
8
  * @since 1.0.0
9
  */
10
  class Structuring_Markup_Display {
12
  /**
13
  * Text Domain
14
  *
 
15
  * @version 3.0.0
16
+ * @since 3.0.0
17
  */
18
  private $text_domain = 'wp-structuring-markup';
19
 
30
  /**
31
  * Setting schema.org
32
  *
33
+ * @version 3.1.0
34
  * @since 1.0.0
 
35
  * @param Structuring_Markup_Admin_Db $db
36
  */
37
  private function set_schema ( Structuring_Markup_Admin_Db $db ) {
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 ) ) {
75
  /**
76
  * Setting JSON-LD Template
77
  *
78
+ * @version 3.1.0
79
  * @since 1.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 ) ) {
128
  $this->set_schema_person( unserialize( $row->options ) );
129
  }
130
  break;
131
+ case 'site_navigation':
132
+ if ( isset( $row->options ) && $row->options ) {
133
+ $this->set_schema_site_navigation( unserialize( $row->options ) );
134
+ }
135
+ break;
136
  case 'video':
137
  $this->set_schema_video();
138
  break;
150
  /**
151
  * Setting JSON-LD Template
152
  *
 
153
  * @since 3.0.0
154
+ * @since 1.0.0
155
  * @param array $args
156
  * @param boolean $error
157
  */
173
  /**
174
  * Setting JSON-LD Template
175
  *
176
+ * @version 3.1.0
177
  * @since 1.1.3
 
178
  * @param string $text
179
  * @return string $text
180
  */
181
+ private function escape_text ( $text ) {
182
+ $text = strip_tags( $text );
183
+ $text = strip_shortcodes( $text );
184
+ $text = str_replace( array( "\r", "\n" ), '', $text );
185
+
186
+ return (string) $text;
187
  }
188
 
189
  /**
190
  * Return image dimensions
191
  *
 
192
  * @version 2.4.2
193
+ * @since 2.3.3
194
  * @author Justin Frydman
195
  * @param string $url
196
  * @return array $dimensions
263
  /**
264
  * Setting schema.org Article
265
  *
266
+ * @version 3.1.0
267
  * @since 1.1.0
 
268
  * @param array $options
269
  */
270
  private function set_schema_article ( array $options ) {
271
  global $post;
272
 
273
+ $options['logo'] = isset( $options['logo'] ) ? esc_url( $options['logo'] ) : "";
274
  $args = array(
275
  "@context" => "http://schema.org",
276
  "@type" => "Article"
278
 
279
  if ( has_post_thumbnail( $post->ID ) && $logo = $this->get_image_dimensions( $options['logo'] ) ) {
280
  $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
281
+ $excerpt = $this->escape_text( $post->post_excerpt );
282
+ $content = $excerpt === "" ? mb_substr( $this->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
283
 
284
  $schema_args = array(
285
  "mainEntityOfPage" => array(
286
  "@type" => "WebPage",
287
  "@id" => get_permalink( $post->ID )
288
  ),
289
+ "headline" => esc_html( $post->post_title ),
290
  "image" => array(
291
  "@type" => "ImageObject",
292
  "url" => $images[0],
297
  "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
298
  "author" => array(
299
  "@type" => "Person",
300
+ "name" => esc_html( get_the_author_meta( 'display_name', $post->post_author ) )
301
  ),
302
  "publisher" => array(
303
  "@type" => "Organization",
327
  /**
328
  * Setting schema.org BlogPosting
329
  *
330
+ * @version 3.1.0
331
  * @since 1.2.0
 
332
  * @param array $options
333
  */
334
  private function set_schema_blog_posting ( array $options ) {
342
 
343
  if ( has_post_thumbnail( $post->ID ) && $logo = $this->get_image_dimensions( $options['logo'] ) ) {
344
  $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
345
+ $excerpt = $this->escape_text( $post->post_excerpt );
346
+ $content = $excerpt === "" ? mb_substr( $this->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
347
 
348
  $schema_args = array(
349
  "mainEntityOfPage" => array(
350
  "@type" => "WebPage",
351
  "@id" => get_permalink( $post->ID )
352
  ),
353
+ "headline" => esc_html( $post->post_title ),
354
  "image" => array(
355
  "@type" => "ImageObject",
356
  "url" => $images[0],
361
  "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
362
  "author" => array(
363
  "@type" => "Person",
364
+ "name" => esc_html( get_the_author_meta( 'display_name', $post->post_author ) )
365
  ),
366
  "publisher" => array(
367
  "@type" => "Organization",
391
  /**
392
  * Setting schema.org Breadcrumb
393
  *
394
+ * @version 3.1.0
395
  * @since 2.0.0
 
396
  * @param array $options
397
  */
398
  private function set_schema_breadcrumb ( array $options ) {
415
 
416
  /** Breadcrumb Schema build */
417
  $args = array(
418
+ "@context" => "http://schema.org",
419
+ "@type" => "BreadcrumbList",
420
  "itemListElement" => $item_list_element
421
  );
422
 
427
  /**
428
  * Setting schema.org Event
429
  *
430
+ * @version 3.1.0
431
  * @since 2.1.0
 
432
  */
433
  private function set_schema_event () {
434
  global $post;
450
  $args = array(
451
  "@context" => "http://schema.org",
452
  "@type" => "Event",
453
+ "name" => esc_html( $meta['schema_event_name'] ),
454
+ "startDate" => esc_html( $meta['schema_event_date'] ) . 'T' . esc_html( $meta['schema_event_time'] ),
455
  "url" => esc_url( $meta['schema_event_url'] ),
456
  "location" => array(
457
  "@type" => "Place",
458
  "sameAs" => esc_url( $meta['schema_event_place_url'] ),
459
+ "name" => esc_html( $meta['schema_event_place_name'] ),
460
+ "address" => esc_html( $meta['schema_event_place_address'] )
461
  ),
462
  "offers" => array(
463
  "@type" => "Offer",
464
+ "price" => esc_html( $meta['schema_event_offers_price'] ),
465
+ "priceCurrency" => esc_html( $meta['schema_event_offers_currency'] ),
466
  "url" => esc_url( $meta['schema_event_url'] )
467
  )
468
  );
473
  /**
474
  * Setting schema.org LocalBusiness
475
  *
 
476
  * @version 3.0.4
477
+ * @since 2.3.0
478
  * @param array $options
479
  */
480
  private function set_schema_local_business ( array $options ) {
584
  /**
585
  * Setting schema.org NewsArticle
586
  *
587
+ * @version 3.1.0
588
  * @since 1.0.0
 
589
  * @param array $options
590
  */
591
  private function set_schema_news_article ( array $options ) {
599
 
600
  if ( has_post_thumbnail( $post->ID ) && $logo = $this->get_image_dimensions( $options['logo'] ) ) {
601
  $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
602
+ $excerpt = $this->escape_text( $post->post_excerpt );
603
+ $content = $excerpt === "" ? mb_substr( $this->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
604
 
605
  $schema_args = array(
606
  "mainEntityOfPage" => array(
607
  "@type" => "WebPage",
608
  "@id" => get_permalink( $post->ID )
609
  ),
610
+ "headline" => esc_html( $post->post_title ),
611
  "image" => array(
612
  "@type" => "ImageObject",
613
  "url" => $images[0],
618
  "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
619
  "author" => array(
620
  "@type" => "Person",
621
+ "name" => esc_html( get_the_author_meta( 'display_name', $post->post_author ) )
622
  ),
623
  "publisher" => array(
624
  "@type" => "Organization",
648
  /**
649
  * Setting schema.org Organization
650
  *
 
651
  * @version 3.0.0
652
+ * @since 1.0.0
653
  * @param array $options
654
  */
655
  private function set_schema_organization ( array $options ) {
667
  $contact_point["contactPoint"] = array(
668
  array(
669
  "@type" => "ContactPoint",
670
+ "telephone" => isset( $options['telephone'] ) ? esc_html( $options['telephone'] ) : "",
671
  "contactType" => isset( $options['contact_type'] ) ? esc_html( $options['contact_type'] ) : ""
672
  )
673
  );
693
  /**
694
  * Setting schema.org Person
695
  *
 
696
  * @version 3.0.4
697
+ * @since 2.4.0
698
  * @param array $options
699
  */
700
  private function set_schema_person ( array $options ) {
721
  }
722
  $this->set_schema_json( $args );
723
  }
724
+
725
+ /**
726
+ * Setting schema.org Site Navigation
727
+ *
728
+ * @version 3.1.0
729
+ * @since 3.1.0
730
+ * @param array $options
731
+ */
732
+ private function set_schema_site_navigation ( array $options ) {
733
+ $args = array();
734
+
735
+ if ( isset( $options['menu_name'] ) && wp_get_nav_menu_items( $options['menu_name'], $args ) ) {
736
+ $items_array = wp_get_nav_menu_items( $options['menu_name'], $args );
737
+ $name_array = array();
738
+ $url_array = array();
739
+
740
+ foreach ( (array) $items_array as $key => $menu_item ) {
741
+ $url_array[] = $menu_item->url;
742
+ $name_array[] = $menu_item->title;
743
+ }
744
+
745
+ if ( count( $items_array ) > 0 ) {
746
+ $args = array(
747
+ "@context" => "http://schema.org",
748
+ "@type" => "SiteNavigationElement",
749
+ "name" => $name_array,
750
+ "url" => $url_array
751
+ );
752
+ $this->set_schema_json ( $args );
753
+ }
754
+ }
755
+ }
756
+
757
  /**
758
  * Setting schema.org Video
759
  *
760
+ * @version 3.1.0
761
  * @since 3.0.0
 
762
  */
763
  private function set_schema_video () {
764
  global $post;
766
 
767
  $args = array(
768
  "@context" => "http://schema.org",
769
+ "@type" => "VideoObject"
770
  );
771
 
772
  if ( has_post_thumbnail( $post->ID ) ) {
773
  $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
774
+ $excerpt = $this->escape_text( $post->post_excerpt );
775
+ $content = $excerpt === "" ? mb_substr( $this->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
776
 
777
  if ( isset( $meta[0] ) ) {
778
  $meta = unserialize( $meta[0] );
784
  if ( !isset( $meta['schema_video_expires_date'] ) ) $meta['schema_video_expires_date'] = '';
785
  if ( !isset( $meta['schema_video_expires_time'] ) ) $meta['schema_video_expires_time'] = '';
786
 
787
+ $args["name"] = esc_html( $post->post_title );
788
  $args["description"] = $content;
789
  $args["thumbnailUrl"] = $images[0];
790
  $args["uploadDate"] = get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID );
802
  $args["interactionCount"] = esc_html( $meta['schema_video_interaction_count'] );
803
  }
804
  if ( !empty( $meta['schema_video_expires_date'] ) && !empty( $meta['schema_video_expires_time'] ) ) {
805
+ $args["expires"] = esc_html( $meta['schema_video_expires_date'] ) . 'T' . esc_html( $meta['schema_video_expires_time'] );
806
  }
807
  $this->set_schema_json( $args );
808
  }
815
  /**
816
  * Setting schema.org WebSite
817
  *
818
+ * @version 3.1.0
819
  * @since 1.0.0
 
820
  * @param array $options
821
  */
822
  private function set_schema_website ( array $options ) {
828
  "url" => isset( $options['url'] ) ? esc_url( $options['url'] ) : ""
829
  );
830
 
831
+ $search_array = array();
832
+
833
  if ( isset( $options['potential_action'] ) && $options['potential_action'] === 'on' ) {
834
+ $action_array = array(
835
  "@type" => "SearchAction",
836
  "target" => isset( $options['target'] ) ? esc_url( $options['target'] ) . "{search_term_string}" : "",
837
  "query-input" => isset( $options['target'] ) ? "required name=search_term_string" : ""
838
  );
839
+ $search_array[] = $action_array;
840
+ }
841
+
842
+ if ( count( $search_array ) > 0 ) {
843
+ if ( isset( $options['potential_action_app'] ) && $options['potential_action_app'] === 'on' ) {
844
+ $action_array = array(
845
+ "@type" => "SearchAction",
846
+ "target" => isset( $options['target_app'] ) ? $options['target_app'] . "{search_term_string}" : "",
847
+ "query-input" => isset( $options['target_app'] ) ? "required name=search_term_string" : ""
848
+ );
849
+ $search_array[] = $action_array;
850
+ }
851
+
852
+ $potential_action["potentialAction"] = $search_array;
853
  $args = array_merge( $args, $potential_action );
854
  }
855
 
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.6.0
6
- Stable tag: 3.0.5
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
  * Video: https://schema.org/Video
26
  * Website: https://schema.org/WebSite
27
 
@@ -53,6 +54,12 @@ if ( shortcode_exists( 'wp-structuring-markup-breadcrumb' ) ) {
53
 
54
  == Changelog ==
55
 
 
 
 
 
 
 
56
  = 3.0.5 (2016-09-06) =
57
  * Fixed : CSS & JavaScript version control.
58
  * Fixed : Registration screen display adjustment.
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.6.1
6
+ Stable tag: 3.1.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
+ * SiteNavigation: https://schema.org/SiteNavigationElement
26
  * Video: https://schema.org/Video
27
  * Website: https://schema.org/WebSite
28
 
54
 
55
  == Changelog ==
56
 
57
+ = 3.1.0 (2016-09-20) =
58
+ * Added : Schema.org type "SiteNavigation".
59
+ * Checked : WordPress version 4.6.1 operation check.
60
+ * Updated : Application URL input item of Schema.org type "WebSite".
61
+ * Fixed : LocalBusiness Convert data(In the case of version 2.3.x) Logic remove.
62
+
63
  = 3.0.5 (2016-09-06) =
64
  * Fixed : CSS & JavaScript version control.
65
  * Fixed : Registration screen display adjustment.
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: 3.0.5
7
  Author: Kazuya Takami
8
  Author URI: http://programp.com/
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.0.5
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.0.5
30
  * @since 1.3.0
31
  */
32
  private $text_domain = 'wp-structuring-markup';
33
- private $version = '3.0.5';
34
 
35
  /**
36
  * Constructor Define.
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.1.0
7
  Author: Kazuya Takami
8
  Author URI: http://programp.com/
9
  License: GPLv2 or later
18
  * Schema.org Basic Class
19
  *
20
  * @author Kazuya Takami
21
+ * @version 3.1.0
22
  * @since 1.0.0
23
  */
24
  class Structuring_Markup {
26
  /**
27
  * Variable definition.
28
  *
29
+ * @version 3.1.0
30
  * @since 1.3.0
31
  */
32
  private $text_domain = 'wp-structuring-markup';
33
+ private $version = '3.1.0';
34
 
35
  /**
36
  * Constructor Define.