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

Version Description

(2017-03-21) = * Fixed : "Warning: Illegal string offset" error occurred on Video and Event Schema.org. * Updated : Event Types add fields. * Updated : Video Types add fields. * Updated : Change selection method of SiteNavigation type.

Download this release

Release Info

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

Code changes from version 3.2.2 to 3.2.3

includes/wp-structuring-admin-type-site-navigation.php CHANGED
@@ -36,8 +36,25 @@ class Structuring_Markup_Type_Site_Navigation {
36
  $html = '<table class="schema-admin-table">';
37
  $html .= '<caption>Basic Setting</caption>';
38
  $html .= '<tr><th class="require"><label for="menu_name">Menu Name :</label></th><td>';
39
- $html .= '<input type="text" name="option[' . "menu_name" . ']" id="menu_name" class="regular-text" required value="' . esc_attr( $option['menu_name'] ) . '">';
40
- $html .= '<small>Menu ID, name, or slug</small>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  $html .= '</td></tr>';
42
  $html .= '</table>';
43
  echo $html;
36
  $html = '<table class="schema-admin-table">';
37
  $html .= '<caption>Basic Setting</caption>';
38
  $html .= '<tr><th class="require"><label for="menu_name">Menu Name :</label></th><td>';
39
+
40
+ $nav_menus = wp_get_nav_menus();
41
+
42
+ if ( count( $nav_menus ) > 0 ) {
43
+ $html .= '<select name="option[' . "menu_name" . ']" id="menu_name">';
44
+
45
+ foreach ( (array) $nav_menus as $menu ) {
46
+ if ( $option['menu_name'] === $menu->name ) {
47
+ $html .= '<option value="' . esc_attr( $menu->name ) . '" selected>';
48
+ } else {
49
+ $html .= '<option value="' . esc_attr( $menu->name ) . '">';
50
+ }
51
+ $html .= esc_html( $menu->name );
52
+ $html .= '</option>';
53
+ }
54
+
55
+ $html .= '</select>';
56
+ }
57
+
58
  $html .= '</td></tr>';
59
  $html .= '</table>';
60
  echo $html;
includes/wp-structuring-cache.php DELETED
@@ -1,92 +0,0 @@
1
- <?php
2
- /**
3
- * WP Structuring Markup Transient Cache
4
- *
5
- * @author Justin Frydman
6
- * @author Kazuya Takami
7
- * @since 3.1.6
8
- * @version 2.4.2
9
- */
10
- class Structuring_Markup_Cache {
11
-
12
- /**
13
- * The key to be stored
14
- *
15
- * @since 2.4.2
16
- * @version 2.4.2
17
- */
18
- private $key;
19
-
20
- /**
21
- * The prefix for a stored transient
22
- * This prefix should never exceed 7 characters
23
- *
24
- * @since 2.4.2
25
- * @version 2.4.2
26
- */
27
- private $prefix = 'struct_';
28
-
29
- /**
30
- * Constructor Define.
31
- *
32
- * @since 3.1.6
33
- * @version 2.4.2
34
- * @param string $key Unique key for this transient
35
- */
36
- public function __construct ( $key ) {
37
- @assert( !empty( $key ) );
38
-
39
- $this->key = (string) $key;
40
- }
41
-
42
- /**
43
- * Store a transient
44
- *
45
- * @since 3.1.6
46
- * @version 2.4.2
47
- * @see https://codex.wordpress.org/Easier_Expression_of_Time_Constants
48
- * @param string $value - The value to be stored in the cache
49
- * @param string $ttl - The time to live in the cache. Wordpress Time Constants can be used
50
- * @return bool - If the transient was set properly
51
- */
52
- public function set( $value, $ttl ) {
53
- @assert( !empty( $value ) );
54
- @assert( !empty( $ttl ) );
55
-
56
- return set_transient( $this->prepared_key(), $value, $ttl );
57
- }
58
-
59
- /**
60
- * Get a transient
61
- *
62
- * @since 2.4.2
63
- * @version 2.4.2
64
- * @return string $transient_value - The value from the cache
65
- */
66
- public function get() {
67
- return get_transient( $this->prepared_key() );
68
- }
69
-
70
- /**
71
- * Delete a transient
72
- *
73
- * @since 2.4.2
74
- * @version 2.4.2
75
- * @return bool - If the transient was properly deleted
76
- */
77
- public function delete () {
78
- return delete_transient( $this->prepared_key() );
79
- }
80
-
81
- /**
82
- * Prepare a transient for storage or retrieval
83
- * There is a 40 character transient limit
84
- *
85
- * @since 2.4.2
86
- * @version 2.4.2
87
- * @return string $prepared_key - The prefixed and MD5'd key
88
- */
89
- private function prepared_key() {
90
- return $this->prefix . md5( $this->key );
91
- }
92
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/wp-structuring-custom-post-event.php CHANGED
@@ -3,16 +3,18 @@
3
  * Schema.org Custom Post "Event"
4
  *
5
  * @author Kazuya Takami
6
- * @version 3.1.6
7
  * @since 2.1.0
 
 
8
  */
9
  class Structuring_Markup_Custom_Post_Event {
10
 
11
  /**
12
  * Variable definition.
13
  *
14
- * @since 2.1.0
15
  * @version 2.1.0
 
16
  */
17
  private $text_domain;
18
  private $custom_type = 'schema_event_post';
@@ -122,31 +124,25 @@ class Structuring_Markup_Custom_Post_Event {
122
  /**
123
  * Set custom fields.
124
  *
125
- * @version 3.1.3
126
  * @since 2.1.0
127
  */
128
  public function set_custom_fields () {
129
- $args = get_post_meta( get_the_ID(), $this->custom_type, false );
130
- $args = isset( $args[0] ) ? unserialize( $args[0] ) : "";
131
-
132
- if ( !isset( $args['schema_event_type'] ) ) $args['schema_event_type'] = 'Event';
133
- if ( !isset( $args['schema_event_name'] ) ) $args['schema_event_name'] = '';
134
- if ( !isset( $args['schema_event_date'] ) ) $args['schema_event_date'] = date( 'Y-m-d' );
135
- if ( !isset( $args['schema_event_time'] ) ) $args['schema_event_time'] = date( 'h:i' );
136
- if ( !isset( $args['schema_event_date_end'] ) ) $args['schema_event_date_end'] = date( 'Y-m-d' );
137
- if ( !isset( $args['schema_event_time_end'] ) ) $args['schema_event_time_end'] = date( 'h:i' );
138
- if ( !isset( $args['schema_event_url'] ) ) $args['schema_event_url'] = '';
139
- if ( !isset( $args['schema_event_place_name'] ) ) $args['schema_event_place_name'] = '';
140
- if ( !isset( $args['schema_event_place_url'] ) ) $args['schema_event_place_url'] = '';
141
- if ( !isset( $args['schema_event_place_address'] ) ) $args['schema_event_place_address'] = '';
142
- if ( !isset( $args['schema_event_offers_price'] ) ) $args['schema_event_offers_price'] = 0;
143
- if ( !isset( $args['schema_event_offers_currency'] ) ) $args['schema_event_offers_currency'] = esc_html__( 'USD', $this->text_domain );
144
 
145
  $html = '';
146
  $html .= '<table>';
147
- $html .= '<tr><th><label for="schema_event_type">';
148
  $html .= esc_html__( 'Event Type', $this->text_domain );
149
- $html .= '</label></th><td>';
150
  $html .= '<select name="option[' . "schema_event_type" . ']" id="schema_event_type">';
151
  foreach( $this->event_type as $value) {
152
  $html .= '<option';
@@ -157,45 +153,61 @@ class Structuring_Markup_Custom_Post_Event {
157
  }
158
  $html .= '</select>';
159
  $html .= '</td></tr>';
160
- $html .= '<tr><th><label for="schema_event_name">';
161
  $html .= esc_html__( 'Event Name', $this->text_domain );
162
- $html .= '</label></th><td>';
163
  $html .= '<input type="text" name="option[' . "schema_event_name" . ']" id="schema_event_name" class="regular-text" required value="' . esc_attr( $args['schema_event_name'] ) . '">';
164
  $html .= '</td></tr>';
165
- $html .= '<tr><th><label for="schema_event_date">';
 
 
 
 
 
 
 
 
 
 
166
  $html .= esc_html__( 'Start Date', $this->text_domain );
167
- $html .= '</label></th><td>';
168
  $html .= '<input type="date" name="option[' . "schema_event_date" . ']" id="schema_event_date" required value="' . esc_attr( $args['schema_event_date'] ) . '">';
169
  $html .= '<input type="time" name="option[' . "schema_event_time" . ']" id="schema_event_time" required value="' . esc_attr( $args['schema_event_time'] ) . '">';
170
  $html .= '</td></tr>';
171
- $html .= '<tr><th><label for="schema_event_url">';
 
 
 
 
 
 
172
  $html .= esc_html__( 'Event URL', $this->text_domain );
173
- $html .= '</label></th><td>';
174
  $html .= '<input type="text" name="option[' . "schema_event_url" . ']" id="schema_event_url" class="regular-text" required value="' . esc_attr( $args['schema_event_url'] ) . '">';
175
  $html .= '</td></tr>';
176
- $html .= '<tr><th><label for="schema_event_place_name">';
177
  $html .= esc_html__( 'Place Name', $this->text_domain );
178
- $html .= '</label></th><td>';
179
  $html .= '<input type="text" name="option[' . "schema_event_place_name" . ']" id="schema_event_place_name" class="regular-text" required value="' . esc_attr( $args['schema_event_place_name'] ) . '">';
180
  $html .= '</td></tr>';
181
- $html .= '<tr><th><label for="schema_event_place_url">';
182
  $html .= esc_html__( 'Place URL', $this->text_domain );
183
- $html .= '</label></th><td>';
184
  $html .= '<input type="text" name="option[' . "schema_event_place_url" . ']" id="schema_event_place_url" class="regular-text" required value="' . esc_attr( $args['schema_event_place_url'] ) . '">';
185
  $html .= '</td></tr>';
186
- $html .= '<tr><th><label for="schema_event_place_address">';
187
  $html .= esc_html__( 'Place Address', $this->text_domain );
188
- $html .= '</label></th><td>';
189
  $html .= '<input type="text" name="option[' . "schema_event_place_address" . ']" id="schema_event_place_address" class="regular-text" required value="' . esc_attr( $args['schema_event_place_address'] ) . '">';
190
  $html .= '</td></tr>';
191
- $html .= '<tr><th><label for="schema_event_offers_price">';
192
  $html .= esc_html__( 'Price', $this->text_domain );
193
- $html .= '</label></th><td>';
194
  $html .= '<input type="number" name="option[' . "schema_event_offers_price" . ']" id="schema_event_offers_price" required value="' . esc_attr( $args['schema_event_offers_price'] ) . '">';
195
  $html .= '</td></tr>';
196
- $html .= '<tr><th><label for="schema_event_offers_currency">';
197
  $html .= esc_html__( 'Currency', $this->text_domain );
198
- $html .= '</label></th><td>';
199
  $html .= '<input type="text" name="option[' . "schema_event_offers_currency" . ']" id="schema_event_offers_currency" maxlength="3" required value="' . esc_attr( $args['schema_event_offers_currency'] ) . '">';
200
  $html .= '&nbsp;&nbsp;<small>( with <a hre="https://en.wikipedia.org/wiki/ISO_4217#Active_codes" target="_blank">ISO 4217 codes</a> e.g. "USD" )</small>';
201
  $html .= '</td></tr>';
@@ -216,4 +228,32 @@ class Structuring_Markup_Custom_Post_Event {
216
  update_post_meta( $post_id, $this->custom_type, serialize( $_POST['option'] ) );
217
  }
218
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  }
3
  * Schema.org Custom Post "Event"
4
  *
5
  * @author Kazuya Takami
6
+ * @version 3.2.3
7
  * @since 2.1.0
8
+ * @link https://schema.org/Event
9
+ * @link https://developers.google.com/search/docs/data-types/events
10
  */
11
  class Structuring_Markup_Custom_Post_Event {
12
 
13
  /**
14
  * Variable definition.
15
  *
 
16
  * @version 2.1.0
17
+ * @since 2.1.0
18
  */
19
  private $text_domain;
20
  private $custom_type = 'schema_event_post';
124
  /**
125
  * Set custom fields.
126
  *
127
+ * @version 3.2.3
128
  * @since 2.1.0
129
  */
130
  public function set_custom_fields () {
131
+ $custom_array = get_post_meta( get_the_ID(), $this->custom_type, false );
132
+ $custom_array = isset( $custom_array[0] ) ? unserialize( $custom_array[0] ) : array();
133
+
134
+ /** Default Value Set */
135
+ $args = $this->get_default_options();
136
+
137
+ if ( !empty( $args ) ) {
138
+ $args = array_merge( $args, $custom_array );
139
+ }
 
 
 
 
 
 
140
 
141
  $html = '';
142
  $html .= '<table>';
143
+ $html .= '<tr><td><label for="schema_event_type">';
144
  $html .= esc_html__( 'Event Type', $this->text_domain );
145
+ $html .= '&nbsp;(required)</label></td><td>';
146
  $html .= '<select name="option[' . "schema_event_type" . ']" id="schema_event_type">';
147
  foreach( $this->event_type as $value) {
148
  $html .= '<option';
153
  }
154
  $html .= '</select>';
155
  $html .= '</td></tr>';
156
+ $html .= '<tr><td><label for="schema_event_name">';
157
  $html .= esc_html__( 'Event Name', $this->text_domain );
158
+ $html .= '&nbsp;(required)</label></td><td>';
159
  $html .= '<input type="text" name="option[' . "schema_event_name" . ']" id="schema_event_name" class="regular-text" required value="' . esc_attr( $args['schema_event_name'] ) . '">';
160
  $html .= '</td></tr>';
161
+ $html .= '<tr><td><label for="schema_event_description">';
162
+ $html .= esc_html__( 'Event Description', $this->text_domain );
163
+ $html .= '&nbsp;(recommended)</label></td><td>';
164
+ $html .= '<textarea name="option[' . "schema_event_description" . ']" id="schema_event_description" class="large-text code" rows="3">' . esc_attr( $args['schema_event_description'] ) . '</textarea>';
165
+ $html .= '</td></tr>';
166
+ $html .= '<tr><td><label for="schema_event_image">';
167
+ $html .= esc_html__( 'Event Image', $this->text_domain );
168
+ $html .= '&nbsp;(recommended)</label></td><td>';
169
+ $html .= '<input type="text" name="option[' . "schema_event_image" . ']" id="schema_event_image" class="large-text" value="' . esc_attr( $args['schema_event_image'] ) . '">';
170
+ $html .= '</td></tr>';
171
+ $html .= '<tr><td><label for="schema_event_date">';
172
  $html .= esc_html__( 'Start Date', $this->text_domain );
173
+ $html .= '&nbsp;(required)</label></td><td>';
174
  $html .= '<input type="date" name="option[' . "schema_event_date" . ']" id="schema_event_date" required value="' . esc_attr( $args['schema_event_date'] ) . '">';
175
  $html .= '<input type="time" name="option[' . "schema_event_time" . ']" id="schema_event_time" required value="' . esc_attr( $args['schema_event_time'] ) . '">';
176
  $html .= '</td></tr>';
177
+ $html .= '<tr><td><label for="schema_event_date_end">';
178
+ $html .= esc_html__( 'End Date', $this->text_domain );
179
+ $html .= '&nbsp;(recommended)</label></td><td>';
180
+ $html .= '<input type="date" name="option[' . "schema_event_date_end" . ']" id="schema_event_date" value="' . esc_attr( $args['schema_event_date_end'] ) . '">';
181
+ $html .= '<input type="time" name="option[' . "schema_event_time_end" . ']" id="schema_event_time" value="' . esc_attr( $args['schema_event_time_end'] ) . '">';
182
+ $html .= '</td></tr>';
183
+ $html .= '<tr><td><label for="schema_event_url">';
184
  $html .= esc_html__( 'Event URL', $this->text_domain );
185
+ $html .= '&nbsp;(required)</label></td><td>';
186
  $html .= '<input type="text" name="option[' . "schema_event_url" . ']" id="schema_event_url" class="regular-text" required value="' . esc_attr( $args['schema_event_url'] ) . '">';
187
  $html .= '</td></tr>';
188
+ $html .= '<tr><td><label for="schema_event_place_name">';
189
  $html .= esc_html__( 'Place Name', $this->text_domain );
190
+ $html .= '&nbsp;(required)</label></td><td>';
191
  $html .= '<input type="text" name="option[' . "schema_event_place_name" . ']" id="schema_event_place_name" class="regular-text" required value="' . esc_attr( $args['schema_event_place_name'] ) . '">';
192
  $html .= '</td></tr>';
193
+ $html .= '<tr><td><label for="schema_event_place_url">';
194
  $html .= esc_html__( 'Place URL', $this->text_domain );
195
+ $html .= '&nbsp;(required)</label></td><td>';
196
  $html .= '<input type="text" name="option[' . "schema_event_place_url" . ']" id="schema_event_place_url" class="regular-text" required value="' . esc_attr( $args['schema_event_place_url'] ) . '">';
197
  $html .= '</td></tr>';
198
+ $html .= '<tr><td><label for="schema_event_place_address">';
199
  $html .= esc_html__( 'Place Address', $this->text_domain );
200
+ $html .= '&nbsp;(required)</label></td><td>';
201
  $html .= '<input type="text" name="option[' . "schema_event_place_address" . ']" id="schema_event_place_address" class="regular-text" required value="' . esc_attr( $args['schema_event_place_address'] ) . '">';
202
  $html .= '</td></tr>';
203
+ $html .= '<tr><td><label for="schema_event_offers_price">';
204
  $html .= esc_html__( 'Price', $this->text_domain );
205
+ $html .= '&nbsp;(required)</label></td><td>';
206
  $html .= '<input type="number" name="option[' . "schema_event_offers_price" . ']" id="schema_event_offers_price" required value="' . esc_attr( $args['schema_event_offers_price'] ) . '">';
207
  $html .= '</td></tr>';
208
+ $html .= '<tr><td><label for="schema_event_offers_currency">';
209
  $html .= esc_html__( 'Currency', $this->text_domain );
210
+ $html .= '&nbsp;(required)</label></td><td>';
211
  $html .= '<input type="text" name="option[' . "schema_event_offers_currency" . ']" id="schema_event_offers_currency" maxlength="3" required value="' . esc_attr( $args['schema_event_offers_currency'] ) . '">';
212
  $html .= '&nbsp;&nbsp;<small>( with <a hre="https://en.wikipedia.org/wiki/ISO_4217#Active_codes" target="_blank">ISO 4217 codes</a> e.g. "USD" )</small>';
213
  $html .= '</td></tr>';
228
  update_post_meta( $post_id, $this->custom_type, serialize( $_POST['option'] ) );
229
  }
230
  }
231
+
232
+ /**
233
+ * Return the default options array
234
+ *
235
+ * @version 3.2.3
236
+ * @since 3.2.3
237
+ * @return array $args
238
+ */
239
+ private function get_default_options () {
240
+ $args = array(
241
+ 'schema_event_type' => 'Event',
242
+ 'schema_event_name' => '',
243
+ 'schema_event_description' => '',
244
+ 'schema_event_image' => '',
245
+ 'schema_event_date' => date( 'Y-m-d' ),
246
+ 'schema_event_time' => date( 'h:i' ),
247
+ 'schema_event_date_end' => '',
248
+ 'schema_event_time_end' => '',
249
+ 'schema_event_url' => '',
250
+ 'schema_event_place_name' => '',
251
+ 'schema_event_place_url' => '',
252
+ 'schema_event_place_address' => '',
253
+ 'schema_event_offers_price' => 0,
254
+ 'schema_event_offers_currency' => esc_html__( 'USD', $this->text_domain )
255
+ );
256
+
257
+ return (array) $args;
258
+ }
259
  }
includes/wp-structuring-custom-post-video.php CHANGED
@@ -3,16 +3,18 @@
3
  * Schema.org Custom Post "Video"
4
  *
5
  * @author Kazuya Takami
6
- * @since 3.1.6
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';
@@ -20,8 +22,8 @@ class Structuring_Markup_Custom_Post_Video {
20
  /**
21
  * Constructor Define.
22
  *
23
- * @since 3.1.6
24
- * @version 3.0.0
25
  * @param String $text_domain
26
  */
27
  public function __construct ( $text_domain ) {
@@ -73,8 +75,8 @@ class Structuring_Markup_Custom_Post_Video {
73
  /**
74
  * admin init.
75
  *
76
- * @since 3.0.0
77
  * @version 3.0.0
 
78
  */
79
  public function admin_init () {
80
  add_action( 'save_post_' . $this->custom_type, array( $this, 'save_post' ) );
@@ -83,8 +85,8 @@ class Structuring_Markup_Custom_Post_Video {
83
  /**
84
  * admin meta boxes.
85
  *
86
- * @since 3.0.0
87
  * @version 3.0.0
 
88
  */
89
  public function admin_menu () {
90
  $custom_field_title = esc_html__( 'Schema.org Type Video', $this->text_domain );
@@ -94,45 +96,66 @@ class Structuring_Markup_Custom_Post_Video {
94
  /**
95
  * Set custom fields.
96
  *
 
97
  * @since 3.0.0
98
- * @version 3.0.0
99
  */
100
  public function set_custom_fields () {
101
- $args = get_post_meta( get_the_ID(), $this->custom_type, false );
102
- $args = isset( $args[0] ) ? unserialize( $args[0] ) : "";
103
 
104
- if ( !isset( $args['schema_video_duration'] ) ) $args['schema_video_duration'] = '';
105
- if ( !isset( $args['schema_video_content_url'] ) ) $args['schema_video_content_url'] = '';
106
- if ( !isset( $args['schema_video_embed_url'] ) ) $args['schema_video_embed_url'] = '';
107
- if ( !isset( $args['schema_video_interaction_count'] ) ) $args['schema_video_interaction_count'] = '';
108
- if ( !isset( $args['schema_video_expires_date'] ) ) $args['schema_video_expires_date'] = '';
109
- if ( !isset( $args['schema_video_expires_time'] ) ) $args['schema_video_expires_time'] = '';
110
 
111
  $html = '';
112
  $html .= '<table>';
113
- $html .= '<tr><th><label for="schema_video_duration">';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  $html .= esc_html__( 'duration', $this->text_domain );
115
- $html .= '</label></th><td>';
116
  $html .= '<input type="text" name="option[' . "schema_video_duration" . ']" id="schema_video_duration" class="regular-text" value="' . esc_attr( $args['schema_video_duration'] ) . '">';
117
  $html .= '</td></tr>';
118
- $html .= '<tr><th><label for="schema_video_content_url">';
119
  $html .= esc_html__( 'contentURL', $this->text_domain );
120
- $html .= '</label></th><td>';
121
  $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'] ) . '">';
122
  $html .= '</td></tr>';
123
- $html .= '<tr><th><label for="schema_video_embed_url">';
124
  $html .= esc_html__( 'embedURL', $this->text_domain );
125
- $html .= '</label></th><td>';
126
  $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'] ) . '">';
127
  $html .= '</td></tr>';
128
- $html .= '<tr><th><label for="schema_video_interaction_count">';
129
  $html .= esc_html__( 'interactionCount', $this->text_domain );
130
- $html .= '</label></th><td>';
131
  $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'] ) . '">';
132
  $html .= '</td></tr>';
133
- $html .= '<tr><th><label for="schema_video_expires_date">';
134
  $html .= esc_html__( 'expires', $this->text_domain );
135
- $html .= '</label></th><td>';
136
  $html .= '<input type="date" name="option[' . "schema_video_expires_date" . ']" id="schema_video_expires_date" value="' . esc_attr( $args['schema_video_expires_date'] ) . '">';
137
  $html .= '<input type="time" name="option[' . "schema_video_expires_time" . ']" id="schema_video_expires_time" value="' . esc_attr( $args['schema_video_expires_time'] ) . '">';
138
  $html .= '</td></tr>';
@@ -144,8 +167,8 @@ class Structuring_Markup_Custom_Post_Video {
144
  /**
145
  * Save custom post.
146
  *
147
- * @since 3.0.0
148
  * @version 3.0.0
 
149
  * @param integer $post_id The post ID.
150
  */
151
  public function save_post ( $post_id ) {
@@ -153,4 +176,29 @@ class Structuring_Markup_Custom_Post_Video {
153
  update_post_meta( $post_id, $this->custom_type, serialize( $_POST['option'] ) );
154
  }
155
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  }
3
  * Schema.org Custom Post "Video"
4
  *
5
  * @author Kazuya Takami
6
+ * @version 3.2.3
7
+ * @since 3.0.0
8
+ * @link https://schema.org/VideoObject
9
+ * @link https://developers.google.com/search/docs/data-types/videos
10
  */
11
  class Structuring_Markup_Custom_Post_Video {
12
 
13
  /**
14
  * Variable definition.
15
  *
 
16
  * @version 3.0.0
17
+ * @since 3.0.0
18
  */
19
  private $text_domain;
20
  private $custom_type = 'schema_video_post';
22
  /**
23
  * Constructor Define.
24
  *
25
+ * @version 3.1.6
26
+ * @since 3.0.0
27
  * @param String $text_domain
28
  */
29
  public function __construct ( $text_domain ) {
75
  /**
76
  * admin init.
77
  *
 
78
  * @version 3.0.0
79
+ * @since 3.0.0
80
  */
81
  public function admin_init () {
82
  add_action( 'save_post_' . $this->custom_type, array( $this, 'save_post' ) );
85
  /**
86
  * admin meta boxes.
87
  *
 
88
  * @version 3.0.0
89
+ * @since 3.0.0
90
  */
91
  public function admin_menu () {
92
  $custom_field_title = esc_html__( 'Schema.org Type Video', $this->text_domain );
96
  /**
97
  * Set custom fields.
98
  *
99
+ * @version 3.2.3
100
  * @since 3.0.0
 
101
  */
102
  public function set_custom_fields () {
103
+ $custom_array = get_post_meta( get_the_ID(), $this->custom_type, false );
104
+ $custom_array = isset( $custom_array[0] ) ? unserialize( $custom_array[0] ) : array();
105
 
106
+ /** Default Value Set */
107
+ $args = $this->get_default_options();
108
+
109
+ if ( !empty( $args ) ) {
110
+ $args = array_merge( $args, $custom_array );
111
+ }
112
 
113
  $html = '';
114
  $html .= '<table>';
115
+ $html .= '<tr><td><label for="schema_video_name">';
116
+ $html .= esc_html__( 'Video Name', $this->text_domain );
117
+ $html .= '&nbsp;(required)</label></td><td>';
118
+ $html .= '<input type="text" name="option[' . "schema_video_name" . ']" id="schema_video_name" class="regular-text" required value="' . esc_attr( $args['schema_video_name'] ) . '">';
119
+ $html .= '</td></tr>';
120
+ $html .= '<tr><td><label for="schema_video_description">';
121
+ $html .= esc_html__( 'Video Description', $this->text_domain );
122
+ $html .= '&nbsp;(required)</label></td><td>';
123
+ $html .= '<textarea name="option[' . "schema_video_description" . ']" id="schema_video_description" class="large-text code" required rows="3">' . esc_attr( $args['schema_video_description'] ) . '</textarea>';
124
+ $html .= '</td></tr>';
125
+ $html .= '<tr><td><label for="schema_video_thumbnail_url">';
126
+ $html .= esc_html__( 'Thumbnail Url', $this->text_domain );
127
+ $html .= '&nbsp;(required)</label></td><td>';
128
+ $html .= '<input type="text" name="option[' . "schema_video_thumbnail_url" . ']" id="schema_video_thumbnail_url" class="regular-text" required value="' . esc_attr( $args['schema_video_thumbnail_url'] ) . '">';
129
+ $html .= '</td></tr>';
130
+ $html .= '<tr><td><label for="schema_video_upload_date">';
131
+ $html .= esc_html__( 'Upload Date', $this->text_domain );
132
+ $html .= '&nbsp;(required)</label></td><td>';
133
+ $html .= '<input type="date" name="option[' . "schema_video_upload_date" . ']" id="schema_video_upload_date" required value="' . esc_attr( $args['schema_video_upload_date'] ) . '">';
134
+ $html .= '<input type="time" name="option[' . "schema_video_upload_time" . ']" id="schema_video_upload_time" required value="' . esc_attr( $args['schema_video_upload_time'] ) . '">';
135
+ $html .= '</td></tr>';
136
+ $html .= '<tr><td><label for="schema_video_duration">';
137
  $html .= esc_html__( 'duration', $this->text_domain );
138
+ $html .= '&nbsp;(recommended)</label></td><td>';
139
  $html .= '<input type="text" name="option[' . "schema_video_duration" . ']" id="schema_video_duration" class="regular-text" value="' . esc_attr( $args['schema_video_duration'] ) . '">';
140
  $html .= '</td></tr>';
141
+ $html .= '<tr><td><label for="schema_video_content_url">';
142
  $html .= esc_html__( 'contentURL', $this->text_domain );
143
+ $html .= '&nbsp;(recommended)</label></td><td>';
144
  $html .= '<input type="text" name="option[' . "schema_video_content_url" . ']" id="schema_video_content_url" class="regular-text" value="' . esc_attr( $args['schema_video_content_url'] ) . '">';
145
  $html .= '</td></tr>';
146
+ $html .= '<tr><td><label for="schema_video_embed_url">';
147
  $html .= esc_html__( 'embedURL', $this->text_domain );
148
+ $html .= '&nbsp;(recommended)</label></td><td>';
149
  $html .= '<input type="text" name="option[' . "schema_video_embed_url" . ']" id="schema_video_embed_url" class="regular-text" value="' . esc_attr( $args['schema_video_embed_url'] ) . '">';
150
  $html .= '</td></tr>';
151
+ $html .= '<tr><td><label for="schema_video_interaction_count">';
152
  $html .= esc_html__( 'interactionCount', $this->text_domain );
153
+ $html .= '&nbsp;(recommended)</label></td><td>';
154
  $html .= '<input type="text" name="option[' . "schema_video_interaction_count" . ']" id="schema_video_interaction_count" class="regular-text" value="' . esc_attr( $args['schema_video_interaction_count'] ) . '">';
155
  $html .= '</td></tr>';
156
+ $html .= '<tr><td><label for="schema_video_expires_date">';
157
  $html .= esc_html__( 'expires', $this->text_domain );
158
+ $html .= '&nbsp;(recommended)</label></td><td>';
159
  $html .= '<input type="date" name="option[' . "schema_video_expires_date" . ']" id="schema_video_expires_date" value="' . esc_attr( $args['schema_video_expires_date'] ) . '">';
160
  $html .= '<input type="time" name="option[' . "schema_video_expires_time" . ']" id="schema_video_expires_time" value="' . esc_attr( $args['schema_video_expires_time'] ) . '">';
161
  $html .= '</td></tr>';
167
  /**
168
  * Save custom post.
169
  *
 
170
  * @version 3.0.0
171
+ * @since 3.0.0
172
  * @param integer $post_id The post ID.
173
  */
174
  public function save_post ( $post_id ) {
176
  update_post_meta( $post_id, $this->custom_type, serialize( $_POST['option'] ) );
177
  }
178
  }
179
+
180
+ /**
181
+ * Return the default options array
182
+ *
183
+ * @version 3.2.3
184
+ * @since 3.2.3
185
+ * @return array $args
186
+ */
187
+ private function get_default_options () {
188
+ $args = array(
189
+ 'schema_video_name' => '',
190
+ 'schema_video_description' => '',
191
+ 'schema_video_thumbnail_url' => '',
192
+ 'schema_video_upload_date' => '',
193
+ 'schema_video_upload_time' => '',
194
+ 'schema_video_duration' => '',
195
+ 'schema_video_content_url' => '',
196
+ 'schema_video_embed_url' => '',
197
+ 'schema_video_interaction_count' => '',
198
+ 'schema_video_expires_date' => '',
199
+ 'schema_video_expires_time' => '',
200
+ );
201
+
202
+ return (array) $args;
203
+ }
204
  }
includes/wp-structuring-display.php CHANGED
@@ -4,7 +4,7 @@
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 {
@@ -403,7 +403,7 @@ class Structuring_Markup_Display {
403
  /**
404
  * Setting schema.org Event
405
  *
406
- * @version 3.1.3
407
  * @since 2.1.0
408
  */
409
  private function set_schema_event () {
@@ -413,11 +413,12 @@ class Structuring_Markup_Display {
413
  if ( isset( $meta[0] ) ) {
414
  $meta = unserialize( $meta[0] );
415
 
416
- if ( !isset( $meta['schema_event_type']) ) $meta['schema_event_type'] = 'Event';
417
- if ( !isset( $meta['schema_event_name']) ) $meta['schema_event_name'] = '';
418
- if ( !isset( $meta['schema_event_date']) ) $meta['schema_event_date'] = date('Y-m-d');
419
- if ( !isset( $meta['schema_event_time']) ) $meta['schema_event_time'] = date('h:i');
420
- if ( !isset( $meta['schema_event_url']) ) $meta['schema_event_url'] = '';
 
421
  if ( !isset( $meta['schema_event_place_name'] ) ) $meta['schema_event_place_name'] = '';
422
  if ( !isset( $meta['schema_event_place_url'] ) ) $meta['schema_event_place_url'] = '';
423
  if ( !isset( $meta['schema_event_place_address'] ) ) $meta['schema_event_place_address'] = '';
@@ -444,6 +445,17 @@ class Structuring_Markup_Display {
444
  )
445
  );
446
 
 
 
 
 
 
 
 
 
 
 
 
447
  $this->set_schema_json( $args );
448
  }
449
  }
@@ -754,15 +766,13 @@ class Structuring_Markup_Display {
754
  /**
755
  * Setting schema.org Site Navigation
756
  *
757
- * @version 3.1.0
758
  * @since 3.1.0
759
  * @param array $options
760
  */
761
  private function set_schema_site_navigation ( array $options ) {
762
- $args = array();
763
-
764
- if ( isset( $options['menu_name'] ) && wp_get_nav_menu_items( $options['menu_name'], $args ) ) {
765
- $items_array = wp_get_nav_menu_items( $options['menu_name'], $args );
766
  $name_array = array();
767
  $url_array = array();
768
 
@@ -786,58 +796,58 @@ class Structuring_Markup_Display {
786
  /**
787
  * Setting schema.org Video
788
  *
789
- * @version 3.1.0
790
  * @since 3.0.0
791
  */
792
  private function set_schema_video () {
793
  global $post;
794
  $meta = get_post_meta( $post->ID, 'schema_video_post', false );
795
 
796
- $args = array(
797
- "@context" => "http://schema.org",
798
- "@type" => "VideoObject"
799
- );
800
 
801
- if ( has_post_thumbnail( $post->ID ) ) {
802
- $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
803
- $excerpt = $this->escape_text( $post->post_excerpt );
804
- $content = $excerpt === "" ? mb_substr( $this->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
805
-
806
- if ( isset( $meta[0] ) ) {
807
- $meta = unserialize( $meta[0] );
808
-
809
- if ( !isset( $meta['schema_video_duration'] ) ) $meta['schema_video_duration'] = '';
810
- if ( !isset( $meta['schema_video_content_url'] ) ) $meta['schema_video_content_url'] = '';
811
- if ( !isset( $meta['schema_video_embed_url'] ) ) $meta['schema_video_embed_url'] = '';
812
- if ( !isset( $meta['schema_video_interaction_count'] ) ) $meta['schema_video_interaction_count'] = '';
813
- if ( !isset( $meta['schema_video_expires_date'] ) ) $meta['schema_video_expires_date'] = '';
814
- if ( !isset( $meta['schema_video_expires_time'] ) ) $meta['schema_video_expires_time'] = '';
815
-
816
- $args["name"] = esc_html( $post->post_title );
817
- $args["description"] = $content;
818
- $args["thumbnailUrl"] = $images[0];
819
- $args["uploadDate"] = get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID );
820
-
821
- if ( !empty( $meta['schema_video_duration'] ) ) {
822
- $args["duration"] = esc_html( $meta['schema_video_duration'] );
823
- }
824
- if ( !empty( $meta['schema_video_content_url'] ) ) {
825
- $args["contentUrl"] = esc_url( $meta['schema_video_content_url'] );
826
- }
827
- if ( empty( $meta['schema_video_embed_url'] ) ) {
828
- $args["embedUrl"] = esc_url( $meta['schema_video_embed_url'] );
829
- }
830
- if ( !empty( $meta['schema_video_interaction_count'] ) ) {
831
- $args["interactionCount"] = esc_html( $meta['schema_video_interaction_count'] );
832
- }
833
- if ( !empty( $meta['schema_video_expires_date'] ) && !empty( $meta['schema_video_expires_time'] ) ) {
834
- $args["expires"] = esc_html( $meta['schema_video_expires_date'] ) . 'T' . esc_html( $meta['schema_video_expires_time'] );
835
- }
836
- $this->set_schema_json( $args );
837
  }
838
- } else {
839
- $args["message"][] = __( "Featured Image not set.", $this->text_domain );
840
- $this->set_schema_json( $args, __return_true() );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
841
  }
842
  }
843
 
4
  *
5
  * @author Kazuya Takami
6
  * @author Justin Frydman
7
+ * @version 3.2.3
8
  * @since 1.0.0
9
  */
10
  class Structuring_Markup_Display {
403
  /**
404
  * Setting schema.org Event
405
  *
406
+ * @version 3.2.3
407
  * @since 2.1.0
408
  */
409
  private function set_schema_event () {
413
  if ( isset( $meta[0] ) ) {
414
  $meta = unserialize( $meta[0] );
415
 
416
+ /* required items */
417
+ if ( !isset( $meta['schema_event_type']) ) $meta['schema_event_type'] = 'Event';
418
+ if ( !isset( $meta['schema_event_name']) ) $meta['schema_event_name'] = '';
419
+ if ( !isset( $meta['schema_event_date']) ) $meta['schema_event_date'] = date('Y-m-d');
420
+ if ( !isset( $meta['schema_event_time']) ) $meta['schema_event_time'] = date('h:i');
421
+ if ( !isset( $meta['schema_event_url']) ) $meta['schema_event_url'] = '';
422
  if ( !isset( $meta['schema_event_place_name'] ) ) $meta['schema_event_place_name'] = '';
423
  if ( !isset( $meta['schema_event_place_url'] ) ) $meta['schema_event_place_url'] = '';
424
  if ( !isset( $meta['schema_event_place_address'] ) ) $meta['schema_event_place_address'] = '';
445
  )
446
  );
447
 
448
+ /* recommended items */
449
+ if ( isset( $meta['schema_event_description'] ) && $meta['schema_event_description'] !== '' ) {
450
+ $args['description'] = esc_html( $meta['schema_event_description'] );
451
+ }
452
+ if ( isset( $meta['schema_event_image'] ) && $meta['schema_event_image'] !== '' ) {
453
+ $args['image'] = esc_html( $meta['schema_event_image'] );
454
+ }
455
+ if ( isset( $meta['schema_event_date_end'] ) && $meta['schema_event_date_end'] !== '' && isset( $meta['schema_event_time_end'] ) && $meta['schema_event_time_end'] !== '' ) {
456
+ $args['endDate'] = esc_html( $meta['schema_event_date_end'] ) . 'T' . esc_html( $meta['schema_event_time_end'] );
457
+ }
458
+
459
  $this->set_schema_json( $args );
460
  }
461
  }
766
  /**
767
  * Setting schema.org Site Navigation
768
  *
769
+ * @version 3.2.3
770
  * @since 3.1.0
771
  * @param array $options
772
  */
773
  private function set_schema_site_navigation ( array $options ) {
774
+ if ( isset( $options['menu_name'] ) && wp_get_nav_menu_items( $options['menu_name'] ) ) {
775
+ $items_array = wp_get_nav_menu_items( $options['menu_name'] );
 
 
776
  $name_array = array();
777
  $url_array = array();
778
 
796
  /**
797
  * Setting schema.org Video
798
  *
799
+ * @version 3.2.3
800
  * @since 3.0.0
801
  */
802
  private function set_schema_video () {
803
  global $post;
804
  $meta = get_post_meta( $post->ID, 'schema_video_post', false );
805
 
806
+ if ( isset( $meta[0] ) ) {
807
+ $meta = unserialize( $meta[0] );
 
 
808
 
809
+ if ( has_post_thumbnail( $post->ID ) ) {
810
+ $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
811
+ $excerpt = $this->escape_text( $post->post_excerpt );
812
+ $content = $excerpt === "" ? mb_substr( $this->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
813
+ } else {
814
+ $images[0] = '';
815
+ $content = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
816
  }
817
+
818
+ /* required items */
819
+ if ( !isset( $meta['schema_video_name']) ) $meta['schema_video_name'] = esc_html( $post->post_title );
820
+ if ( !isset( $meta['schema_video_description'] ) ) $meta['schema_video_description'] = esc_html( $content );
821
+ if ( !isset( $meta['schema_video_thumbnail_url'] ) ) $meta['schema_video_description'] = esc_html( $images[0] );
822
+ if ( !isset( $meta['schema_video_upload_date'] ) ) $meta['schema_video_upload_date'] = get_post_modified_time( 'Y-m-d', __return_false(), $post->ID );
823
+ if ( !isset( $meta['schema_video_upload_time'] ) ) $meta['schema_video_upload_time'] = get_post_modified_time( 'H:i:s', __return_false(), $post->ID );
824
+
825
+ $args = array(
826
+ "@context" => "http://schema.org",
827
+ "@type" => "VideoObject",
828
+ "name" => esc_html( $meta['schema_video_name'] ),
829
+ "description" => esc_html( $meta['schema_video_description'] ),
830
+ "thumbnailUrl" => esc_html( $meta['schema_video_thumbnail_url'] ),
831
+ "uploadDate" => esc_html( $meta['schema_video_upload_date'] ) . 'T' . esc_html( $meta['schema_video_upload_time'] )
832
+ );
833
+
834
+ /* recommended items */
835
+ if ( isset( $meta['schema_video_duration'] ) && $meta['schema_video_duration'] !== '' ) {
836
+ $args["duration"] = esc_html( $meta['schema_video_duration'] );
837
+ }
838
+ if ( isset( $meta['schema_video_content_url'] ) && $meta['schema_video_content_url'] !== '' ) {
839
+ $args["contentUrl"] = esc_url( $meta['schema_video_content_url'] );
840
+ }
841
+ if ( isset( $meta['schema_video_embed_url'] ) && $meta['schema_video_embed_url'] !== '' ) {
842
+ $args["embedUrl"] = esc_url( $meta['schema_video_embed_url'] );
843
+ }
844
+ if ( isset( $meta['schema_video_interaction_count'] ) && $meta['schema_video_interaction_count'] !== '' ) {
845
+ $args["interactionCount"] = esc_html( $meta['schema_video_interaction_count'] );
846
+ }
847
+ if ( isset( $meta['schema_video_expires_date'] ) && $meta['schema_video_expires_date'] !== '' && isset( $meta['schema_video_expires_time'] ) && $meta['schema_video_expires_time'] !== '' ) {
848
+ $args["expires"] = esc_html( $meta['schema_video_expires_date'] ) . 'T' . esc_html( $meta['schema_video_expires_time'] );
849
+ }
850
+ $this->set_schema_json( $args );
851
  }
852
  }
853
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: miiitaka
3
  Tags: schema, schema.org, json, json-ld, seo, post, posts, google, shortcode, breadcrumb
4
  Requires at least: 4.3.1
5
  Tested up to: 4.7.3
6
- Stable tag: 3.2.2
7
 
8
  Allows you to include schema.org JSON-LD syntax markup on your website
9
 
@@ -54,6 +54,12 @@ if ( shortcode_exists( 'wp-structuring-markup-breadcrumb' ) ) {
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.
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.3
7
 
8
  Allows you to include schema.org JSON-LD syntax markup on your website
9
 
54
 
55
  == Changelog ==
56
 
57
+ = 3.2.3 (2017-03-21) =
58
+ * Fixed : "Warning: Illegal string offset" error occurred on Video and Event Schema.org.
59
+ * Updated : Event Types add fields.
60
+ * Updated : Video Types add fields.
61
+ * Updated : Change selection method of SiteNavigation type.
62
+
63
  = 3.2.2 (2017-03-09) =
64
  * Fixed : Article, BlogPosting, and NewsArticle can not display the Publisher attribute.
65
  * Added : Add media selection function to the field for inputting image path.
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.2
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.2
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.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.
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.3
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.3
22
  * @since 1.0.0
23
  */
24
  class Structuring_Markup {
26
  /**
27
  * Variable definition.
28
  *
29
+ * @version 3.2.3
30
  * @since 1.3.0
31
  */
32
  private $text_domain = 'wp-structuring-markup';
33
+ private $version = '3.2.3';
34
 
35
  /**
36
  * Constructor Define.