Version Description
(2020-02-14) = * Fixed : Schema Type Local Business: Nesting of ternary operators. * Checked : WordPress version 5.6.1 operation check.
Download this release
Release Info
Developer | miiitaka |
Plugin | Markup (JSON-LD) structured in schema.org |
Version | 4.8.0 |
Comparing to | |
See all releases |
Code changes from version 4.6.5 to 4.8.0
- includes/admin/wp-structuring-admin-config.php +153 -153
- includes/admin/wp-structuring-admin-list.php +98 -98
- includes/admin/wp-structuring-admin-post.php +372 -372
- includes/admin/wp-structuring-admin-type-article.php +180 -180
- includes/admin/wp-structuring-admin-type-blog-posting.php +180 -180
- includes/admin/wp-structuring-admin-type-breadcrumb.php +126 -130
- includes/admin/wp-structuring-admin-type-event.php +85 -85
- includes/admin/wp-structuring-admin-type-local-business.php +537 -537
- includes/admin/wp-structuring-admin-type-news-article.php +179 -179
- includes/admin/wp-structuring-admin-type-organization.php +247 -247
- includes/admin/wp-structuring-admin-type-person.php +121 -121
- includes/admin/wp-structuring-admin-type-site-navigation.php +84 -84
- includes/admin/wp-structuring-admin-type-video.php +58 -58
- includes/admin/wp-structuring-admin-type-website.php +118 -118
- includes/custom/wp-structuring-custom-post-event.php +322 -298
- includes/custom/wp-structuring-custom-post-video.php +227 -203
- includes/meta/wp-structuring-meta-article.php +41 -34
- includes/meta/wp-structuring-meta-blog-posting.php +41 -35
- includes/meta/wp-structuring-meta-breadcrumb.php +49 -49
- includes/meta/wp-structuring-meta-event.php +94 -94
- includes/meta/wp-structuring-meta-local-business.php +142 -142
- includes/meta/wp-structuring-meta-news-article.php +41 -35
- includes/meta/wp-structuring-meta-organization.php +79 -79
- includes/meta/wp-structuring-meta-person.php +56 -56
- includes/meta/wp-structuring-meta-site-navigation.php +41 -41
- includes/meta/wp-structuring-meta-video.php +89 -89
- includes/meta/wp-structuring-meta-website.php +57 -57
- includes/wp-structuring-display-amp.php +99 -99
- includes/wp-structuring-opening-hours.php +229 -223
- includes/wp-structuring-short-code-breadcrumb.php +265 -268
- includes/wp-structuring-utility.php +67 -67
- readme.txt +27 -6
- uninstall.php +86 -86
- wp-structuring-markup.php +4 -4
includes/admin/wp-structuring-admin-config.php
CHANGED
@@ -1,154 +1,154 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Admin Config
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.5.3
|
7 |
-
* @since 4.5.0
|
8 |
-
*/
|
9 |
-
class Structuring_Markup_Admin_Config {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Variable definition.
|
13 |
-
*
|
14 |
-
* @version 4.5.0
|
15 |
-
* @since 4.5.0
|
16 |
-
*/
|
17 |
-
private $text_domain;
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Defined nonce.
|
21 |
-
*
|
22 |
-
* @version 4.5.0
|
23 |
-
* @since 4.5.0
|
24 |
-
*/
|
25 |
-
private $nonce_name;
|
26 |
-
private $nonce_action;
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Constructor Define.
|
30 |
-
*
|
31 |
-
* @version 4.5.3
|
32 |
-
* @since 4.5.0
|
33 |
-
* @param String $text_domain
|
34 |
-
*/
|
35 |
-
public function __construct ( $text_domain ) {
|
36 |
-
$this->text_domain = $text_domain;
|
37 |
-
$this->nonce_name = "_wpnonce_" . $text_domain;
|
38 |
-
$this->nonce_action = "config-" . $text_domain;
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Update Status
|
42 |
-
*
|
43 |
-
* "ok" : Successful update
|
44 |
-
* "output" : Output No Check
|
45 |
-
*/
|
46 |
-
$status = "";
|
47 |
-
|
48 |
-
/** DataBase Update & Insert Mode */
|
49 |
-
if ( ! empty( $_POST ) && check_admin_referer( $this->nonce_action, $this->nonce_name ) ) {
|
50 |
-
$db = new Structuring_Markup_Admin_Db();
|
51 |
-
if ( $db->update_config( $_POST, $this->text_domain ) ) {
|
52 |
-
$status = "ok";
|
53 |
-
} else {
|
54 |
-
$status = "error";
|
55 |
-
}
|
56 |
-
}
|
57 |
-
$options = get_option( $text_domain );
|
58 |
-
if ( !$options ) {
|
59 |
-
$options = array();
|
60 |
-
}
|
61 |
-
|
62 |
-
$this->page_render( $options, $status );
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Setting Page of the Admin Screen.
|
67 |
-
*
|
68 |
-
* @version 4.5.0
|
69 |
-
* @since 4.5.0
|
70 |
-
* @param array $options
|
71 |
-
* @param string $status
|
72 |
-
*/
|
73 |
-
private function page_render ( array $options, $status ) {
|
74 |
-
$html = '';
|
75 |
-
$html .= '<div class="wrap">';
|
76 |
-
$html .= '<h1>' . esc_html__( 'Schema.org Config', $this->text_domain ) . '</h1>';
|
77 |
-
switch ( $status ) {
|
78 |
-
case "ok":
|
79 |
-
$html .= $this->information_render();
|
80 |
-
break;
|
81 |
-
case "error":
|
82 |
-
$html .= $this->error_render();
|
83 |
-
break;
|
84 |
-
default:
|
85 |
-
break;
|
86 |
-
}
|
87 |
-
echo $html;
|
88 |
-
|
89 |
-
/** Output Page Select */
|
90 |
-
$html = '<hr>';
|
91 |
-
$html .= '<form method="post" action="">';
|
92 |
-
echo $html;
|
93 |
-
|
94 |
-
wp_nonce_field( $this->nonce_action, $this->nonce_name );
|
95 |
-
|
96 |
-
$html = '<table class="schema-admin-table">';
|
97 |
-
|
98 |
-
$html .= '<tr><th>' . esc_html__( 'Plug-in version' ) . ' : </th>';
|
99 |
-
$html .= '<td>';
|
100 |
-
$html .= isset( $options['version'] ) ? esc_html( $options['version'] ) : '';
|
101 |
-
$html .= '</td></tr>';
|
102 |
-
|
103 |
-
$html .= '<tr><th><label for="compress">Enabled : </label></th>';
|
104 |
-
$html .= '<td><label><input type="checkbox" name="compress" id="compress" value="on"';
|
105 |
-
$html .= ( isset( $options['compress'] ) && $options['compress'] === "on" ) ? ' checked' : '';
|
106 |
-
$html .= '><label for="compress">' . esc_html__( 'Compress output data', $this->text_domain ) . '</label></td></tr>';
|
107 |
-
|
108 |
-
$html .= '</table>';
|
109 |
-
|
110 |
-
echo $html;
|
111 |
-
|
112 |
-
submit_button();
|
113 |
-
|
114 |
-
$html = '</form>';
|
115 |
-
$html .= '</div>';
|
116 |
-
echo $html;
|
117 |
-
}
|
118 |
-
|
119 |
-
/**
|
120 |
-
* Information Message Render
|
121 |
-
*
|
122 |
-
* @version 4.5.0
|
123 |
-
* @since 4.5.0
|
124 |
-
* @return string $html
|
125 |
-
*/
|
126 |
-
private function information_render () {
|
127 |
-
$html = '<div id="message" class="updated notice notice-success is-dismissible below-h2">';
|
128 |
-
$html .= '<p>Schema.org Config Update.</p>';
|
129 |
-
$html .= '<button type="button" class="notice-dismiss">';
|
130 |
-
$html .= '<span class="screen-reader-text">Dismiss this notice.</span>';
|
131 |
-
$html .= '</button>';
|
132 |
-
$html .= '</div>';
|
133 |
-
|
134 |
-
return (string) $html;
|
135 |
-
}
|
136 |
-
|
137 |
-
/**
|
138 |
-
* Error Message Render
|
139 |
-
*
|
140 |
-
* @version 4.5.0
|
141 |
-
* @since 4.5.0
|
142 |
-
* @return string $html
|
143 |
-
*/
|
144 |
-
private function error_render () {
|
145 |
-
$html = '<div id="notice" class="notice notice-error is-dismissible below-h2">';
|
146 |
-
$html .= '<p>Update Error.</p>';
|
147 |
-
$html .= '<button type="button" class="notice-dismiss">';
|
148 |
-
$html .= '<span class="screen-reader-text">Dismiss this notice.</span>';
|
149 |
-
$html .= '</button>';
|
150 |
-
$html .= '</div>';
|
151 |
-
|
152 |
-
return (string) $html;
|
153 |
-
}
|
154 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Admin Config
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.5.3
|
7 |
+
* @since 4.5.0
|
8 |
+
*/
|
9 |
+
class Structuring_Markup_Admin_Config {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Variable definition.
|
13 |
+
*
|
14 |
+
* @version 4.5.0
|
15 |
+
* @since 4.5.0
|
16 |
+
*/
|
17 |
+
private $text_domain;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Defined nonce.
|
21 |
+
*
|
22 |
+
* @version 4.5.0
|
23 |
+
* @since 4.5.0
|
24 |
+
*/
|
25 |
+
private $nonce_name;
|
26 |
+
private $nonce_action;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Constructor Define.
|
30 |
+
*
|
31 |
+
* @version 4.5.3
|
32 |
+
* @since 4.5.0
|
33 |
+
* @param String $text_domain
|
34 |
+
*/
|
35 |
+
public function __construct ( $text_domain ) {
|
36 |
+
$this->text_domain = $text_domain;
|
37 |
+
$this->nonce_name = "_wpnonce_" . $text_domain;
|
38 |
+
$this->nonce_action = "config-" . $text_domain;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Update Status
|
42 |
+
*
|
43 |
+
* "ok" : Successful update
|
44 |
+
* "output" : Output No Check
|
45 |
+
*/
|
46 |
+
$status = "";
|
47 |
+
|
48 |
+
/** DataBase Update & Insert Mode */
|
49 |
+
if ( ! empty( $_POST ) && check_admin_referer( $this->nonce_action, $this->nonce_name ) ) {
|
50 |
+
$db = new Structuring_Markup_Admin_Db();
|
51 |
+
if ( $db->update_config( $_POST, $this->text_domain ) ) {
|
52 |
+
$status = "ok";
|
53 |
+
} else {
|
54 |
+
$status = "error";
|
55 |
+
}
|
56 |
+
}
|
57 |
+
$options = get_option( $text_domain );
|
58 |
+
if ( !$options ) {
|
59 |
+
$options = array();
|
60 |
+
}
|
61 |
+
|
62 |
+
$this->page_render( $options, $status );
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Setting Page of the Admin Screen.
|
67 |
+
*
|
68 |
+
* @version 4.5.0
|
69 |
+
* @since 4.5.0
|
70 |
+
* @param array $options
|
71 |
+
* @param string $status
|
72 |
+
*/
|
73 |
+
private function page_render ( array $options, $status ) {
|
74 |
+
$html = '';
|
75 |
+
$html .= '<div class="wrap">';
|
76 |
+
$html .= '<h1>' . esc_html__( 'Schema.org Config', $this->text_domain ) . '</h1>';
|
77 |
+
switch ( $status ) {
|
78 |
+
case "ok":
|
79 |
+
$html .= $this->information_render();
|
80 |
+
break;
|
81 |
+
case "error":
|
82 |
+
$html .= $this->error_render();
|
83 |
+
break;
|
84 |
+
default:
|
85 |
+
break;
|
86 |
+
}
|
87 |
+
echo $html;
|
88 |
+
|
89 |
+
/** Output Page Select */
|
90 |
+
$html = '<hr>';
|
91 |
+
$html .= '<form method="post" action="">';
|
92 |
+
echo $html;
|
93 |
+
|
94 |
+
wp_nonce_field( $this->nonce_action, $this->nonce_name );
|
95 |
+
|
96 |
+
$html = '<table class="schema-admin-table">';
|
97 |
+
|
98 |
+
$html .= '<tr><th>' . esc_html__( 'Plug-in version' ) . ' : </th>';
|
99 |
+
$html .= '<td>';
|
100 |
+
$html .= isset( $options['version'] ) ? esc_html( $options['version'] ) : '';
|
101 |
+
$html .= '</td></tr>';
|
102 |
+
|
103 |
+
$html .= '<tr><th><label for="compress">Enabled : </label></th>';
|
104 |
+
$html .= '<td><label><input type="checkbox" name="compress" id="compress" value="on"';
|
105 |
+
$html .= ( isset( $options['compress'] ) && $options['compress'] === "on" ) ? ' checked' : '';
|
106 |
+
$html .= '><label for="compress">' . esc_html__( 'Compress output data', $this->text_domain ) . '</label></td></tr>';
|
107 |
+
|
108 |
+
$html .= '</table>';
|
109 |
+
|
110 |
+
echo $html;
|
111 |
+
|
112 |
+
submit_button();
|
113 |
+
|
114 |
+
$html = '</form>';
|
115 |
+
$html .= '</div>';
|
116 |
+
echo $html;
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Information Message Render
|
121 |
+
*
|
122 |
+
* @version 4.5.0
|
123 |
+
* @since 4.5.0
|
124 |
+
* @return string $html
|
125 |
+
*/
|
126 |
+
private function information_render () {
|
127 |
+
$html = '<div id="message" class="updated notice notice-success is-dismissible below-h2">';
|
128 |
+
$html .= '<p>Schema.org Config Update.</p>';
|
129 |
+
$html .= '<button type="button" class="notice-dismiss">';
|
130 |
+
$html .= '<span class="screen-reader-text">Dismiss this notice.</span>';
|
131 |
+
$html .= '</button>';
|
132 |
+
$html .= '</div>';
|
133 |
+
|
134 |
+
return (string) $html;
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Error Message Render
|
139 |
+
*
|
140 |
+
* @version 4.5.0
|
141 |
+
* @since 4.5.0
|
142 |
+
* @return string $html
|
143 |
+
*/
|
144 |
+
private function error_render () {
|
145 |
+
$html = '<div id="notice" class="notice notice-error is-dismissible below-h2">';
|
146 |
+
$html .= '<p>Update Error.</p>';
|
147 |
+
$html .= '<button type="button" class="notice-dismiss">';
|
148 |
+
$html .= '<span class="screen-reader-text">Dismiss this notice.</span>';
|
149 |
+
$html .= '</button>';
|
150 |
+
$html .= '</div>';
|
151 |
+
|
152 |
+
return (string) $html;
|
153 |
+
}
|
154 |
}
|
includes/admin/wp-structuring-admin-list.php
CHANGED
@@ -1,99 +1,99 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Admin List
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.1.4
|
7 |
-
* @since 1.0.0
|
8 |
-
* @see wp-structuring-admin-db.php
|
9 |
-
*/
|
10 |
-
class Structuring_Markup_Admin_List {
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Variable definition.
|
14 |
-
*
|
15 |
-
* @version 2.0.0
|
16 |
-
* @since 1.3.0
|
17 |
-
*/
|
18 |
-
private $text_domain;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Constructor Define.
|
22 |
-
*
|
23 |
-
* @version 2.0.0
|
24 |
-
* @since 1.0.0
|
25 |
-
* @param String $text_domain
|
26 |
-
*/
|
27 |
-
public function __construct ( $text_domain ) {
|
28 |
-
$this->text_domain = $text_domain;
|
29 |
-
$this->page_render();
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* LIST Page HTML Render.
|
34 |
-
*
|
35 |
-
* @version 4.1.4
|
36 |
-
* @since 1.0.0
|
37 |
-
*/
|
38 |
-
private function page_render () {
|
39 |
-
$post_url = 'admin.php?page=' . $this->text_domain . '-post';
|
40 |
-
|
41 |
-
$html = '';
|
42 |
-
$html .= '<div class="wrap">';
|
43 |
-
$html .= '<h1>' . esc_html__( 'Schema.org Settings List', $this->text_domain );
|
44 |
-
$html .= '</h1>';
|
45 |
-
echo $html;
|
46 |
-
|
47 |
-
$html = '<hr>';
|
48 |
-
$html .= '<table class="wp-list-table widefat fixed striped posts schema-admin-table-list">';
|
49 |
-
$html .= '<tr>';
|
50 |
-
$html .= '<th scope="row" class="schema-admin-table-list-type column-primary">' . esc_html__( 'Status', $this->text_domain ) . ' / ' . esc_html__( 'Schema.org Type', $this->text_domain ) . '</th>';
|
51 |
-
$html .= '<th scope="row" class="schema-admin-table-list-output">' . esc_html__( 'Output On', $this->text_domain ) . '</th>';
|
52 |
-
$html .= '</tr>';
|
53 |
-
echo $html;
|
54 |
-
|
55 |
-
$db = new Structuring_Markup_Admin_Db();
|
56 |
-
$results = $db->get_list_options();
|
57 |
-
$type_array = $db->type_array;
|
58 |
-
|
59 |
-
if ( $results ) {
|
60 |
-
foreach ( $results as $row ) {
|
61 |
-
if ( $row->activate === 'on' ) {
|
62 |
-
$html = '<tr class="active"><td class="column-primary"><span><span class="active">Enabled';
|
63 |
-
} else {
|
64 |
-
$html = '<tr class="stop"><td class="column-primary"><span><span class="stop">Disabled';
|
65 |
-
}
|
66 |
-
$html .= '</span></span>';
|
67 |
-
$html .= '<strong><a href="';
|
68 |
-
$html .= admin_url( $post_url . '&type=' . esc_html( $row->type ) . '&schema_post_id=' . esc_html( $row->id ) ) . '">' . $type_array[esc_html( $row->type )];
|
69 |
-
$html .= '</a></strong>';
|
70 |
-
$html .= '<div class="row-actions"><span class="edit"><a href="';
|
71 |
-
$html .= admin_url( $post_url . '&type=' . esc_html( $row->type ) . '&schema_post_id=' . esc_html( $row->id ) ) . '" class="edit" aria-label="' . esc_html__( 'Edit', $this->text_domain ) . '">' . esc_html__( 'Edit', $this->text_domain );
|
72 |
-
$html .= '</a></span></div>';
|
73 |
-
$html .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details', $this->text_domain ) . '</span></button>';
|
74 |
-
$html .= '</td>';
|
75 |
-
$html .= '<td data-colname="' . esc_html__( 'Output On', $this->text_domain ) . '">' . $this->unserialize_output( $row->output ) . '</td>';
|
76 |
-
$html .= '</tr>';
|
77 |
-
echo $html;
|
78 |
-
}
|
79 |
-
} else {
|
80 |
-
echo '<td colspan="2">' . esc_html__( 'Without registration.', $this->text_domain ) . '</td>';
|
81 |
-
}
|
82 |
-
$html = '</table>';
|
83 |
-
$html .= '</div>';
|
84 |
-
echo $html;
|
85 |
-
}
|
86 |
-
|
87 |
-
/**
|
88 |
-
* LIST Page HTML Render.
|
89 |
-
*
|
90 |
-
* @version 2.0.0
|
91 |
-
* @since 1.0.0
|
92 |
-
* @param string $obj
|
93 |
-
* @return string $output
|
94 |
-
*/
|
95 |
-
private function unserialize_output ( $obj ) {
|
96 |
-
$output = implode( ",", unserialize( $obj ) );
|
97 |
-
return (string) $output;
|
98 |
-
}
|
99 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Admin List
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.1.4
|
7 |
+
* @since 1.0.0
|
8 |
+
* @see wp-structuring-admin-db.php
|
9 |
+
*/
|
10 |
+
class Structuring_Markup_Admin_List {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Variable definition.
|
14 |
+
*
|
15 |
+
* @version 2.0.0
|
16 |
+
* @since 1.3.0
|
17 |
+
*/
|
18 |
+
private $text_domain;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Constructor Define.
|
22 |
+
*
|
23 |
+
* @version 2.0.0
|
24 |
+
* @since 1.0.0
|
25 |
+
* @param String $text_domain
|
26 |
+
*/
|
27 |
+
public function __construct ( $text_domain ) {
|
28 |
+
$this->text_domain = $text_domain;
|
29 |
+
$this->page_render();
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* LIST Page HTML Render.
|
34 |
+
*
|
35 |
+
* @version 4.1.4
|
36 |
+
* @since 1.0.0
|
37 |
+
*/
|
38 |
+
private function page_render () {
|
39 |
+
$post_url = 'admin.php?page=' . $this->text_domain . '-post';
|
40 |
+
|
41 |
+
$html = '';
|
42 |
+
$html .= '<div class="wrap">';
|
43 |
+
$html .= '<h1>' . esc_html__( 'Schema.org Settings List', $this->text_domain );
|
44 |
+
$html .= '</h1>';
|
45 |
+
echo $html;
|
46 |
+
|
47 |
+
$html = '<hr>';
|
48 |
+
$html .= '<table class="wp-list-table widefat fixed striped posts schema-admin-table-list">';
|
49 |
+
$html .= '<tr>';
|
50 |
+
$html .= '<th scope="row" class="schema-admin-table-list-type column-primary">' . esc_html__( 'Status', $this->text_domain ) . ' / ' . esc_html__( 'Schema.org Type', $this->text_domain ) . '</th>';
|
51 |
+
$html .= '<th scope="row" class="schema-admin-table-list-output">' . esc_html__( 'Output On', $this->text_domain ) . '</th>';
|
52 |
+
$html .= '</tr>';
|
53 |
+
echo $html;
|
54 |
+
|
55 |
+
$db = new Structuring_Markup_Admin_Db();
|
56 |
+
$results = $db->get_list_options();
|
57 |
+
$type_array = $db->type_array;
|
58 |
+
|
59 |
+
if ( $results ) {
|
60 |
+
foreach ( $results as $row ) {
|
61 |
+
if ( $row->activate === 'on' ) {
|
62 |
+
$html = '<tr class="active"><td class="column-primary"><span><span class="active">Enabled';
|
63 |
+
} else {
|
64 |
+
$html = '<tr class="stop"><td class="column-primary"><span><span class="stop">Disabled';
|
65 |
+
}
|
66 |
+
$html .= '</span></span>';
|
67 |
+
$html .= '<strong><a href="';
|
68 |
+
$html .= admin_url( $post_url . '&type=' . esc_html( $row->type ) . '&schema_post_id=' . esc_html( $row->id ) ) . '">' . $type_array[esc_html( $row->type )];
|
69 |
+
$html .= '</a></strong>';
|
70 |
+
$html .= '<div class="row-actions"><span class="edit"><a href="';
|
71 |
+
$html .= admin_url( $post_url . '&type=' . esc_html( $row->type ) . '&schema_post_id=' . esc_html( $row->id ) ) . '" class="edit" aria-label="' . esc_html__( 'Edit', $this->text_domain ) . '">' . esc_html__( 'Edit', $this->text_domain );
|
72 |
+
$html .= '</a></span></div>';
|
73 |
+
$html .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details', $this->text_domain ) . '</span></button>';
|
74 |
+
$html .= '</td>';
|
75 |
+
$html .= '<td data-colname="' . esc_html__( 'Output On', $this->text_domain ) . '">' . $this->unserialize_output( $row->output ) . '</td>';
|
76 |
+
$html .= '</tr>';
|
77 |
+
echo $html;
|
78 |
+
}
|
79 |
+
} else {
|
80 |
+
echo '<td colspan="2">' . esc_html__( 'Without registration.', $this->text_domain ) . '</td>';
|
81 |
+
}
|
82 |
+
$html = '</table>';
|
83 |
+
$html .= '</div>';
|
84 |
+
echo $html;
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* LIST Page HTML Render.
|
89 |
+
*
|
90 |
+
* @version 2.0.0
|
91 |
+
* @since 1.0.0
|
92 |
+
* @param string $obj
|
93 |
+
* @return string $output
|
94 |
+
*/
|
95 |
+
private function unserialize_output ( $obj ) {
|
96 |
+
$output = implode( ",", unserialize( $obj ) );
|
97 |
+
return (string) $output;
|
98 |
+
}
|
99 |
}
|
includes/admin/wp-structuring-admin-post.php
CHANGED
@@ -1,373 +1,373 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Admin Post
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.1.0
|
7 |
-
* @since 1.0.0
|
8 |
-
*/
|
9 |
-
class Structuring_Markup_Admin_Post {
|
10 |
-
|
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;
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Constructor Define.
|
46 |
-
*
|
47 |
-
* @version 4.1.0
|
48 |
-
* @since 1.0.0
|
49 |
-
* @param String $text_domain
|
50 |
-
*/
|
51 |
-
public function __construct ( $text_domain ) {
|
52 |
-
$args = array(
|
53 |
-
'public' => true,
|
54 |
-
'_builtin' => false
|
55 |
-
);
|
56 |
-
$post_types = get_post_types( $args, 'objects' );
|
57 |
-
|
58 |
-
foreach ( $post_types as $post_type ) {
|
59 |
-
$this->post_args[] = array(
|
60 |
-
'label' => esc_html( $post_type->label ),
|
61 |
-
'value' => esc_html( $post_type->name )
|
62 |
-
);
|
63 |
-
}
|
64 |
-
$this->text_domain = $text_domain;
|
65 |
-
$this->nonce_name = "_wpnonce_" . $text_domain;
|
66 |
-
$this->nonce_action = "edit-" . $text_domain;
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Update Status
|
70 |
-
*
|
71 |
-
* "ok" : Successful update
|
72 |
-
* "output" : Output No Check
|
73 |
-
*/
|
74 |
-
$status = "";
|
75 |
-
|
76 |
-
/** DB Connect */
|
77 |
-
$db = new Structuring_Markup_Admin_Db();
|
78 |
-
$this->type_array = $db->type_array;
|
79 |
-
|
80 |
-
/** Set Default Parameter for Array */
|
81 |
-
$options = array(
|
82 |
-
"id" => "",
|
83 |
-
"type" => "",
|
84 |
-
"activate" => "",
|
85 |
-
"output" => array(),
|
86 |
-
"option" => array()
|
87 |
-
);
|
88 |
-
|
89 |
-
/** DataBase Update & Insert Mode */
|
90 |
-
if ( ! empty( $_POST ) && check_admin_referer( $this->nonce_action, $this->nonce_name ) ) {
|
91 |
-
if ( isset( $_POST['id'] ) && is_numeric( $_POST['id'] ) ) {
|
92 |
-
if ( isset( $_POST['output'] ) ) {
|
93 |
-
$options['id'] = $db->update_options( $_POST );
|
94 |
-
$status = "ok";
|
95 |
-
} else {
|
96 |
-
$status = "output";
|
97 |
-
}
|
98 |
-
}
|
99 |
-
}
|
100 |
-
|
101 |
-
/** Key Set */
|
102 |
-
if ( isset( $_GET['schema_post_id'] ) && is_numeric( $_GET['schema_post_id'] ) ) {
|
103 |
-
$options['id'] = esc_html( $_GET['schema_post_id'] );
|
104 |
-
}
|
105 |
-
|
106 |
-
/** Type Set */
|
107 |
-
if ( isset( $_GET['type'] ) && array_key_exists( $_GET['type'], $this->type_array) ) {
|
108 |
-
$options['type'] = esc_html( $_GET['type'] );
|
109 |
-
}
|
110 |
-
|
111 |
-
$options = $db->get_options( $options['id'] );
|
112 |
-
if ( $options['option'] === false ) {
|
113 |
-
$options['option'] = array();
|
114 |
-
}
|
115 |
-
|
116 |
-
$this->page_render( $options, $status );
|
117 |
-
}
|
118 |
-
|
119 |
-
/**
|
120 |
-
* Setting Page of the Admin Screen.
|
121 |
-
*
|
122 |
-
* @version 4.0.0
|
123 |
-
* @since 1.0.0
|
124 |
-
* @param array $options
|
125 |
-
* @param string $status
|
126 |
-
*/
|
127 |
-
private function page_render ( array $options, $status ) {
|
128 |
-
$html = '';
|
129 |
-
$html .= '<div class="wrap">';
|
130 |
-
$html .= '<h1>' . esc_html__( 'Schema.org Register', $this->text_domain );
|
131 |
-
$html .= '<span class="schema-admin-h1-span">[ Schema Type : ' . esc_html( $this->type_array[$options['type']] ) . ' ]</span>';
|
132 |
-
$html .= '</h1>';
|
133 |
-
switch ( $status ) {
|
134 |
-
case "ok":
|
135 |
-
$html .= $this->information_render();
|
136 |
-
break;
|
137 |
-
case "output":
|
138 |
-
$html .= $this->output_error_render();
|
139 |
-
break;
|
140 |
-
default:
|
141 |
-
break;
|
142 |
-
}
|
143 |
-
echo $html;
|
144 |
-
|
145 |
-
/** Output Page Select */
|
146 |
-
$html = '<hr>';
|
147 |
-
$html .= '<p class="schema-admin-require">';
|
148 |
-
$html .= esc_html__( 'Please note that all fields followed by an asterisk must be filled in.', $this->text_domain );
|
149 |
-
$html .= '</p>';
|
150 |
-
$html .= '<form method="post" action="">';
|
151 |
-
echo $html;
|
152 |
-
|
153 |
-
wp_nonce_field( $this->nonce_action, $this->nonce_name );
|
154 |
-
|
155 |
-
$html = '<input type="hidden" name="id" value="' . esc_attr( $options['id'] ) . '">';
|
156 |
-
$html .= '<input type="hidden" name="type" value="' . esc_attr( $options['type'] ) . '">';
|
157 |
-
$html .= '<table class="schema-admin-table">';
|
158 |
-
$html .= '<tr><th class="require">Enabled : </th><td>';
|
159 |
-
$html .= '<input type="checkbox" name="activate" value="on"';
|
160 |
-
$html .= ( isset( $options['activate'] ) && $options['activate'] === "on" ) ? ' checked' : '';
|
161 |
-
$html .= '></td></tr>';
|
162 |
-
$html .= '<tr><th class="require">' . esc_html__( 'Output On', $this->text_domain ) . ' : </th><td>';
|
163 |
-
echo $html;
|
164 |
-
|
165 |
-
switch ( $options['type'] ) {
|
166 |
-
case 'article':
|
167 |
-
$html = $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
|
168 |
-
$html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
|
169 |
-
$html .= $this->output_checkbox_render( $options['output'], "amp", esc_html__( 'Posts(AMP)', $this->text_domain ) );
|
170 |
-
$html .= '</td></tr>';
|
171 |
-
$html .= $this->output_custom_posts_render( $options['output'] );
|
172 |
-
$html .= '</table><hr>';
|
173 |
-
echo $html;
|
174 |
-
|
175 |
-
require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-article.php' );
|
176 |
-
new Structuring_Markup_Type_Article( $options['option'] );
|
177 |
-
break;
|
178 |
-
case 'blog_posting':
|
179 |
-
$html = $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
|
180 |
-
$html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
|
181 |
-
$html .= $this->output_checkbox_render( $options['output'], "amp", esc_html__( 'Posts(AMP)', $this->text_domain ) );
|
182 |
-
$html .= '</td></tr>';
|
183 |
-
$html .= $this->output_custom_posts_render( $options['output'] );
|
184 |
-
$html .= '</table><hr>';
|
185 |
-
echo $html;
|
186 |
-
|
187 |
-
require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-blog-posting.php' );
|
188 |
-
new Structuring_Markup_Type_Blog_Posting( $options['option'] );
|
189 |
-
break;
|
190 |
-
case 'breadcrumb':
|
191 |
-
$html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
|
192 |
-
$html .= '</td></tr></table><hr>';
|
193 |
-
echo $html;
|
194 |
-
|
195 |
-
require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-breadcrumb.php' );
|
196 |
-
new Structuring_Markup_Type_Breadcrumb( $options['option'] );
|
197 |
-
break;
|
198 |
-
case 'event':
|
199 |
-
$html = $this->output_checkbox_render( $options['output'], "event", esc_html__( 'Event Post Page', $this->text_domain ) );
|
200 |
-
$html .= '</td></tr></table><hr>';
|
201 |
-
echo $html;
|
202 |
-
|
203 |
-
require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-event.php' );
|
204 |
-
new Structuring_Markup_Type_Event();
|
205 |
-
break;
|
206 |
-
case 'local_business':
|
207 |
-
$html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
|
208 |
-
$html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
|
209 |
-
$html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
|
210 |
-
$html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
|
211 |
-
$html .= '</td></tr>';
|
212 |
-
$html .= $this->output_custom_posts_render( $options['output'] );
|
213 |
-
$html .= '</table><hr>';
|
214 |
-
|
215 |
-
echo $html;
|
216 |
-
|
217 |
-
require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-local-business.php' );
|
218 |
-
new Structuring_Markup_Type_LocalBusiness( $options['option'] );
|
219 |
-
break;
|
220 |
-
case 'news_article':
|
221 |
-
$html = $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
|
222 |
-
$html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
|
223 |
-
$html .= $this->output_checkbox_render( $options['output'], "amp", esc_html__( 'Posts(AMP)', $this->text_domain ) );
|
224 |
-
$html .= '</td></tr>';
|
225 |
-
$html .= $this->output_custom_posts_render( $options['output'] );
|
226 |
-
$html .= '</table><hr>';
|
227 |
-
|
228 |
-
echo $html;
|
229 |
-
|
230 |
-
require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-news-article.php' );
|
231 |
-
new Structuring_Markup_Type_NewsArticle( $options['option'] );
|
232 |
-
break;
|
233 |
-
case 'organization':
|
234 |
-
$html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
|
235 |
-
$html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
|
236 |
-
$html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
|
237 |
-
$html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
|
238 |
-
$html .= '</td></tr>';
|
239 |
-
$html .= $this->output_custom_posts_render( $options['output'] );
|
240 |
-
$html .= '</table><hr>';
|
241 |
-
|
242 |
-
echo $html;
|
243 |
-
|
244 |
-
require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-organization.php' );
|
245 |
-
new Structuring_Markup_Type_Organization( $options['option'] );
|
246 |
-
break;
|
247 |
-
case 'person':
|
248 |
-
$html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
|
249 |
-
$html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
|
250 |
-
$html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
|
251 |
-
$html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
|
252 |
-
$html .= '</td></tr>';
|
253 |
-
$html .= $this->output_custom_posts_render( $options['output'] );
|
254 |
-
$html .= '</table><hr>';
|
255 |
-
|
256 |
-
echo $html;
|
257 |
-
|
258 |
-
require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-person.php' );
|
259 |
-
new Structuring_Markup_Type_Person( $options['option'] );
|
260 |
-
break;
|
261 |
-
case 'site_navigation':
|
262 |
-
$html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
|
263 |
-
$html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
|
264 |
-
$html .= '</td></tr></table><hr>';
|
265 |
-
echo $html;
|
266 |
-
|
267 |
-
require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-site-navigation.php' );
|
268 |
-
new Structuring_Markup_Type_Site_Navigation( $options['option'] );
|
269 |
-
break;
|
270 |
-
case 'video':
|
271 |
-
$html = $this->output_checkbox_render( $options['output'], "video", esc_html__( 'Video Post Page', $this->text_domain ) );
|
272 |
-
$html .= '</td></tr></table><hr>';
|
273 |
-
echo $html;
|
274 |
-
|
275 |
-
require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-video.php' );
|
276 |
-
new Structuring_Markup_Type_Videos();
|
277 |
-
break;
|
278 |
-
case 'website':
|
279 |
-
$html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
|
280 |
-
$html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
|
281 |
-
$html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
|
282 |
-
$html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
|
283 |
-
$html .= '</td></tr>';
|
284 |
-
$html .= $this->output_custom_posts_render( $options['output'] );
|
285 |
-
$html .= '</table><hr>';
|
286 |
-
|
287 |
-
echo $html;
|
288 |
-
|
289 |
-
require_once( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-website.php' );
|
290 |
-
new Structuring_Markup_Type_Website( $options['option'] );
|
291 |
-
break;
|
292 |
-
}
|
293 |
-
|
294 |
-
$html = '</form>';
|
295 |
-
$html .= '</div>';
|
296 |
-
echo $html;
|
297 |
-
}
|
298 |
-
|
299 |
-
/**
|
300 |
-
* CheckBox Build Render
|
301 |
-
*
|
302 |
-
* @version 2.5.0
|
303 |
-
* @since 1.0.0
|
304 |
-
* @param array $option['output']
|
305 |
-
* @param string $output
|
306 |
-
* @param string $value
|
307 |
-
* @return string $html
|
308 |
-
*/
|
309 |
-
private function output_checkbox_render ( array $option, $output, $value ) {
|
310 |
-
$html = '<label>';
|
311 |
-
$html .= '<input type="checkbox" name="output[' . $output . ']" value="' . $value . '""';
|
312 |
-
$html .= isset( $option[$output] ) ? ' checked' : '';
|
313 |
-
$html .= '>' . $value . '</label>';
|
314 |
-
|
315 |
-
return (string) $html;
|
316 |
-
}
|
317 |
-
|
318 |
-
/**
|
319 |
-
* Custom Posts Build Render
|
320 |
-
*
|
321 |
-
* @version 4.0.2
|
322 |
-
* @since 2.5.0
|
323 |
-
* @param array $option['output']
|
324 |
-
* @return string $html
|
325 |
-
*/
|
326 |
-
private function output_custom_posts_render ( array $option ) {
|
327 |
-
$html = '';
|
328 |
-
if ( count( $this->post_args ) > 0 ) {
|
329 |
-
$html .= '<tr><th>' . esc_html__( 'Output On(Custom Posts)', $this->text_domain ) . ' : </th><td>';
|
330 |
-
foreach ( $this->post_args as $post_type ) {
|
331 |
-
$html .= $this->output_checkbox_render( $option, $post_type['value'], $post_type['label'] );
|
332 |
-
}
|
333 |
-
$html .= '</td></tr>';
|
334 |
-
}
|
335 |
-
return (string) $html;
|
336 |
-
}
|
337 |
-
|
338 |
-
/**
|
339 |
-
* Information Message Render
|
340 |
-
*
|
341 |
-
* @version 2.0.0
|
342 |
-
* @since 1.0.0
|
343 |
-
* @return string $html
|
344 |
-
*/
|
345 |
-
private function information_render () {
|
346 |
-
$html = '<div id="message" class="updated notice notice-success is-dismissible below-h2">';
|
347 |
-
$html .= '<p>Schema.org Information Update.</p>';
|
348 |
-
$html .= '<button type="button" class="notice-dismiss">';
|
349 |
-
$html .= '<span class="screen-reader-text">Dismiss this notice.</span>';
|
350 |
-
$html .= '</button>';
|
351 |
-
$html .= '</div>';
|
352 |
-
|
353 |
-
return (string) $html;
|
354 |
-
}
|
355 |
-
|
356 |
-
/**
|
357 |
-
* Error Message Render
|
358 |
-
*
|
359 |
-
* @version 2.0.0
|
360 |
-
* @since 1.0.0
|
361 |
-
* @return string $html
|
362 |
-
*/
|
363 |
-
private function output_error_render () {
|
364 |
-
$html = '<div id="notice" class="notice notice-error is-dismissible below-h2">';
|
365 |
-
$html .= '<p>Output No Select.</p>';
|
366 |
-
$html .= '<button type="button" class="notice-dismiss">';
|
367 |
-
$html .= '<span class="screen-reader-text">Dismiss this notice.</span>';
|
368 |
-
$html .= '</button>';
|
369 |
-
$html .= '</div>';
|
370 |
-
|
371 |
-
return (string) $html;
|
372 |
-
}
|
373 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Admin Post
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.1.0
|
7 |
+
* @since 1.0.0
|
8 |
+
*/
|
9 |
+
class Structuring_Markup_Admin_Post {
|
10 |
+
|
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;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Constructor Define.
|
46 |
+
*
|
47 |
+
* @version 4.1.0
|
48 |
+
* @since 1.0.0
|
49 |
+
* @param String $text_domain
|
50 |
+
*/
|
51 |
+
public function __construct ( $text_domain ) {
|
52 |
+
$args = array(
|
53 |
+
'public' => true,
|
54 |
+
'_builtin' => false
|
55 |
+
);
|
56 |
+
$post_types = get_post_types( $args, 'objects' );
|
57 |
+
|
58 |
+
foreach ( $post_types as $post_type ) {
|
59 |
+
$this->post_args[] = array(
|
60 |
+
'label' => esc_html( $post_type->label ),
|
61 |
+
'value' => esc_html( $post_type->name )
|
62 |
+
);
|
63 |
+
}
|
64 |
+
$this->text_domain = $text_domain;
|
65 |
+
$this->nonce_name = "_wpnonce_" . $text_domain;
|
66 |
+
$this->nonce_action = "edit-" . $text_domain;
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Update Status
|
70 |
+
*
|
71 |
+
* "ok" : Successful update
|
72 |
+
* "output" : Output No Check
|
73 |
+
*/
|
74 |
+
$status = "";
|
75 |
+
|
76 |
+
/** DB Connect */
|
77 |
+
$db = new Structuring_Markup_Admin_Db();
|
78 |
+
$this->type_array = $db->type_array;
|
79 |
+
|
80 |
+
/** Set Default Parameter for Array */
|
81 |
+
$options = array(
|
82 |
+
"id" => "",
|
83 |
+
"type" => "",
|
84 |
+
"activate" => "",
|
85 |
+
"output" => array(),
|
86 |
+
"option" => array()
|
87 |
+
);
|
88 |
+
|
89 |
+
/** DataBase Update & Insert Mode */
|
90 |
+
if ( ! empty( $_POST ) && check_admin_referer( $this->nonce_action, $this->nonce_name ) ) {
|
91 |
+
if ( isset( $_POST['id'] ) && is_numeric( $_POST['id'] ) ) {
|
92 |
+
if ( isset( $_POST['output'] ) ) {
|
93 |
+
$options['id'] = $db->update_options( $_POST );
|
94 |
+
$status = "ok";
|
95 |
+
} else {
|
96 |
+
$status = "output";
|
97 |
+
}
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
/** Key Set */
|
102 |
+
if ( isset( $_GET['schema_post_id'] ) && is_numeric( $_GET['schema_post_id'] ) ) {
|
103 |
+
$options['id'] = esc_html( $_GET['schema_post_id'] );
|
104 |
+
}
|
105 |
+
|
106 |
+
/** Type Set */
|
107 |
+
if ( isset( $_GET['type'] ) && array_key_exists( $_GET['type'], $this->type_array) ) {
|
108 |
+
$options['type'] = esc_html( $_GET['type'] );
|
109 |
+
}
|
110 |
+
|
111 |
+
$options = $db->get_options( $options['id'] );
|
112 |
+
if ( $options['option'] === false ) {
|
113 |
+
$options['option'] = array();
|
114 |
+
}
|
115 |
+
|
116 |
+
$this->page_render( $options, $status );
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Setting Page of the Admin Screen.
|
121 |
+
*
|
122 |
+
* @version 4.0.0
|
123 |
+
* @since 1.0.0
|
124 |
+
* @param array $options
|
125 |
+
* @param string $status
|
126 |
+
*/
|
127 |
+
private function page_render ( array $options, $status ) {
|
128 |
+
$html = '';
|
129 |
+
$html .= '<div class="wrap">';
|
130 |
+
$html .= '<h1>' . esc_html__( 'Schema.org Register', $this->text_domain );
|
131 |
+
$html .= '<span class="schema-admin-h1-span">[ Schema Type : ' . esc_html( $this->type_array[$options['type']] ) . ' ]</span>';
|
132 |
+
$html .= '</h1>';
|
133 |
+
switch ( $status ) {
|
134 |
+
case "ok":
|
135 |
+
$html .= $this->information_render();
|
136 |
+
break;
|
137 |
+
case "output":
|
138 |
+
$html .= $this->output_error_render();
|
139 |
+
break;
|
140 |
+
default:
|
141 |
+
break;
|
142 |
+
}
|
143 |
+
echo $html;
|
144 |
+
|
145 |
+
/** Output Page Select */
|
146 |
+
$html = '<hr>';
|
147 |
+
$html .= '<p class="schema-admin-require">';
|
148 |
+
$html .= esc_html__( 'Please note that all fields followed by an asterisk must be filled in.', $this->text_domain );
|
149 |
+
$html .= '</p>';
|
150 |
+
$html .= '<form method="post" action="">';
|
151 |
+
echo $html;
|
152 |
+
|
153 |
+
wp_nonce_field( $this->nonce_action, $this->nonce_name );
|
154 |
+
|
155 |
+
$html = '<input type="hidden" name="id" value="' . esc_attr( $options['id'] ) . '">';
|
156 |
+
$html .= '<input type="hidden" name="type" value="' . esc_attr( $options['type'] ) . '">';
|
157 |
+
$html .= '<table class="schema-admin-table">';
|
158 |
+
$html .= '<tr><th class="require">Enabled : </th><td>';
|
159 |
+
$html .= '<input type="checkbox" name="activate" value="on"';
|
160 |
+
$html .= ( isset( $options['activate'] ) && $options['activate'] === "on" ) ? ' checked' : '';
|
161 |
+
$html .= '></td></tr>';
|
162 |
+
$html .= '<tr><th class="require">' . esc_html__( 'Output On', $this->text_domain ) . ' : </th><td>';
|
163 |
+
echo $html;
|
164 |
+
|
165 |
+
switch ( $options['type'] ) {
|
166 |
+
case 'article':
|
167 |
+
$html = $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
|
168 |
+
$html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
|
169 |
+
$html .= $this->output_checkbox_render( $options['output'], "amp", esc_html__( 'Posts(AMP)', $this->text_domain ) );
|
170 |
+
$html .= '</td></tr>';
|
171 |
+
$html .= $this->output_custom_posts_render( $options['output'] );
|
172 |
+
$html .= '</table><hr>';
|
173 |
+
echo $html;
|
174 |
+
|
175 |
+
require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-article.php' );
|
176 |
+
new Structuring_Markup_Type_Article( $options['option'] );
|
177 |
+
break;
|
178 |
+
case 'blog_posting':
|
179 |
+
$html = $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
|
180 |
+
$html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
|
181 |
+
$html .= $this->output_checkbox_render( $options['output'], "amp", esc_html__( 'Posts(AMP)', $this->text_domain ) );
|
182 |
+
$html .= '</td></tr>';
|
183 |
+
$html .= $this->output_custom_posts_render( $options['output'] );
|
184 |
+
$html .= '</table><hr>';
|
185 |
+
echo $html;
|
186 |
+
|
187 |
+
require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-blog-posting.php' );
|
188 |
+
new Structuring_Markup_Type_Blog_Posting( $options['option'] );
|
189 |
+
break;
|
190 |
+
case 'breadcrumb':
|
191 |
+
$html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
|
192 |
+
$html .= '</td></tr></table><hr>';
|
193 |
+
echo $html;
|
194 |
+
|
195 |
+
require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-breadcrumb.php' );
|
196 |
+
new Structuring_Markup_Type_Breadcrumb( $options['option'] );
|
197 |
+
break;
|
198 |
+
case 'event':
|
199 |
+
$html = $this->output_checkbox_render( $options['output'], "event", esc_html__( 'Event Post Page', $this->text_domain ) );
|
200 |
+
$html .= '</td></tr></table><hr>';
|
201 |
+
echo $html;
|
202 |
+
|
203 |
+
require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-event.php' );
|
204 |
+
new Structuring_Markup_Type_Event();
|
205 |
+
break;
|
206 |
+
case 'local_business':
|
207 |
+
$html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
|
208 |
+
$html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
|
209 |
+
$html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
|
210 |
+
$html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
|
211 |
+
$html .= '</td></tr>';
|
212 |
+
$html .= $this->output_custom_posts_render( $options['output'] );
|
213 |
+
$html .= '</table><hr>';
|
214 |
+
|
215 |
+
echo $html;
|
216 |
+
|
217 |
+
require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-local-business.php' );
|
218 |
+
new Structuring_Markup_Type_LocalBusiness( $options['option'] );
|
219 |
+
break;
|
220 |
+
case 'news_article':
|
221 |
+
$html = $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
|
222 |
+
$html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
|
223 |
+
$html .= $this->output_checkbox_render( $options['output'], "amp", esc_html__( 'Posts(AMP)', $this->text_domain ) );
|
224 |
+
$html .= '</td></tr>';
|
225 |
+
$html .= $this->output_custom_posts_render( $options['output'] );
|
226 |
+
$html .= '</table><hr>';
|
227 |
+
|
228 |
+
echo $html;
|
229 |
+
|
230 |
+
require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-news-article.php' );
|
231 |
+
new Structuring_Markup_Type_NewsArticle( $options['option'] );
|
232 |
+
break;
|
233 |
+
case 'organization':
|
234 |
+
$html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
|
235 |
+
$html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
|
236 |
+
$html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
|
237 |
+
$html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
|
238 |
+
$html .= '</td></tr>';
|
239 |
+
$html .= $this->output_custom_posts_render( $options['output'] );
|
240 |
+
$html .= '</table><hr>';
|
241 |
+
|
242 |
+
echo $html;
|
243 |
+
|
244 |
+
require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-organization.php' );
|
245 |
+
new Structuring_Markup_Type_Organization( $options['option'] );
|
246 |
+
break;
|
247 |
+
case 'person':
|
248 |
+
$html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
|
249 |
+
$html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
|
250 |
+
$html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
|
251 |
+
$html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
|
252 |
+
$html .= '</td></tr>';
|
253 |
+
$html .= $this->output_custom_posts_render( $options['output'] );
|
254 |
+
$html .= '</table><hr>';
|
255 |
+
|
256 |
+
echo $html;
|
257 |
+
|
258 |
+
require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-person.php' );
|
259 |
+
new Structuring_Markup_Type_Person( $options['option'] );
|
260 |
+
break;
|
261 |
+
case 'site_navigation':
|
262 |
+
$html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
|
263 |
+
$html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
|
264 |
+
$html .= '</td></tr></table><hr>';
|
265 |
+
echo $html;
|
266 |
+
|
267 |
+
require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-site-navigation.php' );
|
268 |
+
new Structuring_Markup_Type_Site_Navigation( $options['option'] );
|
269 |
+
break;
|
270 |
+
case 'video':
|
271 |
+
$html = $this->output_checkbox_render( $options['output'], "video", esc_html__( 'Video Post Page', $this->text_domain ) );
|
272 |
+
$html .= '</td></tr></table><hr>';
|
273 |
+
echo $html;
|
274 |
+
|
275 |
+
require_once ( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-video.php' );
|
276 |
+
new Structuring_Markup_Type_Videos();
|
277 |
+
break;
|
278 |
+
case 'website':
|
279 |
+
$html = $this->output_checkbox_render( $options['output'], "all", esc_html__( 'All Pages (In Header)', $this->text_domain ) );
|
280 |
+
$html .= $this->output_checkbox_render( $options['output'], "home", esc_html__( 'Homepage', $this->text_domain ) );
|
281 |
+
$html .= $this->output_checkbox_render( $options['output'], "post", esc_html__( 'Posts', $this->text_domain ) );
|
282 |
+
$html .= $this->output_checkbox_render( $options['output'], "page", esc_html__( 'Pages', $this->text_domain ) );
|
283 |
+
$html .= '</td></tr>';
|
284 |
+
$html .= $this->output_custom_posts_render( $options['output'] );
|
285 |
+
$html .= '</table><hr>';
|
286 |
+
|
287 |
+
echo $html;
|
288 |
+
|
289 |
+
require_once( plugin_dir_path( __FILE__ ) . 'wp-structuring-admin-type-website.php' );
|
290 |
+
new Structuring_Markup_Type_Website( $options['option'] );
|
291 |
+
break;
|
292 |
+
}
|
293 |
+
|
294 |
+
$html = '</form>';
|
295 |
+
$html .= '</div>';
|
296 |
+
echo $html;
|
297 |
+
}
|
298 |
+
|
299 |
+
/**
|
300 |
+
* CheckBox Build Render
|
301 |
+
*
|
302 |
+
* @version 2.5.0
|
303 |
+
* @since 1.0.0
|
304 |
+
* @param array $option['output']
|
305 |
+
* @param string $output
|
306 |
+
* @param string $value
|
307 |
+
* @return string $html
|
308 |
+
*/
|
309 |
+
private function output_checkbox_render ( array $option, $output, $value ) {
|
310 |
+
$html = '<label>';
|
311 |
+
$html .= '<input type="checkbox" name="output[' . $output . ']" value="' . $value . '""';
|
312 |
+
$html .= isset( $option[$output] ) ? ' checked' : '';
|
313 |
+
$html .= '>' . $value . '</label>';
|
314 |
+
|
315 |
+
return (string) $html;
|
316 |
+
}
|
317 |
+
|
318 |
+
/**
|
319 |
+
* Custom Posts Build Render
|
320 |
+
*
|
321 |
+
* @version 4.0.2
|
322 |
+
* @since 2.5.0
|
323 |
+
* @param array $option['output']
|
324 |
+
* @return string $html
|
325 |
+
*/
|
326 |
+
private function output_custom_posts_render ( array $option ) {
|
327 |
+
$html = '';
|
328 |
+
if ( count( $this->post_args ) > 0 ) {
|
329 |
+
$html .= '<tr><th>' . esc_html__( 'Output On(Custom Posts)', $this->text_domain ) . ' : </th><td>';
|
330 |
+
foreach ( $this->post_args as $post_type ) {
|
331 |
+
$html .= $this->output_checkbox_render( $option, $post_type['value'], $post_type['label'] );
|
332 |
+
}
|
333 |
+
$html .= '</td></tr>';
|
334 |
+
}
|
335 |
+
return (string) $html;
|
336 |
+
}
|
337 |
+
|
338 |
+
/**
|
339 |
+
* Information Message Render
|
340 |
+
*
|
341 |
+
* @version 2.0.0
|
342 |
+
* @since 1.0.0
|
343 |
+
* @return string $html
|
344 |
+
*/
|
345 |
+
private function information_render () {
|
346 |
+
$html = '<div id="message" class="updated notice notice-success is-dismissible below-h2">';
|
347 |
+
$html .= '<p>Schema.org Information Update.</p>';
|
348 |
+
$html .= '<button type="button" class="notice-dismiss">';
|
349 |
+
$html .= '<span class="screen-reader-text">Dismiss this notice.</span>';
|
350 |
+
$html .= '</button>';
|
351 |
+
$html .= '</div>';
|
352 |
+
|
353 |
+
return (string) $html;
|
354 |
+
}
|
355 |
+
|
356 |
+
/**
|
357 |
+
* Error Message Render
|
358 |
+
*
|
359 |
+
* @version 2.0.0
|
360 |
+
* @since 1.0.0
|
361 |
+
* @return string $html
|
362 |
+
*/
|
363 |
+
private function output_error_render () {
|
364 |
+
$html = '<div id="notice" class="notice notice-error is-dismissible below-h2">';
|
365 |
+
$html .= '<p>Output No Select.</p>';
|
366 |
+
$html .= '<button type="button" class="notice-dismiss">';
|
367 |
+
$html .= '<span class="screen-reader-text">Dismiss this notice.</span>';
|
368 |
+
$html .= '</button>';
|
369 |
+
$html .= '</div>';
|
370 |
+
|
371 |
+
return (string) $html;
|
372 |
+
}
|
373 |
}
|
includes/admin/wp-structuring-admin-type-article.php
CHANGED
@@ -1,181 +1,181 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Type Article
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.5.3
|
7 |
-
* @since 1.1.0
|
8 |
-
* @see wp-structuring-admin-db.php
|
9 |
-
* @link http://schema.org/Article
|
10 |
-
* @link https://pending.schema.org/speakable
|
11 |
-
* @link https://developers.google.com/search/docs/data-types/articles
|
12 |
-
* @link https://developers.google.com/search/docs/data-types/speakable
|
13 |
-
*/
|
14 |
-
class Structuring_Markup_Type_Article {
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Constructor Define.
|
18 |
-
*
|
19 |
-
* @version 3.2.2
|
20 |
-
* @since 1.0.0
|
21 |
-
* @param array $option
|
22 |
-
*/
|
23 |
-
public function __construct ( array $option ) {
|
24 |
-
/** Default Value Set */
|
25 |
-
$option_array = $this->get_default_options();
|
26 |
-
|
27 |
-
if ( !empty( $option ) ) {
|
28 |
-
$option_array = array_merge( $option_array, $option );
|
29 |
-
}
|
30 |
-
|
31 |
-
$this->page_render( $option_array );
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Form Layout Render
|
36 |
-
*
|
37 |
-
* @version 4.5.3
|
38 |
-
* @since 1.1.0
|
39 |
-
* @param array $option
|
40 |
-
*/
|
41 |
-
private function page_render ( array $option ) {
|
42 |
-
$html = '<table class="schema-admin-table">';
|
43 |
-
$html .= '<caption>Basic Setting</caption>';
|
44 |
-
$html .= '<tr><th>headline :</th><td><small>Default : post_title</small></td></tr>';
|
45 |
-
$html .= '<tr><th>datePublished :</th><td><small>Default : get_the_time( DATE_ISO8601, ID )</small></td></tr>';
|
46 |
-
$html .= '<tr><th>dateModified :</th><td><small>Default : get_the_modified_time( DATE_ISO8601, false, ID )</small></td></tr>';
|
47 |
-
$html .= '<tr><th>description :</th><td><small>Default : post_excerpt</small></td></tr>';
|
48 |
-
$html .= '</table>';
|
49 |
-
echo $html;
|
50 |
-
|
51 |
-
$html = '<table class="schema-admin-table">';
|
52 |
-
$html .= '<caption>mainEntityOfPage</caption>';
|
53 |
-
$html .= '<tr><th>@type :</th><td><small>"WebPage"</small></td></tr>';
|
54 |
-
$html .= '<tr><th>@id :</th><td><small>Default : get_permalink( ID )</small></td></tr>';
|
55 |
-
$html .= '</table>';
|
56 |
-
echo $html;
|
57 |
-
|
58 |
-
$html = '<table class="schema-admin-table">';
|
59 |
-
$html .= '<caption>image</caption>';
|
60 |
-
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
61 |
-
$html .= '<tr><th>url :</th><td><small>Default : Featured Image</small></td></tr>';
|
62 |
-
$html .= '<tr><th>height :</th><td><small>Auto : The height of the image, in pixels.</small></td></tr>';
|
63 |
-
$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>';
|
64 |
-
$html .= '<tr><th><label for="content_image">Setting image url :</label></th><td>';
|
65 |
-
$html .= '<input type="checkbox" name="option[' . "content_image" . ']" id="content_image" value="on"';
|
66 |
-
if ( isset( $option['content_image'] ) && $option['content_image'] === 'on' ) {
|
67 |
-
$html .= ' checked="checked"';
|
68 |
-
}
|
69 |
-
$html .= '>Set the first image in the content.<br><small>Pattern without feature image set (feature image takes precedence)</small>';
|
70 |
-
$html .= '</td></tr>';
|
71 |
-
$html .= '<tr><th><label for="default_image">Default image url :</label></th><td>';
|
72 |
-
$html .= '<input type="text" name="option[' . "default_image" . ']" id="default_image" class="regular-text" value="' . esc_attr( $option['default_image'] ) . '">';
|
73 |
-
$html .= '<button id="media-upload-default" class="dashicons-before dashicons-admin-media schema-admin-media-button"></button><br>';
|
74 |
-
$html .= '<small>Image output when feature image or content image check is not set.</small>';
|
75 |
-
$html .= '</td></tr>';
|
76 |
-
$html .= '</table>';
|
77 |
-
echo $html;
|
78 |
-
|
79 |
-
$html = '<table class="schema-admin-table">';
|
80 |
-
$html .= '<caption>author</caption>';
|
81 |
-
$html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
|
82 |
-
$html .= '<tr><th>name :</th><td><small>Default : get_the_author_meta( "display_name", author )</small>';
|
83 |
-
$html .= '</td></tr>';
|
84 |
-
$html .= '</table>';
|
85 |
-
echo $html;
|
86 |
-
|
87 |
-
$html = '<table class="schema-admin-table">';
|
88 |
-
$html .= '<caption>publisher</caption>';
|
89 |
-
$html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
|
90 |
-
$html .= '<tr><th><label for="name">Organization Name :</label></th><td>';
|
91 |
-
$html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" value="' . esc_attr( $option['name'] ) . '">';
|
92 |
-
$html .= '</td></tr>';
|
93 |
-
$html .= '</table>';
|
94 |
-
echo $html;
|
95 |
-
|
96 |
-
$html = '<table class="schema-admin-table">';
|
97 |
-
$html .= '<caption>publisher.logo</caption>';
|
98 |
-
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
99 |
-
$html .= '<tr><th><label for="logo">url :</label></th><td>';
|
100 |
-
$html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
|
101 |
-
$html .= '<button id="media-upload" class="dashicons-before dashicons-admin-media schema-admin-media-button"></button>';
|
102 |
-
$html .= '</td></tr>';
|
103 |
-
$html .= '<tr><th><label for="logo-width">width :</label></th><td>';
|
104 |
-
$html .= '<input type="number" name="option[' . "logo-width" . ']" id="logo-width" min="0" value="' . esc_attr( $option['logo-width'] ) . '" placeholder="width <= 600px.">px';
|
105 |
-
$html .= '</td></tr>';
|
106 |
-
$html .= '<tr><th><label for="logo-height">height :</label></th><td>';
|
107 |
-
$html .= '<input type="number" name="option[' . "logo-height" . ']" id="logo-height" min="0" value="' . esc_attr( $option['logo-height'] ) . '" placeholder="height <= 60px.">px';
|
108 |
-
$html .= '</td></tr>';
|
109 |
-
$html .= '</table>';
|
110 |
-
echo $html;
|
111 |
-
|
112 |
-
$html = '<table class="schema-admin-table">';
|
113 |
-
$html .= '<caption>Speakable</caption>';
|
114 |
-
$html .= '<tr><th><label for="speakable_action">speakable Active :</label></th><td>';
|
115 |
-
$html .= '<label><input type="checkbox" name="option[' . "speakable_action" . ']" id="speakable_action" value="on"';
|
116 |
-
|
117 |
-
if ( isset( $option['speakable_action'] ) && $option['speakable_action'] === 'on' ) {
|
118 |
-
$html .= ' checked="checked"';
|
119 |
-
}
|
120 |
-
$html .= '>Enabled</label>';
|
121 |
-
$html .= '</td></tr>';
|
122 |
-
$html .= '<tr><th><label for="speakable_type_css">cssSelector OR xpath :</label></th><td>';
|
123 |
-
|
124 |
-
if( $option['speakable_type'] !== 'xpath' ) {
|
125 |
-
$checked['css'] = ' checked';
|
126 |
-
$checked['xpath'] = '';
|
127 |
-
} else {
|
128 |
-
$checked['css'] = '';
|
129 |
-
$checked['xpath'] = ' checked';
|
130 |
-
}
|
131 |
-
|
132 |
-
$html .= '<label><input type="radio" name="option[' . "speakable_type" . ']" id="speakable_type_css" value="cssSelector"' . $checked['css'] . '>CSS selectors </label>';
|
133 |
-
$html .= '<label><input type="radio" name="option[' . "speakable_type" . ']" id="speakable_type_xpath" value="xpath"' . $checked['xpath'] . '>xPaths</label>';
|
134 |
-
$html .= '</td></tr>';
|
135 |
-
$html .= '<tr><th><label for="speakable_headline">headline :</label></th><td>';
|
136 |
-
$html .= '<input type="text" name="option[' . "speakable_headline" . ']" id="speakable_headline" class="regular-text" value="' . esc_attr( stripslashes( $option['speakable_headline'] ) ) . '">';
|
137 |
-
$html .= '</td></tr>';
|
138 |
-
$html .= '<tr><th><label for="speakable_summary">summary :</label></th><td>';
|
139 |
-
$html .= '<input type="text" name="option[' . "speakable_summary" . ']" id="speakable_summary" class="regular-text" value="' . esc_attr( stripslashes( $option['speakable_summary'] ) ) . '">';
|
140 |
-
$html .= '</td></tr>';
|
141 |
-
$html .= '</table>';
|
142 |
-
echo $html;
|
143 |
-
|
144 |
-
$html = '<table class="schema-admin-table">';
|
145 |
-
$html .= '<caption>Setting Knowledge</caption>';
|
146 |
-
$html .= '<tr><th>schema.org Article :</th>';
|
147 |
-
$html .= '<td><a href="http://schema.org/Article" target="_blank">http://schema.org/Article</a></td></tr>';
|
148 |
-
$html .= '<tr><th>pending.schema.org Speakable :</th>';
|
149 |
-
$html .= '<td><a href="https://pending.schema.org/speakable" target="_blank">https://pending.schema.org/speakable</a></td></tr>';
|
150 |
-
$html .= '<tr><th>Google Search Article :</th>';
|
151 |
-
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/articles" target="_blank">https://developers.google.com/search/docs/data-types/articles</a></td></tr>';
|
152 |
-
$html .= '<tr><th>Google Search Speakable (BETA) :</th>';
|
153 |
-
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/speakable" target="_blank">https://developers.google.com/search/docs/data-types/speakable</a></td></tr>';
|
154 |
-
$html .= '</table>';
|
155 |
-
echo $html;
|
156 |
-
|
157 |
-
submit_button();
|
158 |
-
}
|
159 |
-
|
160 |
-
/**
|
161 |
-
* Return the default options array
|
162 |
-
*
|
163 |
-
* @since 4.5.0
|
164 |
-
* @version 2.2.0
|
165 |
-
* @return array $args
|
166 |
-
*/
|
167 |
-
private function get_default_options () {
|
168 |
-
$args['name'] = '';
|
169 |
-
$args['content_image'] = '';
|
170 |
-
$args['default_image'] = '';
|
171 |
-
$args['logo'] = '';
|
172 |
-
$args['logo-height'] = 0;
|
173 |
-
$args['logo-width'] = 0;
|
174 |
-
$args['speakable_action'] = '';
|
175 |
-
$args['speakable_type'] = '';
|
176 |
-
$args['speakable_headline'] = '';
|
177 |
-
$args['speakable_summary'] = '';
|
178 |
-
|
179 |
-
return (array) $args;
|
180 |
-
}
|
181 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type Article
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.5.3
|
7 |
+
* @since 1.1.0
|
8 |
+
* @see wp-structuring-admin-db.php
|
9 |
+
* @link http://schema.org/Article
|
10 |
+
* @link https://pending.schema.org/speakable
|
11 |
+
* @link https://developers.google.com/search/docs/data-types/articles
|
12 |
+
* @link https://developers.google.com/search/docs/data-types/speakable
|
13 |
+
*/
|
14 |
+
class Structuring_Markup_Type_Article {
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Constructor Define.
|
18 |
+
*
|
19 |
+
* @version 3.2.2
|
20 |
+
* @since 1.0.0
|
21 |
+
* @param array $option
|
22 |
+
*/
|
23 |
+
public function __construct ( array $option ) {
|
24 |
+
/** Default Value Set */
|
25 |
+
$option_array = $this->get_default_options();
|
26 |
+
|
27 |
+
if ( !empty( $option ) ) {
|
28 |
+
$option_array = array_merge( $option_array, $option );
|
29 |
+
}
|
30 |
+
|
31 |
+
$this->page_render( $option_array );
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Form Layout Render
|
36 |
+
*
|
37 |
+
* @version 4.5.3
|
38 |
+
* @since 1.1.0
|
39 |
+
* @param array $option
|
40 |
+
*/
|
41 |
+
private function page_render ( array $option ) {
|
42 |
+
$html = '<table class="schema-admin-table">';
|
43 |
+
$html .= '<caption>Basic Setting</caption>';
|
44 |
+
$html .= '<tr><th>headline :</th><td><small>Default : post_title</small></td></tr>';
|
45 |
+
$html .= '<tr><th>datePublished :</th><td><small>Default : get_the_time( DATE_ISO8601, ID )</small></td></tr>';
|
46 |
+
$html .= '<tr><th>dateModified :</th><td><small>Default : get_the_modified_time( DATE_ISO8601, false, ID )</small></td></tr>';
|
47 |
+
$html .= '<tr><th>description :</th><td><small>Default : post_excerpt</small></td></tr>';
|
48 |
+
$html .= '</table>';
|
49 |
+
echo $html;
|
50 |
+
|
51 |
+
$html = '<table class="schema-admin-table">';
|
52 |
+
$html .= '<caption>mainEntityOfPage</caption>';
|
53 |
+
$html .= '<tr><th>@type :</th><td><small>"WebPage"</small></td></tr>';
|
54 |
+
$html .= '<tr><th>@id :</th><td><small>Default : get_permalink( ID )</small></td></tr>';
|
55 |
+
$html .= '</table>';
|
56 |
+
echo $html;
|
57 |
+
|
58 |
+
$html = '<table class="schema-admin-table">';
|
59 |
+
$html .= '<caption>image</caption>';
|
60 |
+
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
61 |
+
$html .= '<tr><th>url :</th><td><small>Default : Featured Image</small></td></tr>';
|
62 |
+
$html .= '<tr><th>height :</th><td><small>Auto : The height of the image, in pixels.</small></td></tr>';
|
63 |
+
$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>';
|
64 |
+
$html .= '<tr><th><label for="content_image">Setting image url :</label></th><td>';
|
65 |
+
$html .= '<input type="checkbox" name="option[' . "content_image" . ']" id="content_image" value="on"';
|
66 |
+
if ( isset( $option['content_image'] ) && $option['content_image'] === 'on' ) {
|
67 |
+
$html .= ' checked="checked"';
|
68 |
+
}
|
69 |
+
$html .= '>Set the first image in the content.<br><small>Pattern without feature image set (feature image takes precedence)</small>';
|
70 |
+
$html .= '</td></tr>';
|
71 |
+
$html .= '<tr><th><label for="default_image">Default image url :</label></th><td>';
|
72 |
+
$html .= '<input type="text" name="option[' . "default_image" . ']" id="default_image" class="regular-text" value="' . esc_attr( $option['default_image'] ) . '">';
|
73 |
+
$html .= '<button id="media-upload-default" class="dashicons-before dashicons-admin-media schema-admin-media-button"></button><br>';
|
74 |
+
$html .= '<small>Image output when feature image or content image check is not set.</small>';
|
75 |
+
$html .= '</td></tr>';
|
76 |
+
$html .= '</table>';
|
77 |
+
echo $html;
|
78 |
+
|
79 |
+
$html = '<table class="schema-admin-table">';
|
80 |
+
$html .= '<caption>author</caption>';
|
81 |
+
$html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
|
82 |
+
$html .= '<tr><th>name :</th><td><small>Default : get_the_author_meta( "display_name", author )</small>';
|
83 |
+
$html .= '</td></tr>';
|
84 |
+
$html .= '</table>';
|
85 |
+
echo $html;
|
86 |
+
|
87 |
+
$html = '<table class="schema-admin-table">';
|
88 |
+
$html .= '<caption>publisher</caption>';
|
89 |
+
$html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
|
90 |
+
$html .= '<tr><th><label for="name">Organization Name :</label></th><td>';
|
91 |
+
$html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" value="' . esc_attr( $option['name'] ) . '">';
|
92 |
+
$html .= '</td></tr>';
|
93 |
+
$html .= '</table>';
|
94 |
+
echo $html;
|
95 |
+
|
96 |
+
$html = '<table class="schema-admin-table">';
|
97 |
+
$html .= '<caption>publisher.logo</caption>';
|
98 |
+
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
99 |
+
$html .= '<tr><th><label for="logo">url :</label></th><td>';
|
100 |
+
$html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
|
101 |
+
$html .= '<button id="media-upload" class="dashicons-before dashicons-admin-media schema-admin-media-button"></button>';
|
102 |
+
$html .= '</td></tr>';
|
103 |
+
$html .= '<tr><th><label for="logo-width">width :</label></th><td>';
|
104 |
+
$html .= '<input type="number" name="option[' . "logo-width" . ']" id="logo-width" min="0" value="' . esc_attr( $option['logo-width'] ) . '" placeholder="width <= 600px.">px';
|
105 |
+
$html .= '</td></tr>';
|
106 |
+
$html .= '<tr><th><label for="logo-height">height :</label></th><td>';
|
107 |
+
$html .= '<input type="number" name="option[' . "logo-height" . ']" id="logo-height" min="0" value="' . esc_attr( $option['logo-height'] ) . '" placeholder="height <= 60px.">px';
|
108 |
+
$html .= '</td></tr>';
|
109 |
+
$html .= '</table>';
|
110 |
+
echo $html;
|
111 |
+
|
112 |
+
$html = '<table class="schema-admin-table">';
|
113 |
+
$html .= '<caption>Speakable</caption>';
|
114 |
+
$html .= '<tr><th><label for="speakable_action">speakable Active :</label></th><td>';
|
115 |
+
$html .= '<label><input type="checkbox" name="option[' . "speakable_action" . ']" id="speakable_action" value="on"';
|
116 |
+
|
117 |
+
if ( isset( $option['speakable_action'] ) && $option['speakable_action'] === 'on' ) {
|
118 |
+
$html .= ' checked="checked"';
|
119 |
+
}
|
120 |
+
$html .= '>Enabled</label>';
|
121 |
+
$html .= '</td></tr>';
|
122 |
+
$html .= '<tr><th><label for="speakable_type_css">cssSelector OR xpath :</label></th><td>';
|
123 |
+
|
124 |
+
if( $option['speakable_type'] !== 'xpath' ) {
|
125 |
+
$checked['css'] = ' checked';
|
126 |
+
$checked['xpath'] = '';
|
127 |
+
} else {
|
128 |
+
$checked['css'] = '';
|
129 |
+
$checked['xpath'] = ' checked';
|
130 |
+
}
|
131 |
+
|
132 |
+
$html .= '<label><input type="radio" name="option[' . "speakable_type" . ']" id="speakable_type_css" value="cssSelector"' . $checked['css'] . '>CSS selectors </label>';
|
133 |
+
$html .= '<label><input type="radio" name="option[' . "speakable_type" . ']" id="speakable_type_xpath" value="xpath"' . $checked['xpath'] . '>xPaths</label>';
|
134 |
+
$html .= '</td></tr>';
|
135 |
+
$html .= '<tr><th><label for="speakable_headline">headline :</label></th><td>';
|
136 |
+
$html .= '<input type="text" name="option[' . "speakable_headline" . ']" id="speakable_headline" class="regular-text" value="' . esc_attr( stripslashes( $option['speakable_headline'] ) ) . '">';
|
137 |
+
$html .= '</td></tr>';
|
138 |
+
$html .= '<tr><th><label for="speakable_summary">summary :</label></th><td>';
|
139 |
+
$html .= '<input type="text" name="option[' . "speakable_summary" . ']" id="speakable_summary" class="regular-text" value="' . esc_attr( stripslashes( $option['speakable_summary'] ) ) . '">';
|
140 |
+
$html .= '</td></tr>';
|
141 |
+
$html .= '</table>';
|
142 |
+
echo $html;
|
143 |
+
|
144 |
+
$html = '<table class="schema-admin-table">';
|
145 |
+
$html .= '<caption>Setting Knowledge</caption>';
|
146 |
+
$html .= '<tr><th>schema.org Article :</th>';
|
147 |
+
$html .= '<td><a href="http://schema.org/Article" target="_blank">http://schema.org/Article</a></td></tr>';
|
148 |
+
$html .= '<tr><th>pending.schema.org Speakable :</th>';
|
149 |
+
$html .= '<td><a href="https://pending.schema.org/speakable" target="_blank">https://pending.schema.org/speakable</a></td></tr>';
|
150 |
+
$html .= '<tr><th>Google Search Article :</th>';
|
151 |
+
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/articles" target="_blank">https://developers.google.com/search/docs/data-types/articles</a></td></tr>';
|
152 |
+
$html .= '<tr><th>Google Search Speakable (BETA) :</th>';
|
153 |
+
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/speakable" target="_blank">https://developers.google.com/search/docs/data-types/speakable</a></td></tr>';
|
154 |
+
$html .= '</table>';
|
155 |
+
echo $html;
|
156 |
+
|
157 |
+
submit_button();
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* Return the default options array
|
162 |
+
*
|
163 |
+
* @since 4.5.0
|
164 |
+
* @version 2.2.0
|
165 |
+
* @return array $args
|
166 |
+
*/
|
167 |
+
private function get_default_options () {
|
168 |
+
$args['name'] = '';
|
169 |
+
$args['content_image'] = '';
|
170 |
+
$args['default_image'] = '';
|
171 |
+
$args['logo'] = '';
|
172 |
+
$args['logo-height'] = 0;
|
173 |
+
$args['logo-width'] = 0;
|
174 |
+
$args['speakable_action'] = '';
|
175 |
+
$args['speakable_type'] = '';
|
176 |
+
$args['speakable_headline'] = '';
|
177 |
+
$args['speakable_summary'] = '';
|
178 |
+
|
179 |
+
return (array) $args;
|
180 |
+
}
|
181 |
}
|
includes/admin/wp-structuring-admin-type-blog-posting.php
CHANGED
@@ -1,181 +1,181 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Type BlogPosting
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.5.3
|
7 |
-
* @since 1.2.0
|
8 |
-
* @see wp-structuring-admin-db.php
|
9 |
-
* @link http://schema.org/BlogPosting
|
10 |
-
* @link https://pending.schema.org/speakable
|
11 |
-
* @link https://developers.google.com/search/docs/data-types/articles
|
12 |
-
* @link https://developers.google.com/search/docs/data-types/speakable
|
13 |
-
*/
|
14 |
-
class Structuring_Markup_Type_Blog_Posting {
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Constructor Define.
|
18 |
-
*
|
19 |
-
* @version 3.2.2
|
20 |
-
* @since 1.0.0
|
21 |
-
* @param array $option
|
22 |
-
*/
|
23 |
-
public function __construct ( array $option ) {
|
24 |
-
/** Default Value Set */
|
25 |
-
$option_array = $this->get_default_options();
|
26 |
-
|
27 |
-
if ( !empty( $option ) ) {
|
28 |
-
$option_array = array_merge( $option_array, $option );
|
29 |
-
}
|
30 |
-
|
31 |
-
$this->page_render( $option_array );
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Form Layout Render
|
36 |
-
*
|
37 |
-
* @version 4.5.3
|
38 |
-
* @since 1.2.0
|
39 |
-
* @param array $option
|
40 |
-
*/
|
41 |
-
private function page_render ( array $option ) {
|
42 |
-
$html = '<table class="schema-admin-table">';
|
43 |
-
$html .= '<caption>Basic Setting</caption>';
|
44 |
-
$html .= '<tr><th>headline :</th><td><small>Default : post_title</small></td></tr>';
|
45 |
-
$html .= '<tr><th>datePublished :</th><td><small>Default : get_the_time( DATE_ISO8601, ID )</small></td></tr>';
|
46 |
-
$html .= '<tr><th>dateModified :</th><td><small>Default : get_the_modified_time( DATE_ISO8601, false, ID )</small></td></tr>';
|
47 |
-
$html .= '<tr><th>description :</th><td><small>Default : post_excerpt</small></td></tr>';
|
48 |
-
$html .= '</table>';
|
49 |
-
echo $html;
|
50 |
-
|
51 |
-
$html = '<table class="schema-admin-table">';
|
52 |
-
$html .= '<caption>mainEntityOfPage</caption>';
|
53 |
-
$html .= '<tr><th>@type :</th><td><small>"WebPage"</small></td></tr>';
|
54 |
-
$html .= '<tr><th>@id :</th><td><small>Default : get_permalink( ID )</small></td></tr>';
|
55 |
-
$html .= '</table>';
|
56 |
-
echo $html;
|
57 |
-
|
58 |
-
$html = '<table class="schema-admin-table">';
|
59 |
-
$html .= '<caption>image</caption>';
|
60 |
-
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
61 |
-
$html .= '<tr><th>url :</th><td><small>Default : Featured Image</small></td></tr>';
|
62 |
-
$html .= '<tr><th>height :</th><td><small>Auto : The height of the image, in pixels.</small></td></tr>';
|
63 |
-
$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>';
|
64 |
-
$html .= '<tr><th><label for="content_image">Setting image url :</label></th><td>';
|
65 |
-
$html .= '<input type="checkbox" name="option[' . "content_image" . ']" id="content_image" value="on"';
|
66 |
-
if ( isset( $option['content_image'] ) && $option['content_image'] === 'on' ) {
|
67 |
-
$html .= ' checked="checked"';
|
68 |
-
}
|
69 |
-
$html .= '>Set the first image in the content.<br><small>Pattern without feature image set (feature image takes precedence)</small>';
|
70 |
-
$html .= '</td></tr>';
|
71 |
-
$html .= '<tr><th><label for="default_image">Default image url :</label></th><td>';
|
72 |
-
$html .= '<input type="text" name="option[' . "default_image" . ']" id="default_image" class="regular-text" value="' . esc_attr( $option['default_image'] ) . '">';
|
73 |
-
$html .= '<button id="media-upload-default" class="dashicons-before dashicons-admin-media schema-admin-media-button"></button><br>';
|
74 |
-
$html .= '<small>Image output when feature image or content image check is not set.</small>';
|
75 |
-
$html .= '</td></tr>';
|
76 |
-
$html .= '</table>';
|
77 |
-
echo $html;
|
78 |
-
|
79 |
-
$html = '<table class="schema-admin-table">';
|
80 |
-
$html .= '<caption>author</caption>';
|
81 |
-
$html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
|
82 |
-
$html .= '<tr><th>name :</th><td><small>Default : get_the_author_meta( "display_name", author )</small>';
|
83 |
-
$html .= '</td></tr>';
|
84 |
-
$html .= '</table>';
|
85 |
-
echo $html;
|
86 |
-
|
87 |
-
$html = '<table class="schema-admin-table">';
|
88 |
-
$html .= '<caption>publisher</caption>';
|
89 |
-
$html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
|
90 |
-
$html .= '<tr><th><label for="name">Organization Name :</label></th><td>';
|
91 |
-
$html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" value="' . esc_attr( $option['name'] ) . '">';
|
92 |
-
$html .= '</td></tr>';
|
93 |
-
$html .= '</table>';
|
94 |
-
echo $html;
|
95 |
-
|
96 |
-
$html = '<table class="schema-admin-table">';
|
97 |
-
$html .= '<caption>publisher.logo</caption>';
|
98 |
-
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
99 |
-
$html .= '<tr><th><label for="logo">url :</label></th><td>';
|
100 |
-
$html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
|
101 |
-
$html .= '<button id="media-upload" class="dashicons-before dashicons-admin-media schema-admin-media-button"></button>';
|
102 |
-
$html .= '</td></tr>';
|
103 |
-
$html .= '<tr><th><label for="logo-width">width :</label></th><td>';
|
104 |
-
$html .= '<input type="number" name="option[' . "logo-width" . ']" id="logo-width" min="0" value="' . esc_attr( $option['logo-width'] ) . '" placeholder="width <= 600px.">px';
|
105 |
-
$html .= '</td></tr>';
|
106 |
-
$html .= '<tr><th><label for="logo-height">height :</label></th><td>';
|
107 |
-
$html .= '<input type="number" name="option[' . "logo-height" . ']" id="logo-height" min="0" value="' . esc_attr( $option['logo-height'] ) . '" placeholder="height <= 60px.">px';
|
108 |
-
$html .= '</td></tr>';
|
109 |
-
$html .= '</table>';
|
110 |
-
echo $html;
|
111 |
-
|
112 |
-
$html = '<table class="schema-admin-table">';
|
113 |
-
$html .= '<caption>Speakable</caption>';
|
114 |
-
$html .= '<tr><th><label for="speakable_action">speakable Active :</label></th><td>';
|
115 |
-
$html .= '<label><input type="checkbox" name="option[' . "speakable_action" . ']" id="speakable_action" value="on"';
|
116 |
-
|
117 |
-
if ( isset( $option['speakable_action'] ) && $option['speakable_action'] === 'on' ) {
|
118 |
-
$html .= ' checked="checked"';
|
119 |
-
}
|
120 |
-
$html .= '>Enabled</label>';
|
121 |
-
$html .= '</td></tr>';
|
122 |
-
$html .= '<tr><th><label for="speakable_type_css">cssSelector OR xpath :</label></th><td>';
|
123 |
-
|
124 |
-
if( $option['speakable_type'] !== 'xpath' ) {
|
125 |
-
$checked['css'] = ' checked';
|
126 |
-
$checked['xpath'] = '';
|
127 |
-
} else {
|
128 |
-
$checked['css'] = '';
|
129 |
-
$checked['xpath'] = ' checked';
|
130 |
-
}
|
131 |
-
|
132 |
-
$html .= '<label><input type="radio" name="option[' . "speakable_type" . ']" id="speakable_type_css" value="cssSelector"' . $checked['css'] . '>CSS selectors </label>';
|
133 |
-
$html .= '<label><input type="radio" name="option[' . "speakable_type" . ']" id="speakable_type_xpath" value="xpath"' . $checked['xpath'] . '>xPaths</label>';
|
134 |
-
$html .= '</td></tr>';
|
135 |
-
$html .= '<tr><th><label for="speakable_headline">headline :</label></th><td>';
|
136 |
-
$html .= '<input type="text" name="option[' . "speakable_headline" . ']" id="speakable_headline" class="regular-text" value="' . esc_attr( stripslashes( $option['speakable_headline'] ) ) . '">';
|
137 |
-
$html .= '</td></tr>';
|
138 |
-
$html .= '<tr><th><label for="speakable_summary">summary :</label></th><td>';
|
139 |
-
$html .= '<input type="text" name="option[' . "speakable_summary" . ']" id="speakable_summary" class="regular-text" value="' . esc_attr( stripslashes( $option['speakable_summary'] ) ) . '">';
|
140 |
-
$html .= '</td></tr>';
|
141 |
-
$html .= '</table>';
|
142 |
-
echo $html;
|
143 |
-
|
144 |
-
$html = '<table class="schema-admin-table">';
|
145 |
-
$html .= '<caption>Setting Knowledge</caption>';
|
146 |
-
$html .= '<tr><th>schema.org BlogPosting :</th>';
|
147 |
-
$html .= '<td><a href="http://schema.org/BlogPosting" target="_blank">http://schema.org/BlogPosting</a></td></tr>';
|
148 |
-
$html .= '<tr><th>pending.schema.org Speakable :</th>';
|
149 |
-
$html .= '<td><a href="https://pending.schema.org/speakable" target="_blank">https://pending.schema.org/speakable</a></td></tr>';
|
150 |
-
$html .= '<tr><th>Google Search Article :</th>';
|
151 |
-
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/articles" target="_blank">https://developers.google.com/search/docs/data-types/articles</a></td></tr>';
|
152 |
-
$html .= '<tr><th>Google Search Speakable (BETA) :</th>';
|
153 |
-
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/speakable" target="_blank">https://developers.google.com/search/docs/data-types/speakable</a></td></tr>';
|
154 |
-
$html .= '</table>';
|
155 |
-
echo $html;
|
156 |
-
|
157 |
-
submit_button();
|
158 |
-
}
|
159 |
-
|
160 |
-
/**
|
161 |
-
* Return the default options array
|
162 |
-
*
|
163 |
-
* @version 4.5.3
|
164 |
-
* @since 2.2.0
|
165 |
-
* @return array $args
|
166 |
-
*/
|
167 |
-
private function get_default_options () {
|
168 |
-
$args['name'] = '';
|
169 |
-
$args['content_image'] = '';
|
170 |
-
$args['default_image'] = '';
|
171 |
-
$args['logo'] = '';
|
172 |
-
$args['logo-height'] = 0;
|
173 |
-
$args['logo-width'] = 0;
|
174 |
-
$args['speakable_action'] = '';
|
175 |
-
$args['speakable_type'] = '';
|
176 |
-
$args['speakable_headline'] = '';
|
177 |
-
$args['speakable_summary'] = '';
|
178 |
-
|
179 |
-
return (array) $args;
|
180 |
-
}
|
181 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type BlogPosting
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.5.3
|
7 |
+
* @since 1.2.0
|
8 |
+
* @see wp-structuring-admin-db.php
|
9 |
+
* @link http://schema.org/BlogPosting
|
10 |
+
* @link https://pending.schema.org/speakable
|
11 |
+
* @link https://developers.google.com/search/docs/data-types/articles
|
12 |
+
* @link https://developers.google.com/search/docs/data-types/speakable
|
13 |
+
*/
|
14 |
+
class Structuring_Markup_Type_Blog_Posting {
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Constructor Define.
|
18 |
+
*
|
19 |
+
* @version 3.2.2
|
20 |
+
* @since 1.0.0
|
21 |
+
* @param array $option
|
22 |
+
*/
|
23 |
+
public function __construct ( array $option ) {
|
24 |
+
/** Default Value Set */
|
25 |
+
$option_array = $this->get_default_options();
|
26 |
+
|
27 |
+
if ( !empty( $option ) ) {
|
28 |
+
$option_array = array_merge( $option_array, $option );
|
29 |
+
}
|
30 |
+
|
31 |
+
$this->page_render( $option_array );
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Form Layout Render
|
36 |
+
*
|
37 |
+
* @version 4.5.3
|
38 |
+
* @since 1.2.0
|
39 |
+
* @param array $option
|
40 |
+
*/
|
41 |
+
private function page_render ( array $option ) {
|
42 |
+
$html = '<table class="schema-admin-table">';
|
43 |
+
$html .= '<caption>Basic Setting</caption>';
|
44 |
+
$html .= '<tr><th>headline :</th><td><small>Default : post_title</small></td></tr>';
|
45 |
+
$html .= '<tr><th>datePublished :</th><td><small>Default : get_the_time( DATE_ISO8601, ID )</small></td></tr>';
|
46 |
+
$html .= '<tr><th>dateModified :</th><td><small>Default : get_the_modified_time( DATE_ISO8601, false, ID )</small></td></tr>';
|
47 |
+
$html .= '<tr><th>description :</th><td><small>Default : post_excerpt</small></td></tr>';
|
48 |
+
$html .= '</table>';
|
49 |
+
echo $html;
|
50 |
+
|
51 |
+
$html = '<table class="schema-admin-table">';
|
52 |
+
$html .= '<caption>mainEntityOfPage</caption>';
|
53 |
+
$html .= '<tr><th>@type :</th><td><small>"WebPage"</small></td></tr>';
|
54 |
+
$html .= '<tr><th>@id :</th><td><small>Default : get_permalink( ID )</small></td></tr>';
|
55 |
+
$html .= '</table>';
|
56 |
+
echo $html;
|
57 |
+
|
58 |
+
$html = '<table class="schema-admin-table">';
|
59 |
+
$html .= '<caption>image</caption>';
|
60 |
+
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
61 |
+
$html .= '<tr><th>url :</th><td><small>Default : Featured Image</small></td></tr>';
|
62 |
+
$html .= '<tr><th>height :</th><td><small>Auto : The height of the image, in pixels.</small></td></tr>';
|
63 |
+
$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>';
|
64 |
+
$html .= '<tr><th><label for="content_image">Setting image url :</label></th><td>';
|
65 |
+
$html .= '<input type="checkbox" name="option[' . "content_image" . ']" id="content_image" value="on"';
|
66 |
+
if ( isset( $option['content_image'] ) && $option['content_image'] === 'on' ) {
|
67 |
+
$html .= ' checked="checked"';
|
68 |
+
}
|
69 |
+
$html .= '>Set the first image in the content.<br><small>Pattern without feature image set (feature image takes precedence)</small>';
|
70 |
+
$html .= '</td></tr>';
|
71 |
+
$html .= '<tr><th><label for="default_image">Default image url :</label></th><td>';
|
72 |
+
$html .= '<input type="text" name="option[' . "default_image" . ']" id="default_image" class="regular-text" value="' . esc_attr( $option['default_image'] ) . '">';
|
73 |
+
$html .= '<button id="media-upload-default" class="dashicons-before dashicons-admin-media schema-admin-media-button"></button><br>';
|
74 |
+
$html .= '<small>Image output when feature image or content image check is not set.</small>';
|
75 |
+
$html .= '</td></tr>';
|
76 |
+
$html .= '</table>';
|
77 |
+
echo $html;
|
78 |
+
|
79 |
+
$html = '<table class="schema-admin-table">';
|
80 |
+
$html .= '<caption>author</caption>';
|
81 |
+
$html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
|
82 |
+
$html .= '<tr><th>name :</th><td><small>Default : get_the_author_meta( "display_name", author )</small>';
|
83 |
+
$html .= '</td></tr>';
|
84 |
+
$html .= '</table>';
|
85 |
+
echo $html;
|
86 |
+
|
87 |
+
$html = '<table class="schema-admin-table">';
|
88 |
+
$html .= '<caption>publisher</caption>';
|
89 |
+
$html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
|
90 |
+
$html .= '<tr><th><label for="name">Organization Name :</label></th><td>';
|
91 |
+
$html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" value="' . esc_attr( $option['name'] ) . '">';
|
92 |
+
$html .= '</td></tr>';
|
93 |
+
$html .= '</table>';
|
94 |
+
echo $html;
|
95 |
+
|
96 |
+
$html = '<table class="schema-admin-table">';
|
97 |
+
$html .= '<caption>publisher.logo</caption>';
|
98 |
+
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
99 |
+
$html .= '<tr><th><label for="logo">url :</label></th><td>';
|
100 |
+
$html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
|
101 |
+
$html .= '<button id="media-upload" class="dashicons-before dashicons-admin-media schema-admin-media-button"></button>';
|
102 |
+
$html .= '</td></tr>';
|
103 |
+
$html .= '<tr><th><label for="logo-width">width :</label></th><td>';
|
104 |
+
$html .= '<input type="number" name="option[' . "logo-width" . ']" id="logo-width" min="0" value="' . esc_attr( $option['logo-width'] ) . '" placeholder="width <= 600px.">px';
|
105 |
+
$html .= '</td></tr>';
|
106 |
+
$html .= '<tr><th><label for="logo-height">height :</label></th><td>';
|
107 |
+
$html .= '<input type="number" name="option[' . "logo-height" . ']" id="logo-height" min="0" value="' . esc_attr( $option['logo-height'] ) . '" placeholder="height <= 60px.">px';
|
108 |
+
$html .= '</td></tr>';
|
109 |
+
$html .= '</table>';
|
110 |
+
echo $html;
|
111 |
+
|
112 |
+
$html = '<table class="schema-admin-table">';
|
113 |
+
$html .= '<caption>Speakable</caption>';
|
114 |
+
$html .= '<tr><th><label for="speakable_action">speakable Active :</label></th><td>';
|
115 |
+
$html .= '<label><input type="checkbox" name="option[' . "speakable_action" . ']" id="speakable_action" value="on"';
|
116 |
+
|
117 |
+
if ( isset( $option['speakable_action'] ) && $option['speakable_action'] === 'on' ) {
|
118 |
+
$html .= ' checked="checked"';
|
119 |
+
}
|
120 |
+
$html .= '>Enabled</label>';
|
121 |
+
$html .= '</td></tr>';
|
122 |
+
$html .= '<tr><th><label for="speakable_type_css">cssSelector OR xpath :</label></th><td>';
|
123 |
+
|
124 |
+
if( $option['speakable_type'] !== 'xpath' ) {
|
125 |
+
$checked['css'] = ' checked';
|
126 |
+
$checked['xpath'] = '';
|
127 |
+
} else {
|
128 |
+
$checked['css'] = '';
|
129 |
+
$checked['xpath'] = ' checked';
|
130 |
+
}
|
131 |
+
|
132 |
+
$html .= '<label><input type="radio" name="option[' . "speakable_type" . ']" id="speakable_type_css" value="cssSelector"' . $checked['css'] . '>CSS selectors </label>';
|
133 |
+
$html .= '<label><input type="radio" name="option[' . "speakable_type" . ']" id="speakable_type_xpath" value="xpath"' . $checked['xpath'] . '>xPaths</label>';
|
134 |
+
$html .= '</td></tr>';
|
135 |
+
$html .= '<tr><th><label for="speakable_headline">headline :</label></th><td>';
|
136 |
+
$html .= '<input type="text" name="option[' . "speakable_headline" . ']" id="speakable_headline" class="regular-text" value="' . esc_attr( stripslashes( $option['speakable_headline'] ) ) . '">';
|
137 |
+
$html .= '</td></tr>';
|
138 |
+
$html .= '<tr><th><label for="speakable_summary">summary :</label></th><td>';
|
139 |
+
$html .= '<input type="text" name="option[' . "speakable_summary" . ']" id="speakable_summary" class="regular-text" value="' . esc_attr( stripslashes( $option['speakable_summary'] ) ) . '">';
|
140 |
+
$html .= '</td></tr>';
|
141 |
+
$html .= '</table>';
|
142 |
+
echo $html;
|
143 |
+
|
144 |
+
$html = '<table class="schema-admin-table">';
|
145 |
+
$html .= '<caption>Setting Knowledge</caption>';
|
146 |
+
$html .= '<tr><th>schema.org BlogPosting :</th>';
|
147 |
+
$html .= '<td><a href="http://schema.org/BlogPosting" target="_blank">http://schema.org/BlogPosting</a></td></tr>';
|
148 |
+
$html .= '<tr><th>pending.schema.org Speakable :</th>';
|
149 |
+
$html .= '<td><a href="https://pending.schema.org/speakable" target="_blank">https://pending.schema.org/speakable</a></td></tr>';
|
150 |
+
$html .= '<tr><th>Google Search Article :</th>';
|
151 |
+
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/articles" target="_blank">https://developers.google.com/search/docs/data-types/articles</a></td></tr>';
|
152 |
+
$html .= '<tr><th>Google Search Speakable (BETA) :</th>';
|
153 |
+
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/speakable" target="_blank">https://developers.google.com/search/docs/data-types/speakable</a></td></tr>';
|
154 |
+
$html .= '</table>';
|
155 |
+
echo $html;
|
156 |
+
|
157 |
+
submit_button();
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* Return the default options array
|
162 |
+
*
|
163 |
+
* @version 4.5.3
|
164 |
+
* @since 2.2.0
|
165 |
+
* @return array $args
|
166 |
+
*/
|
167 |
+
private function get_default_options () {
|
168 |
+
$args['name'] = '';
|
169 |
+
$args['content_image'] = '';
|
170 |
+
$args['default_image'] = '';
|
171 |
+
$args['logo'] = '';
|
172 |
+
$args['logo-height'] = 0;
|
173 |
+
$args['logo-width'] = 0;
|
174 |
+
$args['speakable_action'] = '';
|
175 |
+
$args['speakable_type'] = '';
|
176 |
+
$args['speakable_headline'] = '';
|
177 |
+
$args['speakable_summary'] = '';
|
178 |
+
|
179 |
+
return (array) $args;
|
180 |
+
}
|
181 |
}
|
includes/admin/wp-structuring-admin-type-breadcrumb.php
CHANGED
@@ -1,131 +1,127 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Type Breadcrumb
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.
|
7 |
-
* @since 2.0.0
|
8 |
-
* @see wp-structuring-admin-db.php
|
9 |
-
* @link https://schema.org/BreadcrumbList
|
10 |
-
* @link https://developers.google.com/search/docs/data-types/breadcrumbs
|
11 |
-
*/
|
12 |
-
class Structuring_Markup_Type_Breadcrumb {
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Constructor Define.
|
16 |
-
*
|
17 |
-
* @version 4.1.1
|
18 |
-
* @since 2.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 4.
|
36 |
-
* @since 2.3.3
|
37 |
-
* @param array $option
|
38 |
-
*/
|
39 |
-
private function page_render ( array $option ) {
|
40 |
-
$html = '<table class="schema-admin-table">';
|
41 |
-
$html .= '<caption>Basic Setting</caption>';
|
42 |
-
$html .= '<tr><th><label for="home_on">Display Home Page :</label></th><td>';
|
43 |
-
$html .= '<input type="checkbox" name="option[' . "home_on" . ']" id="home_on" value="on"';
|
44 |
-
if ( isset( $option['home_on'] ) && $option['home_on'] === 'on' ) {
|
45 |
-
$html .= ' checked="checked"';
|
46 |
-
}
|
47 |
-
$html .= '>Enabled';
|
48 |
-
$html .= '<small>Installed the HOME to breadcrumbs.</small>';
|
49 |
-
$html .= '</td></tr>';
|
50 |
-
$html .= '<tr><th><label for="home_name">Home Name :</label></th><td>';
|
51 |
-
$html .= '<input type="text" name="option[' . "home_name" . ']" id="home_name" class="regular-text" value="' . esc_attr( $option['home_name'] ) . '">';
|
52 |
-
$html .= '<small>Default : bloginfo("name")<br>* In the case of the pattern set for the static page on the front page its title is the default value.</small>';
|
53 |
-
$html .= '</td></tr>';
|
54 |
-
$html .= '<tr><th><label for="home_url">Home Url :</label></th><td>';
|
55 |
-
|
56 |
-
switch ( $option['home_url'] ) {
|
57 |
-
case '
|
58 |
-
$checked['home_url'] = '
|
59 |
-
$checked['site_url'] = '';
|
60 |
-
break;
|
61 |
-
|
62 |
-
$checked['home_url'] = '';
|
63 |
-
$checked['site_url'] = '
|
64 |
-
break;
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
$html .= '<label
|
72 |
-
$html .= '<
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
$html .= '
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
$html .= '
|
81 |
-
$
|
82 |
-
|
83 |
-
|
84 |
-
$html .= '
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
$html
|
89 |
-
|
90 |
-
$html
|
91 |
-
$html .= '</
|
92 |
-
|
93 |
-
|
94 |
-
$html
|
95 |
-
$html .= '
|
96 |
-
$html .= '
|
97 |
-
$html
|
98 |
-
|
99 |
-
$html
|
100 |
-
$html .= '</
|
101 |
-
|
102 |
-
|
103 |
-
$html
|
104 |
-
$html .= '<
|
105 |
-
$html .= '
|
106 |
-
$html
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
*
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
$args['
|
124 |
-
|
125 |
-
$args
|
126 |
-
|
127 |
-
$args['current_link'] = '';
|
128 |
-
|
129 |
-
return (array) $args;
|
130 |
-
}
|
131 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type Breadcrumb
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.7.0
|
7 |
+
* @since 2.0.0
|
8 |
+
* @see wp-structuring-admin-db.php
|
9 |
+
* @link https://schema.org/BreadcrumbList
|
10 |
+
* @link https://developers.google.com/search/docs/data-types/breadcrumbs
|
11 |
+
*/
|
12 |
+
class Structuring_Markup_Type_Breadcrumb {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Constructor Define.
|
16 |
+
*
|
17 |
+
* @version 4.1.1
|
18 |
+
* @since 2.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 4.7.0
|
36 |
+
* @since 2.3.3
|
37 |
+
* @param array $option
|
38 |
+
*/
|
39 |
+
private function page_render ( array $option ) {
|
40 |
+
$html = '<table class="schema-admin-table">';
|
41 |
+
$html .= '<caption>Basic Setting</caption>';
|
42 |
+
$html .= '<tr><th><label for="home_on">Display Home Page :</label></th><td>';
|
43 |
+
$html .= '<input type="checkbox" name="option[' . "home_on" . ']" id="home_on" value="on"';
|
44 |
+
if ( isset( $option['home_on'] ) && $option['home_on'] === 'on' ) {
|
45 |
+
$html .= ' checked="checked"';
|
46 |
+
}
|
47 |
+
$html .= '>Enabled';
|
48 |
+
$html .= '<small>Installed the HOME to breadcrumbs.</small>';
|
49 |
+
$html .= '</td></tr>';
|
50 |
+
$html .= '<tr><th><label for="home_name">Home Name :</label></th><td>';
|
51 |
+
$html .= '<input type="text" name="option[' . "home_name" . ']" id="home_name" class="regular-text" value="' . esc_attr( $option['home_name'] ) . '">';
|
52 |
+
$html .= '<small>Default : bloginfo("name")<br>* In the case of the pattern set for the static page on the front page its title is the default value.</small>';
|
53 |
+
$html .= '</td></tr>';
|
54 |
+
$html .= '<tr><th><label for="home_url">Home Url :</label></th><td>';
|
55 |
+
|
56 |
+
switch ( $option['home_url'] ) {
|
57 |
+
case 'site_url':
|
58 |
+
$checked['home_url'] = '';
|
59 |
+
$checked['site_url'] = ' checked';
|
60 |
+
break;
|
61 |
+
default:
|
62 |
+
$checked['home_url'] = ' checked';
|
63 |
+
$checked['site_url'] = '';
|
64 |
+
break;
|
65 |
+
}
|
66 |
+
|
67 |
+
$html .= '<label><input type="radio" name="option[' . "home_url" . ']" id="home_url" value="home_url"' . $checked['home_url'] . '>home_url() </label>';
|
68 |
+
$html .= '<label><input type="radio" name="option[' . "home_url" . ']" id="site_url" value="site_url"' . $checked['site_url'] . '>site_url()</label>';
|
69 |
+
$html .= '<small>Choose which function to set the home URL.</small>';
|
70 |
+
$html .= '</td></tr>';
|
71 |
+
$html .= '<tr><th><label for="current_on">Display Current Page :</label></th><td>';
|
72 |
+
$html .= '<input type="checkbox" name="option[' . "current_on" . ']" id="current_on" value="on"';
|
73 |
+
if ( isset( $option['current_on'] ) && $option['current_on'] === 'on' ) {
|
74 |
+
$html .= ' checked="checked"';
|
75 |
+
}
|
76 |
+
$html .= '>Enabled';
|
77 |
+
$html .= '<small>Installed the Current Page to breadcrumbs.</small>';
|
78 |
+
$html .= '</td></tr>';
|
79 |
+
$html .= '<tr><th><label for="current_link">Current Page Link :</label></th><td>';
|
80 |
+
$html .= '<input type="checkbox" name="option[' . "current_link" . ']" id="current_link" value="on"';
|
81 |
+
if ( isset( $option['current_link'] ) && $option['current_link'] === 'on' ) {
|
82 |
+
$html .= ' checked="checked"';
|
83 |
+
}
|
84 |
+
$html .= '>Enabled';
|
85 |
+
$html .= '<small>Link setting of the current page of breadcrumbs.</small>';
|
86 |
+
$html .= '</td></tr>';
|
87 |
+
$html .= '</table>';
|
88 |
+
echo $html;
|
89 |
+
|
90 |
+
$html = '<table class="schema-admin-table">';
|
91 |
+
$html .= '<caption>Short Code</caption>';
|
92 |
+
$html .= '<tr><th><label for="home_on">Short Code Copy :</label></th><td>';
|
93 |
+
$html .= '<input type="text" onfocus="this.select();" readonly="readonly" value="[wp-structuring-markup-breadcrumb]" class="large-text code">';
|
94 |
+
$html .= '<small>Option : id="id_name" and class="class_name" attribute additional ol element.</small>';
|
95 |
+
$html .= '</td></tr>';
|
96 |
+
$html .= '</table>';
|
97 |
+
echo $html;
|
98 |
+
|
99 |
+
$html = '<table class="schema-admin-table">';
|
100 |
+
$html .= '<caption>Setting Knowledge</caption>';
|
101 |
+
$html .= '<tr><th>schema.org BreadcrumbList :</th>';
|
102 |
+
$html .= '<td><a href="https://schema.org/BreadcrumbList" target="_blank">https://schema.org/BreadcrumbList</a></td></tr>';
|
103 |
+
$html .= '<tr><th>Google Search Breadcrumb :</th>';
|
104 |
+
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/breadcrumbs" target="_blank">https://developers.google.com/search/docs/data-types/breadcrumbs</a></td></tr>';
|
105 |
+
$html .= '</table>';
|
106 |
+
echo $html;
|
107 |
+
|
108 |
+
submit_button();
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Return the default options array
|
113 |
+
*
|
114 |
+
* @version 4.6.0
|
115 |
+
* @since 2.0.0
|
116 |
+
* @return array $args
|
117 |
+
*/
|
118 |
+
private function get_default_options () {
|
119 |
+
$args['home_on'] = '';
|
120 |
+
$args['home_name'] = '';
|
121 |
+
$args['home_url'] = '';
|
122 |
+
$args['current_on'] = '';
|
123 |
+
$args['current_link'] = '';
|
124 |
+
|
125 |
+
return (array) $args;
|
126 |
+
}
|
|
|
|
|
|
|
|
|
127 |
}
|
includes/admin/wp-structuring-admin-type-event.php
CHANGED
@@ -1,86 +1,86 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Type Event
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.5.3
|
7 |
-
* @since 2.1.0
|
8 |
-
* @see wp-structuring-admin-db.php
|
9 |
-
* @link http://schema.org/Event
|
10 |
-
* @link http://schema.org/Place
|
11 |
-
* @link http://schema.org/Offer
|
12 |
-
* @link https://developers.google.com/search/docs/data-types/events
|
13 |
-
*/
|
14 |
-
class Structuring_Markup_Type_Event {
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Constructor Define.
|
18 |
-
*
|
19 |
-
* @since 2.1.0
|
20 |
-
*/
|
21 |
-
public function __construct () {
|
22 |
-
$this->page_render();
|
23 |
-
}
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Form Layout Render
|
27 |
-
*
|
28 |
-
* @version 4.5.3
|
29 |
-
* @since 2.1.0
|
30 |
-
*/
|
31 |
-
private function page_render () {
|
32 |
-
$html = '<table class="schema-admin-table">';
|
33 |
-
$html .= '<caption>Basic Setting</caption>';
|
34 |
-
$html .= '<tr><th class="require">type :</th><td><small>Select a event type: field name "schema_event_type"</small></td></tr>';
|
35 |
-
$html .= '<tr><th class="require">name :</th><td><small>Input a custom post: field name "schema_event_name"</small></td></tr>';
|
36 |
-
$html .= '<tr><th class="require">description :</th><td><small>Input a custom post: field name "schema_event_description"</small></td></tr>';
|
37 |
-
$html .= '<tr><th class="require">image :</th><td><small>Input a custom post: field name "schema_event_image"</small></td></tr>';
|
38 |
-
$html .= '<tr><th class="require">startDate :</th><td><small>Input a custom post: field name "schema_event_date" & "schema_event_time"</small></td></tr>';
|
39 |
-
$html .= '<tr><th class="require">endtDate :</th><td><small>Input a custom post: field name "schema_event_date_end" & "schema_event_time_end"</small></td></tr>';
|
40 |
-
$html .= '<tr><th>url :</th><td><small>Input a custom post: field name "schema_event_url"</small></td></tr>';
|
41 |
-
$html .= '</table>';
|
42 |
-
echo $html;
|
43 |
-
|
44 |
-
$html = '<table class="schema-admin-table">';
|
45 |
-
$html .= '<caption>Location Type "Place" Setting</caption>';
|
46 |
-
$html .= '<tr><th class="require">name :</th><td><small>Input a custom post: field name "schema_event_place_name"</small></td></tr>';
|
47 |
-
$html .= '<tr><th>url(sameAs) :</th><td><small>Input a custom post: field name "schema_event_url"</small></td></tr>';
|
48 |
-
$html .= '<tr><th class="require">address :</th><td><small>Input a custom post: field name "schema_event_place_address"</small></td></tr>';
|
49 |
-
$html .= '</table>';
|
50 |
-
echo $html;
|
51 |
-
|
52 |
-
$html = '<table class="schema-admin-table">';
|
53 |
-
$html .= '<caption>Location Type "Offers" Setting</caption>';
|
54 |
-
$html .= '<tr><th>price :</th><td><small>Input a custom post: field name "schema_event_offers_price"</small></td></tr>';
|
55 |
-
$html .= '<tr><th class="require">priceCurrency :</th><td><small>Input a custom post: field name "schema_event_offers_currency"</small></td></tr>';
|
56 |
-
$html .= '<tr><th>url :</th><td><small>Input a custom post: field name "schema_event_place_url"</small></td></tr>';
|
57 |
-
$html .= '<tr><th>validFrom :</th><td><small>Input a custom post: field name "schema_event_offers_date" & "schema_event_offers_time"</small></td></tr>';
|
58 |
-
$html .= '</table>';
|
59 |
-
echo $html;
|
60 |
-
|
61 |
-
$html = '<table class="schema-admin-table">';
|
62 |
-
$html .= '<caption>Location Type "PerformingGroup" Setting</caption>';
|
63 |
-
$html .= '<tr><th>name :</th><td><small>Input a custom post: field name "schema_event_performer_name"</small></td></tr>';
|
64 |
-
$html .= '</table>';
|
65 |
-
echo $html;
|
66 |
-
|
67 |
-
$html = '<table class="schema-admin-table">';
|
68 |
-
$html .= '<caption>Setting Knowledge</caption>';
|
69 |
-
$html .= '<tr><th>Custom post name :</th>';
|
70 |
-
$html .= '<td>schema_event_post</td></tr>';
|
71 |
-
$html .= '<tr><th>Archive rewrite name :</th>';
|
72 |
-
$html .= '<td>events</td></tr>';
|
73 |
-
$html .= '<tr><th>schema.org Event :</th>';
|
74 |
-
$html .= '<td><a href="http://schema.org/Event" target="_blank">http://schema.org/Event</a></td></tr>';
|
75 |
-
$html .= '<tr><th>schema.org Place :</th>';
|
76 |
-
$html .= '<td><a href="http://schema.org/Place" target="_blank">http://schema.org/Place</a></td></tr>';
|
77 |
-
$html .= '<tr><th>schema.org Offer :</th>';
|
78 |
-
$html .= '<td><a href="http://schema.org/Offer" target="_blank">http://schema.org/Offer</a></td></tr>';
|
79 |
-
$html .= '<tr><th>Google Search Breadcrumb :</th>';
|
80 |
-
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/events" target="_blank">https://developers.google.com/search/docs/data-types/events</a></td></tr>';
|
81 |
-
$html .= '</table>';
|
82 |
-
echo $html;
|
83 |
-
|
84 |
-
submit_button();
|
85 |
-
}
|
86 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type Event
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.5.3
|
7 |
+
* @since 2.1.0
|
8 |
+
* @see wp-structuring-admin-db.php
|
9 |
+
* @link http://schema.org/Event
|
10 |
+
* @link http://schema.org/Place
|
11 |
+
* @link http://schema.org/Offer
|
12 |
+
* @link https://developers.google.com/search/docs/data-types/events
|
13 |
+
*/
|
14 |
+
class Structuring_Markup_Type_Event {
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Constructor Define.
|
18 |
+
*
|
19 |
+
* @since 2.1.0
|
20 |
+
*/
|
21 |
+
public function __construct () {
|
22 |
+
$this->page_render();
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Form Layout Render
|
27 |
+
*
|
28 |
+
* @version 4.5.3
|
29 |
+
* @since 2.1.0
|
30 |
+
*/
|
31 |
+
private function page_render () {
|
32 |
+
$html = '<table class="schema-admin-table">';
|
33 |
+
$html .= '<caption>Basic Setting</caption>';
|
34 |
+
$html .= '<tr><th class="require">type :</th><td><small>Select a event type: field name "schema_event_type"</small></td></tr>';
|
35 |
+
$html .= '<tr><th class="require">name :</th><td><small>Input a custom post: field name "schema_event_name"</small></td></tr>';
|
36 |
+
$html .= '<tr><th class="require">description :</th><td><small>Input a custom post: field name "schema_event_description"</small></td></tr>';
|
37 |
+
$html .= '<tr><th class="require">image :</th><td><small>Input a custom post: field name "schema_event_image"</small></td></tr>';
|
38 |
+
$html .= '<tr><th class="require">startDate :</th><td><small>Input a custom post: field name "schema_event_date" & "schema_event_time"</small></td></tr>';
|
39 |
+
$html .= '<tr><th class="require">endtDate :</th><td><small>Input a custom post: field name "schema_event_date_end" & "schema_event_time_end"</small></td></tr>';
|
40 |
+
$html .= '<tr><th>url :</th><td><small>Input a custom post: field name "schema_event_url"</small></td></tr>';
|
41 |
+
$html .= '</table>';
|
42 |
+
echo $html;
|
43 |
+
|
44 |
+
$html = '<table class="schema-admin-table">';
|
45 |
+
$html .= '<caption>Location Type "Place" Setting</caption>';
|
46 |
+
$html .= '<tr><th class="require">name :</th><td><small>Input a custom post: field name "schema_event_place_name"</small></td></tr>';
|
47 |
+
$html .= '<tr><th>url(sameAs) :</th><td><small>Input a custom post: field name "schema_event_url"</small></td></tr>';
|
48 |
+
$html .= '<tr><th class="require">address :</th><td><small>Input a custom post: field name "schema_event_place_address"</small></td></tr>';
|
49 |
+
$html .= '</table>';
|
50 |
+
echo $html;
|
51 |
+
|
52 |
+
$html = '<table class="schema-admin-table">';
|
53 |
+
$html .= '<caption>Location Type "Offers" Setting</caption>';
|
54 |
+
$html .= '<tr><th>price :</th><td><small>Input a custom post: field name "schema_event_offers_price"</small></td></tr>';
|
55 |
+
$html .= '<tr><th class="require">priceCurrency :</th><td><small>Input a custom post: field name "schema_event_offers_currency"</small></td></tr>';
|
56 |
+
$html .= '<tr><th>url :</th><td><small>Input a custom post: field name "schema_event_place_url"</small></td></tr>';
|
57 |
+
$html .= '<tr><th>validFrom :</th><td><small>Input a custom post: field name "schema_event_offers_date" & "schema_event_offers_time"</small></td></tr>';
|
58 |
+
$html .= '</table>';
|
59 |
+
echo $html;
|
60 |
+
|
61 |
+
$html = '<table class="schema-admin-table">';
|
62 |
+
$html .= '<caption>Location Type "PerformingGroup" Setting</caption>';
|
63 |
+
$html .= '<tr><th>name :</th><td><small>Input a custom post: field name "schema_event_performer_name"</small></td></tr>';
|
64 |
+
$html .= '</table>';
|
65 |
+
echo $html;
|
66 |
+
|
67 |
+
$html = '<table class="schema-admin-table">';
|
68 |
+
$html .= '<caption>Setting Knowledge</caption>';
|
69 |
+
$html .= '<tr><th>Custom post name :</th>';
|
70 |
+
$html .= '<td>schema_event_post</td></tr>';
|
71 |
+
$html .= '<tr><th>Archive rewrite name :</th>';
|
72 |
+
$html .= '<td>events</td></tr>';
|
73 |
+
$html .= '<tr><th>schema.org Event :</th>';
|
74 |
+
$html .= '<td><a href="http://schema.org/Event" target="_blank">http://schema.org/Event</a></td></tr>';
|
75 |
+
$html .= '<tr><th>schema.org Place :</th>';
|
76 |
+
$html .= '<td><a href="http://schema.org/Place" target="_blank">http://schema.org/Place</a></td></tr>';
|
77 |
+
$html .= '<tr><th>schema.org Offer :</th>';
|
78 |
+
$html .= '<td><a href="http://schema.org/Offer" target="_blank">http://schema.org/Offer</a></td></tr>';
|
79 |
+
$html .= '<tr><th>Google Search Breadcrumb :</th>';
|
80 |
+
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/events" target="_blank">https://developers.google.com/search/docs/data-types/events</a></td></tr>';
|
81 |
+
$html .= '</table>';
|
82 |
+
echo $html;
|
83 |
+
|
84 |
+
submit_button();
|
85 |
+
}
|
86 |
}
|
includes/admin/wp-structuring-admin-type-local-business.php
CHANGED
@@ -1,538 +1,538 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Type LocalBusiness
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.6.0
|
7 |
-
* @since 2.3.3
|
8 |
-
* @see wp-structuring-admin-db.php
|
9 |
-
* @link http://schema.org/LocalBusiness
|
10 |
-
* @link https://schema.org/GeoCircle
|
11 |
-
* @link https://developers.google.com/search/docs/data-types/local-businesses
|
12 |
-
*/
|
13 |
-
class Structuring_Markup_Type_LocalBusiness {
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Variable definition.
|
17 |
-
*
|
18 |
-
* @version 4.6.0
|
19 |
-
* @since 2.3.0
|
20 |
-
*/
|
21 |
-
/** LocalBusiness Type defined. */
|
22 |
-
private $business_type_array = array(
|
23 |
-
array( 'type' => 'LocalBusiness', 'display' => 'LocalBusiness' ),
|
24 |
-
|
25 |
-
array( 'type' => 'AnimalShelter', 'display' => '- AnimalShelter' ),
|
26 |
-
|
27 |
-
array( 'type' => 'AutomotiveBusiness', 'display' => '- AutomotiveBusiness' ),
|
28 |
-
array( 'type' => 'AutoBodyShop', 'display' => '-- AutoBodyShop' ),
|
29 |
-
array( 'type' => 'AutoDealer', 'display' => '-- AutoDealer' ),
|
30 |
-
array( 'type' => 'AutoPartsStore', 'display' => '-- AutoPartsStore' ),
|
31 |
-
array( 'type' => 'AutoRental', 'display' => '-- AutoRental' ),
|
32 |
-
array( 'type' => 'AutoRepair', 'display' => '-- AutoRepair' ),
|
33 |
-
array( 'type' => 'AutoWash', 'display' => '-- AutoWash' ),
|
34 |
-
array( 'type' => 'GasStation', 'display' => '-- GasStation' ),
|
35 |
-
array( 'type' => 'MotorcycleDealer', 'display' => '-- MotorcycleDealer' ),
|
36 |
-
array( 'type' => 'MotorcycleRepair', 'display' => '-- MotorcycleRepair' ),
|
37 |
-
|
38 |
-
array( 'type' => 'ChildCare', 'display' => '- ChildCare' ),
|
39 |
-
|
40 |
-
array( 'type' => 'DryCleaningOrLaundry', 'display' => '- DryCleaningOrLaundry' ),
|
41 |
-
|
42 |
-
array( 'type' => 'EmergencyService', 'display' => '- EmergencyService' ),
|
43 |
-
array( 'type' => 'FireStation', 'display' => '-- FireStation' ),
|
44 |
-
array( 'type' => 'Hospital', 'display' => '-- Hospital' ),
|
45 |
-
array( 'type' => 'PoliceStation', 'display' => '-- PoliceStation' ),
|
46 |
-
|
47 |
-
array( 'type' => 'EmploymentAgency', 'display' => '- EmploymentAgency' ),
|
48 |
-
|
49 |
-
array( 'type' => 'EntertainmentBusiness', 'display' => '- EntertainmentBusiness' ),
|
50 |
-
array( 'type' => 'AdultEntertainment', 'display' => '-- AdultEntertainment' ),
|
51 |
-
array( 'type' => 'AmusementPark', 'display' => '-- AmusementPark' ),
|
52 |
-
array( 'type' => 'ArtGallery', 'display' => '-- ArtGallery' ),
|
53 |
-
array( 'type' => 'Casino', 'display' => '-- Casino' ),
|
54 |
-
array( 'type' => 'ComedyClub', 'display' => '-- ComedyClub' ),
|
55 |
-
array( 'type' => 'MovieTheater', 'display' => '-- MovieTheater' ),
|
56 |
-
array( 'type' => 'NightClub', 'display' => '-- NightClub' ),
|
57 |
-
|
58 |
-
array( 'type' => 'FinancialService', 'display' => '- FinancialService' ),
|
59 |
-
array( 'type' => 'AccountingService', 'display' => '-- AccountingService' ),
|
60 |
-
array( 'type' => 'AutomatedTeller', 'display' => '-- AutomatedTeller' ),
|
61 |
-
array( 'type' => 'BankOrCreditUnion', 'display' => '-- BankOrCreditUnion' ),
|
62 |
-
array( 'type' => 'InsuranceAgency', 'display' => '-- InsuranceAgency' ),
|
63 |
-
|
64 |
-
array( 'type' => 'FoodEstablishment', 'display' => '- FoodEstablishment' ),
|
65 |
-
array( 'type' => 'Bakery', 'display' => '-- Bakery' ),
|
66 |
-
array( 'type' => 'BarOrPub', 'display' => '-- BarOrPub' ),
|
67 |
-
array( 'type' => 'Brewery', 'display' => '-- Brewery' ),
|
68 |
-
array( 'type' => 'CafeOrCoffeeShop', 'display' => '-- CafeOrCoffeeShop' ),
|
69 |
-
array( 'type' => 'FastFoodRestaurant', 'display' => '-- FastFoodRestaurant' ),
|
70 |
-
array( 'type' => 'IceCreamShop', 'display' => '-- IceCreamShop' ),
|
71 |
-
array( 'type' => 'Restaurant', 'display' => '-- Restaurant' ),
|
72 |
-
array( 'type' => 'Winery', 'display' => '-- Winery' ),
|
73 |
-
|
74 |
-
array( 'type' => 'GovernmentOffice', 'display' => '- GovernmentOffice' ),
|
75 |
-
array( 'type' => 'PostOffice', 'display' => '-- PostOffice' ),
|
76 |
-
|
77 |
-
array( 'type' => 'HealthAndBeautyBusiness', 'display' => '- HealthAndBeautyBusiness' ),
|
78 |
-
array( 'type' => 'BeautySalon', 'display' => '-- BeautySalon' ),
|
79 |
-
array( 'type' => 'DaySpa', 'display' => '-- DaySpa' ),
|
80 |
-
array( 'type' => 'HairSalon', 'display' => '-- HairSalon' ),
|
81 |
-
array( 'type' => 'HealthClub', 'display' => '-- HealthClub' ),
|
82 |
-
array( 'type' => 'NailSalon', 'display' => '-- NailSalon' ),
|
83 |
-
array( 'type' => 'TattooParlor', 'display' => '-- TattooParlor' ),
|
84 |
-
|
85 |
-
array( 'type' => 'HomeAndConstructionBusiness', 'display' => '- HomeAndConstructionBusiness' ),
|
86 |
-
array( 'type' => 'Electrician', 'display' => '-- Electrician' ),
|
87 |
-
array( 'type' => 'GeneralContractor', 'display' => '-- GeneralContractor' ),
|
88 |
-
array( 'type' => 'HVACBusiness', 'display' => '-- HVACBusiness' ),
|
89 |
-
array( 'type' => 'HousePainter', 'display' => '-- HousePainter' ),
|
90 |
-
array( 'type' => 'Locksmith', 'display' => '-- Locksmith' ),
|
91 |
-
array( 'type' => 'MovingCompany', 'display' => '-- MovingCompany' ),
|
92 |
-
array( 'type' => 'Plumber', 'display' => '-- Plumber' ),
|
93 |
-
array( 'type' => 'RoofingContractor', 'display' => '-- RoofingContractor' ),
|
94 |
-
|
95 |
-
array( 'type' => 'InternetCafe', 'display' => '- InternetCafe' ),
|
96 |
-
|
97 |
-
array( 'type' => 'LegalService', 'display' => '- LegalService' ),
|
98 |
-
array( 'type' => 'Attorney', 'display' => '-- Attorney' ),
|
99 |
-
array( 'type' => 'Notary', 'display' => '-- Notary' ),
|
100 |
-
|
101 |
-
array( 'type' => 'Library', 'display' => '- Library' ),
|
102 |
-
|
103 |
-
array( 'type' => 'LodgingBusiness', 'display' => '- LodgingBusiness' ),
|
104 |
-
array( 'type' => 'BedAndBreakfast', 'display' => '-- BedAndBreakfast' ),
|
105 |
-
array( 'type' => 'Hostel', 'display' => '-- Hostel' ),
|
106 |
-
array( 'type' => 'Hotel', 'display' => '-- Hotel' ),
|
107 |
-
array( 'type' => 'Motel', 'display' => '-- Motel' ),
|
108 |
-
|
109 |
-
array( 'type' => 'MedicalOrganization', 'display' => '- MedicalOrganization' ),
|
110 |
-
array( 'type' => 'Dentist', 'display' => '-- Dentist' ),
|
111 |
-
array( 'type' => 'DiagnosticLab', 'display' => '-- DiagnosticLab' ),
|
112 |
-
array( 'type' => 'Hospital', 'display' => '-- Hospital' ),
|
113 |
-
array( 'type' => 'MedicalClinic', 'display' => '-- MedicalClinic' ),
|
114 |
-
array( 'type' => 'Optician', 'display' => '-- Optician' ),
|
115 |
-
array( 'type' => 'Pharmacy', 'display' => '-- Pharmacy' ),
|
116 |
-
array( 'type' => 'Physician', 'display' => '-- Physician' ),
|
117 |
-
array( 'type' => 'VeterinaryCare', 'display' => '-- VeterinaryCare' ),
|
118 |
-
|
119 |
-
array( 'type' => 'ProfessionalService', 'display' => '- ProfessionalService' ),
|
120 |
-
|
121 |
-
array( 'type' => 'RadioStation', 'display' => '- RadioStation' ),
|
122 |
-
|
123 |
-
array( 'type' => 'RealEstateAgent', 'display' => '- RealEstateAgent' ),
|
124 |
-
|
125 |
-
array( 'type' => 'RecyclingCenter', 'display' => '- RecyclingCenter' ),
|
126 |
-
|
127 |
-
array( 'type' => 'SelfStorage', 'display' => '- SelfStorage' ),
|
128 |
-
|
129 |
-
array( 'type' => 'ShoppingCenter', 'display' => '- ShoppingCenter' ),
|
130 |
-
|
131 |
-
array( 'type' => 'SportsActivityLocation', 'display' => '- SportsActivityLocation' ),
|
132 |
-
array( 'type' => 'BowlingAlley', 'display' => '-- BowlingAlley' ),
|
133 |
-
array( 'type' => 'ExerciseGym', 'display' => '-- ExerciseGym' ),
|
134 |
-
array( 'type' => 'GolfCourse', 'display' => '-- GolfCourse' ),
|
135 |
-
array( 'type' => 'HealthClub', 'display' => '-- HealthClub' ),
|
136 |
-
array( 'type' => 'PublicSwimmingPool', 'display' => '-- PublicSwimmingPool' ),
|
137 |
-
array( 'type' => 'SkiResort', 'display' => '-- SkiResort' ),
|
138 |
-
array( 'type' => 'SportsClub', 'display' => '-- SportsClub' ),
|
139 |
-
array( 'type' => 'StadiumOrArena', 'display' => '-- StadiumOrArena' ),
|
140 |
-
array( 'type' => 'TennisComplex', 'display' => '-- TennisComplex' ),
|
141 |
-
|
142 |
-
array( 'type' => 'Store', 'display' => '- Store' ),
|
143 |
-
array( 'type' => 'AutoPartsStore', 'display' => '-- AutoPartsStore' ),
|
144 |
-
array( 'type' => 'BikeStore', 'display' => '-- BikeStore' ),
|
145 |
-
array( 'type' => 'BookStore', 'display' => '-- BookStore' ),
|
146 |
-
array( 'type' => 'ClothingStore', 'display' => '-- ClothingStore' ),
|
147 |
-
array( 'type' => 'ComputerStore', 'display' => '-- ComputerStore' ),
|
148 |
-
array( 'type' => 'ConvenienceStore', 'display' => '-- ConvenienceStore' ),
|
149 |
-
array( 'type' => 'DepartmentStore', 'display' => '-- DepartmentStore' ),
|
150 |
-
array( 'type' => 'ElectronicsStore', 'display' => '-- ElectronicsStore' ),
|
151 |
-
array( 'type' => 'Florist', 'display' => '-- Florist' ),
|
152 |
-
array( 'type' => 'FurnitureStore', 'display' => '-- FurnitureStore' ),
|
153 |
-
array( 'type' => 'GardenStore', 'display' => '-- GardenStore' ),
|
154 |
-
array( 'type' => 'GroceryStore', 'display' => '-- GroceryStore' ),
|
155 |
-
array( 'type' => 'HardwareStore', 'display' => '-- HardwareStore' ),
|
156 |
-
array( 'type' => 'HobbyShop', 'display' => '-- HobbyShop' ),
|
157 |
-
array( 'type' => 'HomeGoodsStore', 'display' => '-- HomeGoodsStore' ),
|
158 |
-
array( 'type' => 'JewelryStore', 'display' => '-- JewelryStore' ),
|
159 |
-
array( 'type' => 'LiquorStore', 'display' => '-- LiquorStore' ),
|
160 |
-
array( 'type' => 'MensClothingStore', 'display' => '-- MensClothingStore' ),
|
161 |
-
array( 'type' => 'MobilePhoneStore', 'display' => '-- MobilePhoneStore' ),
|
162 |
-
array( 'type' => 'MovieRentalStore', 'display' => '-- MovieRentalStore' ),
|
163 |
-
array( 'type' => 'MusicStore', 'display' => '-- MusicStore' ),
|
164 |
-
array( 'type' => 'OfficeEquipmentStore', 'display' => '-- OfficeEquipmentStore' ),
|
165 |
-
array( 'type' => 'OutletStore', 'display' => '-- OutletStore' ),
|
166 |
-
array( 'type' => 'PawnShop', 'display' => '-- PawnShop' ),
|
167 |
-
array( 'type' => 'PetStore', 'display' => '-- PetStore' ),
|
168 |
-
array( 'type' => 'ShoeStore', 'display' => '-- ShoeStore' ),
|
169 |
-
array( 'type' => 'SportingGoodsStore', 'display' => '-- SportingGoodsStore' ),
|
170 |
-
array( 'type' => 'TireShop', 'display' => '-- TireShop' ),
|
171 |
-
array( 'type' => 'ToyStore', 'display' => '-- ToyStore' ),
|
172 |
-
array( 'type' => 'WholesaleStore', 'display' => '-- WholesaleStore' ),
|
173 |
-
|
174 |
-
array( 'type' => 'TelevisionStation', 'display' => '- TelevisionStation' ),
|
175 |
-
|
176 |
-
array( 'type' => 'TouristInformationCenter', 'display' => '- TouristInformationCenter' ),
|
177 |
-
|
178 |
-
array( 'type' => 'TravelAgency', 'display' => '- TravelAgency' )
|
179 |
-
);
|
180 |
-
|
181 |
-
/** weekType defined. */
|
182 |
-
private $week_array = array(
|
183 |
-
array('type' => 'Mo', 'display' => 'Monday'),
|
184 |
-
array('type' => 'Tu', 'display' => 'Tuesday'),
|
185 |
-
array('type' => 'We', 'display' => 'Wednesday'),
|
186 |
-
array('type' => 'Th', 'display' => 'Thursday'),
|
187 |
-
array('type' => 'Fr', 'display' => 'Friday'),
|
188 |
-
array('type' => 'Sa', 'display' => 'Saturday'),
|
189 |
-
array('type' => 'Su', 'display' => 'Sunday')
|
190 |
-
);
|
191 |
-
|
192 |
-
/**
|
193 |
-
* Constructor Define.
|
194 |
-
*
|
195 |
-
* @version 3.1.4
|
196 |
-
* @since 2.3.0
|
197 |
-
* @param array $option
|
198 |
-
*/
|
199 |
-
public function __construct ( array $option ) {
|
200 |
-
/** Default Value Set */
|
201 |
-
$option_array = $this->get_default_options();
|
202 |
-
|
203 |
-
if ( !empty( $option ) ) {
|
204 |
-
$option_array = array_merge( $option_array, $option );
|
205 |
-
}
|
206 |
-
|
207 |
-
$this->page_render( $option_array );
|
208 |
-
}
|
209 |
-
|
210 |
-
/**
|
211 |
-
* Form Layout Render
|
212 |
-
*
|
213 |
-
* @version 4.5.3
|
214 |
-
* @since 2.3.3
|
215 |
-
* @param array $option
|
216 |
-
*/
|
217 |
-
private function page_render ( array $option ) {
|
218 |
-
/** Local Business Type */
|
219 |
-
$html = '<table class="schema-admin-table">';
|
220 |
-
$html .= '<caption>Local Business</caption>';
|
221 |
-
$html .= $this->set_form_select( 'business_type', 'Local Business Type', $option['business_type'] );
|
222 |
-
$html .= $this->set_form_text( 'image', 'An image of the business', $option['image'], true );
|
223 |
-
$html .= $this->set_form_text( 'name', 'Business Name', $option['name'], true );
|
224 |
-
$html .= $this->set_form_text( 'url', 'Url', $option['url'], true );
|
225 |
-
$html .= $this->set_form_text( 'telephone', 'Telephone', $option['telephone'], false, 'e.g. : +1-880-555-1212' );
|
226 |
-
$html .= '</table>';
|
227 |
-
echo $html;
|
228 |
-
|
229 |
-
/** For food establishments */
|
230 |
-
$html = '<table class="schema-admin-table">';
|
231 |
-
$html .= '<caption>For food establishments</caption>';
|
232 |
-
$html .= $this->set_form_checkbox( 'food_active', 'Setting', $option['food_active'], 'Enabled' );
|
233 |
-
$html .= $this->set_form_text( 'menu', 'Menu url', $option['menu'], false, 'For food establishments, the fully-qualified URL of the menu.' );
|
234 |
-
$html .= $this->set_form_checkbox( 'accepts_reservations', 'Accepts Reservations', $option['accepts_reservations'], 'For food establishments, and whether it is possible to accept a reservation?' );
|
235 |
-
$html .= $this->set_form_text( 'serves_cuisine', 'Serves Cuisine', $option['serves_cuisine'], false, 'If marking up a restaurant, provide the type of cuisine they serve.' );
|
236 |
-
$html .= '</table>';
|
237 |
-
echo $html;
|
238 |
-
|
239 |
-
/** Postal Address */
|
240 |
-
$html = '<table class="schema-admin-table">';
|
241 |
-
$html .= '<caption>Postal Address</caption>';
|
242 |
-
$html .= $this->set_form_text( 'street_address', 'Street Address', $option['street_address'], true );
|
243 |
-
$html .= $this->set_form_text( 'address_locality', 'Address Locality', $option['address_locality'], true );
|
244 |
-
$html .= $this->set_form_text( 'address_region', 'Address Region', $option['address_region'], false );
|
245 |
-
$html .= $this->set_form_text( 'postal_code', 'Postal Code', $option['postal_code'], true );
|
246 |
-
$html .= $this->set_form_text( 'address_country', 'Address Country', $option['address_country'], true, '<a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2" target="_blank">The 2-letter ISO 3166-1 alpha-2 country code.</a>' );
|
247 |
-
$html .= '</table>';
|
248 |
-
echo $html;
|
249 |
-
|
250 |
-
/** Geo Circle */
|
251 |
-
$html = '<table class="schema-admin-table">';
|
252 |
-
$html .= '<caption>Geo Circle</caption>';
|
253 |
-
$html .= $this->set_form_checkbox( 'geo_circle_active', 'Setting', $option['geo_circle_active'], 'Enabled' );
|
254 |
-
$html .= $this->set_form_text( 'geo_circle_radius', 'geoRadius', $option['geo_circle_radius'], false );
|
255 |
-
$html .= '</table>';
|
256 |
-
echo $html;
|
257 |
-
|
258 |
-
/** Geo Coordinates */
|
259 |
-
$html = '<table class="schema-admin-table">';
|
260 |
-
$html .= '<caption>Geo Coordinates</caption>';
|
261 |
-
$html .= $this->set_form_checkbox( 'geo_active', 'Setting', $option['geo_active'], 'Enabled' );
|
262 |
-
$html .= $this->set_form_text( 'latitude', 'Latitude', $option['latitude'], false );
|
263 |
-
$html .= $this->set_form_text( 'longitude', 'Longitude', $option['longitude'], false );
|
264 |
-
$html .= '</table>';
|
265 |
-
echo $html;
|
266 |
-
|
267 |
-
/** Opening Hours Specification */
|
268 |
-
$html = '<table class="schema-admin-table">';
|
269 |
-
$html .= '<caption>Opening Hours Specification</caption>';
|
270 |
-
|
271 |
-
$i = 0;
|
272 |
-
|
273 |
-
foreach ( $this->week_array as $value ) {
|
274 |
-
if ( !isset( $option[$value['type']] ) ) {
|
275 |
-
$option[$value['type']] = "";
|
276 |
-
}
|
277 |
-
|
278 |
-
$html .= $this->set_form_checkbox( $value['type'], $value['display'], $option[$value['type']], 'Enabled' );
|
279 |
-
|
280 |
-
if ( isset( $option['week'][$value['type']] ) ) {
|
281 |
-
foreach ( $option['week'][$value['type']] as $type ) {
|
282 |
-
if ( !empty( $type['open'] ) ) {
|
283 |
-
$html .= $this->set_form_time( $value['type'], '', $type['open'], $type['close'], '', $i );
|
284 |
-
$i++;
|
285 |
-
} else {
|
286 |
-
$html .= $this->set_form_time( $value['type'], '', '', '', '', 0 );
|
287 |
-
break;
|
288 |
-
}
|
289 |
-
}
|
290 |
-
} else {
|
291 |
-
$html .= $this->set_form_time( $value['type'], '', '', '', '', 0 );
|
292 |
-
}
|
293 |
-
|
294 |
-
$i = 0;
|
295 |
-
}
|
296 |
-
|
297 |
-
$html .= '</table>';
|
298 |
-
echo $html;
|
299 |
-
|
300 |
-
/** Holiday Opening Hours */
|
301 |
-
$html = '<table class="schema-admin-table">';
|
302 |
-
$html .= '<caption>Holiday Opening Hours</caption>';
|
303 |
-
$html .= $this->set_form_checkbox( 'holiday_active', 'Setting', $option['holiday_active'], 'Enabled' );
|
304 |
-
$html .= $this->set_form_time_holiday( $option['holiday_open'], $option['holiday_close'] );
|
305 |
-
$html .= $this->set_form_date( 'holiday_valid_from', 'validFrom', $option['holiday_valid_from'], false );
|
306 |
-
$html .= $this->set_form_date( 'holiday_valid_through', 'validThrough', $option['holiday_valid_through'], false );
|
307 |
-
|
308 |
-
$html .= '</table>';
|
309 |
-
echo $html;
|
310 |
-
|
311 |
-
/** Price Range */
|
312 |
-
$html = '<table class="schema-admin-table">';
|
313 |
-
$html .= '<caption>Price Range</caption>';
|
314 |
-
$html .= $this->set_form_text( 'price_range', 'Price Range', $option['price_range'], false, 'The price range of the business, for example $$$.' );
|
315 |
-
$html .= '</table>';
|
316 |
-
echo $html;
|
317 |
-
|
318 |
-
$html = '<table class="schema-admin-table">';
|
319 |
-
$html .= '<caption>Setting Knowledge</caption>';
|
320 |
-
$html .= '<tr><th>schema.org LocalBusiness :</th>';
|
321 |
-
$html .= '<td><a href="http://schema.org/LocalBusiness" target="_blank">http://schema.org/LocalBusiness</a></td></tr>';
|
322 |
-
$html .= '<tr><th>schema.org GeoCircle :</th>';
|
323 |
-
$html .= '<td><a href="https://schema.org/GeoCircle" target="_blank">https://schema.org/GeoCircle</a></td></tr>';
|
324 |
-
$html .= '<tr><th>Google Search LocalBusiness :</th>';
|
325 |
-
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/local-businesses" target="_blank">https://developers.google.com/search/docs/data-types/local-businesses</a></td></tr>';
|
326 |
-
$html .= '</table>';
|
327 |
-
echo $html;
|
328 |
-
|
329 |
-
submit_button();
|
330 |
-
}
|
331 |
-
|
332 |
-
/**
|
333 |
-
* Return the default options array
|
334 |
-
*
|
335 |
-
* @since 4.6.0
|
336 |
-
* @version 2.5.0
|
337 |
-
* @return array $args
|
338 |
-
*/
|
339 |
-
private function get_default_options () {
|
340 |
-
$args['business_type'] = 'LocalBusiness';
|
341 |
-
$args['name'] = '';
|
342 |
-
$args['image'] = '';
|
343 |
-
$args['url'] = '';
|
344 |
-
$args['telephone'] = '';
|
345 |
-
$args['food_active'] = '';
|
346 |
-
$args['menu'] = '';
|
347 |
-
$args['accepts_reservations'] = '';
|
348 |
-
$args['serves_cuisine'] = '';
|
349 |
-
$args['street_address'] = '';
|
350 |
-
$args['address_locality'] = '';
|
351 |
-
$args['address_region'] = '';
|
352 |
-
$args['postal_code'] = '';
|
353 |
-
$args['address_country'] = '';
|
354 |
-
$args['geo_circle_active'] = '';
|
355 |
-
$args['geo_circle_radius'] = '';
|
356 |
-
$args['geo_active'] = '';
|
357 |
-
$args['latitude'] = '';
|
358 |
-
$args['longitude'] = '';
|
359 |
-
$args['opening_active'] = '';
|
360 |
-
|
361 |
-
foreach ( $this->week_array as $value ) {
|
362 |
-
$args[$value['type']] = '';
|
363 |
-
$args['week'][$value['type']]['open'] = '';
|
364 |
-
$args['week'][$value['type']]['close'] = '';
|
365 |
-
}
|
366 |
-
|
367 |
-
$args['holiday_active'] = '';
|
368 |
-
$args['holiday_open'] = '';
|
369 |
-
$args['holiday_close'] = '';
|
370 |
-
$args['holiday_valid_from'] = '';
|
371 |
-
$args['holiday_valid_through'] = '';
|
372 |
-
$args['price_range'] = '';
|
373 |
-
|
374 |
-
return (array) $args;
|
375 |
-
}
|
376 |
-
|
377 |
-
/**
|
378 |
-
* Return the form text
|
379 |
-
*
|
380 |
-
* @version 4.1.3
|
381 |
-
* @since 2.3.0
|
382 |
-
* @param string $id
|
383 |
-
* @param string $display
|
384 |
-
* @param string $value
|
385 |
-
* @param boolean $required
|
386 |
-
* @param string $note
|
387 |
-
* @return string $html
|
388 |
-
*/
|
389 |
-
private function set_form_text ( $id, $display, $value = "", $required = false, $note = "" ) {
|
390 |
-
$value = esc_attr( $value );
|
391 |
-
|
392 |
-
if ( $required ) {
|
393 |
-
$format = '<tr><th class="require"><label for=%s>%s :</label></th><td>';
|
394 |
-
} else {
|
395 |
-
$format = '<tr><th><label for=%s>%s :</label></th><td>';
|
396 |
-
}
|
397 |
-
|
398 |
-
$format .= '<input type="text" name="option[%s]" id="%s" class="regular-text" value="%s"';
|
399 |
-
|
400 |
-
if ( $required ) {
|
401 |
-
$format .= ' required';
|
402 |
-
}
|
403 |
-
if ( $note === "" ) {
|
404 |
-
$format .= '></td></tr>';
|
405 |
-
} else {
|
406 |
-
$format .= '><small>%s</small></td></tr>';
|
407 |
-
}
|
408 |
-
|
409 |
-
return (string) sprintf( $format, $id, $display, $id, $id, $value, $note );
|
410 |
-
}
|
411 |
-
|
412 |
-
/**
|
413 |
-
* Return the form date
|
414 |
-
*
|
415 |
-
* @since 3.0.5
|
416 |
-
* @version 2.5.0
|
417 |
-
* @param string $id
|
418 |
-
* @param string $display
|
419 |
-
* @param string $value
|
420 |
-
* @param boolean $required
|
421 |
-
* @param string $note
|
422 |
-
* @return string $html
|
423 |
-
*/
|
424 |
-
private function set_form_date ( $id, $display, $value = "", $required = false, $note = "" ) {
|
425 |
-
$value = esc_attr( $value );
|
426 |
-
|
427 |
-
$format = '<tr><th><label for=%s>%s :</label></th><td>';
|
428 |
-
$format .= '<input type="date" name="option[%s]" id="%s" value="%s"';
|
429 |
-
if ( $required ) {
|
430 |
-
$format .= ' required';
|
431 |
-
}
|
432 |
-
$format .= '><small>%s</small></td></tr>';
|
433 |
-
|
434 |
-
return (string) sprintf( $format, $id, $display, $id, $id, $value, $note );
|
435 |
-
}
|
436 |
-
|
437 |
-
/**
|
438 |
-
* Return the form checkbox
|
439 |
-
*
|
440 |
-
* @version 3.0.5
|
441 |
-
* @since 2.3.0
|
442 |
-
* @param string $id
|
443 |
-
* @param string $display
|
444 |
-
* @param string $value
|
445 |
-
* @param string $note
|
446 |
-
* @return string $html
|
447 |
-
*/
|
448 |
-
private function set_form_checkbox ( $id, $display, $value = "", $note = "" ) {
|
449 |
-
$value = esc_attr( $value );
|
450 |
-
|
451 |
-
$format = '<tr><th><label for=%s>%s :</label></th><td>';
|
452 |
-
$format .= '<input type="checkbox" name="option[%s]" id="%s" value="on"';
|
453 |
-
if ( $value === 'on' ) {
|
454 |
-
$format .= ' checked="checked"';
|
455 |
-
}
|
456 |
-
$format .= '>%s</td></tr>';
|
457 |
-
|
458 |
-
return (string) sprintf( $format, $id, $display, $id, $id, $note );
|
459 |
-
}
|
460 |
-
|
461 |
-
/**
|
462 |
-
* Return the form select
|
463 |
-
*
|
464 |
-
* @since 2.3.0
|
465 |
-
* @param string $id
|
466 |
-
* @param string $display
|
467 |
-
* @param string $value
|
468 |
-
* @param string $note
|
469 |
-
* @return string $html
|
470 |
-
*/
|
471 |
-
private function set_form_select ( $id, $display, $value = "", $note = "" ) {
|
472 |
-
$value = esc_attr( $value );
|
473 |
-
|
474 |
-
$format = '<tr><th class="require"><label for=%s>%s :</label></th><td>';
|
475 |
-
$format .= '<select id="%s" name="option[%s]">';
|
476 |
-
foreach ( $this->business_type_array as $args ) {
|
477 |
-
$format .= '<option value="' . $args['type'] . '"';
|
478 |
-
if ( $args['type'] === $value ) {
|
479 |
-
$format .= ' selected';
|
480 |
-
}
|
481 |
-
$format .= '>' . $args['display'] . '</option>';
|
482 |
-
}
|
483 |
-
$format .= '</select>';
|
484 |
-
$format .= '<small>%s</small></td></tr>';
|
485 |
-
|
486 |
-
return (string) sprintf( $format, $id, $display, $id, $id, $note );
|
487 |
-
}
|
488 |
-
|
489 |
-
/**
|
490 |
-
* Return the form time
|
491 |
-
*
|
492 |
-
* @version 3.0.5
|
493 |
-
* @since 2.3.0
|
494 |
-
* @param string $id
|
495 |
-
* @param string $display
|
496 |
-
* @param string $value1
|
497 |
-
* @param string $value2
|
498 |
-
* @param string $note
|
499 |
-
* @param int $count
|
500 |
-
* @return string $html
|
501 |
-
*/
|
502 |
-
private function set_form_time ( $id, $display, $value1 = "", $value2 = "", $note = "", $count = 0 ) {
|
503 |
-
$value1 = esc_attr( $value1 );
|
504 |
-
$value2 = esc_attr( $value2 );
|
505 |
-
|
506 |
-
$format = '<tr class="opening-hours %s"><th><label for=%s>%s :</label></th><td>';
|
507 |
-
$format .= 'Open Time : <input type="time" name="option[week][%s][%d][open]" id="%s-open" value="%s">';
|
508 |
-
$format .= ' Close Time : <input type="time" name="option[week][%s][%d][close]" id="%s-close" value="%s">';
|
509 |
-
$format .= '%s<a class="dashicons dashicons-plus markup-time plus"></a>';
|
510 |
-
if( $count !== 0 ) {
|
511 |
-
$format .= '<a class="dashicons dashicons-minus markup-time minus"></a>';
|
512 |
-
}
|
513 |
-
$format .= '</td></tr>';
|
514 |
-
|
515 |
-
return (string) sprintf( $format, $id, $id, $display, $id, $count, $id, $value1, $id, $count, $id, $value2, $note );
|
516 |
-
}
|
517 |
-
|
518 |
-
/**
|
519 |
-
* Return the form time (Holiday)
|
520 |
-
*
|
521 |
-
* @since 2.5.0
|
522 |
-
* @version 2.5.0
|
523 |
-
* @param string $value1
|
524 |
-
* @param string $value2
|
525 |
-
* @return string $html
|
526 |
-
*/
|
527 |
-
private function set_form_time_holiday ( $value1 = "", $value2 = "" ) {
|
528 |
-
$value1 = esc_attr( $value1 );
|
529 |
-
$value2 = esc_attr( $value2 );
|
530 |
-
|
531 |
-
$format = '<tr><th>Holiday Time :</th><td>';
|
532 |
-
$format .= 'Open Time : <input type="time" name="option[holiday_open]" value="%s">';
|
533 |
-
$format .= 'Close Time : <input type="time" name="option[holiday_close]" value="%s">';
|
534 |
-
$format .= '</td></tr>';
|
535 |
-
|
536 |
-
return (string) sprintf( $format, $value1, $value2 );
|
537 |
-
}
|
538 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type LocalBusiness
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.6.0
|
7 |
+
* @since 2.3.3
|
8 |
+
* @see wp-structuring-admin-db.php
|
9 |
+
* @link http://schema.org/LocalBusiness
|
10 |
+
* @link https://schema.org/GeoCircle
|
11 |
+
* @link https://developers.google.com/search/docs/data-types/local-businesses
|
12 |
+
*/
|
13 |
+
class Structuring_Markup_Type_LocalBusiness {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Variable definition.
|
17 |
+
*
|
18 |
+
* @version 4.6.0
|
19 |
+
* @since 2.3.0
|
20 |
+
*/
|
21 |
+
/** LocalBusiness Type defined. */
|
22 |
+
private $business_type_array = array(
|
23 |
+
array( 'type' => 'LocalBusiness', 'display' => 'LocalBusiness' ),
|
24 |
+
|
25 |
+
array( 'type' => 'AnimalShelter', 'display' => '- AnimalShelter' ),
|
26 |
+
|
27 |
+
array( 'type' => 'AutomotiveBusiness', 'display' => '- AutomotiveBusiness' ),
|
28 |
+
array( 'type' => 'AutoBodyShop', 'display' => '-- AutoBodyShop' ),
|
29 |
+
array( 'type' => 'AutoDealer', 'display' => '-- AutoDealer' ),
|
30 |
+
array( 'type' => 'AutoPartsStore', 'display' => '-- AutoPartsStore' ),
|
31 |
+
array( 'type' => 'AutoRental', 'display' => '-- AutoRental' ),
|
32 |
+
array( 'type' => 'AutoRepair', 'display' => '-- AutoRepair' ),
|
33 |
+
array( 'type' => 'AutoWash', 'display' => '-- AutoWash' ),
|
34 |
+
array( 'type' => 'GasStation', 'display' => '-- GasStation' ),
|
35 |
+
array( 'type' => 'MotorcycleDealer', 'display' => '-- MotorcycleDealer' ),
|
36 |
+
array( 'type' => 'MotorcycleRepair', 'display' => '-- MotorcycleRepair' ),
|
37 |
+
|
38 |
+
array( 'type' => 'ChildCare', 'display' => '- ChildCare' ),
|
39 |
+
|
40 |
+
array( 'type' => 'DryCleaningOrLaundry', 'display' => '- DryCleaningOrLaundry' ),
|
41 |
+
|
42 |
+
array( 'type' => 'EmergencyService', 'display' => '- EmergencyService' ),
|
43 |
+
array( 'type' => 'FireStation', 'display' => '-- FireStation' ),
|
44 |
+
array( 'type' => 'Hospital', 'display' => '-- Hospital' ),
|
45 |
+
array( 'type' => 'PoliceStation', 'display' => '-- PoliceStation' ),
|
46 |
+
|
47 |
+
array( 'type' => 'EmploymentAgency', 'display' => '- EmploymentAgency' ),
|
48 |
+
|
49 |
+
array( 'type' => 'EntertainmentBusiness', 'display' => '- EntertainmentBusiness' ),
|
50 |
+
array( 'type' => 'AdultEntertainment', 'display' => '-- AdultEntertainment' ),
|
51 |
+
array( 'type' => 'AmusementPark', 'display' => '-- AmusementPark' ),
|
52 |
+
array( 'type' => 'ArtGallery', 'display' => '-- ArtGallery' ),
|
53 |
+
array( 'type' => 'Casino', 'display' => '-- Casino' ),
|
54 |
+
array( 'type' => 'ComedyClub', 'display' => '-- ComedyClub' ),
|
55 |
+
array( 'type' => 'MovieTheater', 'display' => '-- MovieTheater' ),
|
56 |
+
array( 'type' => 'NightClub', 'display' => '-- NightClub' ),
|
57 |
+
|
58 |
+
array( 'type' => 'FinancialService', 'display' => '- FinancialService' ),
|
59 |
+
array( 'type' => 'AccountingService', 'display' => '-- AccountingService' ),
|
60 |
+
array( 'type' => 'AutomatedTeller', 'display' => '-- AutomatedTeller' ),
|
61 |
+
array( 'type' => 'BankOrCreditUnion', 'display' => '-- BankOrCreditUnion' ),
|
62 |
+
array( 'type' => 'InsuranceAgency', 'display' => '-- InsuranceAgency' ),
|
63 |
+
|
64 |
+
array( 'type' => 'FoodEstablishment', 'display' => '- FoodEstablishment' ),
|
65 |
+
array( 'type' => 'Bakery', 'display' => '-- Bakery' ),
|
66 |
+
array( 'type' => 'BarOrPub', 'display' => '-- BarOrPub' ),
|
67 |
+
array( 'type' => 'Brewery', 'display' => '-- Brewery' ),
|
68 |
+
array( 'type' => 'CafeOrCoffeeShop', 'display' => '-- CafeOrCoffeeShop' ),
|
69 |
+
array( 'type' => 'FastFoodRestaurant', 'display' => '-- FastFoodRestaurant' ),
|
70 |
+
array( 'type' => 'IceCreamShop', 'display' => '-- IceCreamShop' ),
|
71 |
+
array( 'type' => 'Restaurant', 'display' => '-- Restaurant' ),
|
72 |
+
array( 'type' => 'Winery', 'display' => '-- Winery' ),
|
73 |
+
|
74 |
+
array( 'type' => 'GovernmentOffice', 'display' => '- GovernmentOffice' ),
|
75 |
+
array( 'type' => 'PostOffice', 'display' => '-- PostOffice' ),
|
76 |
+
|
77 |
+
array( 'type' => 'HealthAndBeautyBusiness', 'display' => '- HealthAndBeautyBusiness' ),
|
78 |
+
array( 'type' => 'BeautySalon', 'display' => '-- BeautySalon' ),
|
79 |
+
array( 'type' => 'DaySpa', 'display' => '-- DaySpa' ),
|
80 |
+
array( 'type' => 'HairSalon', 'display' => '-- HairSalon' ),
|
81 |
+
array( 'type' => 'HealthClub', 'display' => '-- HealthClub' ),
|
82 |
+
array( 'type' => 'NailSalon', 'display' => '-- NailSalon' ),
|
83 |
+
array( 'type' => 'TattooParlor', 'display' => '-- TattooParlor' ),
|
84 |
+
|
85 |
+
array( 'type' => 'HomeAndConstructionBusiness', 'display' => '- HomeAndConstructionBusiness' ),
|
86 |
+
array( 'type' => 'Electrician', 'display' => '-- Electrician' ),
|
87 |
+
array( 'type' => 'GeneralContractor', 'display' => '-- GeneralContractor' ),
|
88 |
+
array( 'type' => 'HVACBusiness', 'display' => '-- HVACBusiness' ),
|
89 |
+
array( 'type' => 'HousePainter', 'display' => '-- HousePainter' ),
|
90 |
+
array( 'type' => 'Locksmith', 'display' => '-- Locksmith' ),
|
91 |
+
array( 'type' => 'MovingCompany', 'display' => '-- MovingCompany' ),
|
92 |
+
array( 'type' => 'Plumber', 'display' => '-- Plumber' ),
|
93 |
+
array( 'type' => 'RoofingContractor', 'display' => '-- RoofingContractor' ),
|
94 |
+
|
95 |
+
array( 'type' => 'InternetCafe', 'display' => '- InternetCafe' ),
|
96 |
+
|
97 |
+
array( 'type' => 'LegalService', 'display' => '- LegalService' ),
|
98 |
+
array( 'type' => 'Attorney', 'display' => '-- Attorney' ),
|
99 |
+
array( 'type' => 'Notary', 'display' => '-- Notary' ),
|
100 |
+
|
101 |
+
array( 'type' => 'Library', 'display' => '- Library' ),
|
102 |
+
|
103 |
+
array( 'type' => 'LodgingBusiness', 'display' => '- LodgingBusiness' ),
|
104 |
+
array( 'type' => 'BedAndBreakfast', 'display' => '-- BedAndBreakfast' ),
|
105 |
+
array( 'type' => 'Hostel', 'display' => '-- Hostel' ),
|
106 |
+
array( 'type' => 'Hotel', 'display' => '-- Hotel' ),
|
107 |
+
array( 'type' => 'Motel', 'display' => '-- Motel' ),
|
108 |
+
|
109 |
+
array( 'type' => 'MedicalOrganization', 'display' => '- MedicalOrganization' ),
|
110 |
+
array( 'type' => 'Dentist', 'display' => '-- Dentist' ),
|
111 |
+
array( 'type' => 'DiagnosticLab', 'display' => '-- DiagnosticLab' ),
|
112 |
+
array( 'type' => 'Hospital', 'display' => '-- Hospital' ),
|
113 |
+
array( 'type' => 'MedicalClinic', 'display' => '-- MedicalClinic' ),
|
114 |
+
array( 'type' => 'Optician', 'display' => '-- Optician' ),
|
115 |
+
array( 'type' => 'Pharmacy', 'display' => '-- Pharmacy' ),
|
116 |
+
array( 'type' => 'Physician', 'display' => '-- Physician' ),
|
117 |
+
array( 'type' => 'VeterinaryCare', 'display' => '-- VeterinaryCare' ),
|
118 |
+
|
119 |
+
array( 'type' => 'ProfessionalService', 'display' => '- ProfessionalService' ),
|
120 |
+
|
121 |
+
array( 'type' => 'RadioStation', 'display' => '- RadioStation' ),
|
122 |
+
|
123 |
+
array( 'type' => 'RealEstateAgent', 'display' => '- RealEstateAgent' ),
|
124 |
+
|
125 |
+
array( 'type' => 'RecyclingCenter', 'display' => '- RecyclingCenter' ),
|
126 |
+
|
127 |
+
array( 'type' => 'SelfStorage', 'display' => '- SelfStorage' ),
|
128 |
+
|
129 |
+
array( 'type' => 'ShoppingCenter', 'display' => '- ShoppingCenter' ),
|
130 |
+
|
131 |
+
array( 'type' => 'SportsActivityLocation', 'display' => '- SportsActivityLocation' ),
|
132 |
+
array( 'type' => 'BowlingAlley', 'display' => '-- BowlingAlley' ),
|
133 |
+
array( 'type' => 'ExerciseGym', 'display' => '-- ExerciseGym' ),
|
134 |
+
array( 'type' => 'GolfCourse', 'display' => '-- GolfCourse' ),
|
135 |
+
array( 'type' => 'HealthClub', 'display' => '-- HealthClub' ),
|
136 |
+
array( 'type' => 'PublicSwimmingPool', 'display' => '-- PublicSwimmingPool' ),
|
137 |
+
array( 'type' => 'SkiResort', 'display' => '-- SkiResort' ),
|
138 |
+
array( 'type' => 'SportsClub', 'display' => '-- SportsClub' ),
|
139 |
+
array( 'type' => 'StadiumOrArena', 'display' => '-- StadiumOrArena' ),
|
140 |
+
array( 'type' => 'TennisComplex', 'display' => '-- TennisComplex' ),
|
141 |
+
|
142 |
+
array( 'type' => 'Store', 'display' => '- Store' ),
|
143 |
+
array( 'type' => 'AutoPartsStore', 'display' => '-- AutoPartsStore' ),
|
144 |
+
array( 'type' => 'BikeStore', 'display' => '-- BikeStore' ),
|
145 |
+
array( 'type' => 'BookStore', 'display' => '-- BookStore' ),
|
146 |
+
array( 'type' => 'ClothingStore', 'display' => '-- ClothingStore' ),
|
147 |
+
array( 'type' => 'ComputerStore', 'display' => '-- ComputerStore' ),
|
148 |
+
array( 'type' => 'ConvenienceStore', 'display' => '-- ConvenienceStore' ),
|
149 |
+
array( 'type' => 'DepartmentStore', 'display' => '-- DepartmentStore' ),
|
150 |
+
array( 'type' => 'ElectronicsStore', 'display' => '-- ElectronicsStore' ),
|
151 |
+
array( 'type' => 'Florist', 'display' => '-- Florist' ),
|
152 |
+
array( 'type' => 'FurnitureStore', 'display' => '-- FurnitureStore' ),
|
153 |
+
array( 'type' => 'GardenStore', 'display' => '-- GardenStore' ),
|
154 |
+
array( 'type' => 'GroceryStore', 'display' => '-- GroceryStore' ),
|
155 |
+
array( 'type' => 'HardwareStore', 'display' => '-- HardwareStore' ),
|
156 |
+
array( 'type' => 'HobbyShop', 'display' => '-- HobbyShop' ),
|
157 |
+
array( 'type' => 'HomeGoodsStore', 'display' => '-- HomeGoodsStore' ),
|
158 |
+
array( 'type' => 'JewelryStore', 'display' => '-- JewelryStore' ),
|
159 |
+
array( 'type' => 'LiquorStore', 'display' => '-- LiquorStore' ),
|
160 |
+
array( 'type' => 'MensClothingStore', 'display' => '-- MensClothingStore' ),
|
161 |
+
array( 'type' => 'MobilePhoneStore', 'display' => '-- MobilePhoneStore' ),
|
162 |
+
array( 'type' => 'MovieRentalStore', 'display' => '-- MovieRentalStore' ),
|
163 |
+
array( 'type' => 'MusicStore', 'display' => '-- MusicStore' ),
|
164 |
+
array( 'type' => 'OfficeEquipmentStore', 'display' => '-- OfficeEquipmentStore' ),
|
165 |
+
array( 'type' => 'OutletStore', 'display' => '-- OutletStore' ),
|
166 |
+
array( 'type' => 'PawnShop', 'display' => '-- PawnShop' ),
|
167 |
+
array( 'type' => 'PetStore', 'display' => '-- PetStore' ),
|
168 |
+
array( 'type' => 'ShoeStore', 'display' => '-- ShoeStore' ),
|
169 |
+
array( 'type' => 'SportingGoodsStore', 'display' => '-- SportingGoodsStore' ),
|
170 |
+
array( 'type' => 'TireShop', 'display' => '-- TireShop' ),
|
171 |
+
array( 'type' => 'ToyStore', 'display' => '-- ToyStore' ),
|
172 |
+
array( 'type' => 'WholesaleStore', 'display' => '-- WholesaleStore' ),
|
173 |
+
|
174 |
+
array( 'type' => 'TelevisionStation', 'display' => '- TelevisionStation' ),
|
175 |
+
|
176 |
+
array( 'type' => 'TouristInformationCenter', 'display' => '- TouristInformationCenter' ),
|
177 |
+
|
178 |
+
array( 'type' => 'TravelAgency', 'display' => '- TravelAgency' )
|
179 |
+
);
|
180 |
+
|
181 |
+
/** weekType defined. */
|
182 |
+
private $week_array = array(
|
183 |
+
array('type' => 'Mo', 'display' => 'Monday'),
|
184 |
+
array('type' => 'Tu', 'display' => 'Tuesday'),
|
185 |
+
array('type' => 'We', 'display' => 'Wednesday'),
|
186 |
+
array('type' => 'Th', 'display' => 'Thursday'),
|
187 |
+
array('type' => 'Fr', 'display' => 'Friday'),
|
188 |
+
array('type' => 'Sa', 'display' => 'Saturday'),
|
189 |
+
array('type' => 'Su', 'display' => 'Sunday')
|
190 |
+
);
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Constructor Define.
|
194 |
+
*
|
195 |
+
* @version 3.1.4
|
196 |
+
* @since 2.3.0
|
197 |
+
* @param array $option
|
198 |
+
*/
|
199 |
+
public function __construct ( array $option ) {
|
200 |
+
/** Default Value Set */
|
201 |
+
$option_array = $this->get_default_options();
|
202 |
+
|
203 |
+
if ( !empty( $option ) ) {
|
204 |
+
$option_array = array_merge( $option_array, $option );
|
205 |
+
}
|
206 |
+
|
207 |
+
$this->page_render( $option_array );
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Form Layout Render
|
212 |
+
*
|
213 |
+
* @version 4.5.3
|
214 |
+
* @since 2.3.3
|
215 |
+
* @param array $option
|
216 |
+
*/
|
217 |
+
private function page_render ( array $option ) {
|
218 |
+
/** Local Business Type */
|
219 |
+
$html = '<table class="schema-admin-table">';
|
220 |
+
$html .= '<caption>Local Business</caption>';
|
221 |
+
$html .= $this->set_form_select( 'business_type', 'Local Business Type', $option['business_type'] );
|
222 |
+
$html .= $this->set_form_text( 'image', 'An image of the business', $option['image'], true );
|
223 |
+
$html .= $this->set_form_text( 'name', 'Business Name', $option['name'], true );
|
224 |
+
$html .= $this->set_form_text( 'url', 'Url', $option['url'], true );
|
225 |
+
$html .= $this->set_form_text( 'telephone', 'Telephone', $option['telephone'], false, 'e.g. : +1-880-555-1212' );
|
226 |
+
$html .= '</table>';
|
227 |
+
echo $html;
|
228 |
+
|
229 |
+
/** For food establishments */
|
230 |
+
$html = '<table class="schema-admin-table">';
|
231 |
+
$html .= '<caption>For food establishments</caption>';
|
232 |
+
$html .= $this->set_form_checkbox( 'food_active', 'Setting', $option['food_active'], 'Enabled' );
|
233 |
+
$html .= $this->set_form_text( 'menu', 'Menu url', $option['menu'], false, 'For food establishments, the fully-qualified URL of the menu.' );
|
234 |
+
$html .= $this->set_form_checkbox( 'accepts_reservations', 'Accepts Reservations', $option['accepts_reservations'], 'For food establishments, and whether it is possible to accept a reservation?' );
|
235 |
+
$html .= $this->set_form_text( 'serves_cuisine', 'Serves Cuisine', $option['serves_cuisine'], false, 'If marking up a restaurant, provide the type of cuisine they serve.' );
|
236 |
+
$html .= '</table>';
|
237 |
+
echo $html;
|
238 |
+
|
239 |
+
/** Postal Address */
|
240 |
+
$html = '<table class="schema-admin-table">';
|
241 |
+
$html .= '<caption>Postal Address</caption>';
|
242 |
+
$html .= $this->set_form_text( 'street_address', 'Street Address', $option['street_address'], true );
|
243 |
+
$html .= $this->set_form_text( 'address_locality', 'Address Locality', $option['address_locality'], true );
|
244 |
+
$html .= $this->set_form_text( 'address_region', 'Address Region', $option['address_region'], false );
|
245 |
+
$html .= $this->set_form_text( 'postal_code', 'Postal Code', $option['postal_code'], true );
|
246 |
+
$html .= $this->set_form_text( 'address_country', 'Address Country', $option['address_country'], true, '<a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2" target="_blank">The 2-letter ISO 3166-1 alpha-2 country code.</a>' );
|
247 |
+
$html .= '</table>';
|
248 |
+
echo $html;
|
249 |
+
|
250 |
+
/** Geo Circle */
|
251 |
+
$html = '<table class="schema-admin-table">';
|
252 |
+
$html .= '<caption>Geo Circle</caption>';
|
253 |
+
$html .= $this->set_form_checkbox( 'geo_circle_active', 'Setting', $option['geo_circle_active'], 'Enabled' );
|
254 |
+
$html .= $this->set_form_text( 'geo_circle_radius', 'geoRadius', $option['geo_circle_radius'], false );
|
255 |
+
$html .= '</table>';
|
256 |
+
echo $html;
|
257 |
+
|
258 |
+
/** Geo Coordinates */
|
259 |
+
$html = '<table class="schema-admin-table">';
|
260 |
+
$html .= '<caption>Geo Coordinates</caption>';
|
261 |
+
$html .= $this->set_form_checkbox( 'geo_active', 'Setting', $option['geo_active'], 'Enabled' );
|
262 |
+
$html .= $this->set_form_text( 'latitude', 'Latitude', $option['latitude'], false );
|
263 |
+
$html .= $this->set_form_text( 'longitude', 'Longitude', $option['longitude'], false );
|
264 |
+
$html .= '</table>';
|
265 |
+
echo $html;
|
266 |
+
|
267 |
+
/** Opening Hours Specification */
|
268 |
+
$html = '<table class="schema-admin-table">';
|
269 |
+
$html .= '<caption>Opening Hours Specification</caption>';
|
270 |
+
|
271 |
+
$i = 0;
|
272 |
+
|
273 |
+
foreach ( $this->week_array as $value ) {
|
274 |
+
if ( !isset( $option[$value['type']] ) ) {
|
275 |
+
$option[$value['type']] = "";
|
276 |
+
}
|
277 |
+
|
278 |
+
$html .= $this->set_form_checkbox( $value['type'], $value['display'], $option[$value['type']], 'Enabled' );
|
279 |
+
|
280 |
+
if ( isset( $option['week'][$value['type']] ) ) {
|
281 |
+
foreach ( $option['week'][$value['type']] as $type ) {
|
282 |
+
if ( !empty( $type['open'] ) ) {
|
283 |
+
$html .= $this->set_form_time( $value['type'], '', $type['open'], $type['close'], '', $i );
|
284 |
+
$i++;
|
285 |
+
} else {
|
286 |
+
$html .= $this->set_form_time( $value['type'], '', '', '', '', 0 );
|
287 |
+
break;
|
288 |
+
}
|
289 |
+
}
|
290 |
+
} else {
|
291 |
+
$html .= $this->set_form_time( $value['type'], '', '', '', '', 0 );
|
292 |
+
}
|
293 |
+
|
294 |
+
$i = 0;
|
295 |
+
}
|
296 |
+
|
297 |
+
$html .= '</table>';
|
298 |
+
echo $html;
|
299 |
+
|
300 |
+
/** Holiday Opening Hours */
|
301 |
+
$html = '<table class="schema-admin-table">';
|
302 |
+
$html .= '<caption>Holiday Opening Hours</caption>';
|
303 |
+
$html .= $this->set_form_checkbox( 'holiday_active', 'Setting', $option['holiday_active'], 'Enabled' );
|
304 |
+
$html .= $this->set_form_time_holiday( $option['holiday_open'], $option['holiday_close'] );
|
305 |
+
$html .= $this->set_form_date( 'holiday_valid_from', 'validFrom', $option['holiday_valid_from'], false );
|
306 |
+
$html .= $this->set_form_date( 'holiday_valid_through', 'validThrough', $option['holiday_valid_through'], false );
|
307 |
+
|
308 |
+
$html .= '</table>';
|
309 |
+
echo $html;
|
310 |
+
|
311 |
+
/** Price Range */
|
312 |
+
$html = '<table class="schema-admin-table">';
|
313 |
+
$html .= '<caption>Price Range</caption>';
|
314 |
+
$html .= $this->set_form_text( 'price_range', 'Price Range', $option['price_range'], false, 'The price range of the business, for example $$$.' );
|
315 |
+
$html .= '</table>';
|
316 |
+
echo $html;
|
317 |
+
|
318 |
+
$html = '<table class="schema-admin-table">';
|
319 |
+
$html .= '<caption>Setting Knowledge</caption>';
|
320 |
+
$html .= '<tr><th>schema.org LocalBusiness :</th>';
|
321 |
+
$html .= '<td><a href="http://schema.org/LocalBusiness" target="_blank">http://schema.org/LocalBusiness</a></td></tr>';
|
322 |
+
$html .= '<tr><th>schema.org GeoCircle :</th>';
|
323 |
+
$html .= '<td><a href="https://schema.org/GeoCircle" target="_blank">https://schema.org/GeoCircle</a></td></tr>';
|
324 |
+
$html .= '<tr><th>Google Search LocalBusiness :</th>';
|
325 |
+
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/local-businesses" target="_blank">https://developers.google.com/search/docs/data-types/local-businesses</a></td></tr>';
|
326 |
+
$html .= '</table>';
|
327 |
+
echo $html;
|
328 |
+
|
329 |
+
submit_button();
|
330 |
+
}
|
331 |
+
|
332 |
+
/**
|
333 |
+
* Return the default options array
|
334 |
+
*
|
335 |
+
* @since 4.6.0
|
336 |
+
* @version 2.5.0
|
337 |
+
* @return array $args
|
338 |
+
*/
|
339 |
+
private function get_default_options () {
|
340 |
+
$args['business_type'] = 'LocalBusiness';
|
341 |
+
$args['name'] = '';
|
342 |
+
$args['image'] = '';
|
343 |
+
$args['url'] = '';
|
344 |
+
$args['telephone'] = '';
|
345 |
+
$args['food_active'] = '';
|
346 |
+
$args['menu'] = '';
|
347 |
+
$args['accepts_reservations'] = '';
|
348 |
+
$args['serves_cuisine'] = '';
|
349 |
+
$args['street_address'] = '';
|
350 |
+
$args['address_locality'] = '';
|
351 |
+
$args['address_region'] = '';
|
352 |
+
$args['postal_code'] = '';
|
353 |
+
$args['address_country'] = '';
|
354 |
+
$args['geo_circle_active'] = '';
|
355 |
+
$args['geo_circle_radius'] = '';
|
356 |
+
$args['geo_active'] = '';
|
357 |
+
$args['latitude'] = '';
|
358 |
+
$args['longitude'] = '';
|
359 |
+
$args['opening_active'] = '';
|
360 |
+
|
361 |
+
foreach ( $this->week_array as $value ) {
|
362 |
+
$args[$value['type']] = '';
|
363 |
+
$args['week'][$value['type']]['open'] = '';
|
364 |
+
$args['week'][$value['type']]['close'] = '';
|
365 |
+
}
|
366 |
+
|
367 |
+
$args['holiday_active'] = '';
|
368 |
+
$args['holiday_open'] = '';
|
369 |
+
$args['holiday_close'] = '';
|
370 |
+
$args['holiday_valid_from'] = '';
|
371 |
+
$args['holiday_valid_through'] = '';
|
372 |
+
$args['price_range'] = '';
|
373 |
+
|
374 |
+
return (array) $args;
|
375 |
+
}
|
376 |
+
|
377 |
+
/**
|
378 |
+
* Return the form text
|
379 |
+
*
|
380 |
+
* @version 4.1.3
|
381 |
+
* @since 2.3.0
|
382 |
+
* @param string $id
|
383 |
+
* @param string $display
|
384 |
+
* @param string $value
|
385 |
+
* @param boolean $required
|
386 |
+
* @param string $note
|
387 |
+
* @return string $html
|
388 |
+
*/
|
389 |
+
private function set_form_text ( $id, $display, $value = "", $required = false, $note = "" ) {
|
390 |
+
$value = esc_attr( $value );
|
391 |
+
|
392 |
+
if ( $required ) {
|
393 |
+
$format = '<tr><th class="require"><label for=%s>%s :</label></th><td>';
|
394 |
+
} else {
|
395 |
+
$format = '<tr><th><label for=%s>%s :</label></th><td>';
|
396 |
+
}
|
397 |
+
|
398 |
+
$format .= '<input type="text" name="option[%s]" id="%s" class="regular-text" value="%s"';
|
399 |
+
|
400 |
+
if ( $required ) {
|
401 |
+
$format .= ' required';
|
402 |
+
}
|
403 |
+
if ( $note === "" ) {
|
404 |
+
$format .= '></td></tr>';
|
405 |
+
} else {
|
406 |
+
$format .= '><small>%s</small></td></tr>';
|
407 |
+
}
|
408 |
+
|
409 |
+
return (string) sprintf( $format, $id, $display, $id, $id, $value, $note );
|
410 |
+
}
|
411 |
+
|
412 |
+
/**
|
413 |
+
* Return the form date
|
414 |
+
*
|
415 |
+
* @since 3.0.5
|
416 |
+
* @version 2.5.0
|
417 |
+
* @param string $id
|
418 |
+
* @param string $display
|
419 |
+
* @param string $value
|
420 |
+
* @param boolean $required
|
421 |
+
* @param string $note
|
422 |
+
* @return string $html
|
423 |
+
*/
|
424 |
+
private function set_form_date ( $id, $display, $value = "", $required = false, $note = "" ) {
|
425 |
+
$value = esc_attr( $value );
|
426 |
+
|
427 |
+
$format = '<tr><th><label for=%s>%s :</label></th><td>';
|
428 |
+
$format .= '<input type="date" name="option[%s]" id="%s" value="%s"';
|
429 |
+
if ( $required ) {
|
430 |
+
$format .= ' required';
|
431 |
+
}
|
432 |
+
$format .= '><small>%s</small></td></tr>';
|
433 |
+
|
434 |
+
return (string) sprintf( $format, $id, $display, $id, $id, $value, $note );
|
435 |
+
}
|
436 |
+
|
437 |
+
/**
|
438 |
+
* Return the form checkbox
|
439 |
+
*
|
440 |
+
* @version 3.0.5
|
441 |
+
* @since 2.3.0
|
442 |
+
* @param string $id
|
443 |
+
* @param string $display
|
444 |
+
* @param string $value
|
445 |
+
* @param string $note
|
446 |
+
* @return string $html
|
447 |
+
*/
|
448 |
+
private function set_form_checkbox ( $id, $display, $value = "", $note = "" ) {
|
449 |
+
$value = esc_attr( $value );
|
450 |
+
|
451 |
+
$format = '<tr><th><label for=%s>%s :</label></th><td>';
|
452 |
+
$format .= '<input type="checkbox" name="option[%s]" id="%s" value="on"';
|
453 |
+
if ( $value === 'on' ) {
|
454 |
+
$format .= ' checked="checked"';
|
455 |
+
}
|
456 |
+
$format .= '>%s</td></tr>';
|
457 |
+
|
458 |
+
return (string) sprintf( $format, $id, $display, $id, $id, $note );
|
459 |
+
}
|
460 |
+
|
461 |
+
/**
|
462 |
+
* Return the form select
|
463 |
+
*
|
464 |
+
* @since 2.3.0
|
465 |
+
* @param string $id
|
466 |
+
* @param string $display
|
467 |
+
* @param string $value
|
468 |
+
* @param string $note
|
469 |
+
* @return string $html
|
470 |
+
*/
|
471 |
+
private function set_form_select ( $id, $display, $value = "", $note = "" ) {
|
472 |
+
$value = esc_attr( $value );
|
473 |
+
|
474 |
+
$format = '<tr><th class="require"><label for=%s>%s :</label></th><td>';
|
475 |
+
$format .= '<select id="%s" name="option[%s]">';
|
476 |
+
foreach ( $this->business_type_array as $args ) {
|
477 |
+
$format .= '<option value="' . $args['type'] . '"';
|
478 |
+
if ( $args['type'] === $value ) {
|
479 |
+
$format .= ' selected';
|
480 |
+
}
|
481 |
+
$format .= '>' . $args['display'] . '</option>';
|
482 |
+
}
|
483 |
+
$format .= '</select>';
|
484 |
+
$format .= '<small>%s</small></td></tr>';
|
485 |
+
|
486 |
+
return (string) sprintf( $format, $id, $display, $id, $id, $note );
|
487 |
+
}
|
488 |
+
|
489 |
+
/**
|
490 |
+
* Return the form time
|
491 |
+
*
|
492 |
+
* @version 3.0.5
|
493 |
+
* @since 2.3.0
|
494 |
+
* @param string $id
|
495 |
+
* @param string $display
|
496 |
+
* @param string $value1
|
497 |
+
* @param string $value2
|
498 |
+
* @param string $note
|
499 |
+
* @param int $count
|
500 |
+
* @return string $html
|
501 |
+
*/
|
502 |
+
private function set_form_time ( $id, $display, $value1 = "", $value2 = "", $note = "", $count = 0 ) {
|
503 |
+
$value1 = esc_attr( $value1 );
|
504 |
+
$value2 = esc_attr( $value2 );
|
505 |
+
|
506 |
+
$format = '<tr class="opening-hours %s"><th><label for=%s>%s :</label></th><td>';
|
507 |
+
$format .= 'Open Time : <input type="time" name="option[week][%s][%d][open]" id="%s-open" value="%s">';
|
508 |
+
$format .= ' Close Time : <input type="time" name="option[week][%s][%d][close]" id="%s-close" value="%s">';
|
509 |
+
$format .= '%s<a class="dashicons dashicons-plus markup-time plus"></a>';
|
510 |
+
if( $count !== 0 ) {
|
511 |
+
$format .= '<a class="dashicons dashicons-minus markup-time minus"></a>';
|
512 |
+
}
|
513 |
+
$format .= '</td></tr>';
|
514 |
+
|
515 |
+
return (string) sprintf( $format, $id, $id, $display, $id, $count, $id, $value1, $id, $count, $id, $value2, $note );
|
516 |
+
}
|
517 |
+
|
518 |
+
/**
|
519 |
+
* Return the form time (Holiday)
|
520 |
+
*
|
521 |
+
* @since 2.5.0
|
522 |
+
* @version 2.5.0
|
523 |
+
* @param string $value1
|
524 |
+
* @param string $value2
|
525 |
+
* @return string $html
|
526 |
+
*/
|
527 |
+
private function set_form_time_holiday ( $value1 = "", $value2 = "" ) {
|
528 |
+
$value1 = esc_attr( $value1 );
|
529 |
+
$value2 = esc_attr( $value2 );
|
530 |
+
|
531 |
+
$format = '<tr><th>Holiday Time :</th><td>';
|
532 |
+
$format .= 'Open Time : <input type="time" name="option[holiday_open]" value="%s">';
|
533 |
+
$format .= 'Close Time : <input type="time" name="option[holiday_close]" value="%s">';
|
534 |
+
$format .= '</td></tr>';
|
535 |
+
|
536 |
+
return (string) sprintf( $format, $value1, $value2 );
|
537 |
+
}
|
538 |
}
|
includes/admin/wp-structuring-admin-type-news-article.php
CHANGED
@@ -1,180 +1,180 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Type News Article
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.5.3
|
7 |
-
* @since 1.0.0
|
8 |
-
* @see wp-structuring-admin-db.php
|
9 |
-
* @link http://schema.org/NewsArticle
|
10 |
-
* @link https://developers.google.com/search/docs/data-types/articles
|
11 |
-
* @link https://developers.google.com/search/docs/data-types/speakable
|
12 |
-
*/
|
13 |
-
class Structuring_Markup_Type_NewsArticle {
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Constructor Define.
|
17 |
-
*
|
18 |
-
* @version 3.2.2
|
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 4.5.3
|
37 |
-
* @since 1.0.0
|
38 |
-
* @param array $option
|
39 |
-
*/
|
40 |
-
private function page_render ( array $option ) {
|
41 |
-
$html = '<table class="schema-admin-table">';
|
42 |
-
$html .= '<caption>Basic Setting</caption>';
|
43 |
-
$html .= '<tr><th>headline :</th><td><small>Default : post_title</small></td></tr>';
|
44 |
-
$html .= '<tr><th>datePublished :</th><td><small>Default : get_the_time( DATE_ISO8601, ID )</small></td></tr>';
|
45 |
-
$html .= '<tr><th>dateModified :</th><td><small>Default : get_the_modified_time( DATE_ISO8601, false, ID )</small></td></tr>';
|
46 |
-
$html .= '<tr><th>description :</th><td><small>Default : post_excerpt</small></td></tr>';
|
47 |
-
$html .= '</table>';
|
48 |
-
echo $html;
|
49 |
-
|
50 |
-
$html = '<table class="schema-admin-table">';
|
51 |
-
$html .= '<caption>mainEntityOfPage</caption>';
|
52 |
-
$html .= '<tr><th>@type :</th><td><small>"WebPage"</small></td></tr>';
|
53 |
-
$html .= '<tr><th>@id :</th><td><small>Default : get_permalink( ID )</small></td></tr>';
|
54 |
-
$html .= '</table>';
|
55 |
-
echo $html;
|
56 |
-
|
57 |
-
$html = '<table class="schema-admin-table">';
|
58 |
-
$html .= '<caption>image</caption>';
|
59 |
-
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
60 |
-
$html .= '<tr><th>url :</th><td><small>Default : thumbnail</small></td></tr>';
|
61 |
-
$html .= '<tr><th>height :</th><td><small>Auto : The height of the image, in pixels.</small></td></tr>';
|
62 |
-
$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>';
|
63 |
-
$html .= '<tr><th><label for="content_image">Setting image url :</label></th><td>';
|
64 |
-
$html .= '<input type="checkbox" name="option[' . "content_image" . ']" id="content_image" value="on"';
|
65 |
-
if ( isset( $option['content_image'] ) && $option['content_image'] === 'on' ) {
|
66 |
-
$html .= ' checked="checked"';
|
67 |
-
}
|
68 |
-
$html .= '>Set the first image in the content.<br><small>Pattern without feature image set (feature image takes precedence)</small>';
|
69 |
-
$html .= '</td></tr>';
|
70 |
-
$html .= '<tr><th><label for="default_image">Default image url :</label></th><td>';
|
71 |
-
$html .= '<input type="text" name="option[' . "default_image" . ']" id="default_image" class="regular-text" value="' . esc_attr( $option['default_image'] ) . '">';
|
72 |
-
$html .= '<button id="media-upload-default" class="dashicons-before dashicons-admin-media schema-admin-media-button"></button><br>';
|
73 |
-
$html .= '<small>Image output when feature image or content image check is not set.</small>';
|
74 |
-
$html .= '</td></tr>';
|
75 |
-
$html .= '</table>';
|
76 |
-
echo $html;
|
77 |
-
|
78 |
-
$html = '<table class="schema-admin-table">';
|
79 |
-
$html .= '<caption>author</caption>';
|
80 |
-
$html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
|
81 |
-
$html .= '<tr><th>name :</th><td><small>Default : get_the_author_meta( "display_name", author )</small>';
|
82 |
-
$html .= '</td></tr>';
|
83 |
-
$html .= '</table>';
|
84 |
-
echo $html;
|
85 |
-
|
86 |
-
$html = '<table class="schema-admin-table">';
|
87 |
-
$html .= '<caption>publisher</caption>';
|
88 |
-
$html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
|
89 |
-
$html .= '<tr><th><label for="name">Organization Name :</label></th><td>';
|
90 |
-
$html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" value="' . esc_attr( $option['name'] ) . '">';
|
91 |
-
$html .= '</td></tr>';
|
92 |
-
$html .= '</table>';
|
93 |
-
echo $html;
|
94 |
-
|
95 |
-
$html = '<table class="schema-admin-table">';
|
96 |
-
$html .= '<caption>publisher.logo</caption>';
|
97 |
-
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
98 |
-
$html .= '<tr><th><label for="logo">url :</label></th><td>';
|
99 |
-
$html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
|
100 |
-
$html .= '<button id="media-upload" class="dashicons-before dashicons-admin-media schema-admin-media-button"></button>';
|
101 |
-
$html .= '</td></tr>';
|
102 |
-
$html .= '<tr><th><label for="logo-width">width :</label></th><td>';
|
103 |
-
$html .= '<input type="number" name="option[' . "logo-width" . ']" id="logo-width" min="0" value="' . esc_attr( $option['logo-width'] ) . '" placeholder="width <= 600px.">px';
|
104 |
-
$html .= '</td></tr>';
|
105 |
-
$html .= '<tr><th><label for="logo-height">height :</label></th><td>';
|
106 |
-
$html .= '<input type="number" name="option[' . "logo-height" . ']" id="logo-height" min="0" value="' . esc_attr( $option['logo-height'] ) . '" placeholder="height <= 60px.">px';
|
107 |
-
$html .= '</td></tr>';
|
108 |
-
$html .= '</table>';
|
109 |
-
echo $html;
|
110 |
-
|
111 |
-
$html = '<table class="schema-admin-table">';
|
112 |
-
$html .= '<caption>Speakable</caption>';
|
113 |
-
$html .= '<tr><th><label for="speakable_action">speakable Active :</label></th><td>';
|
114 |
-
$html .= '<label><input type="checkbox" name="option[' . "speakable_action" . ']" id="speakable_action" value="on"';
|
115 |
-
|
116 |
-
if ( isset( $option['speakable_action'] ) && $option['speakable_action'] === 'on' ) {
|
117 |
-
$html .= ' checked="checked"';
|
118 |
-
}
|
119 |
-
$html .= '>Enabled</label>';
|
120 |
-
$html .= '</td></tr>';
|
121 |
-
$html .= '<tr><th><label for="speakable_type_css">cssSelector OR xpath :</label></th><td>';
|
122 |
-
|
123 |
-
if( $option['speakable_type'] !== 'xpath' ) {
|
124 |
-
$checked['css'] = ' checked';
|
125 |
-
$checked['xpath'] = '';
|
126 |
-
} else {
|
127 |
-
$checked['css'] = '';
|
128 |
-
$checked['xpath'] = ' checked';
|
129 |
-
}
|
130 |
-
|
131 |
-
$html .= '<label><input type="radio" name="option[' . "speakable_type" . ']" id="speakable_type_css" value="cssSelector"' . $checked['css'] . '>CSS selectors </label>';
|
132 |
-
$html .= '<label><input type="radio" name="option[' . "speakable_type" . ']" id="speakable_type_xpath" value="xpath"' . $checked['xpath'] . '>xPaths</label>';
|
133 |
-
$html .= '</td></tr>';
|
134 |
-
$html .= '<tr><th><label for="speakable_headline">headline :</label></th><td>';
|
135 |
-
$html .= '<input type="text" name="option[' . "speakable_headline" . ']" id="speakable_headline" class="regular-text" value="' . esc_attr( stripslashes( $option['speakable_headline'] ) ) . '">';
|
136 |
-
$html .= '</td></tr>';
|
137 |
-
$html .= '<tr><th><label for="speakable_summary">summary :</label></th><td>';
|
138 |
-
$html .= '<input type="text" name="option[' . "speakable_summary" . ']" id="speakable_summary" class="regular-text" value="' . esc_attr( stripslashes( $option['speakable_summary'] ) ) . '">';
|
139 |
-
$html .= '</td></tr>';
|
140 |
-
$html .= '</table>';
|
141 |
-
echo $html;
|
142 |
-
|
143 |
-
$html = '<table class="schema-admin-table">';
|
144 |
-
$html .= '<caption>Setting Knowledge</caption>';
|
145 |
-
$html .= '<tr><th>schema.org NewsArticle :</th>';
|
146 |
-
$html .= '<td><a href="http://schema.org/NewsArticle" target="_blank">http://schema.org/NewsArticle</a></td></tr>';
|
147 |
-
$html .= '<tr><th>pending.schema.org Speakable :</th>';
|
148 |
-
$html .= '<td><a href="https://pending.schema.org/speakable" target="_blank">https://pending.schema.org/speakable</a></td></tr>';
|
149 |
-
$html .= '<tr><th>Google Search Article :</th>';
|
150 |
-
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/articles" target="_blank">https://developers.google.com/search/docs/data-types/articles</a></td></tr>';
|
151 |
-
$html .= '<tr><th>Google Search Speakable (BETA) :</th>';
|
152 |
-
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/speakable" target="_blank">https://developers.google.com/search/docs/data-types/speakable</a></td></tr>';
|
153 |
-
$html .= '</table>';
|
154 |
-
echo $html;
|
155 |
-
|
156 |
-
submit_button();
|
157 |
-
}
|
158 |
-
|
159 |
-
/**
|
160 |
-
* Return the default options array
|
161 |
-
*
|
162 |
-
* @since 4.5.3
|
163 |
-
* @version 2.2.0
|
164 |
-
* @return array $args
|
165 |
-
*/
|
166 |
-
private function get_default_options () {
|
167 |
-
$args['name'] = '';
|
168 |
-
$args['content_image'] = '';
|
169 |
-
$args['default_image'] = '';
|
170 |
-
$args['logo'] = '';
|
171 |
-
$args['logo-height'] = 0;
|
172 |
-
$args['logo-width'] = 0;
|
173 |
-
$args['speakable_action'] = '';
|
174 |
-
$args['speakable_type'] = '';
|
175 |
-
$args['speakable_headline'] = '';
|
176 |
-
$args['speakable_summary'] = '';
|
177 |
-
|
178 |
-
return (array) $args;
|
179 |
-
}
|
180 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type News Article
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.5.3
|
7 |
+
* @since 1.0.0
|
8 |
+
* @see wp-structuring-admin-db.php
|
9 |
+
* @link http://schema.org/NewsArticle
|
10 |
+
* @link https://developers.google.com/search/docs/data-types/articles
|
11 |
+
* @link https://developers.google.com/search/docs/data-types/speakable
|
12 |
+
*/
|
13 |
+
class Structuring_Markup_Type_NewsArticle {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Constructor Define.
|
17 |
+
*
|
18 |
+
* @version 3.2.2
|
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 4.5.3
|
37 |
+
* @since 1.0.0
|
38 |
+
* @param array $option
|
39 |
+
*/
|
40 |
+
private function page_render ( array $option ) {
|
41 |
+
$html = '<table class="schema-admin-table">';
|
42 |
+
$html .= '<caption>Basic Setting</caption>';
|
43 |
+
$html .= '<tr><th>headline :</th><td><small>Default : post_title</small></td></tr>';
|
44 |
+
$html .= '<tr><th>datePublished :</th><td><small>Default : get_the_time( DATE_ISO8601, ID )</small></td></tr>';
|
45 |
+
$html .= '<tr><th>dateModified :</th><td><small>Default : get_the_modified_time( DATE_ISO8601, false, ID )</small></td></tr>';
|
46 |
+
$html .= '<tr><th>description :</th><td><small>Default : post_excerpt</small></td></tr>';
|
47 |
+
$html .= '</table>';
|
48 |
+
echo $html;
|
49 |
+
|
50 |
+
$html = '<table class="schema-admin-table">';
|
51 |
+
$html .= '<caption>mainEntityOfPage</caption>';
|
52 |
+
$html .= '<tr><th>@type :</th><td><small>"WebPage"</small></td></tr>';
|
53 |
+
$html .= '<tr><th>@id :</th><td><small>Default : get_permalink( ID )</small></td></tr>';
|
54 |
+
$html .= '</table>';
|
55 |
+
echo $html;
|
56 |
+
|
57 |
+
$html = '<table class="schema-admin-table">';
|
58 |
+
$html .= '<caption>image</caption>';
|
59 |
+
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
60 |
+
$html .= '<tr><th>url :</th><td><small>Default : thumbnail</small></td></tr>';
|
61 |
+
$html .= '<tr><th>height :</th><td><small>Auto : The height of the image, in pixels.</small></td></tr>';
|
62 |
+
$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>';
|
63 |
+
$html .= '<tr><th><label for="content_image">Setting image url :</label></th><td>';
|
64 |
+
$html .= '<input type="checkbox" name="option[' . "content_image" . ']" id="content_image" value="on"';
|
65 |
+
if ( isset( $option['content_image'] ) && $option['content_image'] === 'on' ) {
|
66 |
+
$html .= ' checked="checked"';
|
67 |
+
}
|
68 |
+
$html .= '>Set the first image in the content.<br><small>Pattern without feature image set (feature image takes precedence)</small>';
|
69 |
+
$html .= '</td></tr>';
|
70 |
+
$html .= '<tr><th><label for="default_image">Default image url :</label></th><td>';
|
71 |
+
$html .= '<input type="text" name="option[' . "default_image" . ']" id="default_image" class="regular-text" value="' . esc_attr( $option['default_image'] ) . '">';
|
72 |
+
$html .= '<button id="media-upload-default" class="dashicons-before dashicons-admin-media schema-admin-media-button"></button><br>';
|
73 |
+
$html .= '<small>Image output when feature image or content image check is not set.</small>';
|
74 |
+
$html .= '</td></tr>';
|
75 |
+
$html .= '</table>';
|
76 |
+
echo $html;
|
77 |
+
|
78 |
+
$html = '<table class="schema-admin-table">';
|
79 |
+
$html .= '<caption>author</caption>';
|
80 |
+
$html .= '<tr><th>@type :</th><td><small>"Person"</small></td></tr>';
|
81 |
+
$html .= '<tr><th>name :</th><td><small>Default : get_the_author_meta( "display_name", author )</small>';
|
82 |
+
$html .= '</td></tr>';
|
83 |
+
$html .= '</table>';
|
84 |
+
echo $html;
|
85 |
+
|
86 |
+
$html = '<table class="schema-admin-table">';
|
87 |
+
$html .= '<caption>publisher</caption>';
|
88 |
+
$html .= '<tr><th>@type :</th><td><small>"Organization"</small></td></tr>';
|
89 |
+
$html .= '<tr><th><label for="name">Organization Name :</label></th><td>';
|
90 |
+
$html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" value="' . esc_attr( $option['name'] ) . '">';
|
91 |
+
$html .= '</td></tr>';
|
92 |
+
$html .= '</table>';
|
93 |
+
echo $html;
|
94 |
+
|
95 |
+
$html = '<table class="schema-admin-table">';
|
96 |
+
$html .= '<caption>publisher.logo</caption>';
|
97 |
+
$html .= '<tr><th>@type :</th><td><small>"ImageObject"</small></td></tr>';
|
98 |
+
$html .= '<tr><th><label for="logo">url :</label></th><td>';
|
99 |
+
$html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" value="' . esc_attr( $option['logo'] ) . '">';
|
100 |
+
$html .= '<button id="media-upload" class="dashicons-before dashicons-admin-media schema-admin-media-button"></button>';
|
101 |
+
$html .= '</td></tr>';
|
102 |
+
$html .= '<tr><th><label for="logo-width">width :</label></th><td>';
|
103 |
+
$html .= '<input type="number" name="option[' . "logo-width" . ']" id="logo-width" min="0" value="' . esc_attr( $option['logo-width'] ) . '" placeholder="width <= 600px.">px';
|
104 |
+
$html .= '</td></tr>';
|
105 |
+
$html .= '<tr><th><label for="logo-height">height :</label></th><td>';
|
106 |
+
$html .= '<input type="number" name="option[' . "logo-height" . ']" id="logo-height" min="0" value="' . esc_attr( $option['logo-height'] ) . '" placeholder="height <= 60px.">px';
|
107 |
+
$html .= '</td></tr>';
|
108 |
+
$html .= '</table>';
|
109 |
+
echo $html;
|
110 |
+
|
111 |
+
$html = '<table class="schema-admin-table">';
|
112 |
+
$html .= '<caption>Speakable</caption>';
|
113 |
+
$html .= '<tr><th><label for="speakable_action">speakable Active :</label></th><td>';
|
114 |
+
$html .= '<label><input type="checkbox" name="option[' . "speakable_action" . ']" id="speakable_action" value="on"';
|
115 |
+
|
116 |
+
if ( isset( $option['speakable_action'] ) && $option['speakable_action'] === 'on' ) {
|
117 |
+
$html .= ' checked="checked"';
|
118 |
+
}
|
119 |
+
$html .= '>Enabled</label>';
|
120 |
+
$html .= '</td></tr>';
|
121 |
+
$html .= '<tr><th><label for="speakable_type_css">cssSelector OR xpath :</label></th><td>';
|
122 |
+
|
123 |
+
if( $option['speakable_type'] !== 'xpath' ) {
|
124 |
+
$checked['css'] = ' checked';
|
125 |
+
$checked['xpath'] = '';
|
126 |
+
} else {
|
127 |
+
$checked['css'] = '';
|
128 |
+
$checked['xpath'] = ' checked';
|
129 |
+
}
|
130 |
+
|
131 |
+
$html .= '<label><input type="radio" name="option[' . "speakable_type" . ']" id="speakable_type_css" value="cssSelector"' . $checked['css'] . '>CSS selectors </label>';
|
132 |
+
$html .= '<label><input type="radio" name="option[' . "speakable_type" . ']" id="speakable_type_xpath" value="xpath"' . $checked['xpath'] . '>xPaths</label>';
|
133 |
+
$html .= '</td></tr>';
|
134 |
+
$html .= '<tr><th><label for="speakable_headline">headline :</label></th><td>';
|
135 |
+
$html .= '<input type="text" name="option[' . "speakable_headline" . ']" id="speakable_headline" class="regular-text" value="' . esc_attr( stripslashes( $option['speakable_headline'] ) ) . '">';
|
136 |
+
$html .= '</td></tr>';
|
137 |
+
$html .= '<tr><th><label for="speakable_summary">summary :</label></th><td>';
|
138 |
+
$html .= '<input type="text" name="option[' . "speakable_summary" . ']" id="speakable_summary" class="regular-text" value="' . esc_attr( stripslashes( $option['speakable_summary'] ) ) . '">';
|
139 |
+
$html .= '</td></tr>';
|
140 |
+
$html .= '</table>';
|
141 |
+
echo $html;
|
142 |
+
|
143 |
+
$html = '<table class="schema-admin-table">';
|
144 |
+
$html .= '<caption>Setting Knowledge</caption>';
|
145 |
+
$html .= '<tr><th>schema.org NewsArticle :</th>';
|
146 |
+
$html .= '<td><a href="http://schema.org/NewsArticle" target="_blank">http://schema.org/NewsArticle</a></td></tr>';
|
147 |
+
$html .= '<tr><th>pending.schema.org Speakable :</th>';
|
148 |
+
$html .= '<td><a href="https://pending.schema.org/speakable" target="_blank">https://pending.schema.org/speakable</a></td></tr>';
|
149 |
+
$html .= '<tr><th>Google Search Article :</th>';
|
150 |
+
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/articles" target="_blank">https://developers.google.com/search/docs/data-types/articles</a></td></tr>';
|
151 |
+
$html .= '<tr><th>Google Search Speakable (BETA) :</th>';
|
152 |
+
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/speakable" target="_blank">https://developers.google.com/search/docs/data-types/speakable</a></td></tr>';
|
153 |
+
$html .= '</table>';
|
154 |
+
echo $html;
|
155 |
+
|
156 |
+
submit_button();
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Return the default options array
|
161 |
+
*
|
162 |
+
* @since 4.5.3
|
163 |
+
* @version 2.2.0
|
164 |
+
* @return array $args
|
165 |
+
*/
|
166 |
+
private function get_default_options () {
|
167 |
+
$args['name'] = '';
|
168 |
+
$args['content_image'] = '';
|
169 |
+
$args['default_image'] = '';
|
170 |
+
$args['logo'] = '';
|
171 |
+
$args['logo-height'] = 0;
|
172 |
+
$args['logo-width'] = 0;
|
173 |
+
$args['speakable_action'] = '';
|
174 |
+
$args['speakable_type'] = '';
|
175 |
+
$args['speakable_headline'] = '';
|
176 |
+
$args['speakable_summary'] = '';
|
177 |
+
|
178 |
+
return (array) $args;
|
179 |
+
}
|
180 |
}
|
includes/admin/wp-structuring-admin-type-organization.php
CHANGED
@@ -1,248 +1,248 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Type Organization
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.6.0
|
7 |
-
* @since 1.0.0
|
8 |
-
* @see wp-structuring-admin-db.php
|
9 |
-
* @link https://schema.org/Organization
|
10 |
-
* @link https://developers.google.com/search/docs/data-types/logo
|
11 |
-
* @link https://developers.google.com/search/docs/data-types/corporate-contact
|
12 |
-
* @link https://developers.google.com/search/docs/data-types/social-profile
|
13 |
-
*/
|
14 |
-
class Structuring_Markup_Type_Organization {
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Variable definition.
|
18 |
-
*
|
19 |
-
* @version 4.6.0
|
20 |
-
* @since 1.0.0
|
21 |
-
*/
|
22 |
-
/** Organization Type defined */
|
23 |
-
private $organization_type_array = array(
|
24 |
-
array('type' => 'Organization', 'display' => 'Organization'),
|
25 |
-
array('type' => 'Airline', 'display' => '- Airline'),
|
26 |
-
array('type' => 'Consortium', 'display' => '- Consortium'),
|
27 |
-
array('type' => 'Corporation', 'display' => '- Corporation'),
|
28 |
-
array('type' => 'EducationalOrganization', 'display' => '- EducationalOrganization'),
|
29 |
-
array('type' => 'GovernmentOrganization', 'display' => '- GovernmentOrganization'),
|
30 |
-
array('type' => 'LibrarySystem', 'display' => '- LibrarySystem'),
|
31 |
-
array('type' => 'LocalBusiness', 'display' => '- LocalBusiness'),
|
32 |
-
array('type' => 'MedicalOrganization', 'display' => '- MedicalOrganization'),
|
33 |
-
array('type' => 'NewsMediaOrganization', 'display' => '- NewsMediaOrganization'),
|
34 |
-
array('type' => 'NGO', 'display' => '- NGO'),
|
35 |
-
array('type' => 'PerformingGroup', 'display' => '- PerformingGroup'),
|
36 |
-
array('type' => 'SportsOrganization', 'display' => '- SportsOrganization'),
|
37 |
-
array('type' => 'WorkersUnion', 'display' => '- WorkersUnion')
|
38 |
-
);
|
39 |
-
/** contactType defined. */
|
40 |
-
private $contact_type_array = array(
|
41 |
-
array('type' => 'customer service', 'display' => 'customer service'),
|
42 |
-
array('type' => 'technical support', 'display' => 'technical support'),
|
43 |
-
array('type' => 'billing support', 'display' => 'billing support'),
|
44 |
-
array('type' => 'bill payment', 'display' => 'bill payment'),
|
45 |
-
array('type' => 'sales', 'display' => 'sales'),
|
46 |
-
array('type' => 'reservations', 'display' => 'reservations'),
|
47 |
-
array('type' => 'credit card_support', 'display' => 'credit card support'),
|
48 |
-
array('type' => 'emergency', 'display' => 'emergency'),
|
49 |
-
array('type' => 'baggage tracking', 'display' => 'baggage tracking'),
|
50 |
-
array('type' => 'roadside assistance', 'display' => 'roadside assistance'),
|
51 |
-
array('type' => 'package tracking', 'display' => 'package tracking')
|
52 |
-
);
|
53 |
-
/** Social Profile */
|
54 |
-
private $social_array = array(
|
55 |
-
array('type' => 'facebook', 'display' => 'Facebook'),
|
56 |
-
array('type' => 'twitter', 'display' => 'Twitter'),
|
57 |
-
array('type' => 'google', 'display' => 'Google+'),
|
58 |
-
array('type' => 'instagram', 'display' => 'Instagram'),
|
59 |
-
array('type' => 'youtube', 'display' => 'Youtube'),
|
60 |
-
array('type' => 'linkedin', 'display' => 'LinkedIn'),
|
61 |
-
array('type' => 'myspace', 'display' => 'Myspace'),
|
62 |
-
array('type' => 'pinterest', 'display' => 'Pinterest'),
|
63 |
-
array('type' => 'soundcloud', 'display' => 'SoundCloud'),
|
64 |
-
array('type' => 'tumblr', 'display' => 'Tumblr')
|
65 |
-
);
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Constructor Define.
|
69 |
-
*
|
70 |
-
* @version 4.1.0
|
71 |
-
* @since 1.0.0
|
72 |
-
* @param array $option
|
73 |
-
*/
|
74 |
-
public function __construct ( array $option ) {
|
75 |
-
/** Default Value Set */
|
76 |
-
$option_array = $this->get_default_options();
|
77 |
-
|
78 |
-
if ( !empty( $option ) ) {
|
79 |
-
$option_array = array_merge( $option_array, $option );
|
80 |
-
}
|
81 |
-
$this->page_render( $option_array );
|
82 |
-
}
|
83 |
-
|
84 |
-
/**
|
85 |
-
* Form Layout Render
|
86 |
-
*
|
87 |
-
* @version 4.6.0
|
88 |
-
* @since 1.0.0
|
89 |
-
* @param array $option
|
90 |
-
*/
|
91 |
-
private function page_render ( array $option ) {
|
92 |
-
/** Organization Type */
|
93 |
-
$html = '<table class="schema-admin-table">';
|
94 |
-
$html .= '<caption>Organization</caption>';
|
95 |
-
$html .= $this->set_form_select( 'organization_type', 'Organization Type', $option['organization_type'] );
|
96 |
-
$html .= '</table>';
|
97 |
-
echo $html;
|
98 |
-
|
99 |
-
/** Logos */
|
100 |
-
$html = '<table class="schema-admin-table">';
|
101 |
-
$html .= '<caption>Logos</caption>';
|
102 |
-
$html .= '<tr><th class="require"><label for="name">Organization Name :</label></th><td>';
|
103 |
-
$html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" required value="' . esc_attr( $option['name'] ) . '">';
|
104 |
-
$html .= '</td></tr>';
|
105 |
-
$html .= '<tr><th class="require"><label for="url">url :</label></th><td>';
|
106 |
-
$html .= '<input type="text" name="option[' . "url" . ']" id="url" class="regular-text" required value="' . esc_attr( $option['url'] ) . '">';
|
107 |
-
$html .= '</td></tr>';
|
108 |
-
$html .= '<tr><th class="require"><label for="logo">logo :</label></th><td>';
|
109 |
-
$html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" required value="' . esc_attr( $option['logo'] ) . '">';
|
110 |
-
$html .= '<button id="media-upload" class="dashicons-before dashicons-admin-media schema-admin-media-button"></button>';
|
111 |
-
$html .= '</td></tr>';
|
112 |
-
$html .= '</table>';
|
113 |
-
echo $html;
|
114 |
-
|
115 |
-
/** Corporate Contact */
|
116 |
-
$html = '<table class="schema-admin-table">';
|
117 |
-
$html .= '<caption>Corporate Contact</caption>';
|
118 |
-
$html .= '<tr><th><label for="contact_point">contactPoint :</label></th><td>';
|
119 |
-
$html .= '<input type="checkbox" name="option[' . "contact_point" . ']" id="contact_point" value="on"';
|
120 |
-
if ( isset( $option['contact_point'] ) && $option['contact_point'] === 'on' ) {
|
121 |
-
$html .= ' checked="checked"';
|
122 |
-
}
|
123 |
-
$html .= '>Enabled';
|
124 |
-
$html .= '</td></tr>';
|
125 |
-
$html .= '<tr><th><label for="telephone">telephone :</label></th><td>';
|
126 |
-
$html .= '<input type="text" name="option[' . "telephone" . ']" id="telephone" class="regular-text" value="' . esc_attr( $option['telephone'] ) . '" placeholder="e.g. : +1-880-555-1212">';
|
127 |
-
$html .= '</td></tr>';
|
128 |
-
$html .= '<tr><th><label for="contact_type">contactType :</label></th><td>';
|
129 |
-
$html .= '<select id="contact_type" name="option[' . "contact_type" . ']">';
|
130 |
-
foreach ( $this->contact_type_array as $value ) {
|
131 |
-
$html .= '<option value="' . $value['type'] . '"';
|
132 |
-
if ( $value['type'] === $option['contact_type'] ) {
|
133 |
-
$html .= ' selected';
|
134 |
-
}
|
135 |
-
$html .= '>' . $value['display'] . '</option>';
|
136 |
-
}
|
137 |
-
$html .= '</select>';
|
138 |
-
$html .= '</td></tr>';
|
139 |
-
$html .= '<tr><th><label for="email">email :</label></th><td>';
|
140 |
-
$html .= '<input type="email" name="option[' . "email" . ']" id="email" class="regular-text" value="' . esc_attr( $option['email'] ) . '" placeholder="e.g. : info@example.com">';
|
141 |
-
$html .= '</td></tr>';
|
142 |
-
$html .= '<tr><th><label for="area_served">areaServed :</label></th><td>';
|
143 |
-
$html .= '<input type="text" name="option[' . "area_served" . ']" id="area_served" class="regular-text" value="' . esc_attr( $option['area_served'] ) . '">';
|
144 |
-
$html .= '<small>Default : "US" Multiple : "US,CA"</small>';
|
145 |
-
$html .= '</td></tr>';
|
146 |
-
$html .= '<tr><th>contactOption :</th><td>';
|
147 |
-
$html .= '<label><input type="checkbox" name="option[' . "contact_point_1" . ']" id="contact_point_1" value="on"';
|
148 |
-
if ( isset( $option['contact_point_1'] ) && $option['contact_point_1'] === 'on' ) {
|
149 |
-
$html .= ' checked="checked"';
|
150 |
-
}
|
151 |
-
$html .= '>HearingImpairedSupported</label><br>';
|
152 |
-
$html .= '<label><input type="checkbox" name="option[' . "contact_point_2" . ']" id="contact_point_2" value="on"';
|
153 |
-
if ( isset( $option['contact_point_2'] ) && $option['contact_point_2'] === 'on' ) {
|
154 |
-
$html .= ' checked="checked"';
|
155 |
-
}
|
156 |
-
$html .= '>TollFree</label><br>';
|
157 |
-
$html .= '</td></tr>';
|
158 |
-
$html .= '<tr><th><label for="available_language">available Language :</label></th><td>';
|
159 |
-
$html .= '<input type="text" name="option[' . "available_language" . ']" id="available_language" class="regular-text" value="' . esc_attr( $option['available_language'] ) . '">';
|
160 |
-
$html .= '<small>Default : "English" Multiple : "French,English"</small>';
|
161 |
-
$html .= '</td></tr>';
|
162 |
-
$html .= '</table>';
|
163 |
-
echo $html;
|
164 |
-
|
165 |
-
/** Social Profiles */
|
166 |
-
$html = '<table class="schema-admin-table">';
|
167 |
-
$html .= '<caption>Social Profiles</caption>';
|
168 |
-
foreach ( $this->social_array as $value ) {
|
169 |
-
$html .= '<tr><th><label for="' . $value['type'] . '">' . $value['display'] . ' :</label></th><td>';
|
170 |
-
$html .= '<input type="text" name="option[' . "social" . '][' . $value['type'] . ']" id="' . $value['type'] . '" class="regular-text" value="' . esc_attr( $option['social'][$value['type']] ) . '">';
|
171 |
-
$html .= '</td></tr>';
|
172 |
-
}
|
173 |
-
$html .= '</table>';
|
174 |
-
echo $html;
|
175 |
-
|
176 |
-
$html = '<table class="schema-admin-table">';
|
177 |
-
$html .= '<caption>Setting Knowledge</caption>';
|
178 |
-
$html .= '<tr><th>schema.org Organization :</th>';
|
179 |
-
$html .= '<td><a href="https://schema.org/Organization" target="_blank">https://schema.org/Organization</a></td></tr>';
|
180 |
-
$html .= '<tr><th>Google Search Logos :</th>';
|
181 |
-
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/logo" target="_blank">https://developers.google.com/search/docs/data-types/logo</a></td></tr>';
|
182 |
-
$html .= '<tr><th>Google Search Corporate Contact :</th>';
|
183 |
-
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/corporate-contact" target="_blank">https://developers.google.com/search/docs/data-types/corporate-contact</a></td></tr>';
|
184 |
-
$html .= '<tr><th>Google Search Social Profile :</th>';
|
185 |
-
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/social-profile" target="_blank">https://developers.google.com/search/docs/data-types/social-profile</a></td></tr>';
|
186 |
-
$html .= '</table>';
|
187 |
-
echo $html;
|
188 |
-
|
189 |
-
submit_button();
|
190 |
-
}
|
191 |
-
|
192 |
-
/**
|
193 |
-
* Return the form select
|
194 |
-
*
|
195 |
-
* @version 4.6.0
|
196 |
-
* @since 4.6.0
|
197 |
-
* @param string $id
|
198 |
-
* @param string $display
|
199 |
-
* @param string $value
|
200 |
-
* @param string $note
|
201 |
-
* @return string $html
|
202 |
-
*/
|
203 |
-
private function set_form_select ( $id, $display, $value = "", $note = "" ) {
|
204 |
-
$value = esc_attr( $value );
|
205 |
-
|
206 |
-
$format = '<tr><th class="require"><label for=%s>%s :</label></th><td>';
|
207 |
-
$format .= '<select id="%s" name="option[%s]">';
|
208 |
-
foreach ( $this->organization_type_array as $args ) {
|
209 |
-
$format .= '<option value="' . $args['type'] . '"';
|
210 |
-
if ( $args['type'] === $value ) {
|
211 |
-
$format .= ' selected';
|
212 |
-
}
|
213 |
-
$format .= '>' . $args['display'] . '</option>';
|
214 |
-
}
|
215 |
-
$format .= '</select>';
|
216 |
-
$format .= '<small>%s</small></td></tr>';
|
217 |
-
|
218 |
-
return (string) sprintf( $format, $id, $display, $id, $id, $note );
|
219 |
-
}
|
220 |
-
|
221 |
-
/**
|
222 |
-
* Return the default options array
|
223 |
-
*
|
224 |
-
* @version 4.6.0
|
225 |
-
* @since 1.0.0
|
226 |
-
* @return array $args
|
227 |
-
*/
|
228 |
-
private function get_default_options () {
|
229 |
-
$args['organization_type'] = 'Organization';
|
230 |
-
$args['name'] = '';
|
231 |
-
$args['url'] = '';
|
232 |
-
$args['logo'] = '';
|
233 |
-
$args['contact_point'] = '';
|
234 |
-
$args['telephone'] = '';
|
235 |
-
$args['contact_type'] = 'customer service';
|
236 |
-
$args['email'] = '';
|
237 |
-
$args['area_served'] = 'US';
|
238 |
-
$args['contact_option_1'] = '';
|
239 |
-
$args['contact_option_2'] = '';
|
240 |
-
$args['available_language'] = 'English';
|
241 |
-
|
242 |
-
foreach ( $this->social_array as $value ) {
|
243 |
-
$args['social'][$value['type']] = '';
|
244 |
-
}
|
245 |
-
|
246 |
-
return (array) $args;
|
247 |
-
}
|
248 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type Organization
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.6.0
|
7 |
+
* @since 1.0.0
|
8 |
+
* @see wp-structuring-admin-db.php
|
9 |
+
* @link https://schema.org/Organization
|
10 |
+
* @link https://developers.google.com/search/docs/data-types/logo
|
11 |
+
* @link https://developers.google.com/search/docs/data-types/corporate-contact
|
12 |
+
* @link https://developers.google.com/search/docs/data-types/social-profile
|
13 |
+
*/
|
14 |
+
class Structuring_Markup_Type_Organization {
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Variable definition.
|
18 |
+
*
|
19 |
+
* @version 4.6.0
|
20 |
+
* @since 1.0.0
|
21 |
+
*/
|
22 |
+
/** Organization Type defined */
|
23 |
+
private $organization_type_array = array(
|
24 |
+
array('type' => 'Organization', 'display' => 'Organization'),
|
25 |
+
array('type' => 'Airline', 'display' => '- Airline'),
|
26 |
+
array('type' => 'Consortium', 'display' => '- Consortium'),
|
27 |
+
array('type' => 'Corporation', 'display' => '- Corporation'),
|
28 |
+
array('type' => 'EducationalOrganization', 'display' => '- EducationalOrganization'),
|
29 |
+
array('type' => 'GovernmentOrganization', 'display' => '- GovernmentOrganization'),
|
30 |
+
array('type' => 'LibrarySystem', 'display' => '- LibrarySystem'),
|
31 |
+
array('type' => 'LocalBusiness', 'display' => '- LocalBusiness'),
|
32 |
+
array('type' => 'MedicalOrganization', 'display' => '- MedicalOrganization'),
|
33 |
+
array('type' => 'NewsMediaOrganization', 'display' => '- NewsMediaOrganization'),
|
34 |
+
array('type' => 'NGO', 'display' => '- NGO'),
|
35 |
+
array('type' => 'PerformingGroup', 'display' => '- PerformingGroup'),
|
36 |
+
array('type' => 'SportsOrganization', 'display' => '- SportsOrganization'),
|
37 |
+
array('type' => 'WorkersUnion', 'display' => '- WorkersUnion')
|
38 |
+
);
|
39 |
+
/** contactType defined. */
|
40 |
+
private $contact_type_array = array(
|
41 |
+
array('type' => 'customer service', 'display' => 'customer service'),
|
42 |
+
array('type' => 'technical support', 'display' => 'technical support'),
|
43 |
+
array('type' => 'billing support', 'display' => 'billing support'),
|
44 |
+
array('type' => 'bill payment', 'display' => 'bill payment'),
|
45 |
+
array('type' => 'sales', 'display' => 'sales'),
|
46 |
+
array('type' => 'reservations', 'display' => 'reservations'),
|
47 |
+
array('type' => 'credit card_support', 'display' => 'credit card support'),
|
48 |
+
array('type' => 'emergency', 'display' => 'emergency'),
|
49 |
+
array('type' => 'baggage tracking', 'display' => 'baggage tracking'),
|
50 |
+
array('type' => 'roadside assistance', 'display' => 'roadside assistance'),
|
51 |
+
array('type' => 'package tracking', 'display' => 'package tracking')
|
52 |
+
);
|
53 |
+
/** Social Profile */
|
54 |
+
private $social_array = array(
|
55 |
+
array('type' => 'facebook', 'display' => 'Facebook'),
|
56 |
+
array('type' => 'twitter', 'display' => 'Twitter'),
|
57 |
+
array('type' => 'google', 'display' => 'Google+'),
|
58 |
+
array('type' => 'instagram', 'display' => 'Instagram'),
|
59 |
+
array('type' => 'youtube', 'display' => 'Youtube'),
|
60 |
+
array('type' => 'linkedin', 'display' => 'LinkedIn'),
|
61 |
+
array('type' => 'myspace', 'display' => 'Myspace'),
|
62 |
+
array('type' => 'pinterest', 'display' => 'Pinterest'),
|
63 |
+
array('type' => 'soundcloud', 'display' => 'SoundCloud'),
|
64 |
+
array('type' => 'tumblr', 'display' => 'Tumblr')
|
65 |
+
);
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Constructor Define.
|
69 |
+
*
|
70 |
+
* @version 4.1.0
|
71 |
+
* @since 1.0.0
|
72 |
+
* @param array $option
|
73 |
+
*/
|
74 |
+
public function __construct ( array $option ) {
|
75 |
+
/** Default Value Set */
|
76 |
+
$option_array = $this->get_default_options();
|
77 |
+
|
78 |
+
if ( !empty( $option ) ) {
|
79 |
+
$option_array = array_merge( $option_array, $option );
|
80 |
+
}
|
81 |
+
$this->page_render( $option_array );
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Form Layout Render
|
86 |
+
*
|
87 |
+
* @version 4.6.0
|
88 |
+
* @since 1.0.0
|
89 |
+
* @param array $option
|
90 |
+
*/
|
91 |
+
private function page_render ( array $option ) {
|
92 |
+
/** Organization Type */
|
93 |
+
$html = '<table class="schema-admin-table">';
|
94 |
+
$html .= '<caption>Organization</caption>';
|
95 |
+
$html .= $this->set_form_select( 'organization_type', 'Organization Type', $option['organization_type'] );
|
96 |
+
$html .= '</table>';
|
97 |
+
echo $html;
|
98 |
+
|
99 |
+
/** Logos */
|
100 |
+
$html = '<table class="schema-admin-table">';
|
101 |
+
$html .= '<caption>Logos</caption>';
|
102 |
+
$html .= '<tr><th class="require"><label for="name">Organization Name :</label></th><td>';
|
103 |
+
$html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" required value="' . esc_attr( $option['name'] ) . '">';
|
104 |
+
$html .= '</td></tr>';
|
105 |
+
$html .= '<tr><th class="require"><label for="url">url :</label></th><td>';
|
106 |
+
$html .= '<input type="text" name="option[' . "url" . ']" id="url" class="regular-text" required value="' . esc_attr( $option['url'] ) . '">';
|
107 |
+
$html .= '</td></tr>';
|
108 |
+
$html .= '<tr><th class="require"><label for="logo">logo :</label></th><td>';
|
109 |
+
$html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" required value="' . esc_attr( $option['logo'] ) . '">';
|
110 |
+
$html .= '<button id="media-upload" class="dashicons-before dashicons-admin-media schema-admin-media-button"></button>';
|
111 |
+
$html .= '</td></tr>';
|
112 |
+
$html .= '</table>';
|
113 |
+
echo $html;
|
114 |
+
|
115 |
+
/** Corporate Contact */
|
116 |
+
$html = '<table class="schema-admin-table">';
|
117 |
+
$html .= '<caption>Corporate Contact</caption>';
|
118 |
+
$html .= '<tr><th><label for="contact_point">contactPoint :</label></th><td>';
|
119 |
+
$html .= '<input type="checkbox" name="option[' . "contact_point" . ']" id="contact_point" value="on"';
|
120 |
+
if ( isset( $option['contact_point'] ) && $option['contact_point'] === 'on' ) {
|
121 |
+
$html .= ' checked="checked"';
|
122 |
+
}
|
123 |
+
$html .= '>Enabled';
|
124 |
+
$html .= '</td></tr>';
|
125 |
+
$html .= '<tr><th><label for="telephone">telephone :</label></th><td>';
|
126 |
+
$html .= '<input type="text" name="option[' . "telephone" . ']" id="telephone" class="regular-text" value="' . esc_attr( $option['telephone'] ) . '" placeholder="e.g. : +1-880-555-1212">';
|
127 |
+
$html .= '</td></tr>';
|
128 |
+
$html .= '<tr><th><label for="contact_type">contactType :</label></th><td>';
|
129 |
+
$html .= '<select id="contact_type" name="option[' . "contact_type" . ']">';
|
130 |
+
foreach ( $this->contact_type_array as $value ) {
|
131 |
+
$html .= '<option value="' . $value['type'] . '"';
|
132 |
+
if ( $value['type'] === $option['contact_type'] ) {
|
133 |
+
$html .= ' selected';
|
134 |
+
}
|
135 |
+
$html .= '>' . $value['display'] . '</option>';
|
136 |
+
}
|
137 |
+
$html .= '</select>';
|
138 |
+
$html .= '</td></tr>';
|
139 |
+
$html .= '<tr><th><label for="email">email :</label></th><td>';
|
140 |
+
$html .= '<input type="email" name="option[' . "email" . ']" id="email" class="regular-text" value="' . esc_attr( $option['email'] ) . '" placeholder="e.g. : info@example.com">';
|
141 |
+
$html .= '</td></tr>';
|
142 |
+
$html .= '<tr><th><label for="area_served">areaServed :</label></th><td>';
|
143 |
+
$html .= '<input type="text" name="option[' . "area_served" . ']" id="area_served" class="regular-text" value="' . esc_attr( $option['area_served'] ) . '">';
|
144 |
+
$html .= '<small>Default : "US" Multiple : "US,CA"</small>';
|
145 |
+
$html .= '</td></tr>';
|
146 |
+
$html .= '<tr><th>contactOption :</th><td>';
|
147 |
+
$html .= '<label><input type="checkbox" name="option[' . "contact_point_1" . ']" id="contact_point_1" value="on"';
|
148 |
+
if ( isset( $option['contact_point_1'] ) && $option['contact_point_1'] === 'on' ) {
|
149 |
+
$html .= ' checked="checked"';
|
150 |
+
}
|
151 |
+
$html .= '>HearingImpairedSupported</label><br>';
|
152 |
+
$html .= '<label><input type="checkbox" name="option[' . "contact_point_2" . ']" id="contact_point_2" value="on"';
|
153 |
+
if ( isset( $option['contact_point_2'] ) && $option['contact_point_2'] === 'on' ) {
|
154 |
+
$html .= ' checked="checked"';
|
155 |
+
}
|
156 |
+
$html .= '>TollFree</label><br>';
|
157 |
+
$html .= '</td></tr>';
|
158 |
+
$html .= '<tr><th><label for="available_language">available Language :</label></th><td>';
|
159 |
+
$html .= '<input type="text" name="option[' . "available_language" . ']" id="available_language" class="regular-text" value="' . esc_attr( $option['available_language'] ) . '">';
|
160 |
+
$html .= '<small>Default : "English" Multiple : "French,English"</small>';
|
161 |
+
$html .= '</td></tr>';
|
162 |
+
$html .= '</table>';
|
163 |
+
echo $html;
|
164 |
+
|
165 |
+
/** Social Profiles */
|
166 |
+
$html = '<table class="schema-admin-table">';
|
167 |
+
$html .= '<caption>Social Profiles</caption>';
|
168 |
+
foreach ( $this->social_array as $value ) {
|
169 |
+
$html .= '<tr><th><label for="' . $value['type'] . '">' . $value['display'] . ' :</label></th><td>';
|
170 |
+
$html .= '<input type="text" name="option[' . "social" . '][' . $value['type'] . ']" id="' . $value['type'] . '" class="regular-text" value="' . esc_attr( $option['social'][$value['type']] ) . '">';
|
171 |
+
$html .= '</td></tr>';
|
172 |
+
}
|
173 |
+
$html .= '</table>';
|
174 |
+
echo $html;
|
175 |
+
|
176 |
+
$html = '<table class="schema-admin-table">';
|
177 |
+
$html .= '<caption>Setting Knowledge</caption>';
|
178 |
+
$html .= '<tr><th>schema.org Organization :</th>';
|
179 |
+
$html .= '<td><a href="https://schema.org/Organization" target="_blank">https://schema.org/Organization</a></td></tr>';
|
180 |
+
$html .= '<tr><th>Google Search Logos :</th>';
|
181 |
+
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/logo" target="_blank">https://developers.google.com/search/docs/data-types/logo</a></td></tr>';
|
182 |
+
$html .= '<tr><th>Google Search Corporate Contact :</th>';
|
183 |
+
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/corporate-contact" target="_blank">https://developers.google.com/search/docs/data-types/corporate-contact</a></td></tr>';
|
184 |
+
$html .= '<tr><th>Google Search Social Profile :</th>';
|
185 |
+
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/social-profile" target="_blank">https://developers.google.com/search/docs/data-types/social-profile</a></td></tr>';
|
186 |
+
$html .= '</table>';
|
187 |
+
echo $html;
|
188 |
+
|
189 |
+
submit_button();
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Return the form select
|
194 |
+
*
|
195 |
+
* @version 4.6.0
|
196 |
+
* @since 4.6.0
|
197 |
+
* @param string $id
|
198 |
+
* @param string $display
|
199 |
+
* @param string $value
|
200 |
+
* @param string $note
|
201 |
+
* @return string $html
|
202 |
+
*/
|
203 |
+
private function set_form_select ( $id, $display, $value = "", $note = "" ) {
|
204 |
+
$value = esc_attr( $value );
|
205 |
+
|
206 |
+
$format = '<tr><th class="require"><label for=%s>%s :</label></th><td>';
|
207 |
+
$format .= '<select id="%s" name="option[%s]">';
|
208 |
+
foreach ( $this->organization_type_array as $args ) {
|
209 |
+
$format .= '<option value="' . $args['type'] . '"';
|
210 |
+
if ( $args['type'] === $value ) {
|
211 |
+
$format .= ' selected';
|
212 |
+
}
|
213 |
+
$format .= '>' . $args['display'] . '</option>';
|
214 |
+
}
|
215 |
+
$format .= '</select>';
|
216 |
+
$format .= '<small>%s</small></td></tr>';
|
217 |
+
|
218 |
+
return (string) sprintf( $format, $id, $display, $id, $id, $note );
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Return the default options array
|
223 |
+
*
|
224 |
+
* @version 4.6.0
|
225 |
+
* @since 1.0.0
|
226 |
+
* @return array $args
|
227 |
+
*/
|
228 |
+
private function get_default_options () {
|
229 |
+
$args['organization_type'] = 'Organization';
|
230 |
+
$args['name'] = '';
|
231 |
+
$args['url'] = '';
|
232 |
+
$args['logo'] = '';
|
233 |
+
$args['contact_point'] = '';
|
234 |
+
$args['telephone'] = '';
|
235 |
+
$args['contact_type'] = 'customer service';
|
236 |
+
$args['email'] = '';
|
237 |
+
$args['area_served'] = 'US';
|
238 |
+
$args['contact_option_1'] = '';
|
239 |
+
$args['contact_option_2'] = '';
|
240 |
+
$args['available_language'] = 'English';
|
241 |
+
|
242 |
+
foreach ( $this->social_array as $value ) {
|
243 |
+
$args['social'][$value['type']] = '';
|
244 |
+
}
|
245 |
+
|
246 |
+
return (array) $args;
|
247 |
+
}
|
248 |
}
|
includes/admin/wp-structuring-admin-type-person.php
CHANGED
@@ -1,122 +1,122 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Type Person
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.5.3
|
7 |
-
* @since 2.4.0
|
8 |
-
* @see wp-structuring-admin-db.php
|
9 |
-
* @link https://schema.org/Person
|
10 |
-
* @link https://developers.google.com/search/docs/data-types/social-profile
|
11 |
-
*/
|
12 |
-
class Structuring_Markup_Type_Person {
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Variable definition.
|
16 |
-
*
|
17 |
-
* @version 2.4.0
|
18 |
-
* @since 2.4.0
|
19 |
-
*/
|
20 |
-
/** Social Profile */
|
21 |
-
private $social_array = array(
|
22 |
-
array("type" => "facebook", "display" => "Facebook"),
|
23 |
-
array("type" => "twitter", "display" => "Twitter"),
|
24 |
-
array("type" => "google", "display" => "Google+"),
|
25 |
-
array("type" => "instagram", "display" => "Instagram"),
|
26 |
-
array("type" => "youtube", "display" => "Youtube"),
|
27 |
-
array("type" => "linkedin", "display" => "LinkedIn"),
|
28 |
-
array("type" => "myspace", "display" => "Myspace"),
|
29 |
-
array("type" => "pinterest", "display" => "Pinterest"),
|
30 |
-
array("type" => "soundcloud", "display" => "SoundCloud"),
|
31 |
-
array("type" => "tumblr", "display" => "Tumblr")
|
32 |
-
);
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Constructor Define.
|
36 |
-
*
|
37 |
-
* @version 2.4.0
|
38 |
-
* @since 2.4.0
|
39 |
-
* @param array $option
|
40 |
-
*/
|
41 |
-
public function __construct ( array $option ) {
|
42 |
-
/** Default Value Set */
|
43 |
-
$option_array = $this->get_default_options();
|
44 |
-
|
45 |
-
if ( !empty( $option ) ) {
|
46 |
-
$option_array = array_merge( $option_array, $option );
|
47 |
-
}
|
48 |
-
|
49 |
-
$this->page_render( $option_array );
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Form Layout Render
|
54 |
-
*
|
55 |
-
* @version 4.5.3
|
56 |
-
* @since 2.4.0
|
57 |
-
* @param array $option
|
58 |
-
*/
|
59 |
-
private function page_render ( array $option ) {
|
60 |
-
/** Basic Settings */
|
61 |
-
$html = '<table class="schema-admin-table">';
|
62 |
-
$html .= '<caption>Basic Settings</caption>';
|
63 |
-
$html .= '<tr><th class="require"><label for="name">Name :</label></th><td>';
|
64 |
-
$html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" required value="' . esc_attr( $option['name'] ) . '">';
|
65 |
-
$html .= '</td></tr>';
|
66 |
-
$html .= '<tr><th class="require"><label for="url">url :</label></th><td>';
|
67 |
-
$html .= '<input type="text" name="option[' . "url" . ']" id="url" class="regular-text" required value="' . esc_attr( $option['url'] ) . '">';
|
68 |
-
$html .= '</td></tr>';
|
69 |
-
$html .= '</table>';
|
70 |
-
echo $html;
|
71 |
-
|
72 |
-
/** Place Settings */
|
73 |
-
$html = '<table class="schema-admin-table">';
|
74 |
-
$html .= '<caption>Place Settings</caption>';
|
75 |
-
$html .= '<tr><th class="require"><label for="addressCountry">addressCountry :</label></th><td>';
|
76 |
-
$html .= '<input type="text" name="option[' . "addressCountry" . ']" id="addressCountry" class="regular-text" required value="' . esc_attr( $option['addressCountry'] ) . '" placeholder="e.g. Japan">';
|
77 |
-
$html .= '</td></tr>';
|
78 |
-
$html .= '</table>';
|
79 |
-
echo $html;
|
80 |
-
|
81 |
-
/** Social Profiles */
|
82 |
-
$html = '<table class="schema-admin-table">';
|
83 |
-
$html .= '<caption>Social Profiles</caption>';
|
84 |
-
foreach ( $this->social_array as $value ) {
|
85 |
-
$html .= '<tr><th><label for="' . $value['type'] . '">' . $value['display'] . ' :</label></th><td>';
|
86 |
-
$html .= '<input type="text" name="option[' . "social" . '][' . $value['type'] . ']" id="' . $value['type'] . '" class="regular-text" value="' . esc_attr( $option['social'][$value['type']] ) . '">';
|
87 |
-
$html .= '</td></tr>';
|
88 |
-
}
|
89 |
-
$html .= '</table>';
|
90 |
-
echo $html;
|
91 |
-
|
92 |
-
$html = '<table class="schema-admin-table">';
|
93 |
-
$html .= '<caption>Setting Knowledge</caption>';
|
94 |
-
$html .= '<tr><th>schema.org Person :</th>';
|
95 |
-
$html .= '<td><a href="https://schema.org/Person" target="_blank">https://schema.org/Person</a></td></tr>';
|
96 |
-
$html .= '<tr><th>Google Search Social Profile :</th>';
|
97 |
-
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/social-profile" target="_blank">https://developers.google.com/search/docs/data-types/social-profile</a></td></tr>';
|
98 |
-
$html .= '</table>';
|
99 |
-
echo $html;
|
100 |
-
|
101 |
-
submit_button();
|
102 |
-
}
|
103 |
-
|
104 |
-
/**
|
105 |
-
* Return the default options array
|
106 |
-
*
|
107 |
-
* @since 4.1.3
|
108 |
-
* @version 2.4.0
|
109 |
-
* @return array $args
|
110 |
-
*/
|
111 |
-
private function get_default_options () {
|
112 |
-
$args['name'] = '';
|
113 |
-
$args['url'] = '';
|
114 |
-
$args['addressCountry'] = '';
|
115 |
-
|
116 |
-
foreach ( $this->social_array as $value ) {
|
117 |
-
$args['social'][$value['type']] = '';
|
118 |
-
}
|
119 |
-
|
120 |
-
return (array) $args;
|
121 |
-
}
|
122 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type Person
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.5.3
|
7 |
+
* @since 2.4.0
|
8 |
+
* @see wp-structuring-admin-db.php
|
9 |
+
* @link https://schema.org/Person
|
10 |
+
* @link https://developers.google.com/search/docs/data-types/social-profile
|
11 |
+
*/
|
12 |
+
class Structuring_Markup_Type_Person {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Variable definition.
|
16 |
+
*
|
17 |
+
* @version 2.4.0
|
18 |
+
* @since 2.4.0
|
19 |
+
*/
|
20 |
+
/** Social Profile */
|
21 |
+
private $social_array = array(
|
22 |
+
array("type" => "facebook", "display" => "Facebook"),
|
23 |
+
array("type" => "twitter", "display" => "Twitter"),
|
24 |
+
array("type" => "google", "display" => "Google+"),
|
25 |
+
array("type" => "instagram", "display" => "Instagram"),
|
26 |
+
array("type" => "youtube", "display" => "Youtube"),
|
27 |
+
array("type" => "linkedin", "display" => "LinkedIn"),
|
28 |
+
array("type" => "myspace", "display" => "Myspace"),
|
29 |
+
array("type" => "pinterest", "display" => "Pinterest"),
|
30 |
+
array("type" => "soundcloud", "display" => "SoundCloud"),
|
31 |
+
array("type" => "tumblr", "display" => "Tumblr")
|
32 |
+
);
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Constructor Define.
|
36 |
+
*
|
37 |
+
* @version 2.4.0
|
38 |
+
* @since 2.4.0
|
39 |
+
* @param array $option
|
40 |
+
*/
|
41 |
+
public function __construct ( array $option ) {
|
42 |
+
/** Default Value Set */
|
43 |
+
$option_array = $this->get_default_options();
|
44 |
+
|
45 |
+
if ( !empty( $option ) ) {
|
46 |
+
$option_array = array_merge( $option_array, $option );
|
47 |
+
}
|
48 |
+
|
49 |
+
$this->page_render( $option_array );
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Form Layout Render
|
54 |
+
*
|
55 |
+
* @version 4.5.3
|
56 |
+
* @since 2.4.0
|
57 |
+
* @param array $option
|
58 |
+
*/
|
59 |
+
private function page_render ( array $option ) {
|
60 |
+
/** Basic Settings */
|
61 |
+
$html = '<table class="schema-admin-table">';
|
62 |
+
$html .= '<caption>Basic Settings</caption>';
|
63 |
+
$html .= '<tr><th class="require"><label for="name">Name :</label></th><td>';
|
64 |
+
$html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" required value="' . esc_attr( $option['name'] ) . '">';
|
65 |
+
$html .= '</td></tr>';
|
66 |
+
$html .= '<tr><th class="require"><label for="url">url :</label></th><td>';
|
67 |
+
$html .= '<input type="text" name="option[' . "url" . ']" id="url" class="regular-text" required value="' . esc_attr( $option['url'] ) . '">';
|
68 |
+
$html .= '</td></tr>';
|
69 |
+
$html .= '</table>';
|
70 |
+
echo $html;
|
71 |
+
|
72 |
+
/** Place Settings */
|
73 |
+
$html = '<table class="schema-admin-table">';
|
74 |
+
$html .= '<caption>Place Settings</caption>';
|
75 |
+
$html .= '<tr><th class="require"><label for="addressCountry">addressCountry :</label></th><td>';
|
76 |
+
$html .= '<input type="text" name="option[' . "addressCountry" . ']" id="addressCountry" class="regular-text" required value="' . esc_attr( $option['addressCountry'] ) . '" placeholder="e.g. Japan">';
|
77 |
+
$html .= '</td></tr>';
|
78 |
+
$html .= '</table>';
|
79 |
+
echo $html;
|
80 |
+
|
81 |
+
/** Social Profiles */
|
82 |
+
$html = '<table class="schema-admin-table">';
|
83 |
+
$html .= '<caption>Social Profiles</caption>';
|
84 |
+
foreach ( $this->social_array as $value ) {
|
85 |
+
$html .= '<tr><th><label for="' . $value['type'] . '">' . $value['display'] . ' :</label></th><td>';
|
86 |
+
$html .= '<input type="text" name="option[' . "social" . '][' . $value['type'] . ']" id="' . $value['type'] . '" class="regular-text" value="' . esc_attr( $option['social'][$value['type']] ) . '">';
|
87 |
+
$html .= '</td></tr>';
|
88 |
+
}
|
89 |
+
$html .= '</table>';
|
90 |
+
echo $html;
|
91 |
+
|
92 |
+
$html = '<table class="schema-admin-table">';
|
93 |
+
$html .= '<caption>Setting Knowledge</caption>';
|
94 |
+
$html .= '<tr><th>schema.org Person :</th>';
|
95 |
+
$html .= '<td><a href="https://schema.org/Person" target="_blank">https://schema.org/Person</a></td></tr>';
|
96 |
+
$html .= '<tr><th>Google Search Social Profile :</th>';
|
97 |
+
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/social-profile" target="_blank">https://developers.google.com/search/docs/data-types/social-profile</a></td></tr>';
|
98 |
+
$html .= '</table>';
|
99 |
+
echo $html;
|
100 |
+
|
101 |
+
submit_button();
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Return the default options array
|
106 |
+
*
|
107 |
+
* @since 4.1.3
|
108 |
+
* @version 2.4.0
|
109 |
+
* @return array $args
|
110 |
+
*/
|
111 |
+
private function get_default_options () {
|
112 |
+
$args['name'] = '';
|
113 |
+
$args['url'] = '';
|
114 |
+
$args['addressCountry'] = '';
|
115 |
+
|
116 |
+
foreach ( $this->social_array as $value ) {
|
117 |
+
$args['social'][$value['type']] = '';
|
118 |
+
}
|
119 |
+
|
120 |
+
return (array) $args;
|
121 |
+
}
|
122 |
}
|
includes/admin/wp-structuring-admin-type-site-navigation.php
CHANGED
@@ -1,85 +1,85 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Site Navigation Element
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.5.3
|
7 |
-
* @since 3.1.0
|
8 |
-
* @see wp-structuring-admin-db.php
|
9 |
-
* @link https://schema.org/SiteNavigationElement
|
10 |
-
*/
|
11 |
-
class Structuring_Markup_Type_Site_Navigation {
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Constructor Define.
|
15 |
-
*
|
16 |
-
* @version 3.1.0
|
17 |
-
* @since 3.1.0
|
18 |
-
* @param array $option
|
19 |
-
*/
|
20 |
-
public function __construct ( array $option ) {
|
21 |
-
/** Default Value Set */
|
22 |
-
if ( empty( $option ) ) {
|
23 |
-
$option = $this->get_default_options( $option );
|
24 |
-
}
|
25 |
-
$this->page_render( $option );
|
26 |
-
}
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Form Layout Render
|
30 |
-
*
|
31 |
-
* @version 4.5.3
|
32 |
-
* @since 3.1.0
|
33 |
-
* @param array $option
|
34 |
-
*/
|
35 |
-
private function page_render ( array $option ) {
|
36 |
-
$html = '<table class="schema-admin-table">';
|
37 |
-
$html .= '<caption>Basic Setting</caption>';
|
38 |
-
$html .= '<tr><th 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;
|
61 |
-
|
62 |
-
$html = '<table class="schema-admin-table">';
|
63 |
-
$html .= '<caption>Setting Knowledge</caption>';
|
64 |
-
$html .= '<tr><th>schema.org SiteNavigationElement :</th>';
|
65 |
-
$html .= '<td><a href="https://schema.org/SiteNavigationElement" target="_blank">https://schema.org/SiteNavigationElement</a></td></tr>';
|
66 |
-
$html .= '</table>';
|
67 |
-
echo $html;
|
68 |
-
|
69 |
-
submit_button();
|
70 |
-
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
* Return the default options array
|
74 |
-
*
|
75 |
-
* @version 3.1.0
|
76 |
-
* @since 3.1.0
|
77 |
-
* @param array $args
|
78 |
-
* @return array $args
|
79 |
-
*/
|
80 |
-
private function get_default_options ( array $args ) {
|
81 |
-
$args['menu_name'] = '';
|
82 |
-
|
83 |
-
return (array) $args;
|
84 |
-
}
|
85 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Site Navigation Element
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.5.3
|
7 |
+
* @since 3.1.0
|
8 |
+
* @see wp-structuring-admin-db.php
|
9 |
+
* @link https://schema.org/SiteNavigationElement
|
10 |
+
*/
|
11 |
+
class Structuring_Markup_Type_Site_Navigation {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Constructor Define.
|
15 |
+
*
|
16 |
+
* @version 3.1.0
|
17 |
+
* @since 3.1.0
|
18 |
+
* @param array $option
|
19 |
+
*/
|
20 |
+
public function __construct ( array $option ) {
|
21 |
+
/** Default Value Set */
|
22 |
+
if ( empty( $option ) ) {
|
23 |
+
$option = $this->get_default_options( $option );
|
24 |
+
}
|
25 |
+
$this->page_render( $option );
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Form Layout Render
|
30 |
+
*
|
31 |
+
* @version 4.5.3
|
32 |
+
* @since 3.1.0
|
33 |
+
* @param array $option
|
34 |
+
*/
|
35 |
+
private function page_render ( array $option ) {
|
36 |
+
$html = '<table class="schema-admin-table">';
|
37 |
+
$html .= '<caption>Basic Setting</caption>';
|
38 |
+
$html .= '<tr><th 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;
|
61 |
+
|
62 |
+
$html = '<table class="schema-admin-table">';
|
63 |
+
$html .= '<caption>Setting Knowledge</caption>';
|
64 |
+
$html .= '<tr><th>schema.org SiteNavigationElement :</th>';
|
65 |
+
$html .= '<td><a href="https://schema.org/SiteNavigationElement" target="_blank">https://schema.org/SiteNavigationElement</a></td></tr>';
|
66 |
+
$html .= '</table>';
|
67 |
+
echo $html;
|
68 |
+
|
69 |
+
submit_button();
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Return the default options array
|
74 |
+
*
|
75 |
+
* @version 3.1.0
|
76 |
+
* @since 3.1.0
|
77 |
+
* @param array $args
|
78 |
+
* @return array $args
|
79 |
+
*/
|
80 |
+
private function get_default_options ( array $args ) {
|
81 |
+
$args['menu_name'] = '';
|
82 |
+
|
83 |
+
return (array) $args;
|
84 |
+
}
|
85 |
}
|
includes/admin/wp-structuring-admin-type-video.php
CHANGED
@@ -1,59 +1,59 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Type Video
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 3.0.5
|
7 |
-
* @since 3.0.0
|
8 |
-
* @see wp-structuring-admin-db.php
|
9 |
-
* @link https://schema.org/VideoObject
|
10 |
-
* @link https://developers.google.com/search/docs/data-types/video
|
11 |
-
*/
|
12 |
-
class Structuring_Markup_Type_Videos {
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Constructor Define.
|
16 |
-
*
|
17 |
-
* @since 3.0.0
|
18 |
-
*/
|
19 |
-
public function __construct () {
|
20 |
-
$this->page_render();
|
21 |
-
}
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Form Layout Render
|
25 |
-
*
|
26 |
-
* @version 3.0.5
|
27 |
-
* @since 3.0.0
|
28 |
-
*/
|
29 |
-
private function page_render () {
|
30 |
-
$html = '<table class="schema-admin-table">';
|
31 |
-
$html .= '<caption>Basic Setting</caption>';
|
32 |
-
$html .= '<tr><th class="require">name :</th><td><small>Post Title</small></td></tr>';
|
33 |
-
$html .= '<tr><th class="require">Description :</th><td><small>Post Description</small></td></tr>';
|
34 |
-
$html .= '<tr><th class="require">thumbnailUrl :</th><td><small>Featured Image URL</small></td></tr>';
|
35 |
-
$html .= '<tr><th class="require">uploadDate :</th><td><small>Update Date</small></td></tr>';
|
36 |
-
$html .= '<tr><th>duration :</th><td><small>Input a custom post: field name "schema_video_duration"</small></td></tr>';
|
37 |
-
$html .= '<tr><th>contentUrl :</th><td><small>Input a custom post: field name "schema_video_content_url"</small></td></tr>';
|
38 |
-
$html .= '<tr><th>embedUrl :</th><td><small>Input a custom post: field name "schema_video_embed_url"</small></td></tr>';
|
39 |
-
$html .= '<tr><th>interactionCount :</th><td><small>Input a custom post: field name "schema_video_interaction_count"</small></td></tr>';
|
40 |
-
$html .= '<tr><th>expires :</th><td><small>Input a custom post: field name "schema_video_expires_date" & "schema_video_expires_time"</small></td></tr>';
|
41 |
-
$html .= '</table>';
|
42 |
-
echo $html;
|
43 |
-
|
44 |
-
$html = '<table class="schema-admin-table">';
|
45 |
-
$html .= '<caption>Setting Knowledge</caption>';
|
46 |
-
$html .= '<tr><th>Custom post name :</th>';
|
47 |
-
$html .= '<td>schema_video_post</td></tr>';
|
48 |
-
$html .= '<tr><th>Archive rewrite name :</th>';
|
49 |
-
$html .= '<td>videos</td></tr>';
|
50 |
-
$html .= '<tr><th>schema.org VideoObject :</th>';
|
51 |
-
$html .= '<td><a href="https://schema.org/VideoObject" target="_blank">https://schema.org/VideoObject</a></td></tr>';
|
52 |
-
$html .= '<tr><th>Google Search Video :</th>';
|
53 |
-
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/video" target="_blank">https://developers.google.com/search/docs/data-types/video</a></td></tr>';
|
54 |
-
$html .= '</table>';
|
55 |
-
echo $html;
|
56 |
-
|
57 |
-
submit_button();
|
58 |
-
}
|
59 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type Video
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 3.0.5
|
7 |
+
* @since 3.0.0
|
8 |
+
* @see wp-structuring-admin-db.php
|
9 |
+
* @link https://schema.org/VideoObject
|
10 |
+
* @link https://developers.google.com/search/docs/data-types/video
|
11 |
+
*/
|
12 |
+
class Structuring_Markup_Type_Videos {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Constructor Define.
|
16 |
+
*
|
17 |
+
* @since 3.0.0
|
18 |
+
*/
|
19 |
+
public function __construct () {
|
20 |
+
$this->page_render();
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Form Layout Render
|
25 |
+
*
|
26 |
+
* @version 3.0.5
|
27 |
+
* @since 3.0.0
|
28 |
+
*/
|
29 |
+
private function page_render () {
|
30 |
+
$html = '<table class="schema-admin-table">';
|
31 |
+
$html .= '<caption>Basic Setting</caption>';
|
32 |
+
$html .= '<tr><th class="require">name :</th><td><small>Post Title</small></td></tr>';
|
33 |
+
$html .= '<tr><th class="require">Description :</th><td><small>Post Description</small></td></tr>';
|
34 |
+
$html .= '<tr><th class="require">thumbnailUrl :</th><td><small>Featured Image URL</small></td></tr>';
|
35 |
+
$html .= '<tr><th class="require">uploadDate :</th><td><small>Update Date</small></td></tr>';
|
36 |
+
$html .= '<tr><th>duration :</th><td><small>Input a custom post: field name "schema_video_duration"</small></td></tr>';
|
37 |
+
$html .= '<tr><th>contentUrl :</th><td><small>Input a custom post: field name "schema_video_content_url"</small></td></tr>';
|
38 |
+
$html .= '<tr><th>embedUrl :</th><td><small>Input a custom post: field name "schema_video_embed_url"</small></td></tr>';
|
39 |
+
$html .= '<tr><th>interactionCount :</th><td><small>Input a custom post: field name "schema_video_interaction_count"</small></td></tr>';
|
40 |
+
$html .= '<tr><th>expires :</th><td><small>Input a custom post: field name "schema_video_expires_date" & "schema_video_expires_time"</small></td></tr>';
|
41 |
+
$html .= '</table>';
|
42 |
+
echo $html;
|
43 |
+
|
44 |
+
$html = '<table class="schema-admin-table">';
|
45 |
+
$html .= '<caption>Setting Knowledge</caption>';
|
46 |
+
$html .= '<tr><th>Custom post name :</th>';
|
47 |
+
$html .= '<td>schema_video_post</td></tr>';
|
48 |
+
$html .= '<tr><th>Archive rewrite name :</th>';
|
49 |
+
$html .= '<td>videos</td></tr>';
|
50 |
+
$html .= '<tr><th>schema.org VideoObject :</th>';
|
51 |
+
$html .= '<td><a href="https://schema.org/VideoObject" target="_blank">https://schema.org/VideoObject</a></td></tr>';
|
52 |
+
$html .= '<tr><th>Google Search Video :</th>';
|
53 |
+
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/video" target="_blank">https://developers.google.com/search/docs/data-types/video</a></td></tr>';
|
54 |
+
$html .= '</table>';
|
55 |
+
echo $html;
|
56 |
+
|
57 |
+
submit_button();
|
58 |
+
}
|
59 |
}
|
includes/admin/wp-structuring-admin-type-website.php
CHANGED
@@ -1,119 +1,119 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Type WebSite
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.5.3
|
7 |
-
* @since 1.0.0
|
8 |
-
* @see wp-structuring-admin-db.php
|
9 |
-
* @link https://schema.org/WebSite
|
10 |
-
* @link https://schema.org/SearchAction
|
11 |
-
* @link https://developers.google.com/search/docs/data-types/sitelinks-searchbox
|
12 |
-
*/
|
13 |
-
class Structuring_Markup_Type_Website {
|
14 |
-
|
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 4.5.3
|
37 |
-
* @since 2.3.3
|
38 |
-
* @param array $option
|
39 |
-
*/
|
40 |
-
private function page_render ( array $option ) {
|
41 |
-
$html = '<table class="schema-admin-table">';
|
42 |
-
$html .= '<caption>Basic Setting</caption>';
|
43 |
-
$html .= '<tr><th class="require"><label for="name">name :</label></th><td>';
|
44 |
-
$html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" required value="' . esc_attr( $option['name'] ) . '">';
|
45 |
-
$html .= '</td></tr>';
|
46 |
-
$html .= '<tr><th><label for="alternateName">alternateName :</label></th><td>';
|
47 |
-
$html .= '<input type="text" name="option[' . "alternateName" . ']" id="alternateName" class="regular-text" value="' . esc_attr( $option['alternateName'] ) . '">';
|
48 |
-
$html .= '</td></tr>';
|
49 |
-
$html .= '<tr><th class="require"><label for="url">url :</label></th><td>';
|
50 |
-
$html .= '<input type="text" name="option[' . "url" . ']" id="url" class="regular-text" required value="' . esc_attr( $option['url'] ) . '">';
|
51 |
-
$html .= '</td></tr>';
|
52 |
-
$html .= '</table>';
|
53 |
-
echo $html;
|
54 |
-
|
55 |
-
$html = '<table class="schema-admin-table">';
|
56 |
-
$html .= '<caption>Sitelink Search Box [ Site ]</caption>';
|
57 |
-
$html .= '<tr><th><label for="potential_action">potentialAction Active :</label></th><td>';
|
58 |
-
$html .= '<label><input type="checkbox" name="option[' . "potential_action" . ']" id="potential_action" value="on"';
|
59 |
-
if ( isset( $option['potential_action'] ) && $option['potential_action'] === 'on' ) {
|
60 |
-
$html .= ' checked="checked"';
|
61 |
-
}
|
62 |
-
$html .= '>Enabled</label>';
|
63 |
-
$html .= '</td></tr>';
|
64 |
-
$html .= '<tr><th><label for="target">target :</label></th><td>';
|
65 |
-
$html .= '<input type="text" name="option[' . "target" . ']" id="target" class="regular-text" value="' . esc_attr( $option['target'] ) . '">';
|
66 |
-
$html .= '</td></tr>';
|
67 |
-
$html .= '</table>';
|
68 |
-
echo $html;
|
69 |
-
|
70 |
-
$html = '<table class="schema-admin-table">';
|
71 |
-
$html .= '<caption>Sitelink Search Box [ App ] *required Sitelink Search Box [ Site ]</caption>';
|
72 |
-
$html .= '<tr><th><label for="potential_action_app">potentialAction Active :</label></th><td>';
|
73 |
-
$html .= '<label><input type="checkbox" name="option[' . "potential_action_app" . ']" id="potential_action_app" value="on"';
|
74 |
-
if ( isset( $option['potential_action_app'] ) && $option['potential_action_app'] === 'on' ) {
|
75 |
-
$html .= ' checked="checked"';
|
76 |
-
}
|
77 |
-
$html .= '>Enabled</label>';
|
78 |
-
$html .= '</td></tr>';
|
79 |
-
$html .= '<tr><th><label for="target_app">target :</label></th><td>';
|
80 |
-
$html .= '<input type="text" name="option[' . "target_app" . ']" id="target_app" class="regular-text" value="' . esc_attr( $option['target_app'] ) . '">';
|
81 |
-
$html .= '</td></tr>';
|
82 |
-
$html .= '</table>';
|
83 |
-
echo $html;
|
84 |
-
|
85 |
-
$html = '<table class="schema-admin-table">';
|
86 |
-
$html .= '<caption>Setting Knowledge</caption>';
|
87 |
-
$html .= '<tr><th>schema.org SearchAction :</th>';
|
88 |
-
$html .= '<td><a href="https://schema.org/WebSite" target="_blank">https://schema.org/WebSite</a></td></tr>';
|
89 |
-
$html .= '<tr><th>schema.org WebSite :</th>';
|
90 |
-
$html .= '<td><a href="https://schema.org/SearchAction" target="_blank">https://schema.org/SearchAction</a></td></tr>';
|
91 |
-
$html .= '<tr><th>Google Search Sitelinks Searchbox :</th>';
|
92 |
-
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/sitelinks-searchbox" target="_blank">https://developers.google.com/search/docs/data-types/sitelinks-searchbox</a></td></tr>';
|
93 |
-
$html .= '</table>';
|
94 |
-
echo $html;
|
95 |
-
|
96 |
-
submit_button();
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Return the default options array
|
101 |
-
*
|
102 |
-
* @version 4.5.0
|
103 |
-
* @since 1.0.0
|
104 |
-
* @return array $args
|
105 |
-
*/
|
106 |
-
private function get_default_options () {
|
107 |
-
$args = array();
|
108 |
-
|
109 |
-
$args['name'] = '';
|
110 |
-
$args['alternateName'] = '';
|
111 |
-
$args['url'] = '';
|
112 |
-
$args['potential_action'] = '';
|
113 |
-
$args['target'] = '';
|
114 |
-
$args['potential_action_app'] = '';
|
115 |
-
$args['target_app'] = '';
|
116 |
-
|
117 |
-
return (array) $args;
|
118 |
-
}
|
119 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type WebSite
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.5.3
|
7 |
+
* @since 1.0.0
|
8 |
+
* @see wp-structuring-admin-db.php
|
9 |
+
* @link https://schema.org/WebSite
|
10 |
+
* @link https://schema.org/SearchAction
|
11 |
+
* @link https://developers.google.com/search/docs/data-types/sitelinks-searchbox
|
12 |
+
*/
|
13 |
+
class Structuring_Markup_Type_Website {
|
14 |
+
|
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 4.5.3
|
37 |
+
* @since 2.3.3
|
38 |
+
* @param array $option
|
39 |
+
*/
|
40 |
+
private function page_render ( array $option ) {
|
41 |
+
$html = '<table class="schema-admin-table">';
|
42 |
+
$html .= '<caption>Basic Setting</caption>';
|
43 |
+
$html .= '<tr><th class="require"><label for="name">name :</label></th><td>';
|
44 |
+
$html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" required value="' . esc_attr( $option['name'] ) . '">';
|
45 |
+
$html .= '</td></tr>';
|
46 |
+
$html .= '<tr><th><label for="alternateName">alternateName :</label></th><td>';
|
47 |
+
$html .= '<input type="text" name="option[' . "alternateName" . ']" id="alternateName" class="regular-text" value="' . esc_attr( $option['alternateName'] ) . '">';
|
48 |
+
$html .= '</td></tr>';
|
49 |
+
$html .= '<tr><th class="require"><label for="url">url :</label></th><td>';
|
50 |
+
$html .= '<input type="text" name="option[' . "url" . ']" id="url" class="regular-text" required value="' . esc_attr( $option['url'] ) . '">';
|
51 |
+
$html .= '</td></tr>';
|
52 |
+
$html .= '</table>';
|
53 |
+
echo $html;
|
54 |
+
|
55 |
+
$html = '<table class="schema-admin-table">';
|
56 |
+
$html .= '<caption>Sitelink Search Box [ Site ]</caption>';
|
57 |
+
$html .= '<tr><th><label for="potential_action">potentialAction Active :</label></th><td>';
|
58 |
+
$html .= '<label><input type="checkbox" name="option[' . "potential_action" . ']" id="potential_action" value="on"';
|
59 |
+
if ( isset( $option['potential_action'] ) && $option['potential_action'] === 'on' ) {
|
60 |
+
$html .= ' checked="checked"';
|
61 |
+
}
|
62 |
+
$html .= '>Enabled</label>';
|
63 |
+
$html .= '</td></tr>';
|
64 |
+
$html .= '<tr><th><label for="target">target :</label></th><td>';
|
65 |
+
$html .= '<input type="text" name="option[' . "target" . ']" id="target" class="regular-text" value="' . esc_attr( $option['target'] ) . '">';
|
66 |
+
$html .= '</td></tr>';
|
67 |
+
$html .= '</table>';
|
68 |
+
echo $html;
|
69 |
+
|
70 |
+
$html = '<table class="schema-admin-table">';
|
71 |
+
$html .= '<caption>Sitelink Search Box [ App ] *required Sitelink Search Box [ Site ]</caption>';
|
72 |
+
$html .= '<tr><th><label for="potential_action_app">potentialAction Active :</label></th><td>';
|
73 |
+
$html .= '<label><input type="checkbox" name="option[' . "potential_action_app" . ']" id="potential_action_app" value="on"';
|
74 |
+
if ( isset( $option['potential_action_app'] ) && $option['potential_action_app'] === 'on' ) {
|
75 |
+
$html .= ' checked="checked"';
|
76 |
+
}
|
77 |
+
$html .= '>Enabled</label>';
|
78 |
+
$html .= '</td></tr>';
|
79 |
+
$html .= '<tr><th><label for="target_app">target :</label></th><td>';
|
80 |
+
$html .= '<input type="text" name="option[' . "target_app" . ']" id="target_app" class="regular-text" value="' . esc_attr( $option['target_app'] ) . '">';
|
81 |
+
$html .= '</td></tr>';
|
82 |
+
$html .= '</table>';
|
83 |
+
echo $html;
|
84 |
+
|
85 |
+
$html = '<table class="schema-admin-table">';
|
86 |
+
$html .= '<caption>Setting Knowledge</caption>';
|
87 |
+
$html .= '<tr><th>schema.org SearchAction :</th>';
|
88 |
+
$html .= '<td><a href="https://schema.org/WebSite" target="_blank">https://schema.org/WebSite</a></td></tr>';
|
89 |
+
$html .= '<tr><th>schema.org WebSite :</th>';
|
90 |
+
$html .= '<td><a href="https://schema.org/SearchAction" target="_blank">https://schema.org/SearchAction</a></td></tr>';
|
91 |
+
$html .= '<tr><th>Google Search Sitelinks Searchbox :</th>';
|
92 |
+
$html .= '<td><a href="https://developers.google.com/search/docs/data-types/sitelinks-searchbox" target="_blank">https://developers.google.com/search/docs/data-types/sitelinks-searchbox</a></td></tr>';
|
93 |
+
$html .= '</table>';
|
94 |
+
echo $html;
|
95 |
+
|
96 |
+
submit_button();
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Return the default options array
|
101 |
+
*
|
102 |
+
* @version 4.5.0
|
103 |
+
* @since 1.0.0
|
104 |
+
* @return array $args
|
105 |
+
*/
|
106 |
+
private function get_default_options () {
|
107 |
+
$args = array();
|
108 |
+
|
109 |
+
$args['name'] = '';
|
110 |
+
$args['alternateName'] = '';
|
111 |
+
$args['url'] = '';
|
112 |
+
$args['potential_action'] = '';
|
113 |
+
$args['target'] = '';
|
114 |
+
$args['potential_action_app'] = '';
|
115 |
+
$args['target_app'] = '';
|
116 |
+
|
117 |
+
return (array) $args;
|
118 |
+
}
|
119 |
}
|
includes/custom/wp-structuring-custom-post-event.php
CHANGED
@@ -1,299 +1,323 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Custom Post "Event"
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.
|
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';
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Event Type.
|
24 |
-
*
|
25 |
-
* @version 3.1.3
|
26 |
-
* @since 3.1.3
|
27 |
-
*/
|
28 |
-
private $event_type = array(
|
29 |
-
"Event",
|
30 |
-
"BusinessEvent",
|
31 |
-
"ChildrensEvent",
|
32 |
-
"ComedyEvent",
|
33 |
-
"DanceEvent",
|
34 |
-
"DeliveryEvent",
|
35 |
-
"EducationEvent",
|
36 |
-
"ExhibitionEvent",
|
37 |
-
"Festival",
|
38 |
-
"FoodEvent",
|
39 |
-
"LiteraryEvent",
|
40 |
-
"MusicEvent",
|
41 |
-
"PublicationEvent",
|
42 |
-
"SaleEvent",
|
43 |
-
"ScreeningEvent",
|
44 |
-
"SocialEvent",
|
45 |
-
"SportsEvent",
|
46 |
-
"TheaterEvent",
|
47 |
-
"VisualArtsEvent"
|
48 |
-
);
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Event Type.
|
52 |
-
*
|
53 |
-
* @version 4.0.2
|
54 |
-
* @since 4.0.2
|
55 |
-
*/
|
56 |
-
private $offers_availability = array(
|
57 |
-
"InStock",
|
58 |
-
"SoldOut",
|
59 |
-
"PreOrder"
|
60 |
-
);
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Constructor Define.
|
64 |
-
*
|
65 |
-
* @version
|
66 |
-
* @since 2.1.0
|
67 |
-
* @param String $text_domain
|
68 |
-
*/
|
69 |
-
public function __construct ( $text_domain ) {
|
70 |
-
$this->text_domain = $text_domain;
|
71 |
-
|
72 |
-
/** Custom post menu controls */
|
73 |
-
$show_flag = __return_false();
|
74 |
-
if ( isset( $_POST['type'] ) && $_POST['type'] === 'event' ) {
|
75 |
-
if ( isset( $_POST['activate'] ) && $_POST['activate'] === 'on' ) {
|
76 |
-
$show_flag = __return_true();
|
77 |
-
}
|
78 |
-
} else {
|
79 |
-
/** DB Connect */
|
80 |
-
$db = new Structuring_Markup_Admin_Db();
|
81 |
-
$results = $db->get_type_options('event');
|
82 |
-
|
83 |
-
if ( isset( $results['activate'] ) && $results['activate'] == 'on' ) {
|
84 |
-
$show_flag = __return_true();
|
85 |
-
}
|
86 |
-
}
|
87 |
-
|
88 |
-
register_post_type(
|
89 |
-
$this->custom_type,
|
90 |
-
array(
|
91 |
-
'labels' => array(
|
92 |
-
'name' => esc_html__( 'Event Posts', $this->text_domain ),
|
93 |
-
'singular_name' => esc_html__( 'Event Posts', $this->text_domain ),
|
94 |
-
'all_items' => esc_html__( 'All Event Posts', $this->text_domain )
|
95 |
-
),
|
96 |
-
'capability_type' => 'post',
|
97 |
-
'has_archive' => true,
|
98 |
-
'hierarchical' => false,
|
99 |
-
'menu_position' => 5,
|
100 |
-
'public' => $show_flag,
|
101 |
-
'query_var' => false,
|
102 |
-
'rewrite' => array( 'with_front' => true, 'slug' => 'events' ),
|
103 |
-
'show_in_menu' => $show_flag,
|
104 |
-
'show_ui' => $show_flag,
|
105 |
-
'supports' => array( 'title', 'editor', 'author', 'thumbnail' )
|
106 |
-
)
|
107 |
-
);
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
*
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
$
|
157 |
-
$
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
$
|
168 |
-
$
|
169 |
-
|
170 |
-
|
171 |
-
$
|
172 |
-
|
173 |
-
$
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
$html
|
178 |
-
$html .= '<
|
179 |
-
$html .=
|
180 |
-
$html .= '
|
181 |
-
$html .= '
|
182 |
-
$html .= '
|
183 |
-
$
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
$html .=
|
191 |
-
$html .= '</
|
192 |
-
$html .= '<
|
193 |
-
$html .=
|
194 |
-
$html .= '</td
|
195 |
-
$html .= '<
|
196 |
-
$html .=
|
197 |
-
$html .= '
|
198 |
-
$html .=
|
199 |
-
$html .= '</td
|
200 |
-
$html .= '<
|
201 |
-
$html .=
|
202 |
-
$html .= '
|
203 |
-
$html .=
|
204 |
-
$html .= '</td
|
205 |
-
$html .= '<
|
206 |
-
$html .=
|
207 |
-
$html .= '
|
208 |
-
$html .=
|
209 |
-
$html .= '</td
|
210 |
-
$html .= '<
|
211 |
-
$html .=
|
212 |
-
$html .= '</
|
213 |
-
$html .= '<
|
214 |
-
$html .= '
|
215 |
-
$html .= '
|
216 |
-
$html .=
|
217 |
-
$html .= '
|
218 |
-
$html .= '
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
$html .= '</
|
227 |
-
$html .= '
|
228 |
-
$html .= '
|
229 |
-
$html .=
|
230 |
-
$html .= '
|
231 |
-
$html .= '
|
232 |
-
$html .= '
|
233 |
-
$html .= '
|
234 |
-
$html .=
|
235 |
-
$html .= '
|
236 |
-
$html .= '
|
237 |
-
$html .= '
|
238 |
-
$html .= '</td></tr>';
|
239 |
-
$html .= '<tr><td><label class="schema-admin-
|
240 |
-
$html .= esc_html__( '
|
241 |
-
$html .= '</label></td><td>';
|
242 |
-
$html .= '<
|
243 |
-
$
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
$html .= '</
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
$
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
'
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Custom Post "Event"
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.7.0
|
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';
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Event Type.
|
24 |
+
*
|
25 |
+
* @version 3.1.3
|
26 |
+
* @since 3.1.3
|
27 |
+
*/
|
28 |
+
private $event_type = array(
|
29 |
+
"Event",
|
30 |
+
"BusinessEvent",
|
31 |
+
"ChildrensEvent",
|
32 |
+
"ComedyEvent",
|
33 |
+
"DanceEvent",
|
34 |
+
"DeliveryEvent",
|
35 |
+
"EducationEvent",
|
36 |
+
"ExhibitionEvent",
|
37 |
+
"Festival",
|
38 |
+
"FoodEvent",
|
39 |
+
"LiteraryEvent",
|
40 |
+
"MusicEvent",
|
41 |
+
"PublicationEvent",
|
42 |
+
"SaleEvent",
|
43 |
+
"ScreeningEvent",
|
44 |
+
"SocialEvent",
|
45 |
+
"SportsEvent",
|
46 |
+
"TheaterEvent",
|
47 |
+
"VisualArtsEvent"
|
48 |
+
);
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Event Type.
|
52 |
+
*
|
53 |
+
* @version 4.0.2
|
54 |
+
* @since 4.0.2
|
55 |
+
*/
|
56 |
+
private $offers_availability = array(
|
57 |
+
"InStock",
|
58 |
+
"SoldOut",
|
59 |
+
"PreOrder"
|
60 |
+
);
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Constructor Define.
|
64 |
+
*
|
65 |
+
* @version 4.7.0
|
66 |
+
* @since 2.1.0
|
67 |
+
* @param String $text_domain
|
68 |
+
*/
|
69 |
+
public function __construct ( $text_domain ) {
|
70 |
+
$this->text_domain = $text_domain;
|
71 |
+
|
72 |
+
/** Custom post menu controls */
|
73 |
+
$show_flag = __return_false();
|
74 |
+
if ( isset( $_POST['type'] ) && $_POST['type'] === 'event' ) {
|
75 |
+
if ( isset( $_POST['activate'] ) && $_POST['activate'] === 'on' ) {
|
76 |
+
$show_flag = __return_true();
|
77 |
+
}
|
78 |
+
} else {
|
79 |
+
/** DB Connect */
|
80 |
+
$db = new Structuring_Markup_Admin_Db();
|
81 |
+
$results = $db->get_type_options('event');
|
82 |
+
|
83 |
+
if ( isset( $results['activate'] ) && $results['activate'] == 'on' ) {
|
84 |
+
$show_flag = __return_true();
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
register_post_type(
|
89 |
+
$this->custom_type,
|
90 |
+
array(
|
91 |
+
'labels' => array(
|
92 |
+
'name' => esc_html__( 'Event Posts', $this->text_domain ),
|
93 |
+
'singular_name' => esc_html__( 'Event Posts', $this->text_domain ),
|
94 |
+
'all_items' => esc_html__( 'All Event Posts', $this->text_domain )
|
95 |
+
),
|
96 |
+
'capability_type' => 'post',
|
97 |
+
'has_archive' => true,
|
98 |
+
'hierarchical' => false,
|
99 |
+
'menu_position' => 5,
|
100 |
+
'public' => $show_flag,
|
101 |
+
'query_var' => false,
|
102 |
+
'rewrite' => array( 'with_front' => true, 'slug' => 'events' ),
|
103 |
+
'show_in_menu' => $show_flag,
|
104 |
+
'show_ui' => $show_flag,
|
105 |
+
'supports' => array( 'title', 'editor', 'author', 'thumbnail' )
|
106 |
+
)
|
107 |
+
);
|
108 |
+
|
109 |
+
register_taxonomy(
|
110 |
+
$this->custom_type . '_cat',
|
111 |
+
$this->custom_type,
|
112 |
+
array(
|
113 |
+
'hierarchical' => true,
|
114 |
+
'label' => esc_html__( 'Categories' ),
|
115 |
+
'public' => true,
|
116 |
+
'show_ui' => true,
|
117 |
+
'update_count_callback' => '_update_post_term_count'
|
118 |
+
)
|
119 |
+
);
|
120 |
+
|
121 |
+
register_taxonomy(
|
122 |
+
$this->custom_type . '_tag',
|
123 |
+
$this->custom_type,
|
124 |
+
array(
|
125 |
+
'hierarchical' => false,
|
126 |
+
'label' => esc_html__( 'Tags' ),
|
127 |
+
'public' => true,
|
128 |
+
'show_ui' => true,
|
129 |
+
'update_count_callback' => '_update_post_term_count'
|
130 |
+
)
|
131 |
+
);
|
132 |
+
|
133 |
+
if ( is_admin() ) {
|
134 |
+
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
135 |
+
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* admin init.
|
141 |
+
*
|
142 |
+
* @version 2.1.0
|
143 |
+
* @since 2.1.0
|
144 |
+
*/
|
145 |
+
public function admin_init () {
|
146 |
+
add_action( 'save_post_' . $this->custom_type, array( $this, 'save_post' ) );
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* admin meta boxes.
|
151 |
+
*
|
152 |
+
* @version 2.1.0
|
153 |
+
* @since 2.1.0
|
154 |
+
*/
|
155 |
+
public function admin_menu () {
|
156 |
+
$custom_field_title = esc_html__( 'Schema.org Type Event', $this->text_domain );
|
157 |
+
add_meta_box( $this->custom_type, $custom_field_title, array( $this, 'set_custom_fields' ), $this->custom_type, 'normal' );
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* Set custom fields.
|
162 |
+
*
|
163 |
+
* @version 4.1.1
|
164 |
+
* @since 2.1.0
|
165 |
+
*/
|
166 |
+
public function set_custom_fields () {
|
167 |
+
$custom_array = get_post_meta( get_the_ID(), $this->custom_type, false );
|
168 |
+
$custom_array = isset( $custom_array[0] ) ? unserialize( $custom_array[0] ) : array();
|
169 |
+
|
170 |
+
/** Default Value Set */
|
171 |
+
$args = $this->get_default_options();
|
172 |
+
|
173 |
+
if ( !empty( $args ) ) {
|
174 |
+
$args = array_merge( $args, $custom_array );
|
175 |
+
}
|
176 |
+
|
177 |
+
$html = '';
|
178 |
+
$html .= '<table class="schema-admin-custom-post">';
|
179 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_event_type">';
|
180 |
+
$html .= esc_html__( 'Event Type', $this->text_domain );
|
181 |
+
$html .= '</label></td><td>';
|
182 |
+
$html .= '<select name="option[' . "schema_event_type" . ']" id="schema_event_type">';
|
183 |
+
foreach( $this->event_type as $value) {
|
184 |
+
$html .= '<option';
|
185 |
+
if ( $value === $args['schema_event_type'] ) {
|
186 |
+
$html .= ' selected="selected"';
|
187 |
+
}
|
188 |
+
$html .= ' value="' . $value . '">' . $value . '</option>';
|
189 |
+
}
|
190 |
+
$html .= '</select>';
|
191 |
+
$html .= '</td></tr>';
|
192 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_event_name">';
|
193 |
+
$html .= esc_html__( 'Event Name', $this->text_domain );
|
194 |
+
$html .= '</label></td><td>';
|
195 |
+
$html .= '<input type="text" name="option[' . "schema_event_name" . ']" id="schema_event_name" class="regular-text" required value="' . esc_attr( $args['schema_event_name'] ) . '">';
|
196 |
+
$html .= '</td></tr>';
|
197 |
+
$html .= '<tr><td><label class="schema-admin-recommended" for="schema_event_description">';
|
198 |
+
$html .= esc_html__( 'Event Description', $this->text_domain );
|
199 |
+
$html .= '</label></td><td>';
|
200 |
+
$html .= '<textarea name="option[' . "schema_event_description" . ']" id="schema_event_description" class="large-text code" rows="3">' . esc_attr( $args['schema_event_description'] ) . '</textarea>';
|
201 |
+
$html .= '</td></tr>';
|
202 |
+
$html .= '<tr><td><label class="schema-admin-recommended" for="schema_event_image">';
|
203 |
+
$html .= esc_html__( 'Event Image', $this->text_domain );
|
204 |
+
$html .= '</label></td><td>';
|
205 |
+
$html .= '<input type="text" name="option[' . "schema_event_image" . ']" id="schema_event_image" class="large-text" value="' . esc_attr( $args['schema_event_image'] ) . '">';
|
206 |
+
$html .= '</td></tr>';
|
207 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_event_date">';
|
208 |
+
$html .= esc_html__( 'Start Date', $this->text_domain );
|
209 |
+
$html .= '</label></td><td>';
|
210 |
+
$html .= '<input type="date" name="option[' . "schema_event_date" . ']" id="schema_event_date" required value="' . esc_attr( $args['schema_event_date'] ) . '">';
|
211 |
+
$html .= '<input type="time" name="option[' . "schema_event_time" . ']" id="schema_event_time" required value="' . esc_attr( $args['schema_event_time'] ) . '">';
|
212 |
+
$html .= '</td></tr>';
|
213 |
+
$html .= '<tr><td><label class="schema-admin-recommended" for="schema_event_date_end">';
|
214 |
+
$html .= esc_html__( 'End Date', $this->text_domain );
|
215 |
+
$html .= '</label></td><td>';
|
216 |
+
$html .= '<input type="date" name="option[' . "schema_event_date_end" . ']" id="schema_event_date" value="' . esc_attr( $args['schema_event_date_end'] ) . '">';
|
217 |
+
$html .= '<input type="time" name="option[' . "schema_event_time_end" . ']" id="schema_event_time" value="' . esc_attr( $args['schema_event_time_end'] ) . '">';
|
218 |
+
$html .= '</td></tr>';
|
219 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_event_url">';
|
220 |
+
$html .= esc_html__( 'Event URL', $this->text_domain );
|
221 |
+
$html .= '</label></td><td>';
|
222 |
+
$html .= '<input type="text" name="option[' . "schema_event_url" . ']" id="schema_event_url" class="regular-text" required value="' . esc_attr( $args['schema_event_url'] ) . '">';
|
223 |
+
$html .= '</td></tr>';
|
224 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_event_place_name">';
|
225 |
+
$html .= esc_html__( 'Place Name', $this->text_domain );
|
226 |
+
$html .= '</label></td><td>';
|
227 |
+
$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'] ) . '">';
|
228 |
+
$html .= '</td></tr>';
|
229 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_event_place_url">';
|
230 |
+
$html .= esc_html__( 'Place URL', $this->text_domain );
|
231 |
+
$html .= '</label></td><td>';
|
232 |
+
$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'] ) . '">';
|
233 |
+
$html .= '</td></tr>';
|
234 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_event_place_address">';
|
235 |
+
$html .= esc_html__( 'Place Address', $this->text_domain );
|
236 |
+
$html .= '</label></td><td>';
|
237 |
+
$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'] ) . '">';
|
238 |
+
$html .= '</td></tr>';
|
239 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_event_type">';
|
240 |
+
$html .= esc_html__( 'Availability', $this->text_domain );
|
241 |
+
$html .= '</label></td><td>';
|
242 |
+
$html .= '<select name="option[' . "schema_event_offers_availability" . ']" id="schema_event_offers_availability">';
|
243 |
+
foreach( $this->offers_availability as $value) {
|
244 |
+
$html .= '<option';
|
245 |
+
if ( $value === $args['schema_event_offers_availability'] ) {
|
246 |
+
$html .= ' selected="selected"';
|
247 |
+
}
|
248 |
+
$html .= ' value="' . $value . '">' . $value . '</option>';
|
249 |
+
}
|
250 |
+
$html .= '</select>';
|
251 |
+
$html .= '</td></tr>';
|
252 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_event_offers_price">';
|
253 |
+
$html .= esc_html__( 'Price', $this->text_domain );
|
254 |
+
$html .= '</label></td><td>';
|
255 |
+
$html .= '<input type="number" name="option[' . "schema_event_offers_price" . ']" id="schema_event_offers_price" required value="' . esc_attr( $args['schema_event_offers_price'] ) . '">';
|
256 |
+
$html .= '</td></tr>';
|
257 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_event_offers_currency">';
|
258 |
+
$html .= esc_html__( 'Currency', $this->text_domain );
|
259 |
+
$html .= '</label></td><td>';
|
260 |
+
$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'] ) . '">';
|
261 |
+
$html .= ' <small>( with <a hre="https://en.wikipedia.org/wiki/ISO_4217#Active_codes" target="_blank">ISO 4217 codes</a> e.g. "USD" )</small>';
|
262 |
+
$html .= '</td></tr>';
|
263 |
+
$html .= '<tr><td><label class="schema-admin-recommended" for="schema_event_offers_date">';
|
264 |
+
$html .= esc_html__( 'validFrom', $this->text_domain );
|
265 |
+
$html .= '</label></td><td>';
|
266 |
+
$html .= '<input type="date" name="option[' . "schema_event_offers_date" . ']" id="schema_event_offers_date" value="' . esc_attr( $args['schema_event_offers_date'] ) . '">';
|
267 |
+
$html .= '<input type="time" name="option[' . "schema_event_offers_time" . ']" id="schema_event_offers_time" value="' . esc_attr( $args['schema_event_offers_time'] ) . '">';
|
268 |
+
$html .= '</td></tr>';
|
269 |
+
$html .= '<tr><td><label class="schema-admin-recommended" for="schema_event_performer_name">';
|
270 |
+
$html .= esc_html__( 'Event Performer', $this->text_domain );
|
271 |
+
$html .= '</label></td><td>';
|
272 |
+
$html .= '<input type="text" name="option[' . "schema_event_performer_name" . ']" id="schema_event_performer_name" class="regular-text" required value="' . esc_attr( $args['schema_event_performer_name'] ) . '">';
|
273 |
+
$html .= '</td></tr>';
|
274 |
+
$html .= '</table>';
|
275 |
+
|
276 |
+
echo $html;
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* Save custom post.
|
281 |
+
*
|
282 |
+
* @version 2.1.0
|
283 |
+
* @since 2.1.0
|
284 |
+
* @param integer $post_id The post ID.
|
285 |
+
*/
|
286 |
+
public function save_post ( $post_id ) {
|
287 |
+
if ( isset( $_POST['option'] ) ) {
|
288 |
+
update_post_meta( $post_id, $this->custom_type, serialize( $_POST['option'] ) );
|
289 |
+
}
|
290 |
+
}
|
291 |
+
|
292 |
+
/**
|
293 |
+
* Return the default options array
|
294 |
+
*
|
295 |
+
* @version 4.0.2
|
296 |
+
* @since 3.2.3
|
297 |
+
* @return array $args
|
298 |
+
*/
|
299 |
+
private function get_default_options () {
|
300 |
+
$args = array(
|
301 |
+
'schema_event_type' => 'Event',
|
302 |
+
'schema_event_name' => '',
|
303 |
+
'schema_event_description' => '',
|
304 |
+
'schema_event_image' => '',
|
305 |
+
'schema_event_date' => date( 'Y-m-d' ),
|
306 |
+
'schema_event_time' => date( 'h:i' ),
|
307 |
+
'schema_event_date_end' => '',
|
308 |
+
'schema_event_time_end' => '',
|
309 |
+
'schema_event_url' => '',
|
310 |
+
'schema_event_place_name' => '',
|
311 |
+
'schema_event_place_url' => '',
|
312 |
+
'schema_event_place_address' => '',
|
313 |
+
'schema_event_offers_availability' => 'InStock',
|
314 |
+
'schema_event_offers_price' => 0,
|
315 |
+
'schema_event_offers_currency' => esc_html__( 'USD', $this->text_domain ),
|
316 |
+
'schema_event_offers_date' => '',
|
317 |
+
'schema_event_offers_time' => '',
|
318 |
+
'schema_event_performer_name' => ''
|
319 |
+
);
|
320 |
+
|
321 |
+
return (array) $args;
|
322 |
+
}
|
323 |
}
|
includes/custom/wp-structuring-custom-post-video.php
CHANGED
@@ -1,204 +1,228 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Custom Post "Video"
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.
|
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';
|
21 |
-
|
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 ) {
|
30 |
-
$this->text_domain = $text_domain;
|
31 |
-
|
32 |
-
/** Custom post menu controls */
|
33 |
-
$show_flag = __return_false();
|
34 |
-
if ( isset( $_POST['type'] ) && $_POST['type'] === 'video' ) {
|
35 |
-
if ( isset( $_POST['activate'] ) && $_POST['activate'] === 'on' ) {
|
36 |
-
$show_flag = __return_true();
|
37 |
-
}
|
38 |
-
} else {
|
39 |
-
/** DB Connect */
|
40 |
-
$db = new Structuring_Markup_Admin_Db();
|
41 |
-
$results = $db->get_type_options('video');
|
42 |
-
|
43 |
-
if ( isset( $results['activate'] ) && $results['activate'] == 'on' ) {
|
44 |
-
$show_flag = __return_true();
|
45 |
-
}
|
46 |
-
}
|
47 |
-
|
48 |
-
register_post_type(
|
49 |
-
$this->custom_type,
|
50 |
-
array(
|
51 |
-
'labels' => array(
|
52 |
-
'name' => esc_html__( 'Video Posts', $this->text_domain ),
|
53 |
-
'singular_name' => esc_html__( 'Video Posts', $this->text_domain ),
|
54 |
-
'all_items' => esc_html__( 'All Video Posts', $this->text_domain )
|
55 |
-
),
|
56 |
-
'capability_type' => 'post',
|
57 |
-
'has_archive' => true,
|
58 |
-
'hierarchical' => false,
|
59 |
-
'menu_position' => 5,
|
60 |
-
'public' => $show_flag,
|
61 |
-
'query_var' => false,
|
62 |
-
'rewrite' => array( 'with_front' => true, 'slug' => 'videos' ),
|
63 |
-
'show_in_menu' => $show_flag,
|
64 |
-
'show_ui' => $show_flag,
|
65 |
-
'supports' => array( 'title', 'editor', 'author', 'thumbnail' )
|
66 |
-
)
|
67 |
-
);
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
*
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
$
|
117 |
-
$
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
$
|
128 |
-
$
|
129 |
-
|
130 |
-
|
131 |
-
$
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
$html
|
138 |
-
$html .= '
|
139 |
-
$html .= '<
|
140 |
-
$html .= '
|
141 |
-
$html .= '
|
142 |
-
$html .=
|
143 |
-
$html .= '</
|
144 |
-
$html .= '<
|
145 |
-
$html .= '
|
146 |
-
$html .= '
|
147 |
-
$html .=
|
148 |
-
$html .= '</
|
149 |
-
$html .= '<
|
150 |
-
$html .= '
|
151 |
-
$html .= '
|
152 |
-
$html .=
|
153 |
-
$html .= '</
|
154 |
-
$html .= '<
|
155 |
-
$html .= '
|
156 |
-
$html .= '
|
157 |
-
$html .=
|
158 |
-
$html .= '
|
159 |
-
$html .= '
|
160 |
-
$html .= '<
|
161 |
-
$html .= '
|
162 |
-
$html .= '</
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
$
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Custom Post "Video"
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.7.0
|
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';
|
21 |
+
|
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 ) {
|
30 |
+
$this->text_domain = $text_domain;
|
31 |
+
|
32 |
+
/** Custom post menu controls */
|
33 |
+
$show_flag = __return_false();
|
34 |
+
if ( isset( $_POST['type'] ) && $_POST['type'] === 'video' ) {
|
35 |
+
if ( isset( $_POST['activate'] ) && $_POST['activate'] === 'on' ) {
|
36 |
+
$show_flag = __return_true();
|
37 |
+
}
|
38 |
+
} else {
|
39 |
+
/** DB Connect */
|
40 |
+
$db = new Structuring_Markup_Admin_Db();
|
41 |
+
$results = $db->get_type_options('video');
|
42 |
+
|
43 |
+
if ( isset( $results['activate'] ) && $results['activate'] == 'on' ) {
|
44 |
+
$show_flag = __return_true();
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
register_post_type(
|
49 |
+
$this->custom_type,
|
50 |
+
array(
|
51 |
+
'labels' => array(
|
52 |
+
'name' => esc_html__( 'Video Posts', $this->text_domain ),
|
53 |
+
'singular_name' => esc_html__( 'Video Posts', $this->text_domain ),
|
54 |
+
'all_items' => esc_html__( 'All Video Posts', $this->text_domain )
|
55 |
+
),
|
56 |
+
'capability_type' => 'post',
|
57 |
+
'has_archive' => true,
|
58 |
+
'hierarchical' => false,
|
59 |
+
'menu_position' => 5,
|
60 |
+
'public' => $show_flag,
|
61 |
+
'query_var' => false,
|
62 |
+
'rewrite' => array( 'with_front' => true, 'slug' => 'videos' ),
|
63 |
+
'show_in_menu' => $show_flag,
|
64 |
+
'show_ui' => $show_flag,
|
65 |
+
'supports' => array( 'title', 'editor', 'author', 'thumbnail' )
|
66 |
+
)
|
67 |
+
);
|
68 |
+
|
69 |
+
register_taxonomy(
|
70 |
+
$this->custom_type . '_cat',
|
71 |
+
$this->custom_type,
|
72 |
+
array(
|
73 |
+
'hierarchical' => true,
|
74 |
+
'label' => esc_html__( 'Categories' ),
|
75 |
+
'public' => true,
|
76 |
+
'show_ui' => true,
|
77 |
+
'update_count_callback' => '_update_post_term_count'
|
78 |
+
)
|
79 |
+
);
|
80 |
+
|
81 |
+
register_taxonomy(
|
82 |
+
$this->custom_type . '_tag',
|
83 |
+
$this->custom_type,
|
84 |
+
array(
|
85 |
+
'hierarchical' => false,
|
86 |
+
'label' => esc_html__( 'Tags' ),
|
87 |
+
'public' => true,
|
88 |
+
'show_ui' => true,
|
89 |
+
'update_count_callback' => '_update_post_term_count'
|
90 |
+
)
|
91 |
+
);
|
92 |
+
|
93 |
+
if ( is_admin() ) {
|
94 |
+
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
95 |
+
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* admin init.
|
101 |
+
*
|
102 |
+
* @version 3.0.0
|
103 |
+
* @since 3.0.0
|
104 |
+
*/
|
105 |
+
public function admin_init () {
|
106 |
+
add_action( 'save_post_' . $this->custom_type, array( $this, 'save_post' ) );
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* admin meta boxes.
|
111 |
+
*
|
112 |
+
* @version 3.0.0
|
113 |
+
* @since 3.0.0
|
114 |
+
*/
|
115 |
+
public function admin_menu () {
|
116 |
+
$custom_field_title = esc_html__( 'Schema.org Type Video', $this->text_domain );
|
117 |
+
add_meta_box( $this->custom_type, $custom_field_title, array( $this, 'set_custom_fields' ), $this->custom_type, 'normal' );
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Set custom fields.
|
122 |
+
*
|
123 |
+
* @version 4.1.1
|
124 |
+
* @since 3.0.0
|
125 |
+
*/
|
126 |
+
public function set_custom_fields () {
|
127 |
+
$custom_array = get_post_meta( get_the_ID(), $this->custom_type, false );
|
128 |
+
$custom_array = isset( $custom_array[0] ) ? unserialize( $custom_array[0] ) : array();
|
129 |
+
|
130 |
+
/** Default Value Set */
|
131 |
+
$args = $this->get_default_options();
|
132 |
+
|
133 |
+
if ( !empty( $args ) ) {
|
134 |
+
$args = array_merge( $args, $custom_array );
|
135 |
+
}
|
136 |
+
|
137 |
+
$html = '';
|
138 |
+
$html .= '<table class="schema-admin-custom-post">';
|
139 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_video_name">';
|
140 |
+
$html .= esc_html__( 'Video Name', $this->text_domain );
|
141 |
+
$html .= '</label></td><td>';
|
142 |
+
$html .= '<input type="text" name="option[' . "schema_video_name" . ']" id="schema_video_name" class="regular-text" required value="' . esc_attr( $args['schema_video_name'] ) . '">';
|
143 |
+
$html .= '</td></tr>';
|
144 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_video_description">';
|
145 |
+
$html .= esc_html__( 'Video Description', $this->text_domain );
|
146 |
+
$html .= '</label></td><td>';
|
147 |
+
$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>';
|
148 |
+
$html .= '</td></tr>';
|
149 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_video_thumbnail_url">';
|
150 |
+
$html .= esc_html__( 'Thumbnail Url', $this->text_domain );
|
151 |
+
$html .= '</label></td><td>';
|
152 |
+
$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'] ) . '">';
|
153 |
+
$html .= '</td></tr>';
|
154 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_video_upload_date">';
|
155 |
+
$html .= esc_html__( 'Upload Date', $this->text_domain );
|
156 |
+
$html .= '</label></td><td>';
|
157 |
+
$html .= '<input type="date" name="option[' . "schema_video_upload_date" . ']" id="schema_video_upload_date" required value="' . esc_attr( $args['schema_video_upload_date'] ) . '">';
|
158 |
+
$html .= '<input type="time" name="option[' . "schema_video_upload_time" . ']" id="schema_video_upload_time" required value="' . esc_attr( $args['schema_video_upload_time'] ) . '">';
|
159 |
+
$html .= '</td></tr>';
|
160 |
+
$html .= '<tr><td><label class="schema-admin-recommended" for="schema_video_duration">';
|
161 |
+
$html .= esc_html__( 'duration', $this->text_domain );
|
162 |
+
$html .= '</label></td><td>';
|
163 |
+
$html .= '<input type="text" name="option[' . "schema_video_duration" . ']" id="schema_video_duration" class="regular-text" value="' . esc_attr( $args['schema_video_duration'] ) . '">';
|
164 |
+
$html .= '</td></tr>';
|
165 |
+
$html .= '<tr><td><label class="schema-admin-recommended" for="schema_video_content_url">';
|
166 |
+
$html .= esc_html__( 'contentURL', $this->text_domain );
|
167 |
+
$html .= '</label></td><td>';
|
168 |
+
$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'] ) . '">';
|
169 |
+
$html .= '</td></tr>';
|
170 |
+
$html .= '<tr><td><label class="schema-admin-recommended" for="schema_video_embed_url">';
|
171 |
+
$html .= esc_html__( 'embedURL', $this->text_domain );
|
172 |
+
$html .= '</label></td><td>';
|
173 |
+
$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'] ) . '">';
|
174 |
+
$html .= '</td></tr>';
|
175 |
+
$html .= '<tr><td><label class="schema-admin-recommended" for="schema_video_interaction_count">';
|
176 |
+
$html .= esc_html__( 'interactionCount', $this->text_domain );
|
177 |
+
$html .= '</label></td><td>';
|
178 |
+
$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'] ) . '">';
|
179 |
+
$html .= '</td></tr>';
|
180 |
+
$html .= '<tr><td><label class="schema-admin-recommended" for="schema_video_expires_date">';
|
181 |
+
$html .= esc_html__( 'expires', $this->text_domain );
|
182 |
+
$html .= '</label></td><td>';
|
183 |
+
$html .= '<input type="date" name="option[' . "schema_video_expires_date" . ']" id="schema_video_expires_date" value="' . esc_attr( $args['schema_video_expires_date'] ) . '">';
|
184 |
+
$html .= '<input type="time" name="option[' . "schema_video_expires_time" . ']" id="schema_video_expires_time" value="' . esc_attr( $args['schema_video_expires_time'] ) . '">';
|
185 |
+
$html .= '</td></tr>';
|
186 |
+
$html .= '</table>';
|
187 |
+
|
188 |
+
echo $html;
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Save custom post.
|
193 |
+
*
|
194 |
+
* @version 3.0.0
|
195 |
+
* @since 3.0.0
|
196 |
+
* @param integer $post_id The post ID.
|
197 |
+
*/
|
198 |
+
public function save_post ( $post_id ) {
|
199 |
+
if ( isset( $_POST['option'] ) ) {
|
200 |
+
update_post_meta( $post_id, $this->custom_type, serialize( $_POST['option'] ) );
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Return the default options array
|
206 |
+
*
|
207 |
+
* @version 3.2.3
|
208 |
+
* @since 3.2.3
|
209 |
+
* @return array $args
|
210 |
+
*/
|
211 |
+
private function get_default_options () {
|
212 |
+
$args = array(
|
213 |
+
'schema_video_name' => '',
|
214 |
+
'schema_video_description' => '',
|
215 |
+
'schema_video_thumbnail_url' => '',
|
216 |
+
'schema_video_upload_date' => '',
|
217 |
+
'schema_video_upload_time' => '',
|
218 |
+
'schema_video_duration' => '',
|
219 |
+
'schema_video_content_url' => '',
|
220 |
+
'schema_video_embed_url' => '',
|
221 |
+
'schema_video_interaction_count' => '',
|
222 |
+
'schema_video_expires_date' => '',
|
223 |
+
'schema_video_expires_time' => '',
|
224 |
+
);
|
225 |
+
|
226 |
+
return (array) $args;
|
227 |
+
}
|
228 |
}
|
includes/meta/wp-structuring-meta-article.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Schema.org Type Article
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version 4.
|
7 |
* @since 4.0.0
|
8 |
* @link http://schema.org/Article
|
9 |
* @link https://developers.google.com/search/docs/data-types/articles
|
@@ -33,7 +33,7 @@ class Structuring_Markup_Meta_Article {
|
|
33 |
/**
|
34 |
* Setting schema.org Article
|
35 |
*
|
36 |
-
* @version 4.
|
37 |
* @since 4.0.0
|
38 |
* @param array $options
|
39 |
* @return array $args
|
@@ -51,7 +51,7 @@ class Structuring_Markup_Meta_Article {
|
|
51 |
"@type" => "WebPage",
|
52 |
"@id" => get_permalink( $post->ID )
|
53 |
),
|
54 |
-
"headline" => mb_substr(
|
55 |
"datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
|
56 |
"dateModified" => get_the_modified_time( DATE_ISO8601, $post->ID ),
|
57 |
"author" => array(
|
@@ -64,24 +64,21 @@ class Structuring_Markup_Meta_Article {
|
|
64 |
if ( has_post_thumbnail( $post->ID ) ) {
|
65 |
$images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
|
66 |
$images_args = array(
|
67 |
-
"image" =>
|
68 |
-
"@type" => "ImageObject",
|
69 |
-
"url" => $images[0],
|
70 |
-
"width" => $images[1],
|
71 |
-
"height" => $images[2]
|
72 |
-
)
|
73 |
);
|
74 |
$args = array_merge( $args, $images_args );
|
75 |
} elseif ( isset( $options['content_image'] ) && $options['content_image'] === 'on' ) {
|
76 |
if ( $images = $this->utility->get_content_image( $post->post_content ) ) {
|
77 |
if ( $size = $this->utility->get_image_dimensions( $images ) ) {
|
78 |
$images_args = array(
|
79 |
-
"image" =>
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
|
|
85 |
);
|
86 |
$args = array_merge( $args, $images_args );
|
87 |
}
|
@@ -89,18 +86,13 @@ class Structuring_Markup_Meta_Article {
|
|
89 |
} elseif ( isset( $options['default_image'] ) ) {
|
90 |
if ( $size = $this->utility->get_image_dimensions( $options['default_image'] ) ) {
|
91 |
$images_args = array(
|
92 |
-
"image" =>
|
93 |
-
"@type" => "ImageObject",
|
94 |
-
"url" => esc_html( $options['default_image'] ),
|
95 |
-
"width" => $size['width'],
|
96 |
-
"height" => $size['height']
|
97 |
-
)
|
98 |
);
|
99 |
$args = array_merge( $args, $images_args );
|
100 |
}
|
101 |
}
|
102 |
|
103 |
-
if ( isset( $options['name'] ) ) {
|
104 |
$publisher_args = array(
|
105 |
"publisher" => array(
|
106 |
"@type" => "Organization",
|
@@ -111,18 +103,12 @@ class Structuring_Markup_Meta_Article {
|
|
111 |
$options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
|
112 |
|
113 |
if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
|
114 |
-
$publisher_args['publisher']['logo'] =
|
115 |
-
"@type" => "ImageObject",
|
116 |
-
"url" => $options['logo'],
|
117 |
-
"width" => $logo['width'],
|
118 |
-
"height" => $logo['height']
|
119 |
-
);
|
120 |
} else if ( !empty( $options['logo'] ) ) {
|
121 |
-
$publisher_args['publisher']['logo'] =
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
"height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
|
126 |
);
|
127 |
}
|
128 |
$args = array_merge( $args, $publisher_args );
|
@@ -143,6 +129,27 @@ class Structuring_Markup_Meta_Article {
|
|
143 |
}
|
144 |
}
|
145 |
|
146 |
-
return (array) $args;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
}
|
148 |
}
|
3 |
* Schema.org Type Article
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 4.7.0
|
7 |
* @since 4.0.0
|
8 |
* @link http://schema.org/Article
|
9 |
* @link https://developers.google.com/search/docs/data-types/articles
|
33 |
/**
|
34 |
* Setting schema.org Article
|
35 |
*
|
36 |
+
* @version 4.7.0
|
37 |
* @since 4.0.0
|
38 |
* @param array $options
|
39 |
* @return array $args
|
51 |
"@type" => "WebPage",
|
52 |
"@id" => get_permalink( $post->ID )
|
53 |
),
|
54 |
+
"headline" => mb_substr( $this->utility->escape_text( $post->post_title ), 0, 110 ),
|
55 |
"datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
|
56 |
"dateModified" => get_the_modified_time( DATE_ISO8601, $post->ID ),
|
57 |
"author" => array(
|
64 |
if ( has_post_thumbnail( $post->ID ) ) {
|
65 |
$images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
|
66 |
$images_args = array(
|
67 |
+
"image" => $this->set_image_object( $images[0], $images[1], $images[2] )
|
|
|
|
|
|
|
|
|
|
|
68 |
);
|
69 |
$args = array_merge( $args, $images_args );
|
70 |
} elseif ( isset( $options['content_image'] ) && $options['content_image'] === 'on' ) {
|
71 |
if ( $images = $this->utility->get_content_image( $post->post_content ) ) {
|
72 |
if ( $size = $this->utility->get_image_dimensions( $images ) ) {
|
73 |
$images_args = array(
|
74 |
+
"image" => $this->set_image_object( $images, $size['width'], $size['height'] )
|
75 |
+
);
|
76 |
+
$args = array_merge( $args, $images_args );
|
77 |
+
}
|
78 |
+
} elseif ( isset( $options['default_image'] ) ) {
|
79 |
+
if ($size = $this->utility->get_image_dimensions( $options['default_image'] ) ) {
|
80 |
+
$images_args = array(
|
81 |
+
"image" => $this->set_image_object( esc_html( $options['default_image'] ), $size['width'], $size['height'] )
|
82 |
);
|
83 |
$args = array_merge( $args, $images_args );
|
84 |
}
|
86 |
} elseif ( isset( $options['default_image'] ) ) {
|
87 |
if ( $size = $this->utility->get_image_dimensions( $options['default_image'] ) ) {
|
88 |
$images_args = array(
|
89 |
+
"image" => $this->set_image_object( esc_html( $options['default_image'] ), $size['width'], $size['height'] )
|
|
|
|
|
|
|
|
|
|
|
90 |
);
|
91 |
$args = array_merge( $args, $images_args );
|
92 |
}
|
93 |
}
|
94 |
|
95 |
+
if ( isset( $options['name'] ) && !empty( $options['name'] ) ) {
|
96 |
$publisher_args = array(
|
97 |
"publisher" => array(
|
98 |
"@type" => "Organization",
|
103 |
$options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
|
104 |
|
105 |
if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
|
106 |
+
$publisher_args['publisher']['logo'] = $this->set_image_object( $options['logo'], $logo['width'], $logo['height'] );
|
|
|
|
|
|
|
|
|
|
|
107 |
} else if ( !empty( $options['logo'] ) ) {
|
108 |
+
$publisher_args['publisher']['logo'] = $this->set_image_object(
|
109 |
+
$options['logo'],
|
110 |
+
isset( $options['logo-width'] ) ? ( int ) $options['logo-width'] : 0,
|
111 |
+
isset( $options['logo-height'] ) ? ( int ) $options['logo-height'] : 0
|
|
|
112 |
);
|
113 |
}
|
114 |
$args = array_merge( $args, $publisher_args );
|
129 |
}
|
130 |
}
|
131 |
|
132 |
+
return ( array ) $args;
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Setting ImageObject
|
137 |
+
*
|
138 |
+
* @version 4.7.0
|
139 |
+
* @since 4.7.0
|
140 |
+
* @param string $url
|
141 |
+
* @param integer $width
|
142 |
+
* @param integer $height
|
143 |
+
* @return array $args
|
144 |
+
*/
|
145 |
+
public function set_image_object ( $url, $width, $height ) {
|
146 |
+
$args = array(
|
147 |
+
"@type" => "ImageObject",
|
148 |
+
"url" => $url,
|
149 |
+
"width" => $width,
|
150 |
+
"height" => $height
|
151 |
+
);
|
152 |
+
|
153 |
+
return ( array ) $args;
|
154 |
}
|
155 |
}
|
includes/meta/wp-structuring-meta-blog-posting.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Schema.org Type BlogPosting
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version 4.
|
7 |
* @since 4.0.0
|
8 |
* @link http://schema.org/BlogPosting
|
9 |
* @link https://developers.google.com/search/docs/data-types/articles
|
@@ -33,7 +33,7 @@ class Structuring_Markup_Meta_Blog_Posting {
|
|
33 |
/**
|
34 |
* Setting schema.org BlogPosting
|
35 |
*
|
36 |
-
* @version 4.
|
37 |
* @since 4.0.0
|
38 |
* @param array $options
|
39 |
* @return array $args
|
@@ -51,7 +51,7 @@ class Structuring_Markup_Meta_Blog_Posting {
|
|
51 |
"@type" => "WebPage",
|
52 |
"@id" => get_permalink( $post->ID )
|
53 |
),
|
54 |
-
"headline" => mb_substr(
|
55 |
"datePublished" => get_the_time( DATE_ISO8601, $post->ID ), "dateModified" => get_the_modified_time( DATE_ISO8601, $post->ID ),
|
56 |
"author" => array(
|
57 |
"@type" => "Person",
|
@@ -62,26 +62,22 @@ class Structuring_Markup_Meta_Blog_Posting {
|
|
62 |
|
63 |
if ( has_post_thumbnail( $post->ID ) ) {
|
64 |
$images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
|
65 |
-
|
66 |
$images_args = array(
|
67 |
-
|
68 |
-
"@type" => "ImageObject",
|
69 |
-
"url" => $images[0],
|
70 |
-
"width" => $images[1],
|
71 |
-
"height" => $images[2]
|
72 |
-
)
|
73 |
);
|
74 |
$args = array_merge( $args, $images_args );
|
75 |
} elseif ( isset( $options['content_image'] ) && $options['content_image'] === 'on' ) {
|
76 |
if ( $images = $this->utility->get_content_image( $post->post_content ) ) {
|
77 |
if ( $size = $this->utility->get_image_dimensions( $images ) ) {
|
78 |
$images_args = array(
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
|
|
85 |
);
|
86 |
$args = array_merge( $args, $images_args );
|
87 |
}
|
@@ -89,18 +85,13 @@ class Structuring_Markup_Meta_Blog_Posting {
|
|
89 |
} elseif ( isset( $options['default_image'] ) ) {
|
90 |
if ( $size = $this->utility->get_image_dimensions( $options['default_image'] ) ) {
|
91 |
$images_args = array(
|
92 |
-
|
93 |
-
"@type" => "ImageObject",
|
94 |
-
"url" => esc_html( $options['default_image'] ),
|
95 |
-
"width" => $size['width'],
|
96 |
-
"height" => $size['height']
|
97 |
-
)
|
98 |
);
|
99 |
$args = array_merge( $args, $images_args );
|
100 |
}
|
101 |
}
|
102 |
|
103 |
-
if ( isset( $options['name'] ) ) {
|
104 |
$publisher_args = array(
|
105 |
"publisher" => array(
|
106 |
"@type" => "Organization",
|
@@ -111,18 +102,12 @@ class Structuring_Markup_Meta_Blog_Posting {
|
|
111 |
$options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
|
112 |
|
113 |
if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
|
114 |
-
$publisher_args['publisher']['logo'] =
|
115 |
-
"@type" => "ImageObject",
|
116 |
-
"url" => $options['logo'],
|
117 |
-
"width" => $logo['width'],
|
118 |
-
"height" => $logo['height']
|
119 |
-
);
|
120 |
} else if ( !empty( $options['logo'] ) ) {
|
121 |
-
$publisher_args['publisher']['logo'] =
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
"height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
|
126 |
);
|
127 |
}
|
128 |
$args = array_merge( $args, $publisher_args );
|
@@ -143,6 +128,27 @@ class Structuring_Markup_Meta_Blog_Posting {
|
|
143 |
}
|
144 |
}
|
145 |
|
146 |
-
return (array) $args;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
}
|
148 |
}
|
3 |
* Schema.org Type BlogPosting
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 4.7.0
|
7 |
* @since 4.0.0
|
8 |
* @link http://schema.org/BlogPosting
|
9 |
* @link https://developers.google.com/search/docs/data-types/articles
|
33 |
/**
|
34 |
* Setting schema.org BlogPosting
|
35 |
*
|
36 |
+
* @version 4.7.0
|
37 |
* @since 4.0.0
|
38 |
* @param array $options
|
39 |
* @return array $args
|
51 |
"@type" => "WebPage",
|
52 |
"@id" => get_permalink( $post->ID )
|
53 |
),
|
54 |
+
"headline" => mb_substr( $this->utility->escape_text( $post->post_title ), 0, 110 ),
|
55 |
"datePublished" => get_the_time( DATE_ISO8601, $post->ID ), "dateModified" => get_the_modified_time( DATE_ISO8601, $post->ID ),
|
56 |
"author" => array(
|
57 |
"@type" => "Person",
|
62 |
|
63 |
if ( has_post_thumbnail( $post->ID ) ) {
|
64 |
$images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
|
|
|
65 |
$images_args = array(
|
66 |
+
"image" => $this->set_image_object( $images[0], $images[1], $images[2] )
|
|
|
|
|
|
|
|
|
|
|
67 |
);
|
68 |
$args = array_merge( $args, $images_args );
|
69 |
} elseif ( isset( $options['content_image'] ) && $options['content_image'] === 'on' ) {
|
70 |
if ( $images = $this->utility->get_content_image( $post->post_content ) ) {
|
71 |
if ( $size = $this->utility->get_image_dimensions( $images ) ) {
|
72 |
$images_args = array(
|
73 |
+
"image" => $this->set_image_object( $images, $size['width'], $size['height'] )
|
74 |
+
);
|
75 |
+
$args = array_merge( $args, $images_args );
|
76 |
+
}
|
77 |
+
} elseif ( isset( $options['default_image'] ) ) {
|
78 |
+
if ($size = $this->utility->get_image_dimensions( $options['default_image'] ) ) {
|
79 |
+
$images_args = array(
|
80 |
+
"image" => $this->set_image_object( esc_html( $options['default_image'] ), $size['width'], $size['height'] )
|
81 |
);
|
82 |
$args = array_merge( $args, $images_args );
|
83 |
}
|
85 |
} elseif ( isset( $options['default_image'] ) ) {
|
86 |
if ( $size = $this->utility->get_image_dimensions( $options['default_image'] ) ) {
|
87 |
$images_args = array(
|
88 |
+
"image" => $this->set_image_object( esc_html( $options['default_image'] ), $size['width'], $size['height'] )
|
|
|
|
|
|
|
|
|
|
|
89 |
);
|
90 |
$args = array_merge( $args, $images_args );
|
91 |
}
|
92 |
}
|
93 |
|
94 |
+
if ( isset( $options['name'] ) && !empty( $options['name'] ) ) {
|
95 |
$publisher_args = array(
|
96 |
"publisher" => array(
|
97 |
"@type" => "Organization",
|
102 |
$options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
|
103 |
|
104 |
if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
|
105 |
+
$publisher_args['publisher']['logo'] = $this->set_image_object( $options['logo'], $logo['width'], $logo['height'] );
|
|
|
|
|
|
|
|
|
|
|
106 |
} else if ( !empty( $options['logo'] ) ) {
|
107 |
+
$publisher_args['publisher']['logo'] = $this->set_image_object(
|
108 |
+
$options['logo'],
|
109 |
+
isset( $options['logo-width'] ) ? ( int ) $options['logo-width'] : 0,
|
110 |
+
isset( $options['logo-height'] ) ? ( int ) $options['logo-height'] : 0
|
|
|
111 |
);
|
112 |
}
|
113 |
$args = array_merge( $args, $publisher_args );
|
128 |
}
|
129 |
}
|
130 |
|
131 |
+
return ( array ) $args;
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Setting ImageObject
|
136 |
+
*
|
137 |
+
* @version 4.7.0
|
138 |
+
* @since 4.7.0
|
139 |
+
* @param string $url
|
140 |
+
* @param integer $width
|
141 |
+
* @param integer $height
|
142 |
+
* @return array $args
|
143 |
+
*/
|
144 |
+
public function set_image_object ( $url, $width, $height ) {
|
145 |
+
$args = array(
|
146 |
+
"@type" => "ImageObject",
|
147 |
+
"url" => $url,
|
148 |
+
"width" => $width,
|
149 |
+
"height" => $height
|
150 |
+
);
|
151 |
+
|
152 |
+
return ( array ) $args;
|
153 |
}
|
154 |
}
|
includes/meta/wp-structuring-meta-breadcrumb.php
CHANGED
@@ -1,50 +1,50 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Type Breadcrumb
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.0.0
|
7 |
-
* @since 4.0.0
|
8 |
-
* @see wp-structuring-short-code-breadcrumb.php
|
9 |
-
* @link https://schema.org/BreadcrumbList
|
10 |
-
* @link https://developers.google.com/search/docs/data-types/breadcrumbs
|
11 |
-
*/
|
12 |
-
class Structuring_Markup_Meta_Breadcrumb {
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Setting schema.org Breadcrumb
|
16 |
-
*
|
17 |
-
* @version 4.0.0
|
18 |
-
* @since 4.0.0
|
19 |
-
* @param array $options
|
20 |
-
* @return array $args
|
21 |
-
*/
|
22 |
-
public function set_meta ( array $options ) {
|
23 |
-
$obj = new Structuring_Markup_ShortCode_Breadcrumb();
|
24 |
-
$item_array = $obj->breadcrumb_array_setting( $options );
|
25 |
-
|
26 |
-
if ( $item_array ) {
|
27 |
-
/** itemListElement build */
|
28 |
-
$item_list_element = array();
|
29 |
-
$position = 1;
|
30 |
-
foreach ($item_array as $item) {
|
31 |
-
$item_list_element[] = array(
|
32 |
-
"@type" => "ListItem",
|
33 |
-
"position" => $position,
|
34 |
-
"item" => $item
|
35 |
-
);
|
36 |
-
$position++;
|
37 |
-
}
|
38 |
-
|
39 |
-
/** Breadcrumb Schema build */
|
40 |
-
$args = array(
|
41 |
-
"@context" => "http://schema.org",
|
42 |
-
"@type" => "BreadcrumbList",
|
43 |
-
"itemListElement" => $item_list_element
|
44 |
-
);
|
45 |
-
|
46 |
-
return (array) $args;
|
47 |
-
}
|
48 |
-
}
|
49 |
-
|
50 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type Breadcrumb
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.0.0
|
7 |
+
* @since 4.0.0
|
8 |
+
* @see wp-structuring-short-code-breadcrumb.php
|
9 |
+
* @link https://schema.org/BreadcrumbList
|
10 |
+
* @link https://developers.google.com/search/docs/data-types/breadcrumbs
|
11 |
+
*/
|
12 |
+
class Structuring_Markup_Meta_Breadcrumb {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Setting schema.org Breadcrumb
|
16 |
+
*
|
17 |
+
* @version 4.0.0
|
18 |
+
* @since 4.0.0
|
19 |
+
* @param array $options
|
20 |
+
* @return array $args
|
21 |
+
*/
|
22 |
+
public function set_meta ( array $options ) {
|
23 |
+
$obj = new Structuring_Markup_ShortCode_Breadcrumb();
|
24 |
+
$item_array = $obj->breadcrumb_array_setting( $options );
|
25 |
+
|
26 |
+
if ( $item_array ) {
|
27 |
+
/** itemListElement build */
|
28 |
+
$item_list_element = array();
|
29 |
+
$position = 1;
|
30 |
+
foreach ($item_array as $item) {
|
31 |
+
$item_list_element[] = array(
|
32 |
+
"@type" => "ListItem",
|
33 |
+
"position" => $position,
|
34 |
+
"item" => $item
|
35 |
+
);
|
36 |
+
$position++;
|
37 |
+
}
|
38 |
+
|
39 |
+
/** Breadcrumb Schema build */
|
40 |
+
$args = array(
|
41 |
+
"@context" => "http://schema.org",
|
42 |
+
"@type" => "BreadcrumbList",
|
43 |
+
"itemListElement" => $item_list_element
|
44 |
+
);
|
45 |
+
|
46 |
+
return (array) $args;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
}
|
includes/meta/wp-structuring-meta-event.php
CHANGED
@@ -1,95 +1,95 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Type Event
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.0.2
|
7 |
-
* @since 4.0.0
|
8 |
-
* @link http://schema.org/Event
|
9 |
-
* @link http://schema.org/Place
|
10 |
-
* @link http://schema.org/Offer
|
11 |
-
* @link https://developers.google.com/search/docs/data-types/events
|
12 |
-
*/
|
13 |
-
class Structuring_Markup_Meta_Event {
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Setting schema.org Event
|
17 |
-
*
|
18 |
-
* @version 4.0.2
|
19 |
-
* @since 4.0.0
|
20 |
-
* @return array $args
|
21 |
-
*/
|
22 |
-
public function set_meta () {
|
23 |
-
global $post;
|
24 |
-
$meta = get_post_meta( $post->ID, 'schema_event_post', false );
|
25 |
-
|
26 |
-
if ( isset( $meta[0] ) ) {
|
27 |
-
$meta = unserialize( $meta[0] );
|
28 |
-
|
29 |
-
// @type: Event
|
30 |
-
if ( !isset( $meta['schema_event_type']) ) $meta['schema_event_type'] = 'Event';
|
31 |
-
if ( !isset( $meta['schema_event_name']) ) $meta['schema_event_name'] = '';
|
32 |
-
if ( !isset( $meta['schema_event_date']) ) $meta['schema_event_date'] = date('Y-m-d');
|
33 |
-
if ( !isset( $meta['schema_event_time']) ) $meta['schema_event_time'] = date('h:i');
|
34 |
-
if ( !isset( $meta['schema_event_url']) ) $meta['schema_event_url'] = '';
|
35 |
-
if ( !isset( $meta['schema_event_place_name'] ) ) $meta['schema_event_place_name'] = '';
|
36 |
-
if ( !isset( $meta['schema_event_place_url'] ) ) $meta['schema_event_place_url'] = '';
|
37 |
-
if ( !isset( $meta['schema_event_place_address'] ) ) $meta['schema_event_place_address'] = '';
|
38 |
-
if ( !isset( $meta['schema_event_offers_price'] ) ) $meta['schema_event_offers_price'] = 0;
|
39 |
-
if ( !isset( $meta['schema_event_offers_currency'] ) ) $meta['schema_event_offers_currency'] = '';
|
40 |
-
|
41 |
-
$args = array(
|
42 |
-
"@context" => "http://schema.org",
|
43 |
-
"@type" => esc_html( $meta['schema_event_type'] ),
|
44 |
-
"name" => esc_html( $meta['schema_event_name'] ),
|
45 |
-
"startDate" => esc_html( $meta['schema_event_date'] ) . 'T' . esc_html( $meta['schema_event_time'] ),
|
46 |
-
"url" => esc_url( $meta['schema_event_url'] ),
|
47 |
-
"location" => array(
|
48 |
-
"@type" => "Place",
|
49 |
-
"sameAs" => esc_url( $meta['schema_event_place_url'] ),
|
50 |
-
"name" => esc_html( $meta['schema_event_place_name'] ),
|
51 |
-
"address" => esc_html( $meta['schema_event_place_address'] )
|
52 |
-
)
|
53 |
-
);
|
54 |
-
|
55 |
-
// @type: Event recommended items
|
56 |
-
if ( isset( $meta['schema_event_description'] ) && $meta['schema_event_description'] !== '' ) {
|
57 |
-
$args['description'] = esc_html( $meta['schema_event_description'] );
|
58 |
-
}
|
59 |
-
if ( isset( $meta['schema_event_image'] ) && $meta['schema_event_image'] !== '' ) {
|
60 |
-
$args['image'] = esc_html( $meta['schema_event_image'] );
|
61 |
-
}
|
62 |
-
if ( isset( $meta['schema_event_date_end'] ) && $meta['schema_event_date_end'] !== '' && isset( $meta['schema_event_time_end'] ) && $meta['schema_event_time_end'] !== '' ) {
|
63 |
-
$args['endDate'] = esc_html( $meta['schema_event_date_end'] ) . 'T' . esc_html( $meta['schema_event_time_end'] );
|
64 |
-
}
|
65 |
-
|
66 |
-
// @type: Offer
|
67 |
-
$offer = array(
|
68 |
-
"@type" => "Offer",
|
69 |
-
"price" => esc_html( $meta['schema_event_offers_price'] ),
|
70 |
-
"priceCurrency" => esc_html( $meta['schema_event_offers_currency'] ),
|
71 |
-
"url" => esc_url( $meta['schema_event_url'] )
|
72 |
-
);
|
73 |
-
|
74 |
-
// @type: Offer recommended items
|
75 |
-
if ( isset( $meta['schema_event_offers_availability'] ) && $meta['schema_event_offers_availability'] !== '' ) {
|
76 |
-
$offer['availability'] = "http://schema.org/" . esc_html( $meta['schema_event_offers_availability'] );
|
77 |
-
}
|
78 |
-
if ( isset( $meta['schema_event_offers_date'] ) && $meta['schema_event_offers_date'] !== '' && isset( $meta['schema_event_offers_time'] ) && $meta['schema_event_offers_time'] !== '' ) {
|
79 |
-
$offer['validFrom'] = esc_html( $meta['schema_event_offers_date'] ) . 'T' . esc_html( $meta['schema_event_offers_time'] );
|
80 |
-
}
|
81 |
-
|
82 |
-
$args['offers'] = $offer;
|
83 |
-
|
84 |
-
// @type: PerformingGroup recommended items
|
85 |
-
if ( isset( $meta['schema_event_performer_name'] ) && $meta['schema_event_performer_name'] !== '' ) {
|
86 |
-
$args['performer'] = array(
|
87 |
-
"@type" => "PerformingGroup",
|
88 |
-
"name" => esc_html( $meta['schema_event_performer_name'] )
|
89 |
-
);
|
90 |
-
}
|
91 |
-
|
92 |
-
return (array) $args;
|
93 |
-
}
|
94 |
-
}
|
95 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type Event
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.0.2
|
7 |
+
* @since 4.0.0
|
8 |
+
* @link http://schema.org/Event
|
9 |
+
* @link http://schema.org/Place
|
10 |
+
* @link http://schema.org/Offer
|
11 |
+
* @link https://developers.google.com/search/docs/data-types/events
|
12 |
+
*/
|
13 |
+
class Structuring_Markup_Meta_Event {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Setting schema.org Event
|
17 |
+
*
|
18 |
+
* @version 4.0.2
|
19 |
+
* @since 4.0.0
|
20 |
+
* @return array $args
|
21 |
+
*/
|
22 |
+
public function set_meta () {
|
23 |
+
global $post;
|
24 |
+
$meta = get_post_meta( $post->ID, 'schema_event_post', false );
|
25 |
+
|
26 |
+
if ( isset( $meta[0] ) ) {
|
27 |
+
$meta = unserialize( $meta[0] );
|
28 |
+
|
29 |
+
// @type: Event
|
30 |
+
if ( !isset( $meta['schema_event_type']) ) $meta['schema_event_type'] = 'Event';
|
31 |
+
if ( !isset( $meta['schema_event_name']) ) $meta['schema_event_name'] = '';
|
32 |
+
if ( !isset( $meta['schema_event_date']) ) $meta['schema_event_date'] = date('Y-m-d');
|
33 |
+
if ( !isset( $meta['schema_event_time']) ) $meta['schema_event_time'] = date('h:i');
|
34 |
+
if ( !isset( $meta['schema_event_url']) ) $meta['schema_event_url'] = '';
|
35 |
+
if ( !isset( $meta['schema_event_place_name'] ) ) $meta['schema_event_place_name'] = '';
|
36 |
+
if ( !isset( $meta['schema_event_place_url'] ) ) $meta['schema_event_place_url'] = '';
|
37 |
+
if ( !isset( $meta['schema_event_place_address'] ) ) $meta['schema_event_place_address'] = '';
|
38 |
+
if ( !isset( $meta['schema_event_offers_price'] ) ) $meta['schema_event_offers_price'] = 0;
|
39 |
+
if ( !isset( $meta['schema_event_offers_currency'] ) ) $meta['schema_event_offers_currency'] = '';
|
40 |
+
|
41 |
+
$args = array(
|
42 |
+
"@context" => "http://schema.org",
|
43 |
+
"@type" => esc_html( $meta['schema_event_type'] ),
|
44 |
+
"name" => esc_html( $meta['schema_event_name'] ),
|
45 |
+
"startDate" => esc_html( $meta['schema_event_date'] ) . 'T' . esc_html( $meta['schema_event_time'] ),
|
46 |
+
"url" => esc_url( $meta['schema_event_url'] ),
|
47 |
+
"location" => array(
|
48 |
+
"@type" => "Place",
|
49 |
+
"sameAs" => esc_url( $meta['schema_event_place_url'] ),
|
50 |
+
"name" => esc_html( $meta['schema_event_place_name'] ),
|
51 |
+
"address" => esc_html( $meta['schema_event_place_address'] )
|
52 |
+
)
|
53 |
+
);
|
54 |
+
|
55 |
+
// @type: Event recommended items
|
56 |
+
if ( isset( $meta['schema_event_description'] ) && $meta['schema_event_description'] !== '' ) {
|
57 |
+
$args['description'] = esc_html( $meta['schema_event_description'] );
|
58 |
+
}
|
59 |
+
if ( isset( $meta['schema_event_image'] ) && $meta['schema_event_image'] !== '' ) {
|
60 |
+
$args['image'] = esc_html( $meta['schema_event_image'] );
|
61 |
+
}
|
62 |
+
if ( isset( $meta['schema_event_date_end'] ) && $meta['schema_event_date_end'] !== '' && isset( $meta['schema_event_time_end'] ) && $meta['schema_event_time_end'] !== '' ) {
|
63 |
+
$args['endDate'] = esc_html( $meta['schema_event_date_end'] ) . 'T' . esc_html( $meta['schema_event_time_end'] );
|
64 |
+
}
|
65 |
+
|
66 |
+
// @type: Offer
|
67 |
+
$offer = array(
|
68 |
+
"@type" => "Offer",
|
69 |
+
"price" => esc_html( $meta['schema_event_offers_price'] ),
|
70 |
+
"priceCurrency" => esc_html( $meta['schema_event_offers_currency'] ),
|
71 |
+
"url" => esc_url( $meta['schema_event_url'] )
|
72 |
+
);
|
73 |
+
|
74 |
+
// @type: Offer recommended items
|
75 |
+
if ( isset( $meta['schema_event_offers_availability'] ) && $meta['schema_event_offers_availability'] !== '' ) {
|
76 |
+
$offer['availability'] = "http://schema.org/" . esc_html( $meta['schema_event_offers_availability'] );
|
77 |
+
}
|
78 |
+
if ( isset( $meta['schema_event_offers_date'] ) && $meta['schema_event_offers_date'] !== '' && isset( $meta['schema_event_offers_time'] ) && $meta['schema_event_offers_time'] !== '' ) {
|
79 |
+
$offer['validFrom'] = esc_html( $meta['schema_event_offers_date'] ) . 'T' . esc_html( $meta['schema_event_offers_time'] );
|
80 |
+
}
|
81 |
+
|
82 |
+
$args['offers'] = $offer;
|
83 |
+
|
84 |
+
// @type: PerformingGroup recommended items
|
85 |
+
if ( isset( $meta['schema_event_performer_name'] ) && $meta['schema_event_performer_name'] !== '' ) {
|
86 |
+
$args['performer'] = array(
|
87 |
+
"@type" => "PerformingGroup",
|
88 |
+
"name" => esc_html( $meta['schema_event_performer_name'] )
|
89 |
+
);
|
90 |
+
}
|
91 |
+
|
92 |
+
return (array) $args;
|
93 |
+
}
|
94 |
+
}
|
95 |
}
|
includes/meta/wp-structuring-meta-local-business.php
CHANGED
@@ -1,143 +1,143 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Type LocalBusiness
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.6.0
|
7 |
-
* @since 4.0.0
|
8 |
-
* @see wp-structuring-opening-hours.php
|
9 |
-
* @link http://schema.org/LocalBusiness
|
10 |
-
* @link https://schema.org/GeoCircle
|
11 |
-
* @link https://developers.google.com/search/docs/data-types/local-businesses
|
12 |
-
*/
|
13 |
-
class Structuring_Markup_Meta_LocalBusiness {
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Setting schema.org LocalBusiness
|
17 |
-
*
|
18 |
-
* @version 4.6.0
|
19 |
-
* @since 4.0.0
|
20 |
-
* @param array $options
|
21 |
-
* @return array $args
|
22 |
-
*/
|
23 |
-
public function set_meta ( array $options ) {
|
24 |
-
|
25 |
-
/** weekType defined. */
|
26 |
-
$week_array = array(
|
27 |
-
array( 'type' => 'Mo', 'display' => 'Monday' ),
|
28 |
-
array( 'type' => 'Tu', 'display' => 'Tuesday' ),
|
29 |
-
array( 'type' => 'We', 'display' => 'Wednesday' ),
|
30 |
-
array( 'type' => 'Th', 'display' => 'Thursday' ),
|
31 |
-
array( 'type' => 'Fr', 'display' => 'Friday' ),
|
32 |
-
array( 'type' => 'Sa', 'display' => 'Saturday' ),
|
33 |
-
array( 'type' => 'Su', 'display' => 'Sunday' )
|
34 |
-
);
|
35 |
-
|
36 |
-
$args = array(
|
37 |
-
'@context' => 'http://schema.org',
|
38 |
-
'@type' => isset( $options['business_type'] ) ? esc_html( $options['business_type'] ) : 'LocalBusiness',
|
39 |
-
'name' => isset( $options['name'] ) ? esc_html( $options['name'] ) : '',
|
40 |
-
'image' => isset( $options['image'] ) ? esc_html( $options['image'] ) : '',
|
41 |
-
'url' => isset( $options['url'] ) ? esc_url( $options['url'] ) : ''
|
42 |
-
);
|
43 |
-
|
44 |
-
if ( isset( $options['telephone'] ) && !empty( $options['telephone'] ) ) {
|
45 |
-
$args['telephone'] = esc_html( $options['telephone'] );
|
46 |
-
}
|
47 |
-
|
48 |
-
if ( isset( $options['food_active'] ) && $options['food_active'] === 'on' ) {
|
49 |
-
if ( isset( $options['menu'] ) && $options['menu'] !== '' ) {
|
50 |
-
$args['menu'] = esc_url( $options['menu'] );
|
51 |
-
}
|
52 |
-
if ( isset( $options['accepts_reservations'] ) && $options['accepts_reservations'] === 'on' ) {
|
53 |
-
$args['acceptsReservations'] = 'True';
|
54 |
-
} else {
|
55 |
-
$args['acceptsReservations'] = 'False';
|
56 |
-
}
|
57 |
-
if ( isset( $options['serves_cuisine'] ) && $options['serves_cuisine'] !== '' ) {
|
58 |
-
$args['servesCuisine'] = esc_html( $options['serves_cuisine'] );
|
59 |
-
}
|
60 |
-
}
|
61 |
-
|
62 |
-
$address_array['address'] = array(
|
63 |
-
'@type' => 'PostalAddress',
|
64 |
-
'streetAddress' => isset( $options['street_address'] ) ? esc_html( $options['street_address'] ) : '',
|
65 |
-
'addressLocality' => isset( $options['address_locality'] ) ? esc_html( $options['address_locality'] ) : '',
|
66 |
-
'postalCode' => isset( $options['postal_code'] ) ? esc_html( $options['postal_code'] ) : '',
|
67 |
-
'addressCountry' => isset( $options['address_country'] ) ? esc_html( $options['address_country'] ) : ''
|
68 |
-
);
|
69 |
-
|
70 |
-
if ( isset( $options['address_region'] ) && !empty( $options['address_region'] ) ) {
|
71 |
-
$address_array['address']['addressRegion'] = esc_html( $options['address_region'] );
|
72 |
-
}
|
73 |
-
|
74 |
-
$args = array_merge( $args, $address_array );
|
75 |
-
$geo_array = array();
|
76 |
-
|
77 |
-
if ( isset( $options['geo_active'] ) && $options['geo_active'] === 'on' ) {
|
78 |
-
$geo_array['geo'] = array(
|
79 |
-
'@type' => 'GeoCoordinates',
|
80 |
-
'latitude' => isset( $options['latitude'] ) ? esc_html(floatval($options['latitude'])) : '',
|
81 |
-
'longitude' => isset( $options['longitude'] ) ? esc_html(floatval($options['longitude'])) : ''
|
82 |
-
);
|
83 |
-
}
|
84 |
-
|
85 |
-
if ( isset( $options['geo_circle_active'] ) && $options['geo_circle_active'] === 'on' ) {
|
86 |
-
$place_array['location'] = array( '@type' => 'Place' );
|
87 |
-
$place_array['location']['geo'] = array(
|
88 |
-
'@type' => 'GeoCircle',
|
89 |
-
'geoRadius' => isset( $options['geo_circle_radius'] ) ? esc_html( floatval( $options['geo_circle_radius'] ) ) : ''
|
90 |
-
);
|
91 |
-
if ( isset( $options['geo_active'] ) && $options['geo_active'] === 'on' ) {
|
92 |
-
$place_array['location']['geo']['geoMidpoint'] = $geo_array['geo'];
|
93 |
-
}
|
94 |
-
$args = array_merge( $args, $place_array );
|
95 |
-
} else {
|
96 |
-
if ( isset( $options['geo_active'] ) && $options['geo_active'] === 'on' ) {
|
97 |
-
$args = array_merge( $args, $geo_array );
|
98 |
-
}
|
99 |
-
}
|
100 |
-
|
101 |
-
/* openingHours */
|
102 |
-
$active_days = array();
|
103 |
-
foreach ( $week_array as $value ) {
|
104 |
-
if ( isset( $options[$value['type']] ) && $options[$value['type']] === 'on' ) {
|
105 |
-
$active_days[$value['type']] = $options['week'][$value['type']];
|
106 |
-
}
|
107 |
-
}
|
108 |
-
|
109 |
-
if( !empty( $active_days ) ) {
|
110 |
-
|
111 |
-
$obj = new Structuring_Markup_Opening_Hours( $active_days );
|
112 |
-
$opening_hours = $obj->display();
|
113 |
-
|
114 |
-
$opening_array['openingHours'] = array();
|
115 |
-
|
116 |
-
foreach( $opening_hours as $value ) {
|
117 |
-
$opening_array['openingHours'][] = $value;
|
118 |
-
}
|
119 |
-
|
120 |
-
$args = array_merge( $args, $opening_array );
|
121 |
-
|
122 |
-
}
|
123 |
-
|
124 |
-
if ( isset( $options['holiday_active'] ) && $options['holiday_active'] === 'on' ) {
|
125 |
-
$holiday_array['openingHoursSpecification'] = array(
|
126 |
-
'@type' => 'OpeningHoursSpecification',
|
127 |
-
'opens' => isset( $options['holiday_open'] ) ? esc_html( $options['holiday_open'] ) : '',
|
128 |
-
'closes' => isset( $options['holiday_close'] ) ? esc_html( $options['holiday_close'] ) : '',
|
129 |
-
'validFrom' => isset( $options['holiday_valid_from'] ) ? esc_html( $options['holiday_valid_from'] ) : '',
|
130 |
-
'validThrough' => isset( $options['holiday_valid_through'] ) ? esc_html( $options['holiday_valid_through'] ) : ''
|
131 |
-
);
|
132 |
-
$args = array_merge( $args, $holiday_array );
|
133 |
-
}
|
134 |
-
|
135 |
-
if ( isset( $options['price_range'] ) && !empty( $options['price_range'] ) ) {
|
136 |
-
$price_array['priceRange'] = $options['price_range'];
|
137 |
-
$args = array_merge( $args, $price_array );
|
138 |
-
}
|
139 |
-
|
140 |
-
return (array) $args;
|
141 |
-
}
|
142 |
-
|
143 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type LocalBusiness
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.6.0
|
7 |
+
* @since 4.0.0
|
8 |
+
* @see wp-structuring-opening-hours.php
|
9 |
+
* @link http://schema.org/LocalBusiness
|
10 |
+
* @link https://schema.org/GeoCircle
|
11 |
+
* @link https://developers.google.com/search/docs/data-types/local-businesses
|
12 |
+
*/
|
13 |
+
class Structuring_Markup_Meta_LocalBusiness {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Setting schema.org LocalBusiness
|
17 |
+
*
|
18 |
+
* @version 4.6.0
|
19 |
+
* @since 4.0.0
|
20 |
+
* @param array $options
|
21 |
+
* @return array $args
|
22 |
+
*/
|
23 |
+
public function set_meta ( array $options ) {
|
24 |
+
|
25 |
+
/** weekType defined. */
|
26 |
+
$week_array = array(
|
27 |
+
array( 'type' => 'Mo', 'display' => 'Monday' ),
|
28 |
+
array( 'type' => 'Tu', 'display' => 'Tuesday' ),
|
29 |
+
array( 'type' => 'We', 'display' => 'Wednesday' ),
|
30 |
+
array( 'type' => 'Th', 'display' => 'Thursday' ),
|
31 |
+
array( 'type' => 'Fr', 'display' => 'Friday' ),
|
32 |
+
array( 'type' => 'Sa', 'display' => 'Saturday' ),
|
33 |
+
array( 'type' => 'Su', 'display' => 'Sunday' )
|
34 |
+
);
|
35 |
+
|
36 |
+
$args = array(
|
37 |
+
'@context' => 'http://schema.org',
|
38 |
+
'@type' => isset( $options['business_type'] ) ? esc_html( $options['business_type'] ) : 'LocalBusiness',
|
39 |
+
'name' => isset( $options['name'] ) ? esc_html( $options['name'] ) : '',
|
40 |
+
'image' => isset( $options['image'] ) ? esc_html( $options['image'] ) : '',
|
41 |
+
'url' => isset( $options['url'] ) ? esc_url( $options['url'] ) : ''
|
42 |
+
);
|
43 |
+
|
44 |
+
if ( isset( $options['telephone'] ) && !empty( $options['telephone'] ) ) {
|
45 |
+
$args['telephone'] = esc_html( $options['telephone'] );
|
46 |
+
}
|
47 |
+
|
48 |
+
if ( isset( $options['food_active'] ) && $options['food_active'] === 'on' ) {
|
49 |
+
if ( isset( $options['menu'] ) && $options['menu'] !== '' ) {
|
50 |
+
$args['menu'] = esc_url( $options['menu'] );
|
51 |
+
}
|
52 |
+
if ( isset( $options['accepts_reservations'] ) && $options['accepts_reservations'] === 'on' ) {
|
53 |
+
$args['acceptsReservations'] = 'True';
|
54 |
+
} else {
|
55 |
+
$args['acceptsReservations'] = 'False';
|
56 |
+
}
|
57 |
+
if ( isset( $options['serves_cuisine'] ) && $options['serves_cuisine'] !== '' ) {
|
58 |
+
$args['servesCuisine'] = esc_html( $options['serves_cuisine'] );
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
$address_array['address'] = array(
|
63 |
+
'@type' => 'PostalAddress',
|
64 |
+
'streetAddress' => isset( $options['street_address'] ) ? esc_html( $options['street_address'] ) : '',
|
65 |
+
'addressLocality' => isset( $options['address_locality'] ) ? esc_html( $options['address_locality'] ) : '',
|
66 |
+
'postalCode' => isset( $options['postal_code'] ) ? esc_html( $options['postal_code'] ) : '',
|
67 |
+
'addressCountry' => isset( $options['address_country'] ) ? esc_html( $options['address_country'] ) : ''
|
68 |
+
);
|
69 |
+
|
70 |
+
if ( isset( $options['address_region'] ) && !empty( $options['address_region'] ) ) {
|
71 |
+
$address_array['address']['addressRegion'] = esc_html( $options['address_region'] );
|
72 |
+
}
|
73 |
+
|
74 |
+
$args = array_merge( $args, $address_array );
|
75 |
+
$geo_array = array();
|
76 |
+
|
77 |
+
if ( isset( $options['geo_active'] ) && $options['geo_active'] === 'on' ) {
|
78 |
+
$geo_array['geo'] = array(
|
79 |
+
'@type' => 'GeoCoordinates',
|
80 |
+
'latitude' => isset( $options['latitude'] ) ? esc_html(floatval($options['latitude'])) : '',
|
81 |
+
'longitude' => isset( $options['longitude'] ) ? esc_html(floatval($options['longitude'])) : ''
|
82 |
+
);
|
83 |
+
}
|
84 |
+
|
85 |
+
if ( isset( $options['geo_circle_active'] ) && $options['geo_circle_active'] === 'on' ) {
|
86 |
+
$place_array['location'] = array( '@type' => 'Place' );
|
87 |
+
$place_array['location']['geo'] = array(
|
88 |
+
'@type' => 'GeoCircle',
|
89 |
+
'geoRadius' => isset( $options['geo_circle_radius'] ) ? esc_html( floatval( $options['geo_circle_radius'] ) ) : ''
|
90 |
+
);
|
91 |
+
if ( isset( $options['geo_active'] ) && $options['geo_active'] === 'on' ) {
|
92 |
+
$place_array['location']['geo']['geoMidpoint'] = $geo_array['geo'];
|
93 |
+
}
|
94 |
+
$args = array_merge( $args, $place_array );
|
95 |
+
} else {
|
96 |
+
if ( isset( $options['geo_active'] ) && $options['geo_active'] === 'on' ) {
|
97 |
+
$args = array_merge( $args, $geo_array );
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
/* openingHours */
|
102 |
+
$active_days = array();
|
103 |
+
foreach ( $week_array as $value ) {
|
104 |
+
if ( isset( $options[$value['type']] ) && $options[$value['type']] === 'on' ) {
|
105 |
+
$active_days[$value['type']] = $options['week'][$value['type']];
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
if( !empty( $active_days ) ) {
|
110 |
+
|
111 |
+
$obj = new Structuring_Markup_Opening_Hours( $active_days );
|
112 |
+
$opening_hours = $obj->display();
|
113 |
+
|
114 |
+
$opening_array['openingHours'] = array();
|
115 |
+
|
116 |
+
foreach( $opening_hours as $value ) {
|
117 |
+
$opening_array['openingHours'][] = $value;
|
118 |
+
}
|
119 |
+
|
120 |
+
$args = array_merge( $args, $opening_array );
|
121 |
+
|
122 |
+
}
|
123 |
+
|
124 |
+
if ( isset( $options['holiday_active'] ) && $options['holiday_active'] === 'on' ) {
|
125 |
+
$holiday_array['openingHoursSpecification'] = array(
|
126 |
+
'@type' => 'OpeningHoursSpecification',
|
127 |
+
'opens' => isset( $options['holiday_open'] ) ? esc_html( $options['holiday_open'] ) : '',
|
128 |
+
'closes' => isset( $options['holiday_close'] ) ? esc_html( $options['holiday_close'] ) : '',
|
129 |
+
'validFrom' => isset( $options['holiday_valid_from'] ) ? esc_html( $options['holiday_valid_from'] ) : '',
|
130 |
+
'validThrough' => isset( $options['holiday_valid_through'] ) ? esc_html( $options['holiday_valid_through'] ) : ''
|
131 |
+
);
|
132 |
+
$args = array_merge( $args, $holiday_array );
|
133 |
+
}
|
134 |
+
|
135 |
+
if ( isset( $options['price_range'] ) && !empty( $options['price_range'] ) ) {
|
136 |
+
$price_array['priceRange'] = $options['price_range'];
|
137 |
+
$args = array_merge( $args, $price_array );
|
138 |
+
}
|
139 |
+
|
140 |
+
return (array) $args;
|
141 |
+
}
|
142 |
+
|
143 |
}
|
includes/meta/wp-structuring-meta-news-article.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Schema.org Type News Article
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version 4.
|
7 |
* @since 4.0.0
|
8 |
* @link http://schema.org/NewsArticle
|
9 |
* @link https://developers.google.com/search/docs/data-types/articles
|
@@ -33,7 +33,7 @@ class Structuring_Markup_Meta_NewsArticle {
|
|
33 |
/**
|
34 |
* Setting schema.org NewsArticle
|
35 |
*
|
36 |
-
* @version 4.
|
37 |
* @since 4.0.0
|
38 |
* @param array $options
|
39 |
* @return array $args
|
@@ -51,7 +51,7 @@ class Structuring_Markup_Meta_NewsArticle {
|
|
51 |
"@type" => "WebPage",
|
52 |
"@id" => get_permalink( $post->ID )
|
53 |
),
|
54 |
-
"headline" => mb_substr(
|
55 |
"datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
|
56 |
"dateModified" => get_the_modified_time( DATE_ISO8601, $post->ID ),
|
57 |
"author" => array(
|
@@ -63,26 +63,22 @@ class Structuring_Markup_Meta_NewsArticle {
|
|
63 |
|
64 |
if ( has_post_thumbnail( $post->ID ) ) {
|
65 |
$images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
|
66 |
-
|
67 |
$images_args = array(
|
68 |
-
|
69 |
-
"@type" => "ImageObject",
|
70 |
-
"url" => $images[0],
|
71 |
-
"width" => $images[1],
|
72 |
-
"height" => $images[2]
|
73 |
-
)
|
74 |
);
|
75 |
$args = array_merge( $args, $images_args );
|
76 |
} elseif ( isset( $options['content_image'] ) && $options['content_image'] === 'on' ) {
|
77 |
if ( $images = $this->utility->get_content_image( $post->post_content ) ) {
|
78 |
if ( $size = $this->utility->get_image_dimensions( $images ) ) {
|
79 |
$images_args = array(
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
|
|
|
|
86 |
);
|
87 |
$args = array_merge( $args, $images_args );
|
88 |
}
|
@@ -90,18 +86,13 @@ class Structuring_Markup_Meta_NewsArticle {
|
|
90 |
} elseif ( isset( $options['default_image'] ) ) {
|
91 |
if ( $size = $this->utility->get_image_dimensions( $options['default_image'] ) ) {
|
92 |
$images_args = array(
|
93 |
-
|
94 |
-
"@type" => "ImageObject",
|
95 |
-
"url" => esc_html( $options['default_image'] ),
|
96 |
-
"width" => $size['width'],
|
97 |
-
"height" => $size['height']
|
98 |
-
)
|
99 |
);
|
100 |
$args = array_merge( $args, $images_args );
|
101 |
}
|
102 |
}
|
103 |
|
104 |
-
if ( isset( $options['name'] ) ) {
|
105 |
$publisher_args = array(
|
106 |
"publisher" => array(
|
107 |
"@type" => "Organization",
|
@@ -112,18 +103,12 @@ class Structuring_Markup_Meta_NewsArticle {
|
|
112 |
$options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
|
113 |
|
114 |
if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
|
115 |
-
$publisher_args['publisher']['logo'] =
|
116 |
-
"@type" => "ImageObject",
|
117 |
-
"url" => $options['logo'],
|
118 |
-
"width" => $logo['width'],
|
119 |
-
"height" => $logo['height']
|
120 |
-
);
|
121 |
} else if ( !empty( $options['logo'] ) ) {
|
122 |
-
$publisher_args['publisher']['logo'] =
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
"height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
|
127 |
);
|
128 |
}
|
129 |
$args = array_merge( $args, $publisher_args );
|
@@ -144,6 +129,27 @@ class Structuring_Markup_Meta_NewsArticle {
|
|
144 |
}
|
145 |
}
|
146 |
|
147 |
-
return (array) $args;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
}
|
149 |
}
|
3 |
* Schema.org Type News Article
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 4.7.0
|
7 |
* @since 4.0.0
|
8 |
* @link http://schema.org/NewsArticle
|
9 |
* @link https://developers.google.com/search/docs/data-types/articles
|
33 |
/**
|
34 |
* Setting schema.org NewsArticle
|
35 |
*
|
36 |
+
* @version 4.7.0
|
37 |
* @since 4.0.0
|
38 |
* @param array $options
|
39 |
* @return array $args
|
51 |
"@type" => "WebPage",
|
52 |
"@id" => get_permalink( $post->ID )
|
53 |
),
|
54 |
+
"headline" => mb_substr( $this->utility->escape_text( $post->post_title ), 0, 110 ),
|
55 |
"datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
|
56 |
"dateModified" => get_the_modified_time( DATE_ISO8601, $post->ID ),
|
57 |
"author" => array(
|
63 |
|
64 |
if ( has_post_thumbnail( $post->ID ) ) {
|
65 |
$images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
|
|
|
66 |
$images_args = array(
|
67 |
+
"image" => $this->set_image_object( $images[0], $images[1], $images[2] )
|
|
|
|
|
|
|
|
|
|
|
68 |
);
|
69 |
$args = array_merge( $args, $images_args );
|
70 |
} elseif ( isset( $options['content_image'] ) && $options['content_image'] === 'on' ) {
|
71 |
if ( $images = $this->utility->get_content_image( $post->post_content ) ) {
|
72 |
if ( $size = $this->utility->get_image_dimensions( $images ) ) {
|
73 |
$images_args = array(
|
74 |
+
"image" => $this->set_image_object( $images, $size['width'], $size['height'] )
|
75 |
+
);
|
76 |
+
$args = array_merge( $args, $images_args );
|
77 |
+
}
|
78 |
+
} elseif ( isset( $options['default_image'] ) ) {
|
79 |
+
if ($size = $this->utility->get_image_dimensions( $options['default_image'] ) ) {
|
80 |
+
$images_args = array(
|
81 |
+
"image" => $this->set_image_object( esc_html( $options['default_image'] ), $size['width'], $size['height'] )
|
82 |
);
|
83 |
$args = array_merge( $args, $images_args );
|
84 |
}
|
86 |
} elseif ( isset( $options['default_image'] ) ) {
|
87 |
if ( $size = $this->utility->get_image_dimensions( $options['default_image'] ) ) {
|
88 |
$images_args = array(
|
89 |
+
"image" => $this->set_image_object( esc_html( $options['default_image'] ), $size['width'], $size['height'] )
|
|
|
|
|
|
|
|
|
|
|
90 |
);
|
91 |
$args = array_merge( $args, $images_args );
|
92 |
}
|
93 |
}
|
94 |
|
95 |
+
if ( isset( $options['name'] ) && !empty( $options['name'] ) ) {
|
96 |
$publisher_args = array(
|
97 |
"publisher" => array(
|
98 |
"@type" => "Organization",
|
103 |
$options['logo'] = isset( $options['logo'] ) ? esc_html( $options['logo'] ) : "";
|
104 |
|
105 |
if ( $logo = $this->utility->get_image_dimensions( $options['logo'] ) ) {
|
106 |
+
$publisher_args['publisher']['logo'] = $this->set_image_object( $options['logo'], $logo['width'], $logo['height'] );
|
|
|
|
|
|
|
|
|
|
|
107 |
} else if ( !empty( $options['logo'] ) ) {
|
108 |
+
$publisher_args['publisher']['logo'] = $this->set_image_object(
|
109 |
+
$options['logo'],
|
110 |
+
isset( $options['logo-width'] ) ? ( int ) $options['logo-width'] : 0,
|
111 |
+
isset( $options['logo-height'] ) ? ( int ) $options['logo-height'] : 0
|
|
|
112 |
);
|
113 |
}
|
114 |
$args = array_merge( $args, $publisher_args );
|
129 |
}
|
130 |
}
|
131 |
|
132 |
+
return ( array ) $args;
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Setting ImageObject
|
137 |
+
*
|
138 |
+
* @version 4.7.0
|
139 |
+
* @since 4.7.0
|
140 |
+
* @param string $url
|
141 |
+
* @param integer $width
|
142 |
+
* @param integer $height
|
143 |
+
* @return array $args
|
144 |
+
*/
|
145 |
+
public function set_image_object ( $url, $width, $height ) {
|
146 |
+
$args = array(
|
147 |
+
"@type" => "ImageObject",
|
148 |
+
"url" => $url,
|
149 |
+
"width" => $width,
|
150 |
+
"height" => $height
|
151 |
+
);
|
152 |
+
|
153 |
+
return ( array ) $args;
|
154 |
}
|
155 |
}
|
includes/meta/wp-structuring-meta-organization.php
CHANGED
@@ -1,80 +1,80 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Type Organization
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.6.0
|
7 |
-
* @since 4.0.0
|
8 |
-
* @link https://schema.org/Organization
|
9 |
-
* @link https://developers.google.com/search/docs/guides/enhance-site
|
10 |
-
*/
|
11 |
-
class Structuring_Markup_Meta_Organization {
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Setting schema.org Organization
|
15 |
-
*
|
16 |
-
* @version 4.6.0
|
17 |
-
* @since 4.0.0
|
18 |
-
* @param array $options
|
19 |
-
* @return array $args
|
20 |
-
*/
|
21 |
-
public function set_meta ( array $options ) {
|
22 |
-
/** Logos */
|
23 |
-
$args = array(
|
24 |
-
'@context' => 'http://schema.org',
|
25 |
-
'@type' => isset( $options['organization_type'] ) ? esc_html( $options['organization_type'] ) : 'Organization',
|
26 |
-
'name' => isset( $options['name'] ) ? esc_html( $options['name'] ) : '',
|
27 |
-
'url' => isset( $options['url'] ) ? esc_url( $options['url'] ) : '',
|
28 |
-
'logo' => isset( $options['logo'] ) ? esc_url( $options['logo'] ) : ''
|
29 |
-
);
|
30 |
-
|
31 |
-
/** Corporate Contact */
|
32 |
-
if ( isset( $options['contact_point'] ) && $options['contact_point'] === 'on' ) {
|
33 |
-
$contact_point_data = array(
|
34 |
-
'@type' => 'ContactPoint',
|
35 |
-
'telephone' => isset( $options['telephone'] ) ? esc_html( $options['telephone'] ) : '',
|
36 |
-
'contactType' => isset( $options['contact_type'] ) ? esc_html( $options['contact_type'] ) : ''
|
37 |
-
);
|
38 |
-
|
39 |
-
if ( !empty( $options['email'] ) ) {
|
40 |
-
$contact_point_data['email'] = isset( $options['email'] ) ? esc_html( $options['email'] ) : '';
|
41 |
-
}
|
42 |
-
if ( !empty( $options['area_served'] ) ) {
|
43 |
-
$array = explode( ',', esc_html( $options['area_served'] ) );
|
44 |
-
for ( $i = 0; $i < count( $array ); $i++ ) {
|
45 |
-
$contact_point_data['areaServed'][] = isset( $options['area_served'] ) ? $array[$i] : '';
|
46 |
-
}
|
47 |
-
}
|
48 |
-
if ( isset( $options['contact_point_1'] ) && $options['contact_point_1'] === 'on' ) {
|
49 |
-
$contact_point_data['contactOption'][] = 'HearingImpairedSupported';
|
50 |
-
}
|
51 |
-
if ( isset( $options['contact_point_2'] ) && $options['contact_point_2'] === 'on' ) {
|
52 |
-
$contact_point_data['contactOption'][] = 'TollFree';
|
53 |
-
}
|
54 |
-
if ( !empty( $options['available_language'] ) ) {
|
55 |
-
$array = explode( ',', esc_html( $options['available_language'] ) );
|
56 |
-
for ( $i = 0; $i < count( $array ); $i++ ) {
|
57 |
-
$contact_point_data['availableLanguage'][] = isset( $options['available_language'] ) ? $array[$i] : '';
|
58 |
-
}
|
59 |
-
}
|
60 |
-
|
61 |
-
$contact_point['contactPoint'] = array( $contact_point_data );
|
62 |
-
$args = array_merge( $args, $contact_point );
|
63 |
-
}
|
64 |
-
|
65 |
-
/** Social Profiles */
|
66 |
-
if ( isset( $options['social'] ) ) {
|
67 |
-
$socials['sameAs'] = array();
|
68 |
-
|
69 |
-
foreach ( $options['social'] as $value ) {
|
70 |
-
if ( $value ) {
|
71 |
-
$socials['sameAs'][] = esc_url( $value );
|
72 |
-
}
|
73 |
-
}
|
74 |
-
if ( count( $socials['sameAs'] ) > 0 ) {
|
75 |
-
$args = array_merge( $args, $socials );
|
76 |
-
}
|
77 |
-
}
|
78 |
-
return (array) $args;
|
79 |
-
}
|
80 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type Organization
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.6.0
|
7 |
+
* @since 4.0.0
|
8 |
+
* @link https://schema.org/Organization
|
9 |
+
* @link https://developers.google.com/search/docs/guides/enhance-site
|
10 |
+
*/
|
11 |
+
class Structuring_Markup_Meta_Organization {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Setting schema.org Organization
|
15 |
+
*
|
16 |
+
* @version 4.6.0
|
17 |
+
* @since 4.0.0
|
18 |
+
* @param array $options
|
19 |
+
* @return array $args
|
20 |
+
*/
|
21 |
+
public function set_meta ( array $options ) {
|
22 |
+
/** Logos */
|
23 |
+
$args = array(
|
24 |
+
'@context' => 'http://schema.org',
|
25 |
+
'@type' => isset( $options['organization_type'] ) ? esc_html( $options['organization_type'] ) : 'Organization',
|
26 |
+
'name' => isset( $options['name'] ) ? esc_html( $options['name'] ) : '',
|
27 |
+
'url' => isset( $options['url'] ) ? esc_url( $options['url'] ) : '',
|
28 |
+
'logo' => isset( $options['logo'] ) ? esc_url( $options['logo'] ) : ''
|
29 |
+
);
|
30 |
+
|
31 |
+
/** Corporate Contact */
|
32 |
+
if ( isset( $options['contact_point'] ) && $options['contact_point'] === 'on' ) {
|
33 |
+
$contact_point_data = array(
|
34 |
+
'@type' => 'ContactPoint',
|
35 |
+
'telephone' => isset( $options['telephone'] ) ? esc_html( $options['telephone'] ) : '',
|
36 |
+
'contactType' => isset( $options['contact_type'] ) ? esc_html( $options['contact_type'] ) : ''
|
37 |
+
);
|
38 |
+
|
39 |
+
if ( !empty( $options['email'] ) ) {
|
40 |
+
$contact_point_data['email'] = isset( $options['email'] ) ? esc_html( $options['email'] ) : '';
|
41 |
+
}
|
42 |
+
if ( !empty( $options['area_served'] ) ) {
|
43 |
+
$array = explode( ',', esc_html( $options['area_served'] ) );
|
44 |
+
for ( $i = 0; $i < count( $array ); $i++ ) {
|
45 |
+
$contact_point_data['areaServed'][] = isset( $options['area_served'] ) ? $array[$i] : '';
|
46 |
+
}
|
47 |
+
}
|
48 |
+
if ( isset( $options['contact_point_1'] ) && $options['contact_point_1'] === 'on' ) {
|
49 |
+
$contact_point_data['contactOption'][] = 'HearingImpairedSupported';
|
50 |
+
}
|
51 |
+
if ( isset( $options['contact_point_2'] ) && $options['contact_point_2'] === 'on' ) {
|
52 |
+
$contact_point_data['contactOption'][] = 'TollFree';
|
53 |
+
}
|
54 |
+
if ( !empty( $options['available_language'] ) ) {
|
55 |
+
$array = explode( ',', esc_html( $options['available_language'] ) );
|
56 |
+
for ( $i = 0; $i < count( $array ); $i++ ) {
|
57 |
+
$contact_point_data['availableLanguage'][] = isset( $options['available_language'] ) ? $array[$i] : '';
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
$contact_point['contactPoint'] = array( $contact_point_data );
|
62 |
+
$args = array_merge( $args, $contact_point );
|
63 |
+
}
|
64 |
+
|
65 |
+
/** Social Profiles */
|
66 |
+
if ( isset( $options['social'] ) ) {
|
67 |
+
$socials['sameAs'] = array();
|
68 |
+
|
69 |
+
foreach ( $options['social'] as $value ) {
|
70 |
+
if ( $value ) {
|
71 |
+
$socials['sameAs'][] = esc_url( $value );
|
72 |
+
}
|
73 |
+
}
|
74 |
+
if ( count( $socials['sameAs'] ) > 0 ) {
|
75 |
+
$args = array_merge( $args, $socials );
|
76 |
+
}
|
77 |
+
}
|
78 |
+
return (array) $args;
|
79 |
+
}
|
80 |
}
|
includes/meta/wp-structuring-meta-person.php
CHANGED
@@ -1,57 +1,57 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Type Person
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.0.0
|
7 |
-
* @since 4.0.0
|
8 |
-
* @link https://schema.org/Person
|
9 |
-
* @link https://developers.google.com/search/docs/data-types/social-profile-links
|
10 |
-
*/
|
11 |
-
class Structuring_Markup_Meta_Person {
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Setting schema.org Person
|
15 |
-
*
|
16 |
-
* @version 4.0.0
|
17 |
-
* @since 4.0.0
|
18 |
-
* @param array $options
|
19 |
-
* @return array $args
|
20 |
-
*/
|
21 |
-
public function set_meta ( array $options ) {
|
22 |
-
/** Logos */
|
23 |
-
$args = array(
|
24 |
-
"@context" => "http://schema.org",
|
25 |
-
"@type" => "Person",
|
26 |
-
"name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
|
27 |
-
"url" => isset( $options['url'] ) ? esc_url( $options['url'] ) : ""
|
28 |
-
);
|
29 |
-
|
30 |
-
/** Place */
|
31 |
-
if ( isset( $options['addressCountry'] ) ) {
|
32 |
-
$place["homeLocation"] = array(
|
33 |
-
"@type" => "Place",
|
34 |
-
"address" => array(
|
35 |
-
"@type" => "PostalAddress",
|
36 |
-
"addressCountry" => $options['addressCountry']
|
37 |
-
)
|
38 |
-
);
|
39 |
-
$args = array_merge( $args, $place );
|
40 |
-
}
|
41 |
-
|
42 |
-
/** Social Profiles */
|
43 |
-
if ( isset( $options['social'] ) ) {
|
44 |
-
$socials["sameAs"] = array();
|
45 |
-
|
46 |
-
foreach ( $options['social'] as $value ) {
|
47 |
-
if ( !empty( $value ) ) {
|
48 |
-
$socials["sameAs"][] = esc_html( $value );
|
49 |
-
}
|
50 |
-
}
|
51 |
-
if ( count( $socials["sameAs"] ) > 0 ) {
|
52 |
-
$args = array_merge( $args, $socials );
|
53 |
-
}
|
54 |
-
}
|
55 |
-
return (array) $args;
|
56 |
-
}
|
57 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type Person
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.0.0
|
7 |
+
* @since 4.0.0
|
8 |
+
* @link https://schema.org/Person
|
9 |
+
* @link https://developers.google.com/search/docs/data-types/social-profile-links
|
10 |
+
*/
|
11 |
+
class Structuring_Markup_Meta_Person {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Setting schema.org Person
|
15 |
+
*
|
16 |
+
* @version 4.0.0
|
17 |
+
* @since 4.0.0
|
18 |
+
* @param array $options
|
19 |
+
* @return array $args
|
20 |
+
*/
|
21 |
+
public function set_meta ( array $options ) {
|
22 |
+
/** Logos */
|
23 |
+
$args = array(
|
24 |
+
"@context" => "http://schema.org",
|
25 |
+
"@type" => "Person",
|
26 |
+
"name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : "",
|
27 |
+
"url" => isset( $options['url'] ) ? esc_url( $options['url'] ) : ""
|
28 |
+
);
|
29 |
+
|
30 |
+
/** Place */
|
31 |
+
if ( isset( $options['addressCountry'] ) ) {
|
32 |
+
$place["homeLocation"] = array(
|
33 |
+
"@type" => "Place",
|
34 |
+
"address" => array(
|
35 |
+
"@type" => "PostalAddress",
|
36 |
+
"addressCountry" => $options['addressCountry']
|
37 |
+
)
|
38 |
+
);
|
39 |
+
$args = array_merge( $args, $place );
|
40 |
+
}
|
41 |
+
|
42 |
+
/** Social Profiles */
|
43 |
+
if ( isset( $options['social'] ) ) {
|
44 |
+
$socials["sameAs"] = array();
|
45 |
+
|
46 |
+
foreach ( $options['social'] as $value ) {
|
47 |
+
if ( !empty( $value ) ) {
|
48 |
+
$socials["sameAs"][] = esc_html( $value );
|
49 |
+
}
|
50 |
+
}
|
51 |
+
if ( count( $socials["sameAs"] ) > 0 ) {
|
52 |
+
$args = array_merge( $args, $socials );
|
53 |
+
}
|
54 |
+
}
|
55 |
+
return (array) $args;
|
56 |
+
}
|
57 |
}
|
includes/meta/wp-structuring-meta-site-navigation.php
CHANGED
@@ -1,42 +1,42 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Site Navigation Element
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.0.0
|
7 |
-
* @since 4.0.0
|
8 |
-
* @link https://schema.org/SiteNavigationElement
|
9 |
-
*/
|
10 |
-
class Structuring_Markup_Meta_Site_Navigation {
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Setting schema.org Site Navigation
|
14 |
-
*
|
15 |
-
* @version 4.0.0
|
16 |
-
* @since 4.0.0
|
17 |
-
* @param array $options
|
18 |
-
* @return array $args
|
19 |
-
*/
|
20 |
-
public function set_meta ( array $options ) {
|
21 |
-
if ( isset( $options['menu_name'] ) && wp_get_nav_menu_items( $options['menu_name'] ) ) {
|
22 |
-
$items_array = wp_get_nav_menu_items( $options['menu_name'] );
|
23 |
-
$name_array = array();
|
24 |
-
$url_array = array();
|
25 |
-
|
26 |
-
foreach ( (array) $items_array as $key => $menu_item ) {
|
27 |
-
$url_array[] = $menu_item->url;
|
28 |
-
$name_array[] = $menu_item->title;
|
29 |
-
}
|
30 |
-
|
31 |
-
if ( count( $items_array ) > 0 ) {
|
32 |
-
$args = array(
|
33 |
-
"@context" => "http://schema.org",
|
34 |
-
"@type" => "SiteNavigationElement",
|
35 |
-
"name" => $name_array,
|
36 |
-
"url" => $url_array
|
37 |
-
);
|
38 |
-
return (array) $args;
|
39 |
-
}
|
40 |
-
}
|
41 |
-
}
|
42 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Site Navigation Element
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.0.0
|
7 |
+
* @since 4.0.0
|
8 |
+
* @link https://schema.org/SiteNavigationElement
|
9 |
+
*/
|
10 |
+
class Structuring_Markup_Meta_Site_Navigation {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Setting schema.org Site Navigation
|
14 |
+
*
|
15 |
+
* @version 4.0.0
|
16 |
+
* @since 4.0.0
|
17 |
+
* @param array $options
|
18 |
+
* @return array $args
|
19 |
+
*/
|
20 |
+
public function set_meta ( array $options ) {
|
21 |
+
if ( isset( $options['menu_name'] ) && wp_get_nav_menu_items( $options['menu_name'] ) ) {
|
22 |
+
$items_array = wp_get_nav_menu_items( $options['menu_name'] );
|
23 |
+
$name_array = array();
|
24 |
+
$url_array = array();
|
25 |
+
|
26 |
+
foreach ( (array) $items_array as $key => $menu_item ) {
|
27 |
+
$url_array[] = $menu_item->url;
|
28 |
+
$name_array[] = $menu_item->title;
|
29 |
+
}
|
30 |
+
|
31 |
+
if ( count( $items_array ) > 0 ) {
|
32 |
+
$args = array(
|
33 |
+
"@context" => "http://schema.org",
|
34 |
+
"@type" => "SiteNavigationElement",
|
35 |
+
"name" => $name_array,
|
36 |
+
"url" => $url_array
|
37 |
+
);
|
38 |
+
return (array) $args;
|
39 |
+
}
|
40 |
+
}
|
41 |
+
}
|
42 |
}
|
includes/meta/wp-structuring-meta-video.php
CHANGED
@@ -1,90 +1,90 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Type Video
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.0.0
|
7 |
-
* @since 4.0.0
|
8 |
-
* @link https://schema.org/VideoObject
|
9 |
-
* @link https://developers.google.com/search/docs/data-types/videos
|
10 |
-
*/
|
11 |
-
class Structuring_Markup_Meta_Video {
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Utility
|
15 |
-
*
|
16 |
-
* @version 4.0.0
|
17 |
-
* @since 4.0.0
|
18 |
-
*/
|
19 |
-
private $utility;
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Constructor Define.
|
23 |
-
*
|
24 |
-
* @version 4.0.0
|
25 |
-
* @since 4.0.0
|
26 |
-
* @param Structuring_Markup_Utility $utility
|
27 |
-
*/
|
28 |
-
public function __construct ( Structuring_Markup_Utility $utility ) {
|
29 |
-
$this->utility = $utility;
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Setting schema.org Video
|
34 |
-
*
|
35 |
-
* @version 4.0.0
|
36 |
-
* @since 4.0.0
|
37 |
-
* @return array $args
|
38 |
-
*/
|
39 |
-
public function set_meta () {
|
40 |
-
global $post;
|
41 |
-
$meta = get_post_meta( $post->ID, 'schema_video_post', false );
|
42 |
-
|
43 |
-
if ( isset( $meta[0] ) ) {
|
44 |
-
$meta = unserialize( $meta[0] );
|
45 |
-
|
46 |
-
if ( has_post_thumbnail( $post->ID ) ) {
|
47 |
-
$images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
|
48 |
-
$excerpt = $this->utility->escape_text( $post->post_excerpt );
|
49 |
-
$content = $excerpt === "" ? mb_substr( $this->utility->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
|
50 |
-
} else {
|
51 |
-
$images[0] = '';
|
52 |
-
$content = '';
|
53 |
-
}
|
54 |
-
|
55 |
-
/* required items */
|
56 |
-
if ( !isset( $meta['schema_video_name']) ) $meta['schema_video_name'] = esc_html( $post->post_title );
|
57 |
-
if ( !isset( $meta['schema_video_description'] ) ) $meta['schema_video_description'] = esc_html( $content );
|
58 |
-
if ( !isset( $meta['schema_video_thumbnail_url'] ) ) $meta['schema_video_description'] = esc_html( $images[0] );
|
59 |
-
if ( !isset( $meta['schema_video_upload_date'] ) ) $meta['schema_video_upload_date'] = get_post_modified_time( 'Y-m-d', __return_false(), $post->ID );
|
60 |
-
if ( !isset( $meta['schema_video_upload_time'] ) ) $meta['schema_video_upload_time'] = get_post_modified_time( 'H:i:s', __return_false(), $post->ID );
|
61 |
-
|
62 |
-
$args = array(
|
63 |
-
"@context" => "http://schema.org",
|
64 |
-
"@type" => "VideoObject",
|
65 |
-
"name" => esc_html( $meta['schema_video_name'] ),
|
66 |
-
"description" => esc_html( $meta['schema_video_description'] ),
|
67 |
-
"thumbnailUrl" => esc_html( $meta['schema_video_thumbnail_url'] ),
|
68 |
-
"uploadDate" => esc_html( $meta['schema_video_upload_date'] ) . 'T' . esc_html( $meta['schema_video_upload_time'] )
|
69 |
-
);
|
70 |
-
|
71 |
-
/* recommended items */
|
72 |
-
if ( isset( $meta['schema_video_duration'] ) && $meta['schema_video_duration'] !== '' ) {
|
73 |
-
$args["duration"] = esc_html( $meta['schema_video_duration'] );
|
74 |
-
}
|
75 |
-
if ( isset( $meta['schema_video_content_url'] ) && $meta['schema_video_content_url'] !== '' ) {
|
76 |
-
$args["contentUrl"] = esc_url( $meta['schema_video_content_url'] );
|
77 |
-
}
|
78 |
-
if ( isset( $meta['schema_video_embed_url'] ) && $meta['schema_video_embed_url'] !== '' ) {
|
79 |
-
$args["embedUrl"] = esc_url( $meta['schema_video_embed_url'] );
|
80 |
-
}
|
81 |
-
if ( isset( $meta['schema_video_interaction_count'] ) && $meta['schema_video_interaction_count'] !== '' ) {
|
82 |
-
$args["interactionCount"] = esc_html( $meta['schema_video_interaction_count'] );
|
83 |
-
}
|
84 |
-
if ( isset( $meta['schema_video_expires_date'] ) && $meta['schema_video_expires_date'] !== '' && isset( $meta['schema_video_expires_time'] ) && $meta['schema_video_expires_time'] !== '' ) {
|
85 |
-
$args["expires"] = esc_html( $meta['schema_video_expires_date'] ) . 'T' . esc_html( $meta['schema_video_expires_time'] );
|
86 |
-
}
|
87 |
-
return (array) $args;
|
88 |
-
}
|
89 |
-
}
|
90 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type Video
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.0.0
|
7 |
+
* @since 4.0.0
|
8 |
+
* @link https://schema.org/VideoObject
|
9 |
+
* @link https://developers.google.com/search/docs/data-types/videos
|
10 |
+
*/
|
11 |
+
class Structuring_Markup_Meta_Video {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Utility
|
15 |
+
*
|
16 |
+
* @version 4.0.0
|
17 |
+
* @since 4.0.0
|
18 |
+
*/
|
19 |
+
private $utility;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Constructor Define.
|
23 |
+
*
|
24 |
+
* @version 4.0.0
|
25 |
+
* @since 4.0.0
|
26 |
+
* @param Structuring_Markup_Utility $utility
|
27 |
+
*/
|
28 |
+
public function __construct ( Structuring_Markup_Utility $utility ) {
|
29 |
+
$this->utility = $utility;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Setting schema.org Video
|
34 |
+
*
|
35 |
+
* @version 4.0.0
|
36 |
+
* @since 4.0.0
|
37 |
+
* @return array $args
|
38 |
+
*/
|
39 |
+
public function set_meta () {
|
40 |
+
global $post;
|
41 |
+
$meta = get_post_meta( $post->ID, 'schema_video_post', false );
|
42 |
+
|
43 |
+
if ( isset( $meta[0] ) ) {
|
44 |
+
$meta = unserialize( $meta[0] );
|
45 |
+
|
46 |
+
if ( has_post_thumbnail( $post->ID ) ) {
|
47 |
+
$images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
|
48 |
+
$excerpt = $this->utility->escape_text( $post->post_excerpt );
|
49 |
+
$content = $excerpt === "" ? mb_substr( $this->utility->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
|
50 |
+
} else {
|
51 |
+
$images[0] = '';
|
52 |
+
$content = '';
|
53 |
+
}
|
54 |
+
|
55 |
+
/* required items */
|
56 |
+
if ( !isset( $meta['schema_video_name']) ) $meta['schema_video_name'] = esc_html( $post->post_title );
|
57 |
+
if ( !isset( $meta['schema_video_description'] ) ) $meta['schema_video_description'] = esc_html( $content );
|
58 |
+
if ( !isset( $meta['schema_video_thumbnail_url'] ) ) $meta['schema_video_description'] = esc_html( $images[0] );
|
59 |
+
if ( !isset( $meta['schema_video_upload_date'] ) ) $meta['schema_video_upload_date'] = get_post_modified_time( 'Y-m-d', __return_false(), $post->ID );
|
60 |
+
if ( !isset( $meta['schema_video_upload_time'] ) ) $meta['schema_video_upload_time'] = get_post_modified_time( 'H:i:s', __return_false(), $post->ID );
|
61 |
+
|
62 |
+
$args = array(
|
63 |
+
"@context" => "http://schema.org",
|
64 |
+
"@type" => "VideoObject",
|
65 |
+
"name" => esc_html( $meta['schema_video_name'] ),
|
66 |
+
"description" => esc_html( $meta['schema_video_description'] ),
|
67 |
+
"thumbnailUrl" => esc_html( $meta['schema_video_thumbnail_url'] ),
|
68 |
+
"uploadDate" => esc_html( $meta['schema_video_upload_date'] ) . 'T' . esc_html( $meta['schema_video_upload_time'] )
|
69 |
+
);
|
70 |
+
|
71 |
+
/* recommended items */
|
72 |
+
if ( isset( $meta['schema_video_duration'] ) && $meta['schema_video_duration'] !== '' ) {
|
73 |
+
$args["duration"] = esc_html( $meta['schema_video_duration'] );
|
74 |
+
}
|
75 |
+
if ( isset( $meta['schema_video_content_url'] ) && $meta['schema_video_content_url'] !== '' ) {
|
76 |
+
$args["contentUrl"] = esc_url( $meta['schema_video_content_url'] );
|
77 |
+
}
|
78 |
+
if ( isset( $meta['schema_video_embed_url'] ) && $meta['schema_video_embed_url'] !== '' ) {
|
79 |
+
$args["embedUrl"] = esc_url( $meta['schema_video_embed_url'] );
|
80 |
+
}
|
81 |
+
if ( isset( $meta['schema_video_interaction_count'] ) && $meta['schema_video_interaction_count'] !== '' ) {
|
82 |
+
$args["interactionCount"] = esc_html( $meta['schema_video_interaction_count'] );
|
83 |
+
}
|
84 |
+
if ( isset( $meta['schema_video_expires_date'] ) && $meta['schema_video_expires_date'] !== '' && isset( $meta['schema_video_expires_time'] ) && $meta['schema_video_expires_time'] !== '' ) {
|
85 |
+
$args["expires"] = esc_html( $meta['schema_video_expires_date'] ) . 'T' . esc_html( $meta['schema_video_expires_time'] );
|
86 |
+
}
|
87 |
+
return (array) $args;
|
88 |
+
}
|
89 |
+
}
|
90 |
}
|
includes/meta/wp-structuring-meta-website.php
CHANGED
@@ -1,58 +1,58 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Type WebSite
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.5.0
|
7 |
-
* @since 4.0.0
|
8 |
-
* @link https://schema.org/WebSite
|
9 |
-
* @link https://developers.google.com/search/docs/guides/enhance-site#add-a-sitelinks-searchbox-for-your-site
|
10 |
-
* @link https://developers.google.com/search/docs/data-types/sitename
|
11 |
-
*/
|
12 |
-
class Structuring_Markup_Meta_WebSite {
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Setting schema.org WebSite
|
16 |
-
*
|
17 |
-
* @version 4.5.0
|
18 |
-
* @since 4.0.0
|
19 |
-
* @param array $options
|
20 |
-
* @return array $args
|
21 |
-
*/
|
22 |
-
public function set_meta ( array $options ) {
|
23 |
-
$args = array(
|
24 |
-
"@context" => "http://schema.org",
|
25 |
-
"@type" => "WebSite",
|
26 |
-
"name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : '',
|
27 |
-
"alternateName" => isset( $options['alternateName'] ) ? esc_html( $options['alternateName'] ) : '',
|
28 |
-
"url" => isset( $options['url'] ) ? esc_url( $options['url'] ) : ''
|
29 |
-
);
|
30 |
-
|
31 |
-
$search_array = array();
|
32 |
-
|
33 |
-
if ( isset( $options['potential_action'] ) && $options['potential_action'] === 'on' ) {
|
34 |
-
$action_array = array(
|
35 |
-
"@type" => "SearchAction",
|
36 |
-
"target" => isset( $options['target'] ) ? esc_url( $options['target'] ) . "{search_term_string}" : '',
|
37 |
-
"query-input" => isset( $options['target'] ) ? "required name=search_term_string" : ''
|
38 |
-
);
|
39 |
-
$search_array[] = $action_array;
|
40 |
-
}
|
41 |
-
|
42 |
-
if ( count( $search_array ) > 0 ) {
|
43 |
-
if ( isset( $options['potential_action_app'] ) && $options['potential_action_app'] === 'on' ) {
|
44 |
-
$action_array = array(
|
45 |
-
"@type" => "SearchAction",
|
46 |
-
"target" => isset( $options['target_app'] ) ? $options['target_app'] . "{search_term_string}" : '',
|
47 |
-
"query-input" => isset( $options['target_app'] ) ? "required name=search_term_string" : ''
|
48 |
-
);
|
49 |
-
$search_array[] = $action_array;
|
50 |
-
}
|
51 |
-
|
52 |
-
$potential_action["potentialAction"] = $search_array;
|
53 |
-
$args = array_merge( $args, $potential_action );
|
54 |
-
}
|
55 |
-
|
56 |
-
return (array) $args;
|
57 |
-
}
|
58 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type WebSite
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.5.0
|
7 |
+
* @since 4.0.0
|
8 |
+
* @link https://schema.org/WebSite
|
9 |
+
* @link https://developers.google.com/search/docs/guides/enhance-site#add-a-sitelinks-searchbox-for-your-site
|
10 |
+
* @link https://developers.google.com/search/docs/data-types/sitename
|
11 |
+
*/
|
12 |
+
class Structuring_Markup_Meta_WebSite {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Setting schema.org WebSite
|
16 |
+
*
|
17 |
+
* @version 4.5.0
|
18 |
+
* @since 4.0.0
|
19 |
+
* @param array $options
|
20 |
+
* @return array $args
|
21 |
+
*/
|
22 |
+
public function set_meta ( array $options ) {
|
23 |
+
$args = array(
|
24 |
+
"@context" => "http://schema.org",
|
25 |
+
"@type" => "WebSite",
|
26 |
+
"name" => isset( $options['name'] ) ? esc_html( $options['name'] ) : '',
|
27 |
+
"alternateName" => isset( $options['alternateName'] ) ? esc_html( $options['alternateName'] ) : '',
|
28 |
+
"url" => isset( $options['url'] ) ? esc_url( $options['url'] ) : ''
|
29 |
+
);
|
30 |
+
|
31 |
+
$search_array = array();
|
32 |
+
|
33 |
+
if ( isset( $options['potential_action'] ) && $options['potential_action'] === 'on' ) {
|
34 |
+
$action_array = array(
|
35 |
+
"@type" => "SearchAction",
|
36 |
+
"target" => isset( $options['target'] ) ? esc_url( $options['target'] ) . "{search_term_string}" : '',
|
37 |
+
"query-input" => isset( $options['target'] ) ? "required name=search_term_string" : ''
|
38 |
+
);
|
39 |
+
$search_array[] = $action_array;
|
40 |
+
}
|
41 |
+
|
42 |
+
if ( count( $search_array ) > 0 ) {
|
43 |
+
if ( isset( $options['potential_action_app'] ) && $options['potential_action_app'] === 'on' ) {
|
44 |
+
$action_array = array(
|
45 |
+
"@type" => "SearchAction",
|
46 |
+
"target" => isset( $options['target_app'] ) ? $options['target_app'] . "{search_term_string}" : '',
|
47 |
+
"query-input" => isset( $options['target_app'] ) ? "required name=search_term_string" : ''
|
48 |
+
);
|
49 |
+
$search_array[] = $action_array;
|
50 |
+
}
|
51 |
+
|
52 |
+
$potential_action["potentialAction"] = $search_array;
|
53 |
+
$args = array_merge( $args, $potential_action );
|
54 |
+
}
|
55 |
+
|
56 |
+
return (array) $args;
|
57 |
+
}
|
58 |
}
|
includes/wp-structuring-display-amp.php
CHANGED
@@ -1,100 +1,100 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org Display (AMP)
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.0.0
|
7 |
-
* @since 4.0.0
|
8 |
-
*/
|
9 |
-
class Structuring_Markup_Display_Amp {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Utility
|
13 |
-
*
|
14 |
-
* @version 4.0.0
|
15 |
-
* @since 4.0.0
|
16 |
-
*/
|
17 |
-
private $utility;
|
18 |
-
|
19 |
-
/**
|
20 |
-
* JSON-LD output data
|
21 |
-
*
|
22 |
-
* @version 4.0.0
|
23 |
-
* @since 4.0.0
|
24 |
-
*/
|
25 |
-
public $json_ld = array();
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Constructor Define.
|
29 |
-
*
|
30 |
-
* @version 4.0.0
|
31 |
-
* @since 4.0.0
|
32 |
-
*/
|
33 |
-
public function __construct () {
|
34 |
-
require_once( plugin_dir_path( __FILE__ ) . 'wp-structuring-utility.php' );
|
35 |
-
$this->utility = new Structuring_Markup_Utility();
|
36 |
-
|
37 |
-
$db = new Structuring_Markup_Admin_Db();
|
38 |
-
$this->set_schema( $db );
|
39 |
-
}
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Setting schema.org
|
43 |
-
*
|
44 |
-
* @version 4.0.0
|
45 |
-
* @since 4.0.0
|
46 |
-
* @param Structuring_Markup_Admin_Db $db
|
47 |
-
*/
|
48 |
-
private function set_schema ( Structuring_Markup_Admin_Db $db ) {
|
49 |
-
$structuring_markup_args = $db->get_list_options();
|
50 |
-
|
51 |
-
if ( is_single() && get_post_type() === 'post' ) {
|
52 |
-
$this->get_schema_data( 'amp', $structuring_markup_args );
|
53 |
-
}
|
54 |
-
}
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Setting JSON-LD Template
|
58 |
-
*
|
59 |
-
* @version 4.0.0
|
60 |
-
* @since 4.0.0
|
61 |
-
* @param string $output
|
62 |
-
* @param array $structuring_markup_args
|
63 |
-
*/
|
64 |
-
private function get_schema_data ( $output, array $structuring_markup_args ) {
|
65 |
-
|
66 |
-
foreach ( $structuring_markup_args as $row ) {
|
67 |
-
/** Output page check. */
|
68 |
-
$output_args = unserialize( $row->output );
|
69 |
-
if ( array_key_exists( $output, $output_args ) ) {
|
70 |
-
|
71 |
-
/** Activate check. */
|
72 |
-
if ( isset( $row->type ) && isset( $row->activate ) && $row->activate === 'on' ) {
|
73 |
-
switch ( $row->type ) {
|
74 |
-
case 'article':
|
75 |
-
if ( isset( $row->options ) && $row->options ) {
|
76 |
-
require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-article.php' );
|
77 |
-
$obj = new Structuring_Markup_Meta_Article( $this->utility );
|
78 |
-
$this->json_ld = $obj->set_meta( unserialize( $row->options ) );
|
79 |
-
}
|
80 |
-
break;
|
81 |
-
case 'blog_posting':
|
82 |
-
if ( isset( $row->options ) && $row->options ) {
|
83 |
-
require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-blog-posting.php' );
|
84 |
-
$obj = new Structuring_Markup_Meta_Blog_Posting( $this->utility );
|
85 |
-
$this->json_ld = $obj->set_meta( unserialize( $row->options ) );
|
86 |
-
}
|
87 |
-
break;
|
88 |
-
case 'news_article':
|
89 |
-
if ( isset( $row->options ) && $row->options ) {
|
90 |
-
require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-news-article.php' );
|
91 |
-
$obj = new Structuring_Markup_Meta_NewsArticle( $this->utility );
|
92 |
-
$this->json_ld = $obj->set_meta( unserialize( $row->options ) );
|
93 |
-
}
|
94 |
-
break;
|
95 |
-
}
|
96 |
-
}
|
97 |
-
}
|
98 |
-
}
|
99 |
-
}
|
100 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Display (AMP)
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.0.0
|
7 |
+
* @since 4.0.0
|
8 |
+
*/
|
9 |
+
class Structuring_Markup_Display_Amp {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Utility
|
13 |
+
*
|
14 |
+
* @version 4.0.0
|
15 |
+
* @since 4.0.0
|
16 |
+
*/
|
17 |
+
private $utility;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* JSON-LD output data
|
21 |
+
*
|
22 |
+
* @version 4.0.0
|
23 |
+
* @since 4.0.0
|
24 |
+
*/
|
25 |
+
public $json_ld = array();
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Constructor Define.
|
29 |
+
*
|
30 |
+
* @version 4.0.0
|
31 |
+
* @since 4.0.0
|
32 |
+
*/
|
33 |
+
public function __construct () {
|
34 |
+
require_once( plugin_dir_path( __FILE__ ) . 'wp-structuring-utility.php' );
|
35 |
+
$this->utility = new Structuring_Markup_Utility();
|
36 |
+
|
37 |
+
$db = new Structuring_Markup_Admin_Db();
|
38 |
+
$this->set_schema( $db );
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Setting schema.org
|
43 |
+
*
|
44 |
+
* @version 4.0.0
|
45 |
+
* @since 4.0.0
|
46 |
+
* @param Structuring_Markup_Admin_Db $db
|
47 |
+
*/
|
48 |
+
private function set_schema ( Structuring_Markup_Admin_Db $db ) {
|
49 |
+
$structuring_markup_args = $db->get_list_options();
|
50 |
+
|
51 |
+
if ( is_single() && get_post_type() === 'post' ) {
|
52 |
+
$this->get_schema_data( 'amp', $structuring_markup_args );
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Setting JSON-LD Template
|
58 |
+
*
|
59 |
+
* @version 4.0.0
|
60 |
+
* @since 4.0.0
|
61 |
+
* @param string $output
|
62 |
+
* @param array $structuring_markup_args
|
63 |
+
*/
|
64 |
+
private function get_schema_data ( $output, array $structuring_markup_args ) {
|
65 |
+
|
66 |
+
foreach ( $structuring_markup_args as $row ) {
|
67 |
+
/** Output page check. */
|
68 |
+
$output_args = unserialize( $row->output );
|
69 |
+
if ( array_key_exists( $output, $output_args ) ) {
|
70 |
+
|
71 |
+
/** Activate check. */
|
72 |
+
if ( isset( $row->type ) && isset( $row->activate ) && $row->activate === 'on' ) {
|
73 |
+
switch ( $row->type ) {
|
74 |
+
case 'article':
|
75 |
+
if ( isset( $row->options ) && $row->options ) {
|
76 |
+
require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-article.php' );
|
77 |
+
$obj = new Structuring_Markup_Meta_Article( $this->utility );
|
78 |
+
$this->json_ld = $obj->set_meta( unserialize( $row->options ) );
|
79 |
+
}
|
80 |
+
break;
|
81 |
+
case 'blog_posting':
|
82 |
+
if ( isset( $row->options ) && $row->options ) {
|
83 |
+
require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-blog-posting.php' );
|
84 |
+
$obj = new Structuring_Markup_Meta_Blog_Posting( $this->utility );
|
85 |
+
$this->json_ld = $obj->set_meta( unserialize( $row->options ) );
|
86 |
+
}
|
87 |
+
break;
|
88 |
+
case 'news_article':
|
89 |
+
if ( isset( $row->options ) && $row->options ) {
|
90 |
+
require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-news-article.php' );
|
91 |
+
$obj = new Structuring_Markup_Meta_NewsArticle( $this->utility );
|
92 |
+
$this->json_ld = $obj->set_meta( unserialize( $row->options ) );
|
93 |
+
}
|
94 |
+
break;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
}
|
99 |
+
}
|
100 |
}
|
includes/wp-structuring-opening-hours.php
CHANGED
@@ -1,224 +1,230 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Schema.org openingHours
|
4 |
-
*
|
5 |
-
* @author Justin Frydman
|
6 |
-
* @version
|
7 |
-
* @since 2.4.0
|
8 |
-
* @see wp-structuring-display.php
|
9 |
-
* @link https://schema.org/openingHours
|
10 |
-
* @link https://schema.org/LocalBusiness
|
11 |
-
*/
|
12 |
-
class Structuring_Markup_Opening_Hours {
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Multidimensional array of days and opening hours
|
16 |
-
*
|
17 |
-
* @since 2.4.0
|
18 |
-
* @var array
|
19 |
-
*/
|
20 |
-
protected $opening_hours;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* List of days
|
24 |
-
*
|
25 |
-
* @since 2.4.0
|
26 |
-
* @var array
|
27 |
-
*/
|
28 |
-
protected $days;
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Grouped, unique hour periods
|
32 |
-
*
|
33 |
-
* @since 2.4.0
|
34 |
-
* @var array
|
35 |
-
*/
|
36 |
-
protected $periods;
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Days grouped with open-close hours
|
40 |
-
*
|
41 |
-
* @since 2.4.0
|
42 |
-
* @var array
|
43 |
-
*/
|
44 |
-
protected $grouped_days;
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Open/close hours grouped by Mo-Su
|
48 |
-
*
|
49 |
-
* @since 2.4.0
|
50 |
-
* @var array
|
51 |
-
*/
|
52 |
-
protected $weekly_hours;
|
53 |
-
|
54 |
-
/**
|
55 |
-
* Constructor
|
56 |
-
*
|
57 |
-
* @since 2.4.0
|
58 |
-
* @param array $opening_hours
|
59 |
-
*/
|
60 |
-
public function __construct ( array $opening_hours ) {
|
61 |
-
/** Default Value Set */
|
62 |
-
if ( !empty( $opening_hours ) ) {
|
63 |
-
$this->opening_hours = $opening_hours;
|
64 |
-
$this->init();
|
65 |
-
}
|
66 |
-
}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Initialize the class
|
70 |
-
*
|
71 |
-
* @since 2.4.0
|
72 |
-
*/
|
73 |
-
public function init () {
|
74 |
-
$this->days = array_keys( $this->opening_hours );
|
75 |
-
$this->periods = $this->group_periods();
|
76 |
-
$this->grouped_days = $this->group_periods_with_days();
|
77 |
-
$this->weekly_hours = $this->group_weekly_hours();
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Groups unique open and closed hour periods
|
82 |
-
*
|
83 |
-
* @since 2.4.0
|
84 |
-
* @return array
|
85 |
-
*/
|
86 |
-
public function group_periods () {
|
87 |
-
$periods = array();
|
88 |
-
foreach( $this->opening_hours as $day ) {
|
89 |
-
foreach( $day as $group ) {
|
90 |
-
if( !in_array( $group, $periods ) ) {
|
91 |
-
if( !empty( $group['open'] ) && !empty( $group['close'] ) ) {
|
92 |
-
$periods[] = $group;
|
93 |
-
}
|
94 |
-
}
|
95 |
-
}
|
96 |
-
}
|
97 |
-
|
98 |
-
return (array) $periods;
|
99 |
-
}
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Groups day ranges with their opening hours
|
103 |
-
*
|
104 |
-
* @since 2.4.0
|
105 |
-
* @return array
|
106 |
-
*/
|
107 |
-
public function group_periods_with_days () {
|
108 |
-
$periods = $this->periods;
|
109 |
-
|
110 |
-
foreach( $periods as $key => $group ) {
|
111 |
-
$days = array();
|
112 |
-
|
113 |
-
foreach( $this->opening_hours as $day => $grouped_days ) {
|
114 |
-
if( in_array( $group, $grouped_days) ) {
|
115 |
-
$days[] = $day;
|
116 |
-
}
|
117 |
-
}
|
118 |
-
|
119 |
-
$periods[$key]['days'] = $days;
|
120 |
-
}
|
121 |
-
|
122 |
-
return (array) $periods;
|
123 |
-
}
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Group weekly group ranges with their opening hours
|
127 |
-
*
|
128 |
-
* @since 2.4.0
|
129 |
-
* @return array
|
130 |
-
*/
|
131 |
-
public function group_weekly_hours () {
|
132 |
-
$grouped_days = $this->grouped_days;
|
133 |
-
$days = $this->days;
|
134 |
-
$object = $this;
|
135 |
-
|
136 |
-
return (array) array_reduce( $grouped_days, function($result, $group) use ( $days, $object ) {
|
137 |
-
return array_merge( $result, $object->group_periods_to_day_range( $group ) );
|
138 |
-
}, array() );
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Groups days of the week with their opening hours
|
143 |
-
*
|
144 |
-
* @since 2.4.0
|
145 |
-
* @param array $group
|
146 |
-
* @return array
|
147 |
-
*/
|
148 |
-
public function group_periods_to_day_range ( array $group ) {
|
149 |
-
$starting_day = null;
|
150 |
-
$ending_day = null;
|
151 |
-
|
152 |
-
$consecutive_days = array();
|
153 |
-
|
154 |
-
foreach( $this->days as $i => $day ) {
|
155 |
-
$has_day = in_array( $day, $group['days'] );
|
156 |
-
|
157 |
-
if( $has_day ) {
|
158 |
-
$starting_day = $starting_day ? $starting_day : $day;
|
159 |
-
$ending_day = $day;
|
160 |
-
}
|
161 |
-
|
162 |
-
if( $starting_day && (!$has_day || $i == count($this->days) - 1) ) {
|
163 |
-
$consecutive_days[] = array(
|
164 |
-
'start' => $starting_day,
|
165 |
-
'end' => $ending_day,
|
166 |
-
'open' => $group['open'],
|
167 |
-
'close' => $group['close']
|
168 |
-
);
|
169 |
-
|
170 |
-
$starting_day = null;
|
171 |
-
}
|
172 |
-
}
|
173 |
-
|
174 |
-
return (array) $this->sort_by_day_of_the_week( $consecutive_days );
|
175 |
-
}
|
176 |
-
|
177 |
-
/**
|
178 |
-
* Sorts our days in the proper weekly hour
|
179 |
-
*
|
180 |
-
* @
|
181 |
-
* @
|
182 |
-
* @
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
$
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org openingHours
|
4 |
+
*
|
5 |
+
* @author Justin Frydman
|
6 |
+
* @version 4.8.0
|
7 |
+
* @since 2.4.0
|
8 |
+
* @see wp-structuring-display.php
|
9 |
+
* @link https://schema.org/openingHours
|
10 |
+
* @link https://schema.org/LocalBusiness
|
11 |
+
*/
|
12 |
+
class Structuring_Markup_Opening_Hours {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Multidimensional array of days and opening hours
|
16 |
+
*
|
17 |
+
* @since 2.4.0
|
18 |
+
* @var array
|
19 |
+
*/
|
20 |
+
protected $opening_hours;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* List of days
|
24 |
+
*
|
25 |
+
* @since 2.4.0
|
26 |
+
* @var array
|
27 |
+
*/
|
28 |
+
protected $days;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Grouped, unique hour periods
|
32 |
+
*
|
33 |
+
* @since 2.4.0
|
34 |
+
* @var array
|
35 |
+
*/
|
36 |
+
protected $periods;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Days grouped with open-close hours
|
40 |
+
*
|
41 |
+
* @since 2.4.0
|
42 |
+
* @var array
|
43 |
+
*/
|
44 |
+
protected $grouped_days;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Open/close hours grouped by Mo-Su
|
48 |
+
*
|
49 |
+
* @since 2.4.0
|
50 |
+
* @var array
|
51 |
+
*/
|
52 |
+
protected $weekly_hours;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Constructor
|
56 |
+
*
|
57 |
+
* @since 2.4.0
|
58 |
+
* @param array $opening_hours
|
59 |
+
*/
|
60 |
+
public function __construct ( array $opening_hours ) {
|
61 |
+
/** Default Value Set */
|
62 |
+
if ( !empty( $opening_hours ) ) {
|
63 |
+
$this->opening_hours = $opening_hours;
|
64 |
+
$this->init();
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Initialize the class
|
70 |
+
*
|
71 |
+
* @since 2.4.0
|
72 |
+
*/
|
73 |
+
public function init () {
|
74 |
+
$this->days = array_keys( $this->opening_hours );
|
75 |
+
$this->periods = $this->group_periods();
|
76 |
+
$this->grouped_days = $this->group_periods_with_days();
|
77 |
+
$this->weekly_hours = $this->group_weekly_hours();
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Groups unique open and closed hour periods
|
82 |
+
*
|
83 |
+
* @since 2.4.0
|
84 |
+
* @return array
|
85 |
+
*/
|
86 |
+
public function group_periods () {
|
87 |
+
$periods = array();
|
88 |
+
foreach( $this->opening_hours as $day ) {
|
89 |
+
foreach( $day as $group ) {
|
90 |
+
if( !in_array( $group, $periods ) ) {
|
91 |
+
if( !empty( $group['open'] ) && !empty( $group['close'] ) ) {
|
92 |
+
$periods[] = $group;
|
93 |
+
}
|
94 |
+
}
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
return (array) $periods;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Groups day ranges with their opening hours
|
103 |
+
*
|
104 |
+
* @since 2.4.0
|
105 |
+
* @return array
|
106 |
+
*/
|
107 |
+
public function group_periods_with_days () {
|
108 |
+
$periods = $this->periods;
|
109 |
+
|
110 |
+
foreach( $periods as $key => $group ) {
|
111 |
+
$days = array();
|
112 |
+
|
113 |
+
foreach( $this->opening_hours as $day => $grouped_days ) {
|
114 |
+
if( in_array( $group, $grouped_days) ) {
|
115 |
+
$days[] = $day;
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
$periods[$key]['days'] = $days;
|
120 |
+
}
|
121 |
+
|
122 |
+
return (array) $periods;
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Group weekly group ranges with their opening hours
|
127 |
+
*
|
128 |
+
* @since 2.4.0
|
129 |
+
* @return array
|
130 |
+
*/
|
131 |
+
public function group_weekly_hours () {
|
132 |
+
$grouped_days = $this->grouped_days;
|
133 |
+
$days = $this->days;
|
134 |
+
$object = $this;
|
135 |
+
|
136 |
+
return (array) array_reduce( $grouped_days, function($result, $group) use ( $days, $object ) {
|
137 |
+
return array_merge( $result, $object->group_periods_to_day_range( $group ) );
|
138 |
+
}, array() );
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Groups days of the week with their opening hours
|
143 |
+
*
|
144 |
+
* @since 2.4.0
|
145 |
+
* @param array $group
|
146 |
+
* @return array
|
147 |
+
*/
|
148 |
+
public function group_periods_to_day_range ( array $group ) {
|
149 |
+
$starting_day = null;
|
150 |
+
$ending_day = null;
|
151 |
+
|
152 |
+
$consecutive_days = array();
|
153 |
+
|
154 |
+
foreach( $this->days as $i => $day ) {
|
155 |
+
$has_day = in_array( $day, $group['days'] );
|
156 |
+
|
157 |
+
if( $has_day ) {
|
158 |
+
$starting_day = $starting_day ? $starting_day : $day;
|
159 |
+
$ending_day = $day;
|
160 |
+
}
|
161 |
+
|
162 |
+
if( $starting_day && (!$has_day || $i == count($this->days) - 1) ) {
|
163 |
+
$consecutive_days[] = array(
|
164 |
+
'start' => $starting_day,
|
165 |
+
'end' => $ending_day,
|
166 |
+
'open' => $group['open'],
|
167 |
+
'close' => $group['close']
|
168 |
+
);
|
169 |
+
|
170 |
+
$starting_day = null;
|
171 |
+
}
|
172 |
+
}
|
173 |
+
|
174 |
+
return (array) $this->sort_by_day_of_the_week( $consecutive_days );
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Sorts our days in the proper weekly hour
|
179 |
+
*
|
180 |
+
* @version 4.8.0
|
181 |
+
* @since 2.4.0
|
182 |
+
* @param array $consecutive_days
|
183 |
+
* @return array
|
184 |
+
*/
|
185 |
+
public function sort_by_day_of_the_week ( array $consecutive_days ) {
|
186 |
+
$days = $this->days;
|
187 |
+
|
188 |
+
arsort( $consecutive_days );
|
189 |
+
|
190 |
+
$sort_by_day_func = function( $a, $b ) use ( $days ) {
|
191 |
+
$aKey = array_search( $a['start'], $days );
|
192 |
+
$bKey = array_search( $b['start'], $days );
|
193 |
+
|
194 |
+
if ( $aKey < $bKey ) {
|
195 |
+
return -1;
|
196 |
+
} else {
|
197 |
+
return 1;
|
198 |
+
}
|
199 |
+
};
|
200 |
+
|
201 |
+
usort( $consecutive_days, $sort_by_day_func );
|
202 |
+
|
203 |
+
return (array) $consecutive_days;
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Displays formatted opening hours
|
208 |
+
*
|
209 |
+
* @since 2.4.0
|
210 |
+
* @return array
|
211 |
+
*/
|
212 |
+
public function display () {
|
213 |
+
$opening_hours = array();
|
214 |
+
|
215 |
+
foreach( $this->weekly_hours as $key => $group ) {
|
216 |
+
if( $group['start'] != $group['end'] ) {
|
217 |
+
$hours = $group['start'].'-'.$group['end'];
|
218 |
+
} else {
|
219 |
+
$hours = $group['start'];
|
220 |
+
}
|
221 |
+
|
222 |
+
$hours .= ' ' . $group['open'] . '-' . $group['close'];
|
223 |
+
|
224 |
+
$opening_hours[] = $hours;
|
225 |
+
}
|
226 |
+
|
227 |
+
return (array) $opening_hours;
|
228 |
+
}
|
229 |
+
|
230 |
}
|
includes/wp-structuring-short-code-breadcrumb.php
CHANGED
@@ -1,269 +1,266 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Breadcrumb ShortCode Settings
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.
|
7 |
-
* @since 2.0.0
|
8 |
-
*/
|
9 |
-
class Structuring_Markup_ShortCode_Breadcrumb {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* ShortCode Display.
|
13 |
-
*
|
14 |
-
* @version 4.
|
15 |
-
* @since 2.0.0
|
16 |
-
* @access public
|
17 |
-
* @param array $options
|
18 |
-
* @param string $args
|
19 |
-
* @return string $html
|
20 |
-
*/
|
21 |
-
public function short_code_display ( array $options, $args ) {
|
22 |
-
extract( shortcode_atts( array (
|
23 |
-
'id' => "",
|
24 |
-
'class' => ""
|
25 |
-
), $args ) );
|
26 |
-
|
27 |
-
$instance = array(
|
28 |
-
'id' => esc_attr( $id ),
|
29 |
-
'class' => esc_attr( $class )
|
30 |
-
);
|
31 |
-
|
32 |
-
$item_array = $this->breadcrumb_array_setting( $options );
|
33 |
-
$html = '';
|
34 |
-
|
35 |
-
if ( isset( $item_array ) && count( $item_array ) > 0 ) {
|
36 |
-
$html .= '<!-- Markup (JSON-LD) structured in schema.org Breadcrumb START -->' . PHP_EOL;
|
37 |
-
|
38 |
-
if ( $id !== '' && $class !== '' ) {
|
39 |
-
$html .= '<ol id="' . $id . '" class="' . $class . '">';
|
40 |
-
} else if ( $id !== '' && $class === '' ) {
|
41 |
-
$html .= '<ol id="' . $id . '">';
|
42 |
-
} else if ( $id === '' && $class !== '' ) {
|
43 |
-
$html .= '<ol class="' . $class . '">';
|
44 |
-
} else {
|
45 |
-
$html .= '<ol>';
|
46 |
-
}
|
47 |
-
$html .= PHP_EOL;
|
48 |
-
|
49 |
-
$count = 1;
|
50 |
-
$length = count( $item_array );
|
51 |
-
foreach ( $item_array as $item ) {
|
52 |
-
$html .= '<li>';
|
53 |
-
if ( $count === $length && ( !isset( $options['current_link'] ) || $options['current_link'] !== 'on' ) ) {
|
54 |
-
$html .=
|
55 |
-
} else {
|
56 |
-
$html .= '<a href="' . esc_url( $item['@id'] ) . '">';
|
57 |
-
$html .=
|
58 |
-
$html .= '</a>';
|
59 |
-
}
|
60 |
-
$html .= '</li>' . PHP_EOL;
|
61 |
-
$count++;
|
62 |
-
}
|
63 |
-
$html .= '</ol>' . PHP_EOL;
|
64 |
-
$html .= '<!-- Markup (JSON-LD) structured in schema.org Breadcrumb END -->' . PHP_EOL;
|
65 |
-
}
|
66 |
-
|
67 |
-
return (string) $html;
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Breadcrumb array setting.
|
72 |
-
*
|
73 |
-
* @version 4.
|
74 |
-
* @since 2.0.0
|
75 |
-
* @access public
|
76 |
-
* @param array $options
|
77 |
-
* @return array $item_array
|
78 |
-
*/
|
79 |
-
public function breadcrumb_array_setting ( array $options ) {
|
80 |
-
global $post;
|
81 |
-
|
82 |
-
/** item build */
|
83 |
-
$item_array = array();
|
84 |
-
|
85 |
-
if ( isset( $options['home_url'] ) ) {
|
86 |
-
switch ( $options['home_url'] ) {
|
87 |
-
case '
|
88 |
-
$current_url = esc_url(
|
89 |
-
break;
|
90 |
-
|
91 |
-
$current_url = esc_url(
|
92 |
-
break;
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
$item_array[] = $this->set_schema_breadcrumb_item( home_url(),
|
113 |
-
}
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
$item_array[] = $this->set_schema_breadcrumb_item( get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) ), get_query_var( 'monthnum' ) );
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
if
|
169 |
-
$
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
$
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
*
|
214 |
-
*
|
215 |
-
* @
|
216 |
-
* @
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
$
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
*
|
255 |
-
*
|
256 |
-
* @
|
257 |
-
* @
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
);
|
267 |
-
return (array) $args;
|
268 |
-
}
|
269 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Breadcrumb ShortCode Settings
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.7.0
|
7 |
+
* @since 2.0.0
|
8 |
+
*/
|
9 |
+
class Structuring_Markup_ShortCode_Breadcrumb {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* ShortCode Display.
|
13 |
+
*
|
14 |
+
* @version 4.7.0
|
15 |
+
* @since 2.0.0
|
16 |
+
* @access public
|
17 |
+
* @param array $options
|
18 |
+
* @param string $args
|
19 |
+
* @return string $html
|
20 |
+
*/
|
21 |
+
public function short_code_display ( array $options, $args ) {
|
22 |
+
extract( shortcode_atts( array (
|
23 |
+
'id' => "",
|
24 |
+
'class' => ""
|
25 |
+
), $args ) );
|
26 |
+
|
27 |
+
$instance = array(
|
28 |
+
'id' => esc_attr( $id ),
|
29 |
+
'class' => esc_attr( $class )
|
30 |
+
);
|
31 |
+
|
32 |
+
$item_array = $this->breadcrumb_array_setting( $options );
|
33 |
+
$html = '';
|
34 |
+
|
35 |
+
if ( isset( $item_array ) && count( $item_array ) > 0 ) {
|
36 |
+
$html .= '<!-- Markup (JSON-LD) structured in schema.org Breadcrumb START -->' . PHP_EOL;
|
37 |
+
|
38 |
+
if ( $id !== '' && $class !== '' ) {
|
39 |
+
$html .= '<ol id="' . $id . '" class="' . $class . '">';
|
40 |
+
} else if ( $id !== '' && $class === '' ) {
|
41 |
+
$html .= '<ol id="' . $id . '">';
|
42 |
+
} else if ( $id === '' && $class !== '' ) {
|
43 |
+
$html .= '<ol class="' . $class . '">';
|
44 |
+
} else {
|
45 |
+
$html .= '<ol>';
|
46 |
+
}
|
47 |
+
$html .= PHP_EOL;
|
48 |
+
|
49 |
+
$count = 1;
|
50 |
+
$length = count( $item_array );
|
51 |
+
foreach ( $item_array as $item ) {
|
52 |
+
$html .= '<li>';
|
53 |
+
if ( $count === $length && ( !isset( $options['current_link'] ) || $options['current_link'] !== 'on' ) ) {
|
54 |
+
$html .= $item['name'];
|
55 |
+
} else {
|
56 |
+
$html .= '<a href="' . esc_url( $item['@id'] ) . '">';
|
57 |
+
$html .= $item['name'];
|
58 |
+
$html .= '</a>';
|
59 |
+
}
|
60 |
+
$html .= '</li>' . PHP_EOL;
|
61 |
+
$count++;
|
62 |
+
}
|
63 |
+
$html .= '</ol>' . PHP_EOL;
|
64 |
+
$html .= '<!-- Markup (JSON-LD) structured in schema.org Breadcrumb END -->' . PHP_EOL;
|
65 |
+
}
|
66 |
+
|
67 |
+
return (string) $html;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Breadcrumb array setting.
|
72 |
+
*
|
73 |
+
* @version 4.7.0
|
74 |
+
* @since 2.0.0
|
75 |
+
* @access public
|
76 |
+
* @param array $options
|
77 |
+
* @return array $item_array
|
78 |
+
*/
|
79 |
+
public function breadcrumb_array_setting ( array $options ) {
|
80 |
+
global $post;
|
81 |
+
|
82 |
+
/** item build */
|
83 |
+
$item_array = array();
|
84 |
+
|
85 |
+
if ( isset( $options['home_url'] ) ) {
|
86 |
+
switch ( $options['home_url'] ) {
|
87 |
+
case 'site_url':
|
88 |
+
$current_url = esc_url( site_url() . $_SERVER['REQUEST_URI'] );
|
89 |
+
break;
|
90 |
+
default:
|
91 |
+
$current_url = esc_url( home_url() . $_SERVER['REQUEST_URI'] );
|
92 |
+
break;
|
93 |
+
}
|
94 |
+
} else {
|
95 |
+
$current_url = esc_url( home_url() . $_SERVER['REQUEST_URI'] );
|
96 |
+
}
|
97 |
+
|
98 |
+
if ( get_option( 'show_on_front' ) === 'page' ) {
|
99 |
+
$front_page_id = get_option( 'page_on_front' );
|
100 |
+
} else {
|
101 |
+
$front_page_id = null;
|
102 |
+
}
|
103 |
+
|
104 |
+
if ( isset( $options['home_on'] ) && $options['home_on'] === 'on' ) {
|
105 |
+
if ( isset( $options['home_name'] ) && $options['home_name'] !== '' ) {
|
106 |
+
$item_array[] = $this->set_schema_breadcrumb_item( home_url(), $options['home_name'] );
|
107 |
+
} else {
|
108 |
+
if ( is_null( $front_page_id ) ) {
|
109 |
+
$item_array[] = $this->set_schema_breadcrumb_item( home_url(), get_bloginfo( 'name' ) );
|
110 |
+
} else {
|
111 |
+
$front_page = get_post( $front_page_id );
|
112 |
+
$item_array[] = $this->set_schema_breadcrumb_item( home_url(), $front_page->post_title );
|
113 |
+
}
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
if ( is_search() ) {
|
118 |
+
$search_query = get_search_query();
|
119 |
+
if ( $search_query !== '' ) {
|
120 |
+
$item_array[] = $this->set_schema_breadcrumb_item( $current_url, get_search_query() );
|
121 |
+
}
|
122 |
+
} elseif ( is_tag() ) {
|
123 |
+
$item_array[] = $this->set_schema_breadcrumb_item( $current_url, single_tag_title( '', false ) );
|
124 |
+
} elseif ( is_date() ) {
|
125 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_year_link( get_query_var( 'year' ) ), get_query_var( 'year' ) );
|
126 |
+
if ( get_query_var( 'day' ) !== 0 ) {
|
127 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) ), get_query_var( 'monthnum' ) );
|
128 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_day_link( get_query_var( 'year' ), get_query_var( 'monthnum' ), get_query_var( 'day' ) ), get_query_var( 'day' ) );
|
129 |
+
} elseif ( get_query_var( 'monthnum' ) !== 0 ) {
|
130 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) ), get_query_var( 'monthnum' ) );
|
131 |
+
}
|
132 |
+
} elseif ( is_category() ) {
|
133 |
+
$categories = get_queried_object();
|
134 |
+
if( $categories->parent !== 0 ) {
|
135 |
+
$ancestors = array_reverse( get_ancestors( $categories->cat_ID, 'category' ) );
|
136 |
+
foreach( $ancestors as $ancestor ) {
|
137 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_category_link( $ancestor ), get_cat_name( $ancestor ) );
|
138 |
+
}
|
139 |
+
}
|
140 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_category_link( $categories->term_id ), $categories->name );
|
141 |
+
} elseif ( is_author() ) {
|
142 |
+
$item_array[] = $this->set_schema_breadcrumb_item( $current_url, get_the_author_meta( 'display_name', get_query_var( 'author' ) ) );
|
143 |
+
} elseif ( is_page() && (int) $front_page_id !== $post->ID ) {
|
144 |
+
if( $post->post_parent !== 0 ) {
|
145 |
+
$ancestors = array_reverse( get_post_ancestors( $post->ID ) );
|
146 |
+
foreach( $ancestors as $ancestor ) {
|
147 |
+
if ( (int) $front_page_id !== $ancestor ) {
|
148 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_permalink( $ancestor ), get_the_title( $ancestor ) );
|
149 |
+
}
|
150 |
+
}
|
151 |
+
}
|
152 |
+
$item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
|
153 |
+
} elseif ( is_attachment() ) {
|
154 |
+
if ( $post->post_parent !== 0 ) {
|
155 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_permalink( $post->post_parent ), get_the_title( $post->post_parent ) );
|
156 |
+
}
|
157 |
+
$item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
|
158 |
+
} elseif ( is_404() ) {
|
159 |
+
$item_array[] = $this->set_schema_breadcrumb_item( $current_url, wp_get_document_title() );
|
160 |
+
} elseif ( is_post_type_archive() ) {
|
161 |
+
if ( get_post_type_archive_link( get_post_type() ) ) {
|
162 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_post_type_archive_link( get_post_type() ), post_type_archive_title( '', false) );
|
163 |
+
}
|
164 |
+
} elseif ( is_archive() ) {
|
165 |
+
if ( get_post_type_archive_link( get_post_type() ) ) {
|
166 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_post_type_archive_link( get_post_type() ), get_post_type_object( get_post_type() )->label );
|
167 |
+
}
|
168 |
+
if( is_tax() ){
|
169 |
+
$tax_slug = get_query_var( 'taxonomy' );
|
170 |
+
$term_slug = get_query_var( 'term' );
|
171 |
+
$term = get_term_by( "slug", $term_slug, $tax_slug );
|
172 |
+
|
173 |
+
if( $term->parent !== 0 ) {
|
174 |
+
$ancestors = array_reverse( get_ancestors( $term->term_taxonomy_id, $tax_slug ) );
|
175 |
+
foreach( $ancestors as $ancestor ) {
|
176 |
+
$ancestor_term = get_term( $ancestor, $tax_slug );
|
177 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_term_link( $ancestor ), $ancestor_term->name );
|
178 |
+
}
|
179 |
+
}
|
180 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_term_link( $term_slug, $tax_slug ), $term->name );
|
181 |
+
}
|
182 |
+
} elseif ( is_singular( 'post' ) ) {
|
183 |
+
$args = $this->set_taxonomy_item( $post->ID, 'category' );
|
184 |
+
if ( count( $args ) > 0 ) {
|
185 |
+
$item_array = array_merge( $item_array, $args );
|
186 |
+
}
|
187 |
+
$item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
|
188 |
+
} elseif ( is_single() ) {
|
189 |
+
if ( get_post_type_archive_link( get_post_type() ) ) {
|
190 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_post_type_archive_link( get_post_type() ), get_post_type_object( get_post_type() )->label );
|
191 |
+
}
|
192 |
+
$taxonomy_names = get_post_taxonomies();
|
193 |
+
if ( count( $taxonomy_names ) > 0 ) {
|
194 |
+
$args = $this->set_taxonomy_item( $post->ID, $taxonomy_names[0] );
|
195 |
+
if ( count( $args ) > 0 ) {
|
196 |
+
$item_array = array_merge( $item_array, $args );
|
197 |
+
}
|
198 |
+
}
|
199 |
+
$item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
|
200 |
+
}
|
201 |
+
|
202 |
+
if ( !isset( $options['current_on'] ) || $options['current_on'] !== 'on' ) {
|
203 |
+
array_pop( $item_array );
|
204 |
+
}
|
205 |
+
|
206 |
+
return (array) $item_array;
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* taxonomy item settings
|
211 |
+
*
|
212 |
+
* @version 4.7.0
|
213 |
+
* @since 4.0.0
|
214 |
+
* @param int $id
|
215 |
+
* @param string $taxonomy
|
216 |
+
* @return array $args
|
217 |
+
*/
|
218 |
+
private function set_taxonomy_item ( $id, $taxonomy ) {
|
219 |
+
$terms = get_the_terms( $id, $taxonomy );
|
220 |
+
$term_bottom = array();
|
221 |
+
$args = array();
|
222 |
+
|
223 |
+
if ( $terms && ! is_wp_error( $terms ) ) {
|
224 |
+
$parent_ids = array();
|
225 |
+
|
226 |
+
foreach ( $terms as $term ) {
|
227 |
+
if ( $term->parent != 0 ) {
|
228 |
+
$parent_ids[] = $term->parent;
|
229 |
+
}
|
230 |
+
}
|
231 |
+
foreach ( $terms as $term ) {
|
232 |
+
if ( !in_array( $term->term_id, $parent_ids ) ) {
|
233 |
+
$term_bottom[] = $term->term_id;
|
234 |
+
}
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
if ( count( $term_bottom ) > 0 ) {
|
239 |
+
$ancestors = array_reverse( get_ancestors( $term_bottom[0], $taxonomy ) );
|
240 |
+
$ancestors[] = $term_bottom[0];
|
241 |
+
|
242 |
+
foreach ( $ancestors as $ancestor ) {
|
243 |
+
$term = get_term( $ancestor, $taxonomy );
|
244 |
+
$args[] = $this->set_schema_breadcrumb_item( get_term_link( $ancestor ), $term->name );
|
245 |
+
}
|
246 |
+
}
|
247 |
+
return (array) $args;
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Breadcrumb item settings
|
252 |
+
*
|
253 |
+
* @version 4.7.0
|
254 |
+
* @since 2.0.0
|
255 |
+
* @param string $id
|
256 |
+
* @param string $name
|
257 |
+
* @return array $args
|
258 |
+
*/
|
259 |
+
private function set_schema_breadcrumb_item ( $id, $name ) {
|
260 |
+
$args = array(
|
261 |
+
"@id" => esc_url( $id ),
|
262 |
+
"name" => strip_tags( $name )
|
263 |
+
);
|
264 |
+
return (array) $args;
|
265 |
+
}
|
|
|
|
|
|
|
266 |
}
|
includes/wp-structuring-utility.php
CHANGED
@@ -1,68 +1,68 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Utility
|
4 |
-
*
|
5 |
-
* @author Kazuya Takami
|
6 |
-
* @version 4.1.0
|
7 |
-
* @since 4.0.0
|
8 |
-
*/
|
9 |
-
class Structuring_Markup_Utility {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Escape Text
|
13 |
-
*
|
14 |
-
* @version 4.0.0
|
15 |
-
* @since 4.0.0
|
16 |
-
* @param string $text
|
17 |
-
* @return string $text
|
18 |
-
*/
|
19 |
-
public function escape_text ( $text ) {
|
20 |
-
$text = strip_tags( $text );
|
21 |
-
$text = strip_shortcodes( $text );
|
22 |
-
$text = str_replace( array( "\r", "\n" ), '', $text );
|
23 |
-
|
24 |
-
return (string) $text;
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Return image dimensions
|
29 |
-
*
|
30 |
-
* @version 4.0.0
|
31 |
-
* @since 4.0.0
|
32 |
-
* @author Kazuya Takami
|
33 |
-
* @param string $url
|
34 |
-
* @return array | boolean $dimensions
|
35 |
-
*/
|
36 |
-
public function get_image_dimensions ( $url ) {
|
37 |
-
$image = wp_get_image_editor( $url );
|
38 |
-
|
39 |
-
if ( ! is_wp_error( $image ) ) {
|
40 |
-
return $image->get_size();
|
41 |
-
} else {
|
42 |
-
return __return_false();
|
43 |
-
}
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Return image dimensions
|
48 |
-
*
|
49 |
-
* @version 4.1.0
|
50 |
-
* @since 4.1.0
|
51 |
-
* @author Kazuya Takami
|
52 |
-
* @param string $content
|
53 |
-
* @return array | boolean $images
|
54 |
-
*/
|
55 |
-
public function get_content_image ( $content ) {
|
56 |
-
$pattern = '/<img.*?src\s*=\s*[\"|\'](.*?)[\"|\'].*?>/i';
|
57 |
-
|
58 |
-
if ( preg_match( $pattern, $content, $images ) ){
|
59 |
-
if ( is_array( $images ) && isset( $images[1] ) ) {
|
60 |
-
return $images[1];
|
61 |
-
} else {
|
62 |
-
return __return_false();
|
63 |
-
}
|
64 |
-
} else {
|
65 |
-
return __return_false();
|
66 |
-
}
|
67 |
-
}
|
68 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Utility
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.1.0
|
7 |
+
* @since 4.0.0
|
8 |
+
*/
|
9 |
+
class Structuring_Markup_Utility {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Escape Text
|
13 |
+
*
|
14 |
+
* @version 4.0.0
|
15 |
+
* @since 4.0.0
|
16 |
+
* @param string $text
|
17 |
+
* @return string $text
|
18 |
+
*/
|
19 |
+
public function escape_text ( $text ) {
|
20 |
+
$text = strip_tags( $text );
|
21 |
+
$text = strip_shortcodes( $text );
|
22 |
+
$text = str_replace( array( "\r", "\n" ), '', $text );
|
23 |
+
|
24 |
+
return (string) $text;
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Return image dimensions
|
29 |
+
*
|
30 |
+
* @version 4.0.0
|
31 |
+
* @since 4.0.0
|
32 |
+
* @author Kazuya Takami
|
33 |
+
* @param string $url
|
34 |
+
* @return array | boolean $dimensions
|
35 |
+
*/
|
36 |
+
public function get_image_dimensions ( $url ) {
|
37 |
+
$image = wp_get_image_editor( $url );
|
38 |
+
|
39 |
+
if ( ! is_wp_error( $image ) ) {
|
40 |
+
return $image->get_size();
|
41 |
+
} else {
|
42 |
+
return __return_false();
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Return image dimensions
|
48 |
+
*
|
49 |
+
* @version 4.1.0
|
50 |
+
* @since 4.1.0
|
51 |
+
* @author Kazuya Takami
|
52 |
+
* @param string $content
|
53 |
+
* @return array | boolean $images
|
54 |
+
*/
|
55 |
+
public function get_content_image ( $content ) {
|
56 |
+
$pattern = '/<img.*?src\s*=\s*[\"|\'](.*?)[\"|\'].*?>/i';
|
57 |
+
|
58 |
+
if ( preg_match( $pattern, $content, $images ) ){
|
59 |
+
if ( is_array( $images ) && isset( $images[1] ) ) {
|
60 |
+
return $images[1];
|
61 |
+
} else {
|
62 |
+
return __return_false();
|
63 |
+
}
|
64 |
+
} else {
|
65 |
+
return __return_false();
|
66 |
+
}
|
67 |
+
}
|
68 |
}
|
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: 5.1
|
6 |
-
Stable tag: 4.
|
7 |
|
8 |
Allows you to include schema.org JSON-LD syntax markup on your website
|
9 |
|
@@ -14,12 +14,12 @@ Base knowledge is "https://schema.org/" and "https://developers.google.com/struc
|
|
14 |
|
15 |
= Schema.org Type =
|
16 |
|
17 |
-
* Article:
|
18 |
-
* BlogPosting:
|
19 |
* BreadcrumbList: https://schema.org/BreadcrumbList
|
20 |
* Event: https://schema.org/Event
|
21 |
-
* LocalBusiness :
|
22 |
-
* NewsArticle:
|
23 |
* Organization: https://schema.org/Organization
|
24 |
* Person: https://schema.org/Person
|
25 |
* SiteNavigation: https://schema.org/SiteNavigationElement
|
@@ -68,6 +68,27 @@ if ( shortcode_exists( 'wp-structuring-markup-breadcrumb' ) ) {
|
|
68 |
|
69 |
== Changelog ==
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
= 4.6.5 (2019-03-11) =
|
72 |
* Fixed : A bug where the modification date is fixed to GMT time.
|
73 |
|
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: 5.6.1
|
6 |
+
Stable tag: 4.8.0
|
7 |
|
8 |
Allows you to include schema.org JSON-LD syntax markup on your website
|
9 |
|
14 |
|
15 |
= Schema.org Type =
|
16 |
|
17 |
+
* Article: https://schema.org/Article
|
18 |
+
* BlogPosting: https://schema.org/BlogPosting
|
19 |
* BreadcrumbList: https://schema.org/BreadcrumbList
|
20 |
* Event: https://schema.org/Event
|
21 |
+
* LocalBusiness : https://schema.org/LocalBusiness
|
22 |
+
* NewsArticle: https://schema.org/NewsArticle
|
23 |
* Organization: https://schema.org/Organization
|
24 |
* Person: https://schema.org/Person
|
25 |
* SiteNavigation: https://schema.org/SiteNavigationElement
|
68 |
|
69 |
== Changelog ==
|
70 |
|
71 |
+
= 4.8.0 (2020-02-14) =
|
72 |
+
* Fixed : Schema Type Local Business: Nesting of ternary operators.
|
73 |
+
* Checked : WordPress version 5.6.1 operation check.
|
74 |
+
|
75 |
+
= 4.7.0 (2020-01-13) =
|
76 |
+
* Updated : Added categories to videos and event types.
|
77 |
+
* Fixed : HTML tags are removed when outputting breadcrumbs.
|
78 |
+
* Fixed : Schema type Article: bug: 1st image in content is always used if check is on, even if no image present.
|
79 |
+
* Checked : WordPress version 5.3.2 operation check.
|
80 |
+
* Checked : WordPress version 5.3.1 operation check.
|
81 |
+
* Checked : WordPress version 5.3.0 operation check.
|
82 |
+
* Checked : WordPress version 5.2.5 operation check.
|
83 |
+
* Checked : WordPress version 5.2.4 operation check.
|
84 |
+
* Checked : WordPress version 5.2.3 operation check.
|
85 |
+
* Checked : WordPress version 5.2.2 operation check.
|
86 |
+
* Checked : WordPress version 5.2.1 operation check.
|
87 |
+
* Checked : WordPress version 5.2.0 operation check.
|
88 |
+
* Checked : WordPress version 5.1.3 operation check.
|
89 |
+
* Checked : WordPress version 5.1.2 operation check.
|
90 |
+
* Checked : WordPress version 5.1.1 operation check.
|
91 |
+
|
92 |
= 4.6.5 (2019-03-11) =
|
93 |
* Fixed : A bug where the modification date is fixed to GMT time.
|
94 |
|
uninstall.php
CHANGED
@@ -1,87 +1,87 @@
|
|
1 |
-
<?php
|
2 |
-
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
3 |
-
exit;
|
4 |
-
}
|
5 |
-
new Structuring_Markup_Uninstall();
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Schema.org Plugin Uninstall
|
9 |
-
*
|
10 |
-
* @author Kazuya Takami
|
11 |
-
* @version 4.5.0
|
12 |
-
* @since 1.0.0
|
13 |
-
*/
|
14 |
-
class Structuring_Markup_Uninstall {
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Variable definition.
|
18 |
-
*
|
19 |
-
* @version 4.5.0
|
20 |
-
* @since 2.1.0
|
21 |
-
*/
|
22 |
-
private $text_domain = 'wp-structuring-markup';
|
23 |
-
private $custom_type_event = 'schema_event_post';
|
24 |
-
private $custom_type_video = 'schema_video_post';
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Constructor Define.
|
28 |
-
*
|
29 |
-
* @version 4.5.0
|
30 |
-
* @since 1.0.0
|
31 |
-
*/
|
32 |
-
public function __construct () {
|
33 |
-
$this->drop_table( 'structuring_markup' );
|
34 |
-
$this->delete_custom_post( $this->custom_type_event );
|
35 |
-
$this->delete_post_meta( $this->custom_type_event );
|
36 |
-
$this->delete_custom_post( $this->custom_type_video );
|
37 |
-
$this->delete_post_meta( $this->custom_type_video );
|
38 |
-
delete_option( $this->text_domain );
|
39 |
-
}
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Drop Table.
|
43 |
-
*
|
44 |
-
* @version 2.1.0
|
45 |
-
* @since 1.0.0
|
46 |
-
* @param string $table_name
|
47 |
-
*/
|
48 |
-
private function drop_table ( $table_name = null ) {
|
49 |
-
global $wpdb;
|
50 |
-
$table_name = $wpdb->prefix . $table_name;
|
51 |
-
$wpdb->query( "DROP TABLE IF EXISTS " . $table_name );
|
52 |
-
}
|
53 |
-
|
54 |
-
/**
|
55 |
-
* Delete custom post.
|
56 |
-
*
|
57 |
-
* @version 2.1.0
|
58 |
-
* @since 2.1.0
|
59 |
-
* @param string $custom_type
|
60 |
-
*/
|
61 |
-
private function delete_custom_post ( $custom_type = null ) {
|
62 |
-
global $wpdb;
|
63 |
-
$table_name = $wpdb->prefix . "posts";
|
64 |
-
|
65 |
-
$key = array( 'post_type' => $custom_type );
|
66 |
-
$key_prepared = array( '%s' );
|
67 |
-
|
68 |
-
$wpdb->delete( $table_name, $key, $key_prepared );
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Delete post meta.
|
73 |
-
*
|
74 |
-
* @version 2.1.0
|
75 |
-
* @since 2.1.0
|
76 |
-
* @param string $custom_type
|
77 |
-
*/
|
78 |
-
private function delete_post_meta ( $custom_type = null ) {
|
79 |
-
global $wpdb;
|
80 |
-
$table_name = $wpdb->prefix . "postmeta";
|
81 |
-
|
82 |
-
$key = array( 'meta_key' => $custom_type );
|
83 |
-
$key_prepared = array( '%s' );
|
84 |
-
|
85 |
-
$wpdb->delete( $table_name, $key, $key_prepared );
|
86 |
-
}
|
87 |
}
|
1 |
+
<?php
|
2 |
+
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
3 |
+
exit;
|
4 |
+
}
|
5 |
+
new Structuring_Markup_Uninstall();
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Schema.org Plugin Uninstall
|
9 |
+
*
|
10 |
+
* @author Kazuya Takami
|
11 |
+
* @version 4.5.0
|
12 |
+
* @since 1.0.0
|
13 |
+
*/
|
14 |
+
class Structuring_Markup_Uninstall {
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Variable definition.
|
18 |
+
*
|
19 |
+
* @version 4.5.0
|
20 |
+
* @since 2.1.0
|
21 |
+
*/
|
22 |
+
private $text_domain = 'wp-structuring-markup';
|
23 |
+
private $custom_type_event = 'schema_event_post';
|
24 |
+
private $custom_type_video = 'schema_video_post';
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Constructor Define.
|
28 |
+
*
|
29 |
+
* @version 4.5.0
|
30 |
+
* @since 1.0.0
|
31 |
+
*/
|
32 |
+
public function __construct () {
|
33 |
+
$this->drop_table( 'structuring_markup' );
|
34 |
+
$this->delete_custom_post( $this->custom_type_event );
|
35 |
+
$this->delete_post_meta( $this->custom_type_event );
|
36 |
+
$this->delete_custom_post( $this->custom_type_video );
|
37 |
+
$this->delete_post_meta( $this->custom_type_video );
|
38 |
+
delete_option( $this->text_domain );
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Drop Table.
|
43 |
+
*
|
44 |
+
* @version 2.1.0
|
45 |
+
* @since 1.0.0
|
46 |
+
* @param string $table_name
|
47 |
+
*/
|
48 |
+
private function drop_table ( $table_name = null ) {
|
49 |
+
global $wpdb;
|
50 |
+
$table_name = $wpdb->prefix . $table_name;
|
51 |
+
$wpdb->query( "DROP TABLE IF EXISTS " . $table_name );
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Delete custom post.
|
56 |
+
*
|
57 |
+
* @version 2.1.0
|
58 |
+
* @since 2.1.0
|
59 |
+
* @param string $custom_type
|
60 |
+
*/
|
61 |
+
private function delete_custom_post ( $custom_type = null ) {
|
62 |
+
global $wpdb;
|
63 |
+
$table_name = $wpdb->prefix . "posts";
|
64 |
+
|
65 |
+
$key = array( 'post_type' => $custom_type );
|
66 |
+
$key_prepared = array( '%s' );
|
67 |
+
|
68 |
+
$wpdb->delete( $table_name, $key, $key_prepared );
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Delete post meta.
|
73 |
+
*
|
74 |
+
* @version 2.1.0
|
75 |
+
* @since 2.1.0
|
76 |
+
* @param string $custom_type
|
77 |
+
*/
|
78 |
+
private function delete_post_meta ( $custom_type = null ) {
|
79 |
+
global $wpdb;
|
80 |
+
$table_name = $wpdb->prefix . "postmeta";
|
81 |
+
|
82 |
+
$key = array( 'meta_key' => $custom_type );
|
83 |
+
$key_prepared = array( '%s' );
|
84 |
+
|
85 |
+
$wpdb->delete( $table_name, $key, $key_prepared );
|
86 |
+
}
|
87 |
}
|
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: 4.
|
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 4.
|
22 |
* @since 1.0.0
|
23 |
*/
|
24 |
class Structuring_Markup {
|
@@ -26,10 +26,10 @@ class Structuring_Markup {
|
|
26 |
/**
|
27 |
* Variable definition version.
|
28 |
*
|
29 |
-
* @version 4.
|
30 |
* @since 1.3.0
|
31 |
*/
|
32 |
-
private $version = '4.
|
33 |
|
34 |
/**
|
35 |
* Variable definition Text Domain.
|
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: 4.8.0
|
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 4.8.0
|
22 |
* @since 1.0.0
|
23 |
*/
|
24 |
class Structuring_Markup {
|
26 |
/**
|
27 |
* Variable definition version.
|
28 |
*
|
29 |
+
* @version 4.8.0
|
30 |
* @since 1.3.0
|
31 |
*/
|
32 |
+
private $version = '4.8.0';
|
33 |
|
34 |
/**
|
35 |
* Variable definition Text Domain.
|