Version Description
(2018-09-03) = * Fixed : Changed title fixing of breadcrumbs on page 404.
Download this release
Release Info
Developer | miiitaka |
Plugin | Markup (JSON-LD) structured in schema.org |
Version | 4.5.1 |
Comparing to | |
See all releases |
Code changes from version 4.5.0 to 4.5.1
- includes/wp-structuring-short-code-breadcrumb.php +3 -3
- readme.txt +4 -1
- trunk/css/schema-custom-post.css +21 -0
- trunk/css/style.css +163 -0
- trunk/includes/admin/wp-structuring-admin-config.php +151 -0
- trunk/includes/admin/wp-structuring-admin-db.php +290 -0
- trunk/includes/admin/wp-structuring-admin-list.php +99 -0
- trunk/includes/admin/wp-structuring-admin-post.php +373 -0
- trunk/includes/admin/wp-structuring-admin-type-article.php +168 -0
- trunk/includes/admin/wp-structuring-admin-type-blog-posting.php +168 -0
- trunk/includes/admin/wp-structuring-admin-type-breadcrumb.php +101 -0
- trunk/includes/admin/wp-structuring-admin-type-event.php +73 -0
- trunk/includes/admin/wp-structuring-admin-type-local-business.php +528 -0
- trunk/includes/admin/wp-structuring-admin-type-news-article.php +168 -0
- trunk/includes/admin/wp-structuring-admin-type-organization.php +180 -0
- trunk/includes/admin/wp-structuring-admin-type-person.php +114 -0
- trunk/includes/admin/wp-structuring-admin-type-site-navigation.php +79 -0
- trunk/includes/admin/wp-structuring-admin-type-video.php +50 -0
- trunk/includes/admin/wp-structuring-admin-type-website.php +109 -0
- trunk/includes/custom/wp-structuring-custom-post-event.php +299 -0
- trunk/includes/custom/wp-structuring-custom-post-video.php +204 -0
- trunk/includes/meta/wp-structuring-meta-article.php +148 -0
- trunk/includes/meta/wp-structuring-meta-blog-posting.php +149 -0
- trunk/includes/meta/wp-structuring-meta-breadcrumb.php +50 -0
- trunk/includes/meta/wp-structuring-meta-event.php +95 -0
- trunk/includes/meta/wp-structuring-meta-local-business.php +143 -0
- trunk/includes/meta/wp-structuring-meta-news-article.php +149 -0
- trunk/includes/meta/wp-structuring-meta-organization.php +80 -0
- trunk/includes/meta/wp-structuring-meta-person.php +57 -0
- trunk/includes/meta/wp-structuring-meta-site-navigation.php +42 -0
- trunk/includes/meta/wp-structuring-meta-video.php +90 -0
- trunk/includes/meta/wp-structuring-meta-website.php +58 -0
- trunk/includes/wp-structuring-display-amp.php +100 -0
- trunk/includes/wp-structuring-display.php +226 -0
- trunk/includes/wp-structuring-opening-hours.php +224 -0
- trunk/includes/wp-structuring-short-code-breadcrumb.php +254 -0
- trunk/includes/wp-structuring-utility.php +68 -0
- trunk/js/main.js +30 -0
- trunk/js/main.min.js +1 -0
- trunk/js/media-uploader-main.js +39 -0
- trunk/languages/wp-structuring-markup-ja.mo +0 -0
- trunk/languages/wp-structuring-markup-ja.po +217 -0
- trunk/languages/wp-structuring-markup-tr_TR.mo +0 -0
- trunk/languages/wp-structuring-markup-tr_TR.po +163 -0
- trunk/languages/wp-structuring-markup.pot +217 -0
- trunk/readme.txt +347 -0
- trunk/uninstall.php +87 -0
- trunk/wp-structuring-markup.php +308 -0
includes/wp-structuring-short-code-breadcrumb.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Breadcrumb ShortCode Settings
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
-
* @version 4.
|
7 |
* @since 2.0.0
|
8 |
*/
|
9 |
class Structuring_Markup_ShortCode_Breadcrumb {
|
@@ -11,7 +11,7 @@ class Structuring_Markup_ShortCode_Breadcrumb {
|
|
11 |
/**
|
12 |
* ShortCode Display.
|
13 |
*
|
14 |
-
* @version 4.
|
15 |
* @since 2.0.0
|
16 |
* @access public
|
17 |
* @param array $options
|
@@ -144,7 +144,7 @@ class Structuring_Markup_ShortCode_Breadcrumb {
|
|
144 |
}
|
145 |
$item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
|
146 |
} elseif ( is_404() ) {
|
147 |
-
$item_array[] = $this->set_schema_breadcrumb_item( $current_url,
|
148 |
} elseif ( is_post_type_archive() ) {
|
149 |
if ( get_post_type_archive_link( get_post_type() ) ) {
|
150 |
$item_array[] = $this->set_schema_breadcrumb_item( get_post_type_archive_link( get_post_type() ), post_type_archive_title( '', false) );
|
3 |
* Breadcrumb ShortCode Settings
|
4 |
*
|
5 |
* @author Kazuya Takami
|
6 |
+
* @version 4.5.1
|
7 |
* @since 2.0.0
|
8 |
*/
|
9 |
class Structuring_Markup_ShortCode_Breadcrumb {
|
11 |
/**
|
12 |
* ShortCode Display.
|
13 |
*
|
14 |
+
* @version 4.5.1
|
15 |
* @since 2.0.0
|
16 |
* @access public
|
17 |
* @param array $options
|
144 |
}
|
145 |
$item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
|
146 |
} elseif ( is_404() ) {
|
147 |
+
$item_array[] = $this->set_schema_breadcrumb_item( $current_url, wp_get_document_title() );
|
148 |
} elseif ( is_post_type_archive() ) {
|
149 |
if ( get_post_type_archive_link( get_post_type() ) ) {
|
150 |
$item_array[] = $this->set_schema_breadcrumb_item( get_post_type_archive_link( get_post_type() ), post_type_archive_title( '', false) );
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: miiitaka
|
|
3 |
Tags: schema, schema.org, json, json-ld, seo, post, posts, google, shortcode, breadcrumb
|
4 |
Requires at least: 4.3.1
|
5 |
Tested up to: 4.9.8
|
6 |
-
Stable tag: 4.5.
|
7 |
|
8 |
Allows you to include schema.org JSON-LD syntax markup on your website
|
9 |
|
@@ -55,6 +55,9 @@ if ( shortcode_exists( 'wp-structuring-markup-breadcrumb' ) ) {
|
|
55 |
|
56 |
== Changelog ==
|
57 |
|
|
|
|
|
|
|
58 |
= 4.5.0 (2018-08-17) =
|
59 |
* Checked : WordPress version 4.9.8 operation check.
|
60 |
* Added : Speakable structured markup is implemented in "Article", "BlogPosting", "NewsArticle".
|
3 |
Tags: schema, schema.org, json, json-ld, seo, post, posts, google, shortcode, breadcrumb
|
4 |
Requires at least: 4.3.1
|
5 |
Tested up to: 4.9.8
|
6 |
+
Stable tag: 4.5.1
|
7 |
|
8 |
Allows you to include schema.org JSON-LD syntax markup on your website
|
9 |
|
55 |
|
56 |
== Changelog ==
|
57 |
|
58 |
+
= 4.5.1 (2018-09-03) =
|
59 |
+
* Fixed : Changed title fixing of breadcrumbs on page 404.
|
60 |
+
|
61 |
= 4.5.0 (2018-08-17) =
|
62 |
* Checked : WordPress version 4.9.8 operation check.
|
63 |
* Added : Speakable structured markup is implemented in "Article", "BlogPosting", "NewsArticle".
|
trunk/css/schema-custom-post.css
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/** Event & Video Style */
|
2 |
+
.schema-admin-custom-post label:before {
|
3 |
+
border-radius: 2px;
|
4 |
+
box-shadow: inset 0 -1px 0 rgba(27,31,35,0.12);
|
5 |
+
line-height: 1;
|
6 |
+
margin: 0 5px 0 0;
|
7 |
+
}
|
8 |
+
|
9 |
+
.schema-admin-required:before {
|
10 |
+
background: #efefef;
|
11 |
+
color: #a00;
|
12 |
+
content: 'required';
|
13 |
+
padding: 3px 41px 3px 5px;
|
14 |
+
}
|
15 |
+
|
16 |
+
.schema-admin-recommended:before {
|
17 |
+
background: #efefef;
|
18 |
+
color: #0073aa;
|
19 |
+
content: 'recommended';
|
20 |
+
padding: 3px 5px;
|
21 |
+
}
|
trunk/css/style.css
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/** List Setting */
|
2 |
+
.schema-admin-table-list {
|
3 |
+
border-collapse: collapse;
|
4 |
+
}
|
5 |
+
.schema-admin-table-list .schema-admin-table-list-type {
|
6 |
+
width: 15%;
|
7 |
+
}
|
8 |
+
|
9 |
+
.schema-admin-table-list .schema-admin-table-list-output {
|
10 |
+
width: 30%;
|
11 |
+
}
|
12 |
+
|
13 |
+
.schema-admin-table-list tr {
|
14 |
+
border-bottom: solid 1px #ddd;
|
15 |
+
}
|
16 |
+
|
17 |
+
.schema-admin-table-list tr:last-child {
|
18 |
+
border-bottom: none;
|
19 |
+
}
|
20 |
+
|
21 |
+
.schema-admin-table-list td {
|
22 |
+
vertical-align: middle;
|
23 |
+
}
|
24 |
+
|
25 |
+
.schema-admin-table-list td:nth-child(1) > span {
|
26 |
+
float: left;
|
27 |
+
height: 2em;
|
28 |
+
}
|
29 |
+
|
30 |
+
.schema-admin-table-list td:nth-child(1) > span span {
|
31 |
+
display: inline-block;
|
32 |
+
margin: 0 10px 0 0;
|
33 |
+
padding: 0 1em 0 1em;
|
34 |
+
text-align: center;
|
35 |
+
width: 8em;
|
36 |
+
}
|
37 |
+
|
38 |
+
.schema-admin-table-list td:nth-child(1) > span span.active {
|
39 |
+
background: #00a0d2;
|
40 |
+
color: #fff;
|
41 |
+
}
|
42 |
+
|
43 |
+
.schema-admin-table-list tr.active {
|
44 |
+
background: #ffffff;
|
45 |
+
}
|
46 |
+
|
47 |
+
.schema-admin-table-list tr.stop {
|
48 |
+
background: #efefef;
|
49 |
+
}
|
50 |
+
|
51 |
+
.schema-admin-table-list td:nth-child(1) > span span.stop {
|
52 |
+
background: #ddd;
|
53 |
+
}
|
54 |
+
|
55 |
+
/** Posts page */
|
56 |
+
.schema-admin-h1-span {
|
57 |
+
display: inline-block;
|
58 |
+
font-size: 80%;
|
59 |
+
margin: 0 0 0 10px;
|
60 |
+
}
|
61 |
+
|
62 |
+
.schema-admin-require::before {
|
63 |
+
color: #a00;
|
64 |
+
content: "*";
|
65 |
+
margin: 0 3px 0 0;
|
66 |
+
}
|
67 |
+
|
68 |
+
.schema-admin-table {
|
69 |
+
margin: 15px 0 15px 0;
|
70 |
+
}
|
71 |
+
|
72 |
+
.schema-admin-table caption {
|
73 |
+
border-left: solid 4px #00a0d2;
|
74 |
+
margin: 0 0 5px 0;
|
75 |
+
padding: 3px 0 3px 7px;
|
76 |
+
text-align: left;
|
77 |
+
}
|
78 |
+
|
79 |
+
.schema-admin-table th {
|
80 |
+
height: 2em;
|
81 |
+
padding: 0 5px 0 0;
|
82 |
+
text-align: right;
|
83 |
+
vertical-align: middle;
|
84 |
+
width: 200px;
|
85 |
+
}
|
86 |
+
|
87 |
+
.schema-admin-table th.require::before {
|
88 |
+
color: #a00;
|
89 |
+
content: "*";
|
90 |
+
margin: 0 3px 0 0;
|
91 |
+
}
|
92 |
+
|
93 |
+
.schema-admin-table td {
|
94 |
+
vertical-align: middle;
|
95 |
+
}
|
96 |
+
|
97 |
+
.schema-admin-table td label {
|
98 |
+
margin: 0 10px 0 0;
|
99 |
+
}
|
100 |
+
|
101 |
+
.schema-admin-table small {
|
102 |
+
display: block;
|
103 |
+
margin: 2px 0 2px 1px;
|
104 |
+
background: #ddd;
|
105 |
+
padding: 0 5px;
|
106 |
+
}
|
107 |
+
|
108 |
+
.schema-admin-table input[type="checkbox"] {
|
109 |
+
margin: 0 5px 0 0;
|
110 |
+
}
|
111 |
+
|
112 |
+
.schema-admin-table input:invalid {
|
113 |
+
border: solid 1px #d8000c;
|
114 |
+
background: #ffbaba;
|
115 |
+
}
|
116 |
+
|
117 |
+
/** LocalBusiness */
|
118 |
+
.markup-time {
|
119 |
+
color: #999;
|
120 |
+
cursor: pointer;
|
121 |
+
width: 18px;
|
122 |
+
height: 18px;
|
123 |
+
line-height: 20px;
|
124 |
+
font-size: 14px;
|
125 |
+
border: solid 1px #bbb;
|
126 |
+
background-color: #fff;
|
127 |
+
border-radius: 100%;
|
128 |
+
margin-top: 5px;
|
129 |
+
}
|
130 |
+
|
131 |
+
.markup-time:hover {
|
132 |
+
color: #fff;
|
133 |
+
border-color: transparent;
|
134 |
+
}
|
135 |
+
|
136 |
+
.markup-time .plus:hover {
|
137 |
+
background-color: #00a0d2;
|
138 |
+
}
|
139 |
+
|
140 |
+
.markup-time .minus {
|
141 |
+
line-height: 18px;
|
142 |
+
}
|
143 |
+
|
144 |
+
.markup-time .minus:hover {
|
145 |
+
background-color: #f55e4f;
|
146 |
+
}
|
147 |
+
|
148 |
+
/** Media Uploader */
|
149 |
+
.schema-admin-media-button {
|
150 |
+
border: 0;
|
151 |
+
font-size: 12px;
|
152 |
+
padding: 6px 8px 2px 8px;
|
153 |
+
}
|
154 |
+
|
155 |
+
.schema-admin-media-button:before {
|
156 |
+
font-size: 16px;
|
157 |
+
height: 16px;
|
158 |
+
width: 16px;
|
159 |
+
}
|
160 |
+
|
161 |
+
.schema-admin-media-button:hover {
|
162 |
+
cursor: pointer;
|
163 |
+
}
|
trunk/includes/admin/wp-structuring-admin-config.php
ADDED
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Admin Config
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.5.0
|
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.0
|
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 |
+
|
59 |
+
$this->page_render( $options, $status );
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Setting Page of the Admin Screen.
|
64 |
+
*
|
65 |
+
* @version 4.5.0
|
66 |
+
* @since 4.5.0
|
67 |
+
* @param array $options
|
68 |
+
* @param string $status
|
69 |
+
*/
|
70 |
+
private function page_render ( array $options, $status ) {
|
71 |
+
$html = '';
|
72 |
+
$html .= '<div class="wrap">';
|
73 |
+
$html .= '<h1>' . esc_html__( 'Schema.org Config', $this->text_domain ) . '</h1>';
|
74 |
+
switch ( $status ) {
|
75 |
+
case "ok":
|
76 |
+
$html .= $this->information_render();
|
77 |
+
break;
|
78 |
+
case "error":
|
79 |
+
$html .= $this->error_render();
|
80 |
+
break;
|
81 |
+
default:
|
82 |
+
break;
|
83 |
+
}
|
84 |
+
echo $html;
|
85 |
+
|
86 |
+
/** Output Page Select */
|
87 |
+
$html = '<hr>';
|
88 |
+
$html .= '<form method="post" action="">';
|
89 |
+
echo $html;
|
90 |
+
|
91 |
+
wp_nonce_field( $this->nonce_action, $this->nonce_name );
|
92 |
+
|
93 |
+
$html = '<table class="schema-admin-table">';
|
94 |
+
|
95 |
+
$html .= '<tr><th>' . esc_html__( 'Plug-in version' ) . ' : </th>';
|
96 |
+
$html .= '<td>';
|
97 |
+
$html .= isset( $options['version'] ) ? esc_html( $options['version'] ) : '';
|
98 |
+
$html .= '</td></tr>';
|
99 |
+
|
100 |
+
$html .= '<tr><th><label for="compress">Enabled : </label></th>';
|
101 |
+
$html .= '<td><label><input type="checkbox" name="compress" id="compress" value="on"';
|
102 |
+
$html .= ( isset( $options['compress'] ) && $options['compress'] === "on" ) ? ' checked' : '';
|
103 |
+
$html .= '><label for="compress">' . esc_html__( 'Compress output data', $this->text_domain ) . '</label></td></tr>';
|
104 |
+
|
105 |
+
$html .= '</table>';
|
106 |
+
|
107 |
+
echo $html;
|
108 |
+
|
109 |
+
submit_button();
|
110 |
+
|
111 |
+
$html = '</form>';
|
112 |
+
$html .= '</div>';
|
113 |
+
echo $html;
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Information Message Render
|
118 |
+
*
|
119 |
+
* @version 4.5.0
|
120 |
+
* @since 4.5.0
|
121 |
+
* @return string $html
|
122 |
+
*/
|
123 |
+
private function information_render () {
|
124 |
+
$html = '<div id="message" class="updated notice notice-success is-dismissible below-h2">';
|
125 |
+
$html .= '<p>Schema.org Config Update.</p>';
|
126 |
+
$html .= '<button type="button" class="notice-dismiss">';
|
127 |
+
$html .= '<span class="screen-reader-text">Dismiss this notice.</span>';
|
128 |
+
$html .= '</button>';
|
129 |
+
$html .= '</div>';
|
130 |
+
|
131 |
+
return (string) $html;
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Error Message Render
|
136 |
+
*
|
137 |
+
* @version 4.5.0
|
138 |
+
* @since 4.5.0
|
139 |
+
* @return string $html
|
140 |
+
*/
|
141 |
+
private function error_render () {
|
142 |
+
$html = '<div id="notice" class="notice notice-error is-dismissible below-h2">';
|
143 |
+
$html .= '<p>Update Error.</p>';
|
144 |
+
$html .= '<button type="button" class="notice-dismiss">';
|
145 |
+
$html .= '<span class="screen-reader-text">Dismiss this notice.</span>';
|
146 |
+
$html .= '</button>';
|
147 |
+
$html .= '</div>';
|
148 |
+
|
149 |
+
return (string) $html;
|
150 |
+
}
|
151 |
+
}
|
trunk/includes/admin/wp-structuring-admin-db.php
ADDED
@@ -0,0 +1,290 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Admin DB Connection.
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.5.0
|
7 |
+
* @since 1.0.0
|
8 |
+
*/
|
9 |
+
class Structuring_Markup_Admin_Db {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Variable definition.
|
13 |
+
*
|
14 |
+
* @version 3.1.0
|
15 |
+
* @since 1.0.0
|
16 |
+
*/
|
17 |
+
private $table_name;
|
18 |
+
|
19 |
+
/** Schema.org Type defined. */
|
20 |
+
public $type_array = array(
|
21 |
+
"article" => "Article",
|
22 |
+
"blog_posting" => "Blog Posting",
|
23 |
+
"breadcrumb" => "Breadcrumb",
|
24 |
+
"event" => "Event",
|
25 |
+
"local_business" => "Local Business",
|
26 |
+
"news_article" => "News Article",
|
27 |
+
"organization" => "Organization",
|
28 |
+
"person" => "Person",
|
29 |
+
"site_navigation"=> "Site Navigation",
|
30 |
+
"video" => "Video",
|
31 |
+
"website" => "Web Site"
|
32 |
+
);
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Constructor Define.
|
36 |
+
*
|
37 |
+
* @version 1.3.2
|
38 |
+
* @since 1.0.0
|
39 |
+
*/
|
40 |
+
public function __construct () {
|
41 |
+
global $wpdb;
|
42 |
+
$this->table_name = $wpdb->prefix . 'structuring_markup';
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Create Table.
|
47 |
+
*
|
48 |
+
* @version 4.3.0
|
49 |
+
* @since 1.0.0
|
50 |
+
* @param string $text_domain
|
51 |
+
* @param string $version
|
52 |
+
*/
|
53 |
+
public function create_table ( $text_domain, $version ) {
|
54 |
+
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
55 |
+
|
56 |
+
global $wpdb;
|
57 |
+
|
58 |
+
$prepared = $wpdb->prepare( "SHOW TABLES LIKE %s", $this->table_name );
|
59 |
+
$is_db_exists = $wpdb->get_var( $prepared );
|
60 |
+
$charset_collate = $wpdb->get_charset_collate();
|
61 |
+
|
62 |
+
if ( is_null( $is_db_exists ) ) {
|
63 |
+
$this->create_table_execute( $charset_collate, $text_domain, $version );
|
64 |
+
|
65 |
+
foreach ( $this->type_array as $key => $value ) {
|
66 |
+
$args = array(
|
67 |
+
'type' => $key,
|
68 |
+
'activate' => "",
|
69 |
+
'output' => serialize( array() ),
|
70 |
+
'options' => serialize( array() ),
|
71 |
+
'register_date' => date( "Y-m-d H:i:s" ),
|
72 |
+
'update_date' => date( "Y-m-d H:i:s" )
|
73 |
+
);
|
74 |
+
$this->insert_options( $args );
|
75 |
+
}
|
76 |
+
} else {
|
77 |
+
/**
|
78 |
+
* version up process.
|
79 |
+
*
|
80 |
+
* @version 4.4.0
|
81 |
+
* @since 2.0.0
|
82 |
+
* */
|
83 |
+
$options = get_option( $text_domain );
|
84 |
+
|
85 |
+
if ( !isset( $options['version'] ) || $options['version'] !== $version ) {
|
86 |
+
$lists = $this->get_list_options();
|
87 |
+
|
88 |
+
$wpdb->query( "DROP TABLE " . $this->table_name );
|
89 |
+
$this->create_table_execute( $charset_collate, $text_domain, $version );
|
90 |
+
|
91 |
+
foreach ( $this->type_array as $key => $value ) {
|
92 |
+
$args = array(
|
93 |
+
'type' => $key,
|
94 |
+
'activate' => "",
|
95 |
+
'output' => serialize( array() ),
|
96 |
+
'options' => serialize( array() ),
|
97 |
+
'register_date' => date( "Y-m-d H:i:s" ),
|
98 |
+
'update_date' => date( "Y-m-d H:i:s" )
|
99 |
+
);
|
100 |
+
foreach ( $lists as $list ) {
|
101 |
+
if ( $list->type === $key ) {
|
102 |
+
$activate = isset( $list->activate ) ? $list->activate : "";
|
103 |
+
|
104 |
+
// version up default value setting.
|
105 |
+
if ( $version >= '4.3.0' && $key === 'breadcrumb' ) {
|
106 |
+
$works = unserialize( $list->options );
|
107 |
+
$works['current_link'] = 'on';
|
108 |
+
$list->options = serialize( $works );
|
109 |
+
}
|
110 |
+
|
111 |
+
$args = array(
|
112 |
+
'type' => $key,
|
113 |
+
'activate' => $activate,
|
114 |
+
'output' => $list->output,
|
115 |
+
'options' => $list->options,
|
116 |
+
'register_date' => date( "Y-m-d H:i:s" ),
|
117 |
+
'update_date' => date( "Y-m-d H:i:s" )
|
118 |
+
);
|
119 |
+
}
|
120 |
+
}
|
121 |
+
$this->insert_options( $args );
|
122 |
+
}
|
123 |
+
}
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Create table execute
|
129 |
+
*
|
130 |
+
* @version 4.5.0
|
131 |
+
* @since 2.0.0
|
132 |
+
* @param string $charset_collate
|
133 |
+
* @param string $text_domain
|
134 |
+
* @param string $version
|
135 |
+
*/
|
136 |
+
private function create_table_execute ( $charset_collate, $text_domain, $version ) {
|
137 |
+
$query = " CREATE TABLE " . $this->table_name;
|
138 |
+
$query .= " (id MEDIUMINT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY";
|
139 |
+
$query .= ",type TINYTEXT NOT NULL";
|
140 |
+
$query .= ",activate TINYTEXT NOT NULL";
|
141 |
+
$query .= ",output TEXT NOT NULL";
|
142 |
+
$query .= ",options TEXT NOT NULL";
|
143 |
+
$query .= ",register_date DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL";
|
144 |
+
$query .= ",update_date DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL";
|
145 |
+
$query .= ",UNIQUE KEY id (id)) " . $charset_collate;
|
146 |
+
|
147 |
+
dbDelta( $query );
|
148 |
+
|
149 |
+
$args = array( 'version' => $version );
|
150 |
+
$options = get_option( $text_domain );
|
151 |
+
|
152 |
+
if ( $options ) {
|
153 |
+
$options = array_merge( $options, $args );
|
154 |
+
}
|
155 |
+
update_option( $text_domain, $options );
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Get Data.
|
160 |
+
*
|
161 |
+
* @version 2.1.0
|
162 |
+
* @since 1.0.0
|
163 |
+
* @param integer $id
|
164 |
+
* @return array $results
|
165 |
+
*/
|
166 |
+
public function get_options ( $id ) {
|
167 |
+
global $wpdb;
|
168 |
+
|
169 |
+
$query = "SELECT * FROM " . $this->table_name . " WHERE id = %d";
|
170 |
+
$data = array( esc_html( $id ) );
|
171 |
+
$prepared = $wpdb->prepare( $query, $data );
|
172 |
+
$args = $wpdb->get_row( $prepared );
|
173 |
+
$results = array();
|
174 |
+
|
175 |
+
if ( $args ) {
|
176 |
+
$results['id'] = $args->id;
|
177 |
+
$results['activate'] = isset( $args->activate ) ? $args->activate : "";
|
178 |
+
$results['type'] = $args->type;
|
179 |
+
$results['output'] = unserialize( $args->output );
|
180 |
+
$results['option'] = unserialize( $args->options );
|
181 |
+
}
|
182 |
+
return (array) $results;
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Get All Data.
|
187 |
+
*
|
188 |
+
* @since 1.0.0
|
189 |
+
* @return array $results
|
190 |
+
*/
|
191 |
+
public function get_list_options () {
|
192 |
+
global $wpdb;
|
193 |
+
|
194 |
+
$query = "SELECT * FROM " . $this->table_name . " ORDER BY type ASC";
|
195 |
+
|
196 |
+
return (array) $wpdb->get_results( $query );
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Get Type Data.
|
201 |
+
*
|
202 |
+
* @version 2.1.0
|
203 |
+
* @since 2.0.0
|
204 |
+
* @param string $type
|
205 |
+
* @return array $results
|
206 |
+
*/
|
207 |
+
public function get_type_options ( $type ) {
|
208 |
+
global $wpdb;
|
209 |
+
|
210 |
+
$query = "SELECT * FROM " . $this->table_name . " WHERE type = %s";
|
211 |
+
$data = array( esc_html( $type ) );
|
212 |
+
$prepared = $wpdb->prepare( $query, $data );
|
213 |
+
$args = $wpdb->get_row( $prepared );
|
214 |
+
$results = array();
|
215 |
+
|
216 |
+
if ( $args ) {
|
217 |
+
$results['id'] = $args->id;
|
218 |
+
$results['activate'] = isset( $args->activate ) ? $args->activate : "";
|
219 |
+
$results['type'] = $args->type;
|
220 |
+
$results['output'] = unserialize( $args->output );
|
221 |
+
$results['option'] = unserialize( $args->options );
|
222 |
+
}
|
223 |
+
return (array) $results;
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* Insert Data.
|
228 |
+
*
|
229 |
+
* @version 2.0.0
|
230 |
+
* @since 1.0.0
|
231 |
+
* @param array $args
|
232 |
+
*/
|
233 |
+
private function insert_options ( array $args ) {
|
234 |
+
global $wpdb;
|
235 |
+
|
236 |
+
$prepared = array( '%s', '%s', '%s', '%s', '%s', '%s' );
|
237 |
+
$wpdb->insert( $this->table_name, $args, $prepared );
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* Update Data.
|
242 |
+
*
|
243 |
+
* @version 2.0.0
|
244 |
+
* @since 1.0.0
|
245 |
+
* @param array $post($_POST)
|
246 |
+
* @return integer $post['id']
|
247 |
+
*/
|
248 |
+
public function update_options ( array $post ) {
|
249 |
+
global $wpdb;
|
250 |
+
|
251 |
+
$data = array(
|
252 |
+
'type' => $post['type'],
|
253 |
+
'activate' => isset( $post['activate'] ) ? $post['activate'] : "",
|
254 |
+
'output' => serialize( $post['output'] ),
|
255 |
+
'options' => isset( $post['option'] ) ? serialize( $post['option'] ) : "",
|
256 |
+
'update_date' => date( "Y-m-d H:i:s" )
|
257 |
+
);
|
258 |
+
$key = array( 'id' => esc_html( $post['id'] ) );
|
259 |
+
$prepared = array( '%s', '%s', '%s', '%s', '%s' );
|
260 |
+
$key_prepared = array( '%d' );
|
261 |
+
|
262 |
+
$wpdb->update( $this->table_name, $data, $key, $prepared, $key_prepared );
|
263 |
+
|
264 |
+
return (integer) $post['id'];
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Update Config Data.
|
269 |
+
*
|
270 |
+
* @version 4.5.0
|
271 |
+
* @since 4.5.0
|
272 |
+
* @param array $post
|
273 |
+
* @param string $text_domain
|
274 |
+
* @return boolean
|
275 |
+
*/
|
276 |
+
public function update_config ( array $post, $text_domain ) {
|
277 |
+
$options = get_option( $text_domain );
|
278 |
+
|
279 |
+
if ( !$options ) {
|
280 |
+
return __return_false();
|
281 |
+
} else {
|
282 |
+
$args = array(
|
283 |
+
'compress' => isset( $post['compress'] ) ? $post['compress'] : ''
|
284 |
+
);
|
285 |
+
$options = array_merge( $options, $args );
|
286 |
+
update_option( $text_domain, $options );
|
287 |
+
return __return_true();
|
288 |
+
}
|
289 |
+
}
|
290 |
+
}
|
trunk/includes/admin/wp-structuring-admin-list.php
ADDED
@@ -0,0 +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 |
+
}
|
trunk/includes/admin/wp-structuring-admin-post.php
ADDED
@@ -0,0 +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 |
+
}
|
trunk/includes/admin/wp-structuring-admin-type-article.php
ADDED
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type Article
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.5.0
|
7 |
+
* @since 1.1.0
|
8 |
+
* @see wp-structuring-admin-db.php
|
9 |
+
* @link http://schema.org/Article
|
10 |
+
* @link https://developers.google.com/search/docs/data-types/articles
|
11 |
+
* @link https://developers.google.com/search/docs/data-types/speakable
|
12 |
+
*/
|
13 |
+
class Structuring_Markup_Type_Article {
|
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.0
|
37 |
+
* @since 1.1.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 : Featured Image</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 |
+
echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/data-types/articles" target="_blank">https://developers.google.com/search/docs/data-types/articles</a></p>';
|
144 |
+
submit_button();
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Return the default options array
|
149 |
+
*
|
150 |
+
* @since 4.5.0
|
151 |
+
* @version 2.2.0
|
152 |
+
* @return array $args
|
153 |
+
*/
|
154 |
+
private function get_default_options () {
|
155 |
+
$args['name'] = '';
|
156 |
+
$args['content_image'] = '';
|
157 |
+
$args['default_image'] = '';
|
158 |
+
$args['logo'] = '';
|
159 |
+
$args['logo-height'] = 0;
|
160 |
+
$args['logo-width'] = 0;
|
161 |
+
$args['speakable_action'] = '';
|
162 |
+
$args['speakable_type'] = '';
|
163 |
+
$args['speakable_headline'] = '';
|
164 |
+
$args['speakable_summary'] = '';
|
165 |
+
|
166 |
+
return (array) $args;
|
167 |
+
}
|
168 |
+
}
|
trunk/includes/admin/wp-structuring-admin-type-blog-posting.php
ADDED
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type BlogPosting
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.5.0
|
7 |
+
* @since 1.2.0
|
8 |
+
* @see wp-structuring-admin-db.php
|
9 |
+
* @link http://schema.org/BlogPosting
|
10 |
+
* @link https://developers.google.com/search/docs/data-types/articles
|
11 |
+
* @link https://developers.google.com/search/docs/data-types/speakable
|
12 |
+
*/
|
13 |
+
class Structuring_Markup_Type_Blog_Posting {
|
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.0
|
37 |
+
* @since 1.2.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 : Featured Image</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 |
+
echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/data-types/articles" target="_blank">https://developers.google.com/search/docs/data-types/articles</a></p>';
|
144 |
+
submit_button();
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Return the default options array
|
149 |
+
*
|
150 |
+
* @version 4.5.0
|
151 |
+
* @since 2.2.0
|
152 |
+
* @return array $args
|
153 |
+
*/
|
154 |
+
private function get_default_options () {
|
155 |
+
$args['name'] = '';
|
156 |
+
$args['content_image'] = '';
|
157 |
+
$args['default_image'] = '';
|
158 |
+
$args['logo'] = '';
|
159 |
+
$args['logo-height'] = 0;
|
160 |
+
$args['logo-width'] = 0;
|
161 |
+
$args['speakable_action'] = '';
|
162 |
+
$args['speakable_type'] = '';
|
163 |
+
$args['speakable_headline'] = '';
|
164 |
+
$args['speakable_summary'] = '';
|
165 |
+
|
166 |
+
return (array) $args;
|
167 |
+
}
|
168 |
+
}
|
trunk/includes/admin/wp-structuring-admin-type-breadcrumb.php
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type Breadcrumb
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.3.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.3.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="current_on">Display Current Page :</label></th><td>';
|
55 |
+
$html .= '<input type="checkbox" name="option[' . "current_on" . ']" id="current_on" value="on"';
|
56 |
+
if ( isset( $option['current_on'] ) && $option['current_on'] === 'on' ) {
|
57 |
+
$html .= ' checked="checked"';
|
58 |
+
}
|
59 |
+
$html .= '>Enabled';
|
60 |
+
$html .= '<small>Installed the Current Page to breadcrumbs.</small>';
|
61 |
+
$html .= '</td></tr>';
|
62 |
+
$html .= '<tr><th><label for="current_link">Current Page Link :</label></th><td>';
|
63 |
+
$html .= '<input type="checkbox" name="option[' . "current_link" . ']" id="current_link" value="on"';
|
64 |
+
if ( isset( $option['current_link'] ) && $option['current_link'] === 'on' ) {
|
65 |
+
$html .= ' checked="checked"';
|
66 |
+
}
|
67 |
+
$html .= '>Enabled';
|
68 |
+
$html .= '<small>Link setting of the current page of breadcrumbs.</small>';
|
69 |
+
$html .= '</td></tr>';
|
70 |
+
$html .= '</table>';
|
71 |
+
echo $html;
|
72 |
+
|
73 |
+
$html = '<table class="schema-admin-table">';
|
74 |
+
$html .= '<caption>Short Code</caption>';
|
75 |
+
$html .= '<tr><th><label for="home_on">Short Code Copy :</label></th><td>';
|
76 |
+
$html .= '<input type="text" onfocus="this.select();" readonly="readonly" value="[wp-structuring-markup-breadcrumb]" class="large-text code">';
|
77 |
+
$html .= '<small>Option : id="id_name" and class="class_name" attribute additional ol element.</small>';
|
78 |
+
$html .= '</td></tr>';
|
79 |
+
$html .= '</table>';
|
80 |
+
echo $html;
|
81 |
+
|
82 |
+
echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/data-types/breadcrumbs" target="_blank">https://developers.google.com/search/docs/data-types/breadcrumbs</a></p>';
|
83 |
+
submit_button();
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Return the default options array
|
88 |
+
*
|
89 |
+
* @version 4.3.0
|
90 |
+
* @since 2.0.0
|
91 |
+
* @return array $args
|
92 |
+
*/
|
93 |
+
private function get_default_options () {
|
94 |
+
$args['home_on'] = '';
|
95 |
+
$args['home_name'] = '';
|
96 |
+
$args['current_on'] = '';
|
97 |
+
$args['current_link'] = '';
|
98 |
+
|
99 |
+
return (array) $args;
|
100 |
+
}
|
101 |
+
}
|
trunk/includes/admin/wp-structuring-admin-type-event.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type Event
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.0.2
|
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.0.2
|
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 |
+
echo '<p>Custom post name "schema_event_post"</p>';
|
68 |
+
echo '<p>Archive rewrite name "events"</p>';
|
69 |
+
echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/data-types/events" target="_blank">https://developers.google.com/search/docs/data-types/events</a></p>';
|
70 |
+
|
71 |
+
submit_button();
|
72 |
+
}
|
73 |
+
}
|
trunk/includes/admin/wp-structuring-admin-type-local-business.php
ADDED
@@ -0,0 +1,528 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type LocalBusiness
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.1.3
|
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 2.3.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.1.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 |
+
echo '<p>Setting Knowledge : <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></p>';
|
319 |
+
submit_button();
|
320 |
+
}
|
321 |
+
|
322 |
+
/**
|
323 |
+
* Return the default options array
|
324 |
+
*
|
325 |
+
* @since 4.1.3
|
326 |
+
* @version 2.5.0
|
327 |
+
* @return array $args
|
328 |
+
*/
|
329 |
+
private function get_default_options () {
|
330 |
+
$args['business_type'] = 'local_business';
|
331 |
+
$args['name'] = '';
|
332 |
+
$args['image'] = '';
|
333 |
+
$args['url'] = '';
|
334 |
+
$args['telephone'] = '';
|
335 |
+
$args['food_active'] = '';
|
336 |
+
$args['menu'] = '';
|
337 |
+
$args['accepts_reservations'] = '';
|
338 |
+
$args['serves_cuisine'] = '';
|
339 |
+
$args['street_address'] = '';
|
340 |
+
$args['address_locality'] = '';
|
341 |
+
$args['address_region'] = '';
|
342 |
+
$args['postal_code'] = '';
|
343 |
+
$args['address_country'] = '';
|
344 |
+
$args['geo_circle_active'] = '';
|
345 |
+
$args['geo_circle_radius'] = '';
|
346 |
+
$args['geo_active'] = '';
|
347 |
+
$args['latitude'] = '';
|
348 |
+
$args['longitude'] = '';
|
349 |
+
$args['opening_active'] = '';
|
350 |
+
|
351 |
+
foreach ( $this->week_array as $value ) {
|
352 |
+
$args[$value['type']] = '';
|
353 |
+
$args['week'][$value['type']]['open'] = '';
|
354 |
+
$args['week'][$value['type']]['close'] = '';
|
355 |
+
}
|
356 |
+
|
357 |
+
$args['holiday_active'] = '';
|
358 |
+
$args['holiday_open'] = '';
|
359 |
+
$args['holiday_close'] = '';
|
360 |
+
$args['holiday_valid_from'] = '';
|
361 |
+
$args['holiday_valid_through'] = '';
|
362 |
+
$args['price_range'] = '';
|
363 |
+
|
364 |
+
return (array) $args;
|
365 |
+
}
|
366 |
+
|
367 |
+
/**
|
368 |
+
* Return the form text
|
369 |
+
*
|
370 |
+
* @version 4.1.3
|
371 |
+
* @since 2.3.0
|
372 |
+
* @param string $id
|
373 |
+
* @param string $display
|
374 |
+
* @param string $value
|
375 |
+
* @param boolean $required
|
376 |
+
* @param string $note
|
377 |
+
* @return string $html
|
378 |
+
*/
|
379 |
+
private function set_form_text ( $id, $display, $value = "", $required = false, $note = "" ) {
|
380 |
+
$value = esc_attr( $value );
|
381 |
+
|
382 |
+
if ( $required ) {
|
383 |
+
$format = '<tr><th class="require"><label for=%s>%s :</label></th><td>';
|
384 |
+
} else {
|
385 |
+
$format = '<tr><th><label for=%s>%s :</label></th><td>';
|
386 |
+
}
|
387 |
+
|
388 |
+
$format .= '<input type="text" name="option[%s]" id="%s" class="regular-text" value="%s"';
|
389 |
+
|
390 |
+
if ( $required ) {
|
391 |
+
$format .= ' required';
|
392 |
+
}
|
393 |
+
if ( $note === "" ) {
|
394 |
+
$format .= '></td></tr>';
|
395 |
+
} else {
|
396 |
+
$format .= '><small>%s</small></td></tr>';
|
397 |
+
}
|
398 |
+
|
399 |
+
return (string) sprintf( $format, $id, $display, $id, $id, $value, $note );
|
400 |
+
}
|
401 |
+
|
402 |
+
/**
|
403 |
+
* Return the form date
|
404 |
+
*
|
405 |
+
* @since 3.0.5
|
406 |
+
* @version 2.5.0
|
407 |
+
* @param string $id
|
408 |
+
* @param string $display
|
409 |
+
* @param string $value
|
410 |
+
* @param boolean $required
|
411 |
+
* @param string $note
|
412 |
+
* @return string $html
|
413 |
+
*/
|
414 |
+
private function set_form_date ( $id, $display, $value = "", $required = false, $note = "" ) {
|
415 |
+
$value = esc_attr( $value );
|
416 |
+
|
417 |
+
$format = '<tr><th><label for=%s>%s :</label></th><td>';
|
418 |
+
$format .= '<input type="date" name="option[%s]" id="%s" value="%s"';
|
419 |
+
if ( $required ) {
|
420 |
+
$format .= ' required';
|
421 |
+
}
|
422 |
+
$format .= '><small>%s</small></td></tr>';
|
423 |
+
|
424 |
+
return (string) sprintf( $format, $id, $display, $id, $id, $value, $note );
|
425 |
+
}
|
426 |
+
|
427 |
+
/**
|
428 |
+
* Return the form checkbox
|
429 |
+
*
|
430 |
+
* @version 3.0.5
|
431 |
+
* @since 2.3.0
|
432 |
+
* @param string $id
|
433 |
+
* @param string $display
|
434 |
+
* @param string $value
|
435 |
+
* @param string $note
|
436 |
+
* @return string $html
|
437 |
+
*/
|
438 |
+
private function set_form_checkbox ( $id, $display, $value = "", $note = "" ) {
|
439 |
+
$value = esc_attr( $value );
|
440 |
+
|
441 |
+
$format = '<tr><th><label for=%s>%s :</label></th><td>';
|
442 |
+
$format .= '<input type="checkbox" name="option[%s]" id="%s" value="on"';
|
443 |
+
if ( $value === 'on' ) {
|
444 |
+
$format .= ' checked="checked"';
|
445 |
+
}
|
446 |
+
$format .= '>%s</td></tr>';
|
447 |
+
|
448 |
+
return (string) sprintf( $format, $id, $display, $id, $id, $note );
|
449 |
+
}
|
450 |
+
|
451 |
+
/**
|
452 |
+
* Return the form select
|
453 |
+
*
|
454 |
+
* @since 2.3.0
|
455 |
+
* @param string $id
|
456 |
+
* @param string $display
|
457 |
+
* @param string $value
|
458 |
+
* @param string $note
|
459 |
+
* @return string $html
|
460 |
+
*/
|
461 |
+
private function set_form_select ( $id, $display, $value = "", $note = "" ) {
|
462 |
+
$value = esc_attr( $value );
|
463 |
+
|
464 |
+
$format = '<tr><th class="require"><label for=%s>%s :</label></th><td>';
|
465 |
+
$format .= '<select id="%s" name="option[%s]">';
|
466 |
+
foreach ( $this->business_type_array as $args ) {
|
467 |
+
$format .= '<option value="' . $args['type'] . '"';
|
468 |
+
if ( $args['type'] === $value ) {
|
469 |
+
$format .= ' selected';
|
470 |
+
}
|
471 |
+
$format .= '>' . $args['display'] . '</option>';
|
472 |
+
}
|
473 |
+
$format .= '</select>';
|
474 |
+
$format .= '<small>%s</small></td></tr>';
|
475 |
+
|
476 |
+
return (string) sprintf( $format, $id, $display, $id, $id, $note );
|
477 |
+
}
|
478 |
+
|
479 |
+
/**
|
480 |
+
* Return the form time
|
481 |
+
*
|
482 |
+
* @version 3.0.5
|
483 |
+
* @since 2.3.0
|
484 |
+
* @param string $id
|
485 |
+
* @param string $display
|
486 |
+
* @param string $value1
|
487 |
+
* @param string $value2
|
488 |
+
* @param string $note
|
489 |
+
* @param int $count
|
490 |
+
* @return string $html
|
491 |
+
*/
|
492 |
+
private function set_form_time ( $id, $display, $value1 = "", $value2 = "", $note = "", $count = 0 ) {
|
493 |
+
$value1 = esc_attr( $value1 );
|
494 |
+
$value2 = esc_attr( $value2 );
|
495 |
+
|
496 |
+
$format = '<tr class="opening-hours %s"><th><label for=%s>%s :</label></th><td>';
|
497 |
+
$format .= 'Open Time : <input type="time" name="option[week][%s][%d][open]" id="%s-open" value="%s">';
|
498 |
+
$format .= ' Close Time : <input type="time" name="option[week][%s][%d][close]" id="%s-close" value="%s">';
|
499 |
+
$format .= '%s<a class="dashicons dashicons-plus markup-time plus"></a>';
|
500 |
+
if( $count !== 0 ) {
|
501 |
+
$format .= '<a class="dashicons dashicons-minus markup-time minus"></a>';
|
502 |
+
}
|
503 |
+
$format .= '</td></tr>';
|
504 |
+
|
505 |
+
return (string) sprintf( $format, $id, $id, $display, $id, $count, $id, $value1, $id, $count, $id, $value2, $note );
|
506 |
+
}
|
507 |
+
|
508 |
+
/**
|
509 |
+
* Return the form time (Holiday)
|
510 |
+
*
|
511 |
+
* @since 2.5.0
|
512 |
+
* @version 2.5.0
|
513 |
+
* @param string $value1
|
514 |
+
* @param string $value2
|
515 |
+
* @return string $html
|
516 |
+
*/
|
517 |
+
private function set_form_time_holiday ( $value1 = "", $value2 = "" ) {
|
518 |
+
$value1 = esc_attr( $value1 );
|
519 |
+
$value2 = esc_attr( $value2 );
|
520 |
+
|
521 |
+
$format = '<tr><th>Holiday Time :</th><td>';
|
522 |
+
$format .= 'Open Time : <input type="time" name="option[holiday_open]" value="%s">';
|
523 |
+
$format .= 'Close Time : <input type="time" name="option[holiday_close]" value="%s">';
|
524 |
+
$format .= '</td></tr>';
|
525 |
+
|
526 |
+
return (string) sprintf( $format, $value1, $value2 );
|
527 |
+
}
|
528 |
+
}
|
trunk/includes/admin/wp-structuring-admin-type-news-article.php
ADDED
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type News Article
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.5.0
|
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.0
|
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 |
+
echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/data-types/articles" target="_blank">https://developers.google.com/search/docs/data-types/articles</a></p>';
|
144 |
+
submit_button();
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Return the default options array
|
149 |
+
*
|
150 |
+
* @since 4.5.0
|
151 |
+
* @version 2.2.0
|
152 |
+
* @return array $args
|
153 |
+
*/
|
154 |
+
private function get_default_options () {
|
155 |
+
$args['name'] = '';
|
156 |
+
$args['content_image'] = '';
|
157 |
+
$args['default_image'] = '';
|
158 |
+
$args['logo'] = '';
|
159 |
+
$args['logo-height'] = 0;
|
160 |
+
$args['logo-width'] = 0;
|
161 |
+
$args['speakable_action'] = '';
|
162 |
+
$args['speakable_type'] = '';
|
163 |
+
$args['speakable_headline'] = '';
|
164 |
+
$args['speakable_summary'] = '';
|
165 |
+
|
166 |
+
return (array) $args;
|
167 |
+
}
|
168 |
+
}
|
trunk/includes/admin/wp-structuring-admin-type-organization.php
ADDED
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type Organization
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.1.3
|
7 |
+
* @since 1.0.0
|
8 |
+
* @see wp-structuring-admin-db.php
|
9 |
+
* @link https://schema.org/Organization
|
10 |
+
* @link https://developers.google.com/search/docs/guides/enhance-site
|
11 |
+
*/
|
12 |
+
class Structuring_Markup_Type_Organization {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Variable definition.
|
16 |
+
*
|
17 |
+
* @version 2.3.2
|
18 |
+
* @since 1.0.0
|
19 |
+
*/
|
20 |
+
/** contactType defined. */
|
21 |
+
private $contact_type_array = array(
|
22 |
+
array("type" => "customer service", "display" => "customer service"),
|
23 |
+
array("type" => "technical support", "display" => "technical support"),
|
24 |
+
array("type" => "billing support", "display" => "billing support"),
|
25 |
+
array("type" => "bill payment", "display" => "bill payment"),
|
26 |
+
array("type" => "sales", "display" => "sales"),
|
27 |
+
array("type" => "reservations", "display" => "reservations"),
|
28 |
+
array("type" => "credit card_support", "display" => "credit card support"),
|
29 |
+
array("type" => "emergency", "display" => "emergency"),
|
30 |
+
array("type" => "baggage tracking", "display" => "baggage tracking"),
|
31 |
+
array("type" => "roadside assistance", "display" => "roadside assistance"),
|
32 |
+
array("type" => "package tracking", "display" => "package tracking")
|
33 |
+
);
|
34 |
+
/** Social Profile */
|
35 |
+
private $social_array = array(
|
36 |
+
array("type" => "facebook", "display" => "Facebook"),
|
37 |
+
array("type" => "twitter", "display" => "Twitter"),
|
38 |
+
array("type" => "google", "display" => "Google+"),
|
39 |
+
array("type" => "instagram", "display" => "Instagram"),
|
40 |
+
array("type" => "youtube", "display" => "Youtube"),
|
41 |
+
array("type" => "linkedin", "display" => "LinkedIn"),
|
42 |
+
array("type" => "myspace", "display" => "Myspace"),
|
43 |
+
array("type" => "pinterest", "display" => "Pinterest"),
|
44 |
+
array("type" => "soundcloud", "display" => "SoundCloud"),
|
45 |
+
array("type" => "tumblr", "display" => "Tumblr")
|
46 |
+
);
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Constructor Define.
|
50 |
+
*
|
51 |
+
* @version 4.1.0
|
52 |
+
* @since 1.0.0
|
53 |
+
* @param array $option
|
54 |
+
*/
|
55 |
+
public function __construct ( array $option ) {
|
56 |
+
/** Default Value Set */
|
57 |
+
$option_array = $this->get_default_options();
|
58 |
+
|
59 |
+
if ( !empty( $option ) ) {
|
60 |
+
$option_array = array_merge( $option_array, $option );
|
61 |
+
}
|
62 |
+
$this->page_render( $option_array );
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Form Layout Render
|
67 |
+
*
|
68 |
+
* @version 4.1.3
|
69 |
+
* @since 1.0.0
|
70 |
+
* @param array $option
|
71 |
+
*/
|
72 |
+
private function page_render ( array $option ) {
|
73 |
+
/** Logos */
|
74 |
+
$html = '<table class="schema-admin-table">';
|
75 |
+
$html .= '<caption>Logos</caption>';
|
76 |
+
$html .= '<tr><th class="require"><label for="name">Organization Name :</label></th><td>';
|
77 |
+
$html .= '<input type="text" name="option[' . "name" . ']" id="name" class="regular-text" required value="' . esc_attr( $option['name'] ) . '">';
|
78 |
+
$html .= '</td></tr>';
|
79 |
+
$html .= '<tr><th class="require"><label for="url">url :</label></th><td>';
|
80 |
+
$html .= '<input type="text" name="option[' . "url" . ']" id="url" class="regular-text" required value="' . esc_attr( $option['url'] ) . '">';
|
81 |
+
$html .= '</td></tr>';
|
82 |
+
$html .= '<tr><th class="require"><label for="logo">logo :</label></th><td>';
|
83 |
+
$html .= '<input type="text" name="option[' . "logo" . ']" id="logo" class="regular-text" required value="' . esc_attr( $option['logo'] ) . '">';
|
84 |
+
$html .= '<button id="media-upload" class="dashicons-before dashicons-admin-media schema-admin-media-button"></button>';
|
85 |
+
$html .= '</td></tr>';
|
86 |
+
$html .= '</table>';
|
87 |
+
echo $html;
|
88 |
+
|
89 |
+
/** Corporate Contact */
|
90 |
+
$html = '<table class="schema-admin-table">';
|
91 |
+
$html .= '<caption>Corporate Contact</caption>';
|
92 |
+
$html .= '<tr><th><label for="contact_point">contactPoint :</label></th><td>';
|
93 |
+
$html .= '<input type="checkbox" name="option[' . "contact_point" . ']" id="contact_point" value="on"';
|
94 |
+
if ( isset( $option['contact_point'] ) && $option['contact_point'] === 'on' ) {
|
95 |
+
$html .= ' checked="checked"';
|
96 |
+
}
|
97 |
+
$html .= '>Enabled';
|
98 |
+
$html .= '</td></tr>';
|
99 |
+
$html .= '<tr><th><label for="telephone">telephone :</label></th><td>';
|
100 |
+
$html .= '<input type="text" name="option[' . "telephone" . ']" id="telephone" class="regular-text" value="' . esc_attr( $option['telephone'] ) . '" placeholder="e.g. : +1-880-555-1212">';
|
101 |
+
$html .= '</td></tr>';
|
102 |
+
$html .= '<tr><th><label for="contact_type">contactType :</label></th><td>';
|
103 |
+
$html .= '<select id="contact_type" name="option[' . "contact_type" . ']">';
|
104 |
+
foreach ( $this->contact_type_array as $value ) {
|
105 |
+
$html .= '<option value="' . $value['type'] . '"';
|
106 |
+
if ( $value['type'] === $option['contact_type'] ) {
|
107 |
+
$html .= ' selected';
|
108 |
+
}
|
109 |
+
$html .= '>' . $value['display'] . '</option>';
|
110 |
+
}
|
111 |
+
$html .= '</select>';
|
112 |
+
$html .= '</td></tr>';
|
113 |
+
$html .= '<tr><th><label for="email">email :</label></th><td>';
|
114 |
+
$html .= '<input type="email" name="option[' . "email" . ']" id="email" class="regular-text" value="' . esc_attr( $option['email'] ) . '" placeholder="e.g. : info@example.com">';
|
115 |
+
$html .= '</td></tr>';
|
116 |
+
$html .= '<tr><th><label for="area_served">areaServed :</label></th><td>';
|
117 |
+
$html .= '<input type="text" name="option[' . "area_served" . ']" id="area_served" class="regular-text" value="' . esc_attr( $option['area_served'] ) . '">';
|
118 |
+
$html .= '<small>Default : "US" Multiple : "US,CA"</small>';
|
119 |
+
$html .= '</td></tr>';
|
120 |
+
$html .= '<tr><th>contactOption :</th><td>';
|
121 |
+
$html .= '<label><input type="checkbox" name="option[' . "contact_point_1" . ']" id="contact_point_1" value="on"';
|
122 |
+
if ( isset( $option['contact_point_1'] ) && $option['contact_point_1'] === 'on' ) {
|
123 |
+
$html .= ' checked="checked"';
|
124 |
+
}
|
125 |
+
$html .= '>HearingImpairedSupported</label><br>';
|
126 |
+
$html .= '<label><input type="checkbox" name="option[' . "contact_point_2" . ']" id="contact_point_2" value="on"';
|
127 |
+
if ( isset( $option['contact_point_2'] ) && $option['contact_point_2'] === 'on' ) {
|
128 |
+
$html .= ' checked="checked"';
|
129 |
+
}
|
130 |
+
$html .= '>TollFree</label><br>';
|
131 |
+
$html .= '</td></tr>';
|
132 |
+
$html .= '<tr><th><label for="available_language">available Language :</label></th><td>';
|
133 |
+
$html .= '<input type="text" name="option[' . "available_language" . ']" id="available_language" class="regular-text" value="' . esc_attr( $option['available_language'] ) . '">';
|
134 |
+
$html .= '<small>Default : "English" Multiple : "French,English"</small>';
|
135 |
+
$html .= '</td></tr>';
|
136 |
+
$html .= '</table>';
|
137 |
+
echo $html;
|
138 |
+
|
139 |
+
/** Social Profiles */
|
140 |
+
$html = '<table class="schema-admin-table">';
|
141 |
+
$html .= '<caption>Social Profiles</caption>';
|
142 |
+
foreach ( $this->social_array as $value ) {
|
143 |
+
$html .= '<tr><th><label for="' . $value['type'] . '">' . $value['display'] . ' :</label></th><td>';
|
144 |
+
$html .= '<input type="text" name="option[' . "social" . '][' . $value['type'] . ']" id="' . $value['type'] . '" class="regular-text" value="' . esc_attr( $option['social'][$value['type']] ) . '">';
|
145 |
+
$html .= '</td></tr>';
|
146 |
+
}
|
147 |
+
$html .= '</table>';
|
148 |
+
echo $html;
|
149 |
+
|
150 |
+
echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/guides/enhance-site" target="_blank">https://developers.google.com/search/docs/guides/enhance-site</a></p>';
|
151 |
+
submit_button();
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Return the default options array
|
156 |
+
*
|
157 |
+
* @version 4.1.3
|
158 |
+
* @since 1.0.0
|
159 |
+
* @return array $args
|
160 |
+
*/
|
161 |
+
private function get_default_options () {
|
162 |
+
$args['name'] = '';
|
163 |
+
$args['url'] = '';
|
164 |
+
$args['logo'] = '';
|
165 |
+
$args['contact_point'] = '';
|
166 |
+
$args['telephone'] = '';
|
167 |
+
$args['contact_type'] = 'customer_service';
|
168 |
+
$args['email'] = '';
|
169 |
+
$args['area_served'] = 'US';
|
170 |
+
$args['contact_option_1'] = '';
|
171 |
+
$args['contact_option_2'] = '';
|
172 |
+
$args['available_language'] = 'English';
|
173 |
+
|
174 |
+
foreach ( $this->social_array as $value ) {
|
175 |
+
$args['social'][$value['type']] = '';
|
176 |
+
}
|
177 |
+
|
178 |
+
return (array) $args;
|
179 |
+
}
|
180 |
+
}
|
trunk/includes/admin/wp-structuring-admin-type-person.php
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type Person
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.1.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-links
|
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.1.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 |
+
echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/data-types/social-profile-links" target="_blank">https://developers.google.com/search/docs/data-types/social-profile-links</a></p>';
|
93 |
+
submit_button();
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Return the default options array
|
98 |
+
*
|
99 |
+
* @since 4.1.3
|
100 |
+
* @version 2.4.0
|
101 |
+
* @return array $args
|
102 |
+
*/
|
103 |
+
private function get_default_options () {
|
104 |
+
$args['name'] = '';
|
105 |
+
$args['url'] = '';
|
106 |
+
$args['addressCountry'] = '';
|
107 |
+
|
108 |
+
foreach ( $this->social_array as $value ) {
|
109 |
+
$args['social'][$value['type']] = '';
|
110 |
+
}
|
111 |
+
|
112 |
+
return (array) $args;
|
113 |
+
}
|
114 |
+
}
|
trunk/includes/admin/wp-structuring-admin-type-site-navigation.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Site Navigation Element
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 3.1.0
|
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 3.1.0
|
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 |
+
echo '<p>Setting Knowledge : <a href="https://schema.org/SiteNavigationElement" target="_blank">https://schema.org/SiteNavigationElement</a></p>';
|
63 |
+
submit_button();
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Return the default options array
|
68 |
+
*
|
69 |
+
* @version 3.1.0
|
70 |
+
* @since 3.1.0
|
71 |
+
* @param array $args
|
72 |
+
* @return array $args
|
73 |
+
*/
|
74 |
+
private function get_default_options ( array $args ) {
|
75 |
+
$args['menu_name'] = '';
|
76 |
+
|
77 |
+
return (array) $args;
|
78 |
+
}
|
79 |
+
}
|
trunk/includes/admin/wp-structuring-admin-type-video.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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/videos
|
11 |
+
*/
|
12 |
+
class Structuring_Markup_Type_Videos {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Constructor Define.
|
16 |
+
*
|
17 |
+
* @since 3.0.0
|
18 |
+
*/
|
19 |
+
public function __construct () {
|
20 |
+
$this->page_render();
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Form Layout Render
|
25 |
+
*
|
26 |
+
* @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 |
+
echo '<p>Custom post name "schema_video_post"</p>';
|
45 |
+
echo '<p>Archive rewrite name "videos"</p>';
|
46 |
+
echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/data-types/videos" target="_blank">https://developers.google.com/search/docs/data-types/videos</a></p>';
|
47 |
+
|
48 |
+
submit_button();
|
49 |
+
}
|
50 |
+
}
|
trunk/includes/admin/wp-structuring-admin-type-website.php
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type WebSite
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.5.0
|
7 |
+
* @since 1.0.0
|
8 |
+
* @see wp-structuring-admin-db.php
|
9 |
+
* @link https://schema.org/WebSite
|
10 |
+
* @link https://developers.google.com/search/docs/guides/enhance-site#add-a-sitelinks-searchbox-for-your-site
|
11 |
+
* @link https://developers.google.com/search/docs/data-types/sitename
|
12 |
+
*/
|
13 |
+
class Structuring_Markup_Type_Website {
|
14 |
+
|
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.0
|
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 |
+
echo '<p>Setting Knowledge : <a href="https://developers.google.com/search/docs/data-types/sitename" target="_blank">https://developers.google.com/search/docs/data-types/sitename</a></p>';
|
86 |
+
submit_button();
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Return the default options array
|
91 |
+
*
|
92 |
+
* @version 4.5.0
|
93 |
+
* @since 1.0.0
|
94 |
+
* @return array $args
|
95 |
+
*/
|
96 |
+
private function get_default_options () {
|
97 |
+
$args = array();
|
98 |
+
|
99 |
+
$args['name'] = '';
|
100 |
+
$args['alternateName'] = '';
|
101 |
+
$args['url'] = '';
|
102 |
+
$args['potential_action'] = '';
|
103 |
+
$args['target'] = '';
|
104 |
+
$args['potential_action_app'] = '';
|
105 |
+
$args['target_app'] = '';
|
106 |
+
|
107 |
+
return (array) $args;
|
108 |
+
}
|
109 |
+
}
|
trunk/includes/custom/wp-structuring-custom-post-event.php
ADDED
@@ -0,0 +1,299 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Custom Post "Event"
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.1.1
|
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 3.1.6
|
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 |
+
if ( is_admin() ) {
|
110 |
+
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
111 |
+
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* admin init.
|
117 |
+
*
|
118 |
+
* @version 2.1.0
|
119 |
+
* @since 2.1.0
|
120 |
+
*/
|
121 |
+
public function admin_init () {
|
122 |
+
add_action( 'save_post_' . $this->custom_type, array( $this, 'save_post' ) );
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* admin meta boxes.
|
127 |
+
*
|
128 |
+
* @version 2.1.0
|
129 |
+
* @since 2.1.0
|
130 |
+
*/
|
131 |
+
public function admin_menu () {
|
132 |
+
$custom_field_title = esc_html__( 'Schema.org Type Event', $this->text_domain );
|
133 |
+
add_meta_box( $this->custom_type, $custom_field_title, array( $this, 'set_custom_fields' ), $this->custom_type, 'normal' );
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Set custom fields.
|
138 |
+
*
|
139 |
+
* @version 4.1.1
|
140 |
+
* @since 2.1.0
|
141 |
+
*/
|
142 |
+
public function set_custom_fields () {
|
143 |
+
$custom_array = get_post_meta( get_the_ID(), $this->custom_type, false );
|
144 |
+
$custom_array = isset( $custom_array[0] ) ? unserialize( $custom_array[0] ) : array();
|
145 |
+
|
146 |
+
/** Default Value Set */
|
147 |
+
$args = $this->get_default_options();
|
148 |
+
|
149 |
+
if ( !empty( $args ) ) {
|
150 |
+
$args = array_merge( $args, $custom_array );
|
151 |
+
}
|
152 |
+
|
153 |
+
$html = '';
|
154 |
+
$html .= '<table class="schema-admin-custom-post">';
|
155 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_event_type">';
|
156 |
+
$html .= esc_html__( 'Event Type', $this->text_domain );
|
157 |
+
$html .= '</label></td><td>';
|
158 |
+
$html .= '<select name="option[' . "schema_event_type" . ']" id="schema_event_type">';
|
159 |
+
foreach( $this->event_type as $value) {
|
160 |
+
$html .= '<option';
|
161 |
+
if ( $value === $args['schema_event_type'] ) {
|
162 |
+
$html .= ' selected="selected"';
|
163 |
+
}
|
164 |
+
$html .= ' value="' . $value . '">' . $value . '</option>';
|
165 |
+
}
|
166 |
+
$html .= '</select>';
|
167 |
+
$html .= '</td></tr>';
|
168 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_event_name">';
|
169 |
+
$html .= esc_html__( 'Event Name', $this->text_domain );
|
170 |
+
$html .= '</label></td><td>';
|
171 |
+
$html .= '<input type="text" name="option[' . "schema_event_name" . ']" id="schema_event_name" class="regular-text" required value="' . esc_attr( $args['schema_event_name'] ) . '">';
|
172 |
+
$html .= '</td></tr>';
|
173 |
+
$html .= '<tr><td><label class="schema-admin-recommended" for="schema_event_description">';
|
174 |
+
$html .= esc_html__( 'Event Description', $this->text_domain );
|
175 |
+
$html .= '</label></td><td>';
|
176 |
+
$html .= '<textarea name="option[' . "schema_event_description" . ']" id="schema_event_description" class="large-text code" rows="3">' . esc_attr( $args['schema_event_description'] ) . '</textarea>';
|
177 |
+
$html .= '</td></tr>';
|
178 |
+
$html .= '<tr><td><label class="schema-admin-recommended" for="schema_event_image">';
|
179 |
+
$html .= esc_html__( 'Event Image', $this->text_domain );
|
180 |
+
$html .= '</label></td><td>';
|
181 |
+
$html .= '<input type="text" name="option[' . "schema_event_image" . ']" id="schema_event_image" class="large-text" value="' . esc_attr( $args['schema_event_image'] ) . '">';
|
182 |
+
$html .= '</td></tr>';
|
183 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_event_date">';
|
184 |
+
$html .= esc_html__( 'Start Date', $this->text_domain );
|
185 |
+
$html .= '</label></td><td>';
|
186 |
+
$html .= '<input type="date" name="option[' . "schema_event_date" . ']" id="schema_event_date" required value="' . esc_attr( $args['schema_event_date'] ) . '">';
|
187 |
+
$html .= '<input type="time" name="option[' . "schema_event_time" . ']" id="schema_event_time" required value="' . esc_attr( $args['schema_event_time'] ) . '">';
|
188 |
+
$html .= '</td></tr>';
|
189 |
+
$html .= '<tr><td><label class="schema-admin-recommended" for="schema_event_date_end">';
|
190 |
+
$html .= esc_html__( 'End Date', $this->text_domain );
|
191 |
+
$html .= '</label></td><td>';
|
192 |
+
$html .= '<input type="date" name="option[' . "schema_event_date_end" . ']" id="schema_event_date" value="' . esc_attr( $args['schema_event_date_end'] ) . '">';
|
193 |
+
$html .= '<input type="time" name="option[' . "schema_event_time_end" . ']" id="schema_event_time" value="' . esc_attr( $args['schema_event_time_end'] ) . '">';
|
194 |
+
$html .= '</td></tr>';
|
195 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_event_url">';
|
196 |
+
$html .= esc_html__( 'Event URL', $this->text_domain );
|
197 |
+
$html .= '</label></td><td>';
|
198 |
+
$html .= '<input type="text" name="option[' . "schema_event_url" . ']" id="schema_event_url" class="regular-text" required value="' . esc_attr( $args['schema_event_url'] ) . '">';
|
199 |
+
$html .= '</td></tr>';
|
200 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_event_place_name">';
|
201 |
+
$html .= esc_html__( 'Place Name', $this->text_domain );
|
202 |
+
$html .= '</label></td><td>';
|
203 |
+
$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'] ) . '">';
|
204 |
+
$html .= '</td></tr>';
|
205 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_event_place_url">';
|
206 |
+
$html .= esc_html__( 'Place URL', $this->text_domain );
|
207 |
+
$html .= '</label></td><td>';
|
208 |
+
$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'] ) . '">';
|
209 |
+
$html .= '</td></tr>';
|
210 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_event_place_address">';
|
211 |
+
$html .= esc_html__( 'Place Address', $this->text_domain );
|
212 |
+
$html .= '</label></td><td>';
|
213 |
+
$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'] ) . '">';
|
214 |
+
$html .= '</td></tr>';
|
215 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_event_type">';
|
216 |
+
$html .= esc_html__( 'Availability', $this->text_domain );
|
217 |
+
$html .= '</label></td><td>';
|
218 |
+
$html .= '<select name="option[' . "schema_event_offers_availability" . ']" id="schema_event_offers_availability">';
|
219 |
+
foreach( $this->offers_availability as $value) {
|
220 |
+
$html .= '<option';
|
221 |
+
if ( $value === $args['schema_event_offers_availability'] ) {
|
222 |
+
$html .= ' selected="selected"';
|
223 |
+
}
|
224 |
+
$html .= ' value="' . $value . '">' . $value . '</option>';
|
225 |
+
}
|
226 |
+
$html .= '</select>';
|
227 |
+
$html .= '</td></tr>';
|
228 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_event_offers_price">';
|
229 |
+
$html .= esc_html__( 'Price', $this->text_domain );
|
230 |
+
$html .= '</label></td><td>';
|
231 |
+
$html .= '<input type="number" name="option[' . "schema_event_offers_price" . ']" id="schema_event_offers_price" required value="' . esc_attr( $args['schema_event_offers_price'] ) . '">';
|
232 |
+
$html .= '</td></tr>';
|
233 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_event_offers_currency">';
|
234 |
+
$html .= esc_html__( 'Currency', $this->text_domain );
|
235 |
+
$html .= '</label></td><td>';
|
236 |
+
$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'] ) . '">';
|
237 |
+
$html .= ' <small>( with <a hre="https://en.wikipedia.org/wiki/ISO_4217#Active_codes" target="_blank">ISO 4217 codes</a> e.g. "USD" )</small>';
|
238 |
+
$html .= '</td></tr>';
|
239 |
+
$html .= '<tr><td><label class="schema-admin-recommended" for="schema_event_offers_date">';
|
240 |
+
$html .= esc_html__( 'validFrom', $this->text_domain );
|
241 |
+
$html .= '</label></td><td>';
|
242 |
+
$html .= '<input type="date" name="option[' . "schema_event_offers_date" . ']" id="schema_event_offers_date" value="' . esc_attr( $args['schema_event_offers_date'] ) . '">';
|
243 |
+
$html .= '<input type="time" name="option[' . "schema_event_offers_time" . ']" id="schema_event_offers_time" value="' . esc_attr( $args['schema_event_offers_time'] ) . '">';
|
244 |
+
$html .= '</td></tr>';
|
245 |
+
$html .= '<tr><td><label class="schema-admin-recommended" for="schema_event_performer_name">';
|
246 |
+
$html .= esc_html__( 'Event Performer', $this->text_domain );
|
247 |
+
$html .= '</label></td><td>';
|
248 |
+
$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'] ) . '">';
|
249 |
+
$html .= '</td></tr>';
|
250 |
+
$html .= '</table>';
|
251 |
+
|
252 |
+
echo $html;
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Save custom post.
|
257 |
+
*
|
258 |
+
* @version 2.1.0
|
259 |
+
* @since 2.1.0
|
260 |
+
* @param integer $post_id The post ID.
|
261 |
+
*/
|
262 |
+
public function save_post ( $post_id ) {
|
263 |
+
if ( isset( $_POST['option'] ) ) {
|
264 |
+
update_post_meta( $post_id, $this->custom_type, serialize( $_POST['option'] ) );
|
265 |
+
}
|
266 |
+
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Return the default options array
|
270 |
+
*
|
271 |
+
* @version 4.0.2
|
272 |
+
* @since 3.2.3
|
273 |
+
* @return array $args
|
274 |
+
*/
|
275 |
+
private function get_default_options () {
|
276 |
+
$args = array(
|
277 |
+
'schema_event_type' => 'Event',
|
278 |
+
'schema_event_name' => '',
|
279 |
+
'schema_event_description' => '',
|
280 |
+
'schema_event_image' => '',
|
281 |
+
'schema_event_date' => date( 'Y-m-d' ),
|
282 |
+
'schema_event_time' => date( 'h:i' ),
|
283 |
+
'schema_event_date_end' => '',
|
284 |
+
'schema_event_time_end' => '',
|
285 |
+
'schema_event_url' => '',
|
286 |
+
'schema_event_place_name' => '',
|
287 |
+
'schema_event_place_url' => '',
|
288 |
+
'schema_event_place_address' => '',
|
289 |
+
'schema_event_offers_availability' => 'InStock',
|
290 |
+
'schema_event_offers_price' => 0,
|
291 |
+
'schema_event_offers_currency' => esc_html__( 'USD', $this->text_domain ),
|
292 |
+
'schema_event_offers_date' => '',
|
293 |
+
'schema_event_offers_time' => '',
|
294 |
+
'schema_event_performer_name' => ''
|
295 |
+
);
|
296 |
+
|
297 |
+
return (array) $args;
|
298 |
+
}
|
299 |
+
}
|
trunk/includes/custom/wp-structuring-custom-post-video.php
ADDED
@@ -0,0 +1,204 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Custom Post "Video"
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.1.1
|
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 |
+
if ( is_admin() ) {
|
70 |
+
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
71 |
+
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* admin init.
|
77 |
+
*
|
78 |
+
* @version 3.0.0
|
79 |
+
* @since 3.0.0
|
80 |
+
*/
|
81 |
+
public function admin_init () {
|
82 |
+
add_action( 'save_post_' . $this->custom_type, array( $this, 'save_post' ) );
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* admin meta boxes.
|
87 |
+
*
|
88 |
+
* @version 3.0.0
|
89 |
+
* @since 3.0.0
|
90 |
+
*/
|
91 |
+
public function admin_menu () {
|
92 |
+
$custom_field_title = esc_html__( 'Schema.org Type Video', $this->text_domain );
|
93 |
+
add_meta_box( $this->custom_type, $custom_field_title, array( $this, 'set_custom_fields' ), $this->custom_type, 'normal' );
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Set custom fields.
|
98 |
+
*
|
99 |
+
* @version 4.1.1
|
100 |
+
* @since 3.0.0
|
101 |
+
*/
|
102 |
+
public function set_custom_fields () {
|
103 |
+
$custom_array = get_post_meta( get_the_ID(), $this->custom_type, false );
|
104 |
+
$custom_array = isset( $custom_array[0] ) ? unserialize( $custom_array[0] ) : array();
|
105 |
+
|
106 |
+
/** Default Value Set */
|
107 |
+
$args = $this->get_default_options();
|
108 |
+
|
109 |
+
if ( !empty( $args ) ) {
|
110 |
+
$args = array_merge( $args, $custom_array );
|
111 |
+
}
|
112 |
+
|
113 |
+
$html = '';
|
114 |
+
$html .= '<table class="schema-admin-custom-post">';
|
115 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_video_name">';
|
116 |
+
$html .= esc_html__( 'Video Name', $this->text_domain );
|
117 |
+
$html .= '</label></td><td>';
|
118 |
+
$html .= '<input type="text" name="option[' . "schema_video_name" . ']" id="schema_video_name" class="regular-text" required value="' . esc_attr( $args['schema_video_name'] ) . '">';
|
119 |
+
$html .= '</td></tr>';
|
120 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_video_description">';
|
121 |
+
$html .= esc_html__( 'Video Description', $this->text_domain );
|
122 |
+
$html .= '</label></td><td>';
|
123 |
+
$html .= '<textarea name="option[' . "schema_video_description" . ']" id="schema_video_description" class="large-text code" required rows="3">' . esc_attr( $args['schema_video_description'] ) . '</textarea>';
|
124 |
+
$html .= '</td></tr>';
|
125 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_video_thumbnail_url">';
|
126 |
+
$html .= esc_html__( 'Thumbnail Url', $this->text_domain );
|
127 |
+
$html .= '</label></td><td>';
|
128 |
+
$html .= '<input type="text" name="option[' . "schema_video_thumbnail_url" . ']" id="schema_video_thumbnail_url" class="regular-text" required value="' . esc_attr( $args['schema_video_thumbnail_url'] ) . '">';
|
129 |
+
$html .= '</td></tr>';
|
130 |
+
$html .= '<tr><td><label class="schema-admin-required" for="schema_video_upload_date">';
|
131 |
+
$html .= esc_html__( 'Upload Date', $this->text_domain );
|
132 |
+
$html .= '</label></td><td>';
|
133 |
+
$html .= '<input type="date" name="option[' . "schema_video_upload_date" . ']" id="schema_video_upload_date" required value="' . esc_attr( $args['schema_video_upload_date'] ) . '">';
|
134 |
+
$html .= '<input type="time" name="option[' . "schema_video_upload_time" . ']" id="schema_video_upload_time" required value="' . esc_attr( $args['schema_video_upload_time'] ) . '">';
|
135 |
+
$html .= '</td></tr>';
|
136 |
+
$html .= '<tr><td><label class="schema-admin-recommended" for="schema_video_duration">';
|
137 |
+
$html .= esc_html__( 'duration', $this->text_domain );
|
138 |
+
$html .= '</label></td><td>';
|
139 |
+
$html .= '<input type="text" name="option[' . "schema_video_duration" . ']" id="schema_video_duration" class="regular-text" value="' . esc_attr( $args['schema_video_duration'] ) . '">';
|
140 |
+
$html .= '</td></tr>';
|
141 |
+
$html .= '<tr><td><label class="schema-admin-recommended" for="schema_video_content_url">';
|
142 |
+
$html .= esc_html__( 'contentURL', $this->text_domain );
|
143 |
+
$html .= '</label></td><td>';
|
144 |
+
$html .= '<input type="text" name="option[' . "schema_video_content_url" . ']" id="schema_video_content_url" class="regular-text" value="' . esc_attr( $args['schema_video_content_url'] ) . '">';
|
145 |
+
$html .= '</td></tr>';
|
146 |
+
$html .= '<tr><td><label class="schema-admin-recommended" for="schema_video_embed_url">';
|
147 |
+
$html .= esc_html__( 'embedURL', $this->text_domain );
|
148 |
+
$html .= '</label></td><td>';
|
149 |
+
$html .= '<input type="text" name="option[' . "schema_video_embed_url" . ']" id="schema_video_embed_url" class="regular-text" value="' . esc_attr( $args['schema_video_embed_url'] ) . '">';
|
150 |
+
$html .= '</td></tr>';
|
151 |
+
$html .= '<tr><td><label class="schema-admin-recommended" for="schema_video_interaction_count">';
|
152 |
+
$html .= esc_html__( 'interactionCount', $this->text_domain );
|
153 |
+
$html .= '</label></td><td>';
|
154 |
+
$html .= '<input type="text" name="option[' . "schema_video_interaction_count" . ']" id="schema_video_interaction_count" class="regular-text" value="' . esc_attr( $args['schema_video_interaction_count'] ) . '">';
|
155 |
+
$html .= '</td></tr>';
|
156 |
+
$html .= '<tr><td><label class="schema-admin-recommended" for="schema_video_expires_date">';
|
157 |
+
$html .= esc_html__( 'expires', $this->text_domain );
|
158 |
+
$html .= '</label></td><td>';
|
159 |
+
$html .= '<input type="date" name="option[' . "schema_video_expires_date" . ']" id="schema_video_expires_date" value="' . esc_attr( $args['schema_video_expires_date'] ) . '">';
|
160 |
+
$html .= '<input type="time" name="option[' . "schema_video_expires_time" . ']" id="schema_video_expires_time" value="' . esc_attr( $args['schema_video_expires_time'] ) . '">';
|
161 |
+
$html .= '</td></tr>';
|
162 |
+
$html .= '</table>';
|
163 |
+
|
164 |
+
echo $html;
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Save custom post.
|
169 |
+
*
|
170 |
+
* @version 3.0.0
|
171 |
+
* @since 3.0.0
|
172 |
+
* @param integer $post_id The post ID.
|
173 |
+
*/
|
174 |
+
public function save_post ( $post_id ) {
|
175 |
+
if ( isset( $_POST['option'] ) ) {
|
176 |
+
update_post_meta( $post_id, $this->custom_type, serialize( $_POST['option'] ) );
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Return the default options array
|
182 |
+
*
|
183 |
+
* @version 3.2.3
|
184 |
+
* @since 3.2.3
|
185 |
+
* @return array $args
|
186 |
+
*/
|
187 |
+
private function get_default_options () {
|
188 |
+
$args = array(
|
189 |
+
'schema_video_name' => '',
|
190 |
+
'schema_video_description' => '',
|
191 |
+
'schema_video_thumbnail_url' => '',
|
192 |
+
'schema_video_upload_date' => '',
|
193 |
+
'schema_video_upload_time' => '',
|
194 |
+
'schema_video_duration' => '',
|
195 |
+
'schema_video_content_url' => '',
|
196 |
+
'schema_video_embed_url' => '',
|
197 |
+
'schema_video_interaction_count' => '',
|
198 |
+
'schema_video_expires_date' => '',
|
199 |
+
'schema_video_expires_time' => '',
|
200 |
+
);
|
201 |
+
|
202 |
+
return (array) $args;
|
203 |
+
}
|
204 |
+
}
|
trunk/includes/meta/wp-structuring-meta-article.php
ADDED
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type Article
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.5.0
|
7 |
+
* @since 4.0.0
|
8 |
+
* @link http://schema.org/Article
|
9 |
+
* @link https://developers.google.com/search/docs/data-types/articles
|
10 |
+
* @link https://developers.google.com/search/docs/data-types/speakable
|
11 |
+
*/
|
12 |
+
class Structuring_Markup_Meta_Article {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Utility
|
16 |
+
*
|
17 |
+
* @version 4.0.0
|
18 |
+
* @since 4.0.0
|
19 |
+
*/
|
20 |
+
private $utility;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Constructor Define.
|
24 |
+
*
|
25 |
+
* @version 4.0.0
|
26 |
+
* @since 4.0.0
|
27 |
+
* @param Structuring_Markup_Utility $utility
|
28 |
+
*/
|
29 |
+
public function __construct ( Structuring_Markup_Utility $utility ) {
|
30 |
+
$this->utility = $utility;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Setting schema.org Article
|
35 |
+
*
|
36 |
+
* @version 4.5.0
|
37 |
+
* @since 4.0.0
|
38 |
+
* @param array $options
|
39 |
+
* @return array $args
|
40 |
+
*/
|
41 |
+
public function set_meta ( array $options ) {
|
42 |
+
global $post;
|
43 |
+
|
44 |
+
$excerpt = $this->utility->escape_text( $post->post_excerpt );
|
45 |
+
$content = $excerpt === "" ? mb_substr( $this->utility->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
|
46 |
+
|
47 |
+
$args = array(
|
48 |
+
"@context" => "http://schema.org",
|
49 |
+
"@type" => "Article",
|
50 |
+
"mainEntityOfPage" => array(
|
51 |
+
"@type" => "WebPage",
|
52 |
+
"@id" => get_permalink( $post->ID )
|
53 |
+
),
|
54 |
+
"headline" => mb_substr( esc_html( $post->post_title ), 0, 110 ),
|
55 |
+
"datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
|
56 |
+
"dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
|
57 |
+
"author" => array(
|
58 |
+
"@type" => "Person",
|
59 |
+
"name" => esc_html( get_the_author_meta( 'display_name', $post->post_author ) )
|
60 |
+
),
|
61 |
+
"description" => $content
|
62 |
+
);
|
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" => array(
|
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" => array(
|
80 |
+
"@type" => "ImageObject",
|
81 |
+
"url" => $images,
|
82 |
+
"width" => $size['width'],
|
83 |
+
"height" => $size['height']
|
84 |
+
)
|
85 |
+
);
|
86 |
+
$args = array_merge( $args, $images_args );
|
87 |
+
}
|
88 |
+
}
|
89 |
+
} elseif ( isset( $options['default_image'] ) ) {
|
90 |
+
if ( $size = $this->utility->get_image_dimensions( $options['default_image'] ) ) {
|
91 |
+
$images_args = array(
|
92 |
+
"image" => array(
|
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",
|
107 |
+
"name" => esc_html( $options['name'] ),
|
108 |
+
)
|
109 |
+
);
|
110 |
+
|
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'] = array(
|
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'] = array(
|
122 |
+
"@type" => "ImageObject",
|
123 |
+
"url" => $options['logo'],
|
124 |
+
"width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
|
125 |
+
"height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
|
126 |
+
);
|
127 |
+
}
|
128 |
+
$args = array_merge( $args, $publisher_args );
|
129 |
+
}
|
130 |
+
|
131 |
+
if ( isset( $options['speakable_action'] ) && $options['speakable_action'] === 'on' ) {
|
132 |
+
$speakable_type = isset( $options['speakable_type'] ) ? $options['speakable_type'] : '';
|
133 |
+
|
134 |
+
if ( !empty( $speakable_type ) ) {
|
135 |
+
$action_array = array(
|
136 |
+
"@type" => "SpeakableSpecification"
|
137 |
+
);
|
138 |
+
$action_array[$speakable_type] = array(
|
139 |
+
isset( $options['speakable_headline'] ) ? stripslashes( $options['speakable_headline'] ) : '',
|
140 |
+
isset( $options['speakable_summary'] ) ? stripslashes( $options['speakable_summary'] ) : ''
|
141 |
+
);
|
142 |
+
$args['speakable'] = $action_array;
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
return (array) $args;
|
147 |
+
}
|
148 |
+
}
|
trunk/includes/meta/wp-structuring-meta-blog-posting.php
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type BlogPosting
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.5.0
|
7 |
+
* @since 4.0.0
|
8 |
+
* @link http://schema.org/BlogPosting
|
9 |
+
* @link https://developers.google.com/search/docs/data-types/articles
|
10 |
+
* @link https://developers.google.com/search/docs/data-types/speakable
|
11 |
+
*/
|
12 |
+
class Structuring_Markup_Meta_Blog_Posting {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Utility
|
16 |
+
*
|
17 |
+
* @version 4.0.0
|
18 |
+
* @since 4.0.0
|
19 |
+
*/
|
20 |
+
private $utility;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Constructor Define.
|
24 |
+
*
|
25 |
+
* @version 4.5.0
|
26 |
+
* @since 4.0.0
|
27 |
+
* @param Structuring_Markup_Utility $utility
|
28 |
+
*/
|
29 |
+
public function __construct ( Structuring_Markup_Utility $utility ) {
|
30 |
+
$this->utility = $utility;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Setting schema.org BlogPosting
|
35 |
+
*
|
36 |
+
* @version 4.4.0
|
37 |
+
* @since 4.0.0
|
38 |
+
* @param array $options
|
39 |
+
* @return array $args
|
40 |
+
*/
|
41 |
+
public function set_meta ( array $options ) {
|
42 |
+
global $post;
|
43 |
+
|
44 |
+
$excerpt = $this->utility->escape_text( $post->post_excerpt );
|
45 |
+
$content = $excerpt === "" ? mb_substr( $this->utility->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
|
46 |
+
|
47 |
+
$args = array(
|
48 |
+
"@context" => "http://schema.org",
|
49 |
+
"@type" => "BlogPosting",
|
50 |
+
"mainEntityOfPage" => array(
|
51 |
+
"@type" => "WebPage",
|
52 |
+
"@id" => get_permalink( $post->ID )
|
53 |
+
),
|
54 |
+
"headline" => mb_substr( esc_html( $post->post_title ), 0, 110 ),
|
55 |
+
"datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
|
56 |
+
"dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
|
57 |
+
"author" => array(
|
58 |
+
"@type" => "Person",
|
59 |
+
"name" => esc_html( get_the_author_meta( 'display_name', $post->post_author ) )
|
60 |
+
),
|
61 |
+
"description" => $content
|
62 |
+
);
|
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 |
+
"image" => array(
|
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 |
+
"image" => array(
|
81 |
+
"@type" => "ImageObject",
|
82 |
+
"url" => $images,
|
83 |
+
"width" => $size['width'],
|
84 |
+
"height" => $size['height']
|
85 |
+
)
|
86 |
+
);
|
87 |
+
$args = array_merge( $args, $images_args );
|
88 |
+
}
|
89 |
+
}
|
90 |
+
} elseif ( isset( $options['default_image'] ) ) {
|
91 |
+
if ( $size = $this->utility->get_image_dimensions( $options['default_image'] ) ) {
|
92 |
+
$images_args = array(
|
93 |
+
"image" => array(
|
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",
|
108 |
+
"name" => esc_html( $options['name'] ),
|
109 |
+
)
|
110 |
+
);
|
111 |
+
|
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'] = array(
|
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'] = array(
|
123 |
+
"@type" => "ImageObject",
|
124 |
+
"url" => $options['logo'],
|
125 |
+
"width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
|
126 |
+
"height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
|
127 |
+
);
|
128 |
+
}
|
129 |
+
$args = array_merge( $args, $publisher_args );
|
130 |
+
}
|
131 |
+
|
132 |
+
if ( isset( $options['speakable_action'] ) && $options['speakable_action'] === 'on' ) {
|
133 |
+
$speakable_type = isset( $options['speakable_type'] ) ? $options['speakable_type'] : '';
|
134 |
+
|
135 |
+
if ( !empty( $speakable_type ) ) {
|
136 |
+
$action_array = array(
|
137 |
+
"@type" => "SpeakableSpecification"
|
138 |
+
);
|
139 |
+
$action_array[$speakable_type] = array(
|
140 |
+
isset( $options['speakable_headline'] ) ? stripslashes( $options['speakable_headline'] ) : '',
|
141 |
+
isset( $options['speakable_summary'] ) ? stripslashes( $options['speakable_summary'] ) : ''
|
142 |
+
);
|
143 |
+
$args['speakable'] = $action_array;
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
return (array) $args;
|
148 |
+
}
|
149 |
+
}
|
trunk/includes/meta/wp-structuring-meta-breadcrumb.php
ADDED
@@ -0,0 +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 |
+
}
|
trunk/includes/meta/wp-structuring-meta-event.php
ADDED
@@ -0,0 +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 |
+
}
|
trunk/includes/meta/wp-structuring-meta-local-business.php
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type LocalBusiness
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.1.6
|
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.1.6
|
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'] ) : "",
|
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 |
+
}
|
trunk/includes/meta/wp-structuring-meta-news-article.php
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type News Article
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.5.0
|
7 |
+
* @since 4.0.0
|
8 |
+
* @link http://schema.org/NewsArticle
|
9 |
+
* @link https://developers.google.com/search/docs/data-types/articles
|
10 |
+
* @link https://developers.google.com/search/docs/data-types/speakable
|
11 |
+
*/
|
12 |
+
class Structuring_Markup_Meta_NewsArticle {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Utility
|
16 |
+
*
|
17 |
+
* @version 4.0.0
|
18 |
+
* @since 4.0.0
|
19 |
+
*/
|
20 |
+
private $utility;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Constructor Define.
|
24 |
+
*
|
25 |
+
* @version 4.0.0
|
26 |
+
* @since 4.0.0
|
27 |
+
* @param Structuring_Markup_Utility $utility
|
28 |
+
*/
|
29 |
+
public function __construct ( Structuring_Markup_Utility $utility ) {
|
30 |
+
$this->utility = $utility;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Setting schema.org NewsArticle
|
35 |
+
*
|
36 |
+
* @version 4.5.0
|
37 |
+
* @since 4.0.0
|
38 |
+
* @param array $options
|
39 |
+
* @return array $args
|
40 |
+
*/
|
41 |
+
public function set_meta ( array $options ) {
|
42 |
+
global $post;
|
43 |
+
|
44 |
+
$excerpt = $this->utility->escape_text( $post->post_excerpt );
|
45 |
+
$content = $excerpt === "" ? mb_substr( $this->utility->escape_text( $post->post_content ), 0, 110 ) : $excerpt;
|
46 |
+
|
47 |
+
$args = array(
|
48 |
+
"@context" => "http://schema.org",
|
49 |
+
"@type" => "NewsArticle",
|
50 |
+
"mainEntityOfPage" => array(
|
51 |
+
"@type" => "WebPage",
|
52 |
+
"@id" => get_permalink( $post->ID )
|
53 |
+
),
|
54 |
+
"headline" => mb_substr( esc_html( $post->post_title ), 0, 110 ),
|
55 |
+
"datePublished" => get_the_time( DATE_ISO8601, $post->ID ),
|
56 |
+
"dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ),
|
57 |
+
"author" => array(
|
58 |
+
"@type" => "Person",
|
59 |
+
"name" => esc_html( get_the_author_meta( 'display_name', $post->post_author ) )
|
60 |
+
),
|
61 |
+
"description" => $content
|
62 |
+
);
|
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 |
+
"image" => array(
|
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 |
+
"image" => array(
|
81 |
+
"@type" => "ImageObject",
|
82 |
+
"url" => $images,
|
83 |
+
"width" => $size['width'],
|
84 |
+
"height" => $size['height']
|
85 |
+
)
|
86 |
+
);
|
87 |
+
$args = array_merge( $args, $images_args );
|
88 |
+
}
|
89 |
+
}
|
90 |
+
} elseif ( isset( $options['default_image'] ) ) {
|
91 |
+
if ( $size = $this->utility->get_image_dimensions( $options['default_image'] ) ) {
|
92 |
+
$images_args = array(
|
93 |
+
"image" => array(
|
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",
|
108 |
+
"name" => esc_html( $options['name'] ),
|
109 |
+
)
|
110 |
+
);
|
111 |
+
|
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'] = array(
|
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'] = array(
|
123 |
+
"@type" => "ImageObject",
|
124 |
+
"url" => $options['logo'],
|
125 |
+
"width" => isset( $options['logo-width'] ) ? (int) $options['logo-width'] : 0,
|
126 |
+
"height" => isset( $options['logo-height'] ) ? (int) $options['logo-height'] : 0
|
127 |
+
);
|
128 |
+
}
|
129 |
+
$args = array_merge( $args, $publisher_args );
|
130 |
+
}
|
131 |
+
|
132 |
+
if ( isset( $options['speakable_action'] ) && $options['speakable_action'] === 'on' ) {
|
133 |
+
$speakable_type = isset( $options['speakable_type'] ) ? $options['speakable_type'] : '';
|
134 |
+
|
135 |
+
if ( !empty( $speakable_type ) ) {
|
136 |
+
$action_array = array(
|
137 |
+
"@type" => "SpeakableSpecification"
|
138 |
+
);
|
139 |
+
$action_array[$speakable_type] = array(
|
140 |
+
isset( $options['speakable_headline'] ) ? stripslashes( $options['speakable_headline'] ) : '',
|
141 |
+
isset( $options['speakable_summary'] ) ? stripslashes( $options['speakable_summary'] ) : ''
|
142 |
+
);
|
143 |
+
$args['speakable'] = $action_array;
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
return (array) $args;
|
148 |
+
}
|
149 |
+
}
|
trunk/includes/meta/wp-structuring-meta-organization.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Type Organization
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.1.3
|
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.1.3
|
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" => "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 |
+
}
|
trunk/includes/meta/wp-structuring-meta-person.php
ADDED
@@ -0,0 +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 |
+
}
|
trunk/includes/meta/wp-structuring-meta-site-navigation.php
ADDED
@@ -0,0 +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 |
+
}
|
trunk/includes/meta/wp-structuring-meta-video.php
ADDED
@@ -0,0 +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 |
+
}
|
trunk/includes/meta/wp-structuring-meta-website.php
ADDED
@@ -0,0 +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 |
+
}
|
trunk/includes/wp-structuring-display-amp.php
ADDED
@@ -0,0 +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 |
+
}
|
trunk/includes/wp-structuring-display.php
ADDED
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org Display
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @author Justin Frydman
|
7 |
+
* @version 4.5.0
|
8 |
+
* @since 1.0.0
|
9 |
+
*/
|
10 |
+
class Structuring_Markup_Display {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Utility
|
14 |
+
*
|
15 |
+
* @version 4.0.0
|
16 |
+
* @since 4.0.0
|
17 |
+
*/
|
18 |
+
private $utility;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* wp_options data
|
22 |
+
*
|
23 |
+
* @version 4.5.0
|
24 |
+
* @since 4.5.0
|
25 |
+
*/
|
26 |
+
private $options;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Constructor Define.
|
30 |
+
*
|
31 |
+
* @version 4.5.0
|
32 |
+
* @since 1.0.0
|
33 |
+
* @param string $version
|
34 |
+
* @param string $text_domain
|
35 |
+
*/
|
36 |
+
public function __construct ( $version, $text_domain ) {
|
37 |
+
require_once( plugin_dir_path( __FILE__ ) . 'wp-structuring-utility.php' );
|
38 |
+
$this->utility = new Structuring_Markup_Utility();
|
39 |
+
|
40 |
+
$this->options = get_option( $text_domain );
|
41 |
+
|
42 |
+
$db = new Structuring_Markup_Admin_Db();
|
43 |
+
$this->set_schema( $db, $version );
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Setting schema.org
|
48 |
+
*
|
49 |
+
* @version 4.5.0
|
50 |
+
* @since 1.0.0
|
51 |
+
* @param Structuring_Markup_Admin_Db $db
|
52 |
+
* @param string $version
|
53 |
+
*/
|
54 |
+
private function set_schema ( Structuring_Markup_Admin_Db $db, $version ) {
|
55 |
+
$structuring_markup_args = $db->get_list_options();
|
56 |
+
|
57 |
+
if ( !isset( $this->options['compress'] ) || $this->options['compress'] !== 'on' ) {
|
58 |
+
echo '<!-- Markup (JSON-LD) structured in schema.org ver.' . $version . ' START -->' . PHP_EOL;
|
59 |
+
}
|
60 |
+
|
61 |
+
$this->get_schema_data( 'all', $structuring_markup_args );
|
62 |
+
if ( is_home() || is_front_page() ) {
|
63 |
+
$this->get_schema_data( 'home', $structuring_markup_args );
|
64 |
+
}
|
65 |
+
if ( is_single() && get_post_type() === 'post' ) {
|
66 |
+
$this->get_schema_data( 'post', $structuring_markup_args );
|
67 |
+
}
|
68 |
+
if ( is_singular( 'schema_event_post' ) ) {
|
69 |
+
$this->get_schema_data( 'event', $structuring_markup_args );
|
70 |
+
}
|
71 |
+
if ( is_singular( 'schema_video_post' ) ) {
|
72 |
+
$this->get_schema_data( 'video', $structuring_markup_args );
|
73 |
+
}
|
74 |
+
if ( is_page() ) {
|
75 |
+
$this->get_schema_data( 'page', $structuring_markup_args );
|
76 |
+
}
|
77 |
+
$args = array(
|
78 |
+
'public' => true,
|
79 |
+
'_builtin' => false
|
80 |
+
);
|
81 |
+
$post_types = get_post_types( $args, 'objects' );
|
82 |
+
|
83 |
+
unset( $post_types['schema_event_post'] );
|
84 |
+
unset( $post_types['schema_video_post'] );
|
85 |
+
|
86 |
+
foreach ( $post_types as $post_type ) {
|
87 |
+
if ( is_singular( $post_type->name ) ) {
|
88 |
+
$this->get_schema_data( $post_type->name, $structuring_markup_args );
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
if ( !isset( $this->options['compress'] ) || $this->options['compress'] !== 'on' ) {
|
93 |
+
echo '<!-- Markup (JSON-LD) structured in schema.org END -->' . PHP_EOL;
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Setting JSON-LD Template
|
99 |
+
*
|
100 |
+
* @version 4.0.0
|
101 |
+
* @since 1.0.0
|
102 |
+
* @param string $output
|
103 |
+
* @param array $structuring_markup_args
|
104 |
+
*/
|
105 |
+
private function get_schema_data ( $output, array $structuring_markup_args ) {
|
106 |
+
|
107 |
+
foreach ( $structuring_markup_args as $row ) {
|
108 |
+
/** Output page check. */
|
109 |
+
$output_args = unserialize( $row->output );
|
110 |
+
if ( array_key_exists( $output, $output_args ) ) {
|
111 |
+
|
112 |
+
/** Activate check. */
|
113 |
+
if ( isset( $row->type ) && isset( $row->activate ) && $row->activate === 'on' ) {
|
114 |
+
switch ( $row->type ) {
|
115 |
+
case 'article':
|
116 |
+
if ( isset( $row->options ) && $row->options ) {
|
117 |
+
require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-article.php' );
|
118 |
+
$obj = new Structuring_Markup_Meta_Article( $this->utility );
|
119 |
+
$this->set_schema_json( $obj->set_meta( unserialize( $row->options ) ) );
|
120 |
+
}
|
121 |
+
break;
|
122 |
+
case 'blog_posting':
|
123 |
+
if ( isset( $row->options ) && $row->options ) {
|
124 |
+
require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-blog-posting.php' );
|
125 |
+
$obj = new Structuring_Markup_Meta_Blog_Posting( $this->utility );
|
126 |
+
$this->set_schema_json( $obj->set_meta( unserialize( $row->options ) ) );
|
127 |
+
}
|
128 |
+
break;
|
129 |
+
case 'breadcrumb':
|
130 |
+
if ( isset( $row->options ) && $row->options ) {
|
131 |
+
require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-breadcrumb.php' );
|
132 |
+
require_once( plugin_dir_path( __FILE__ ) . 'wp-structuring-short-code-breadcrumb.php' );
|
133 |
+
$obj = new Structuring_Markup_Meta_Breadcrumb();
|
134 |
+
$this->set_schema_json( $obj->set_meta( unserialize( $row->options ) ) );
|
135 |
+
}
|
136 |
+
break;
|
137 |
+
case 'event':
|
138 |
+
require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-event.php' );
|
139 |
+
$obj = new Structuring_Markup_Meta_Event();
|
140 |
+
$this->set_schema_json( $obj->set_meta() );
|
141 |
+
break;
|
142 |
+
case 'local_business':
|
143 |
+
if ( isset( $row->options ) && $row->options ) {
|
144 |
+
require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-local-business.php' );
|
145 |
+
require_once( plugin_dir_path( __FILE__ ) . 'wp-structuring-opening-hours.php' );
|
146 |
+
$obj = new Structuring_Markup_Meta_LocalBusiness();
|
147 |
+
$this->set_schema_json( $obj->set_meta( unserialize( $row->options ) ) );
|
148 |
+
}
|
149 |
+
break;
|
150 |
+
case 'news_article':
|
151 |
+
if ( isset( $row->options ) && $row->options ) {
|
152 |
+
require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-news-article.php' );
|
153 |
+
$obj = new Structuring_Markup_Meta_NewsArticle( $this->utility );
|
154 |
+
$this->set_schema_json( $obj->set_meta( unserialize( $row->options ) ) );
|
155 |
+
}
|
156 |
+
break;
|
157 |
+
case 'organization':
|
158 |
+
if ( isset( $row->options ) && $row->options ) {
|
159 |
+
require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-organization.php' );
|
160 |
+
$obj = new Structuring_Markup_Meta_Organization();
|
161 |
+
$this->set_schema_json( $obj->set_meta( unserialize( $row->options ) ) );
|
162 |
+
}
|
163 |
+
break;
|
164 |
+
case 'person':
|
165 |
+
if ( isset( $row->options ) && $row->options ) {
|
166 |
+
require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-person.php' );
|
167 |
+
$obj = new Structuring_Markup_Meta_Person();
|
168 |
+
$this->set_schema_json( $obj->set_meta( unserialize( $row->options ) ) );
|
169 |
+
}
|
170 |
+
break;
|
171 |
+
case 'site_navigation':
|
172 |
+
if ( isset( $row->options ) && $row->options ) {
|
173 |
+
require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-site-navigation.php' );
|
174 |
+
$obj = new Structuring_Markup_Meta_Site_Navigation();
|
175 |
+
$this->set_schema_json( $obj->set_meta( unserialize( $row->options ) ) );
|
176 |
+
}
|
177 |
+
break;
|
178 |
+
case 'video':
|
179 |
+
require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-video.php' );
|
180 |
+
$obj = new Structuring_Markup_Meta_Video( $this->utility );
|
181 |
+
$this->set_schema_json( $obj->set_meta() );
|
182 |
+
break;
|
183 |
+
case 'website':
|
184 |
+
if ( isset( $row->options ) && $row->options ) {
|
185 |
+
require_once( plugin_dir_path( __FILE__ ) . 'meta/wp-structuring-meta-website.php' );
|
186 |
+
$obj = new Structuring_Markup_Meta_WebSite();
|
187 |
+
$this->set_schema_json( $obj->set_meta( unserialize( $row->options ) ) );
|
188 |
+
}
|
189 |
+
break;
|
190 |
+
}
|
191 |
+
}
|
192 |
+
}
|
193 |
+
}
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Setting JSON-LD Template
|
198 |
+
*
|
199 |
+
* @since 4.5.0
|
200 |
+
* @since 1.0.0
|
201 |
+
* @param array $args
|
202 |
+
* @param boolean $error
|
203 |
+
*/
|
204 |
+
private function set_schema_json ( $args, $error = false ) {
|
205 |
+
if ( $error ) {
|
206 |
+
/** Error Display */
|
207 |
+
if ( isset( $args["@type"] ) ) {
|
208 |
+
foreach ( $args["message"] as $message ) {
|
209 |
+
echo "<!-- Schema.org ", $args["@type"], " : ", $message, " -->", PHP_EOL;
|
210 |
+
}
|
211 |
+
}
|
212 |
+
} else {
|
213 |
+
if ( is_array( $args ) ) {
|
214 |
+
if ( isset( $this->options['compress'] ) && $this->options['compress'] === 'on' ) {
|
215 |
+
echo '<script type="application/ld+json">';
|
216 |
+
echo json_encode( $args, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES );
|
217 |
+
echo '</script>';
|
218 |
+
} else {
|
219 |
+
echo '<script type="application/ld+json">', PHP_EOL;
|
220 |
+
echo json_encode( $args, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ), PHP_EOL;
|
221 |
+
echo '</script>', PHP_EOL;
|
222 |
+
}
|
223 |
+
}
|
224 |
+
}
|
225 |
+
}
|
226 |
+
}
|
trunk/includes/wp-structuring-opening-hours.php
ADDED
@@ -0,0 +1,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema.org openingHours
|
4 |
+
*
|
5 |
+
* @author Justin Frydman
|
6 |
+
* @version 2.4.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 |
+
* @since 2.4.0
|
181 |
+
* @param array $consecutive_days
|
182 |
+
* @return array
|
183 |
+
*/
|
184 |
+
public function sort_by_day_of_the_week ( array $consecutive_days ) {
|
185 |
+
$days = $this->days;
|
186 |
+
|
187 |
+
arsort($consecutive_days);
|
188 |
+
|
189 |
+
$sort_by_day_func = function( $a, $b ) use ( $days ) {
|
190 |
+
$aKey = array_search( $a['start'], $days );
|
191 |
+
$bKey = array_search( $b['start'], $days );
|
192 |
+
return $aKey === $bKey ? 1 : $aKey < $bKey ? -1 : 1;
|
193 |
+
};
|
194 |
+
|
195 |
+
usort($consecutive_days, $sort_by_day_func);
|
196 |
+
|
197 |
+
return (array) $consecutive_days;
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Displays formatted opening hours
|
202 |
+
*
|
203 |
+
* @since 2.4.0
|
204 |
+
* @return array
|
205 |
+
*/
|
206 |
+
public function display () {
|
207 |
+
$opening_hours = array();
|
208 |
+
|
209 |
+
foreach( $this->weekly_hours as $key => $group ) {
|
210 |
+
if( $group['start'] != $group['end'] ) {
|
211 |
+
$hours = $group['start'].'-'.$group['end'];
|
212 |
+
} else {
|
213 |
+
$hours = $group['start'];
|
214 |
+
}
|
215 |
+
|
216 |
+
$hours .= ' ' . $group['open'] . '-' . $group['close'];
|
217 |
+
|
218 |
+
$opening_hours[] = $hours;
|
219 |
+
}
|
220 |
+
|
221 |
+
return (array) $opening_hours;
|
222 |
+
}
|
223 |
+
|
224 |
+
}
|
trunk/includes/wp-structuring-short-code-breadcrumb.php
ADDED
@@ -0,0 +1,254 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Breadcrumb ShortCode Settings
|
4 |
+
*
|
5 |
+
* @author Kazuya Takami
|
6 |
+
* @version 4.5.1
|
7 |
+
* @since 2.0.0
|
8 |
+
*/
|
9 |
+
class Structuring_Markup_ShortCode_Breadcrumb {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* ShortCode Display.
|
13 |
+
*
|
14 |
+
* @version 4.5.1
|
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 .= esc_html( $item['name'] );
|
55 |
+
} else {
|
56 |
+
$html .= '<a href="' . esc_url( $item['@id'] ) . '">';
|
57 |
+
$html .= esc_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.2.2
|
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 |
+
$current_url = esc_url( home_url() . $_SERVER['REQUEST_URI'] );
|
85 |
+
|
86 |
+
if ( get_option( 'show_on_front' ) === 'page' ) {
|
87 |
+
$front_page_id = get_option( 'page_on_front' );
|
88 |
+
} else {
|
89 |
+
$front_page_id = null;
|
90 |
+
}
|
91 |
+
|
92 |
+
if ( isset( $options['home_on'] ) && $options['home_on'] === 'on' ) {
|
93 |
+
if ( isset( $options['home_name'] ) && $options['home_name'] !== '' ) {
|
94 |
+
$item_array[] = $this->set_schema_breadcrumb_item( home_url(), $options['home_name'] );
|
95 |
+
} else {
|
96 |
+
if ( is_null( $front_page_id ) ) {
|
97 |
+
$item_array[] = $this->set_schema_breadcrumb_item( home_url(), get_bloginfo( 'name' ) );
|
98 |
+
} else {
|
99 |
+
$front_page = get_post( $front_page_id );
|
100 |
+
$item_array[] = $this->set_schema_breadcrumb_item( home_url(), esc_html( $front_page->post_title ) );
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
if ( is_search() ) {
|
106 |
+
$search_query = get_search_query();
|
107 |
+
if ( $search_query !== '' ) {
|
108 |
+
$item_array[] = $this->set_schema_breadcrumb_item( $current_url, get_search_query() );
|
109 |
+
}
|
110 |
+
} elseif ( is_tag() ) {
|
111 |
+
$item_array[] = $this->set_schema_breadcrumb_item( $current_url, single_tag_title( '', false ) );
|
112 |
+
} elseif ( is_date() ) {
|
113 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_year_link( get_query_var( 'year' ) ), get_query_var( 'year' ) );
|
114 |
+
if ( get_query_var( 'day' ) !== 0 ) {
|
115 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) ), get_query_var( 'monthnum' ) );
|
116 |
+
$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' ) );
|
117 |
+
} elseif ( get_query_var( 'monthnum' ) !== 0 ) {
|
118 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) ), get_query_var( 'monthnum' ) );
|
119 |
+
}
|
120 |
+
} elseif ( is_category() ) {
|
121 |
+
$categories = get_queried_object();
|
122 |
+
if( $categories->parent !== 0 ) {
|
123 |
+
$ancestors = array_reverse( get_ancestors( $categories->cat_ID, 'category' ) );
|
124 |
+
foreach( $ancestors as $ancestor ) {
|
125 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_category_link( $ancestor ), get_cat_name( $ancestor ) );
|
126 |
+
}
|
127 |
+
}
|
128 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_category_link( $categories->term_id ), $categories->name );
|
129 |
+
} elseif ( is_author() ) {
|
130 |
+
$item_array[] = $this->set_schema_breadcrumb_item( $current_url, get_the_author_meta( 'display_name', get_query_var( 'author' ) ) );
|
131 |
+
} elseif ( is_page() && (int) $front_page_id !== $post->ID ) {
|
132 |
+
if( $post->post_parent !== 0 ) {
|
133 |
+
$ancestors = array_reverse( get_post_ancestors( $post->ID ) );
|
134 |
+
foreach( $ancestors as $ancestor ) {
|
135 |
+
if ( (int) $front_page_id !== $ancestor ) {
|
136 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_permalink( $ancestor ), get_the_title( $ancestor ) );
|
137 |
+
}
|
138 |
+
}
|
139 |
+
}
|
140 |
+
$item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
|
141 |
+
} elseif ( is_attachment() ) {
|
142 |
+
if ( $post->post_parent !== 0 ) {
|
143 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_permalink( $post->post_parent ), get_the_title( $post->post_parent ) );
|
144 |
+
}
|
145 |
+
$item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
|
146 |
+
} elseif ( is_404() ) {
|
147 |
+
$item_array[] = $this->set_schema_breadcrumb_item( $current_url, wp_get_document_title() );
|
148 |
+
} elseif ( is_post_type_archive() ) {
|
149 |
+
if ( get_post_type_archive_link( get_post_type() ) ) {
|
150 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_post_type_archive_link( get_post_type() ), post_type_archive_title( '', false) );
|
151 |
+
}
|
152 |
+
} elseif ( is_archive() ) {
|
153 |
+
if ( get_post_type_archive_link( get_post_type() ) ) {
|
154 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_post_type_archive_link( get_post_type() ), get_post_type_object( get_post_type() )->label );
|
155 |
+
}
|
156 |
+
if( is_tax() ){
|
157 |
+
$tax_slug = get_query_var( 'taxonomy' );
|
158 |
+
$term_slug = get_query_var( 'term' );
|
159 |
+
$term = get_term_by( "slug", $term_slug, $tax_slug );
|
160 |
+
|
161 |
+
if( $term->parent !== 0 ) {
|
162 |
+
$ancestors = array_reverse( get_ancestors( $term->term_taxonomy_id, $tax_slug ) );
|
163 |
+
foreach( $ancestors as $ancestor ) {
|
164 |
+
$ancestor_term = get_term( $ancestor, $tax_slug );
|
165 |
+
$item_array[] = $this->set_schema_breadcrumb_item( esc_url( get_term_link( $ancestor ) ), esc_html( $ancestor_term->name ) );
|
166 |
+
}
|
167 |
+
}
|
168 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_term_link( $term_slug, $tax_slug ), esc_html( $term->name ) );
|
169 |
+
}
|
170 |
+
} elseif ( is_singular( 'post' ) ) {
|
171 |
+
$args = $this->set_taxonomy_item( $post->ID, 'category' );
|
172 |
+
if ( count( $args ) > 0 ) {
|
173 |
+
$item_array = array_merge( $item_array, $args );
|
174 |
+
}
|
175 |
+
$item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
|
176 |
+
} elseif ( is_single() ) {
|
177 |
+
if ( get_post_type_archive_link( get_post_type() ) ) {
|
178 |
+
$item_array[] = $this->set_schema_breadcrumb_item( get_post_type_archive_link( get_post_type() ), get_post_type_object( get_post_type() )->label );
|
179 |
+
}
|
180 |
+
$taxonomy_names = get_post_taxonomies();
|
181 |
+
if ( count( $taxonomy_names ) > 0 ) {
|
182 |
+
$args = $this->set_taxonomy_item( $post->ID, $taxonomy_names[0] );
|
183 |
+
if ( count( $args ) > 0 ) {
|
184 |
+
$item_array = array_merge( $item_array, $args );
|
185 |
+
}
|
186 |
+
}
|
187 |
+
$item_array[] = $this->set_schema_breadcrumb_item( $current_url, $post->post_title );
|
188 |
+
}
|
189 |
+
|
190 |
+
if ( !isset( $options['current_on'] ) || $options['current_on'] !== 'on' ) {
|
191 |
+
array_pop( $item_array );
|
192 |
+
}
|
193 |
+
|
194 |
+
return (array) $item_array;
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* taxonomy item settings
|
199 |
+
*
|
200 |
+
* @version 4.2.0
|
201 |
+
* @since 4.0.0
|
202 |
+
* @param int $id
|
203 |
+
* @param string $taxonomy
|
204 |
+
* @return array $args
|
205 |
+
*/
|
206 |
+
private function set_taxonomy_item ( $id, $taxonomy ) {
|
207 |
+
$terms = get_the_terms( $id, $taxonomy );
|
208 |
+
$term_bottom = array();
|
209 |
+
$args = array();
|
210 |
+
|
211 |
+
if ( $terms && ! is_wp_error( $terms ) ) {
|
212 |
+
$parent_ids = array();
|
213 |
+
|
214 |
+
foreach ( $terms as $term ) {
|
215 |
+
if ( $term->parent != 0 ) {
|
216 |
+
$parent_ids[] = $term->parent;
|
217 |
+
}
|
218 |
+
}
|
219 |
+
foreach ( $terms as $term ) {
|
220 |
+
if ( !in_array( $term->term_id, $parent_ids ) ) {
|
221 |
+
$term_bottom[] = $term->term_id;
|
222 |
+
}
|
223 |
+
}
|
224 |
+
}
|
225 |
+
|
226 |
+
if ( count( $term_bottom ) > 0 ) {
|
227 |
+
$ancestors = array_reverse( get_ancestors( $term_bottom[0], $taxonomy ) );
|
228 |
+
$ancestors[] = $term_bottom[0];
|
229 |
+
|
230 |
+
foreach ( $ancestors as $ancestor ) {
|
231 |
+
$term = get_term( $ancestor, $taxonomy );
|
232 |
+
$args[] = $this->set_schema_breadcrumb_item( esc_url( get_term_link( $ancestor ) ), esc_html( $term->name ) );
|
233 |
+
}
|
234 |
+
}
|
235 |
+
return (array) $args;
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Breadcrumb item settings
|
240 |
+
*
|
241 |
+
* @version 2.0.0
|
242 |
+
* @since 2.0.0
|
243 |
+
* @param string $id
|
244 |
+
* @param string $name
|
245 |
+
* @return array $args
|
246 |
+
*/
|
247 |
+
private function set_schema_breadcrumb_item ( $id, $name ) {
|
248 |
+
$args = array(
|
249 |
+
"@id" => esc_url( $id ),
|
250 |
+
"name" => esc_html( $name )
|
251 |
+
);
|
252 |
+
return (array) $args;
|
253 |
+
}
|
254 |
+
}
|
trunk/includes/wp-structuring-utility.php
ADDED
@@ -0,0 +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 |
+
}
|
trunk/js/main.js
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* Markup (JSON-LD) structured in schema.org */
|
2 |
+
jQuery(document).ready(function ($) {
|
3 |
+
'use strict';
|
4 |
+
|
5 |
+
// add row
|
6 |
+
$('.schema-admin-table').on('click', '.markup-time.plus', function () {
|
7 |
+
var newRow = $(this).closest('tr.opening-hours').clone();
|
8 |
+
$(this).closest('tr.opening-hours').after(newRow);
|
9 |
+
newRow.find('input').val('');
|
10 |
+
newRow.find('.minus').show();
|
11 |
+
newRow.find('input').each(function () {
|
12 |
+
var
|
13 |
+
name = $(this).prop('name'),
|
14 |
+
currentIndex = parseInt(name.split('][')[2], 10),
|
15 |
+
nextIndex = currentIndex + 1;
|
16 |
+
|
17 |
+
if (currentIndex === 0) {
|
18 |
+
$(this).parent().find('.plus:last-child').after('<a class="dashicons dashicons-minus markup-time minus"></a>');
|
19 |
+
}
|
20 |
+
$(this).prop('name', name.replace(currentIndex, nextIndex));
|
21 |
+
});
|
22 |
+
});
|
23 |
+
|
24 |
+
// remove row
|
25 |
+
$('.schema-admin-table').on('click', '.markup-time.minus', function () {
|
26 |
+
$(this).closest('tr.opening-hours').fadeOut('normal', function () {
|
27 |
+
$(this).remove();
|
28 |
+
});
|
29 |
+
});
|
30 |
+
});
|
trunk/js/main.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
jQuery(document).ready(function(n){"use strict";n(".schema-admin-table").on("click",".markup-time.plus",function(){var i=n(this).closest("tr.opening-hours").clone();n(this).closest("tr.opening-hours").after(i),i.find("input").val(""),i.find(".minus").show(),i.find("input").each(function(){var i=n(this).prop("name"),s=parseInt(i.split("][")[2],10),t=s+1;0===s&&n(this).parent().find(".plus:last-child").after('<a class="dashicons dashicons-minus markup-time minus"></a>'),n(this).prop("name",i.replace(s,t))})}),n(".schema-admin-table").on("click",".markup-time.minus",function(){n(this).closest("tr.opening-hours").fadeOut("normal",function(){n(this).remove()})})});
|
trunk/js/media-uploader-main.js
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($) {
|
2 |
+
$(function() {
|
3 |
+
var
|
4 |
+
custom_uploader = wp.media({
|
5 |
+
title: "Choose Image",
|
6 |
+
library: {
|
7 |
+
type: "image"
|
8 |
+
},
|
9 |
+
button: {
|
10 |
+
text: "Choose Image"
|
11 |
+
},
|
12 |
+
multiple: false
|
13 |
+
}),
|
14 |
+
media_id = "";
|
15 |
+
|
16 |
+
custom_uploader.on("select", function () {
|
17 |
+
var images = custom_uploader.state().get("selection");
|
18 |
+
|
19 |
+
images.each(function(file) {
|
20 |
+
switch (media_id) {
|
21 |
+
case "media-upload":
|
22 |
+
$("#logo").val(file.toJSON().url);
|
23 |
+
$("#logo-width").val(file.toJSON().width);
|
24 |
+
$("#logo-height").val(file.toJSON().height);
|
25 |
+
break;
|
26 |
+
case "media-upload-default":
|
27 |
+
$("#default_image").val(file.toJSON().url);
|
28 |
+
break;
|
29 |
+
}
|
30 |
+
});
|
31 |
+
});
|
32 |
+
|
33 |
+
$("#media-upload, #media-upload-default").on("click", function(e) {
|
34 |
+
media_id = e.target.id;
|
35 |
+
e.preventDefault();
|
36 |
+
custom_uploader.open();
|
37 |
+
});
|
38 |
+
});
|
39 |
+
})(jQuery);
|
trunk/languages/wp-structuring-markup-ja.mo
ADDED
Binary file
|
trunk/languages/wp-structuring-markup-ja.po
ADDED
@@ -0,0 +1,217 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (C) 2016 Markup (JSON-LD) structured in schema.org
|
2 |
+
# This file is distributed under the same license as the Markup (JSON-LD) structured in schema.org package.
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: Markup (JSON-LD) structured in schema.org 3.0.0\n"
|
6 |
+
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-structuring-"
|
7 |
+
"markup\n"
|
8 |
+
"POT-Creation-Date: 2016-06-20 10:36:01+00:00\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
|
13 |
+
"Last-Translator: Kazuya Takami <foundationmeister@outlook.com>\n"
|
14 |
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
15 |
+
|
16 |
+
#: includes/wp-structuring-admin-list.php:43
|
17 |
+
msgid "Schema.org Settings List"
|
18 |
+
msgstr "Schema.org 設定一覧"
|
19 |
+
|
20 |
+
#: includes/wp-structuring-admin-list.php:50
|
21 |
+
msgid "Status"
|
22 |
+
msgstr "Status"
|
23 |
+
|
24 |
+
#: includes/wp-structuring-admin-list.php:51
|
25 |
+
msgid "Schema.org Type"
|
26 |
+
msgstr "Schema.org タイプ"
|
27 |
+
|
28 |
+
#: includes/wp-structuring-admin-list.php:52
|
29 |
+
#: includes/wp-structuring-admin-post.php:142
|
30 |
+
msgid "Output On"
|
31 |
+
msgstr "出力ページ"
|
32 |
+
|
33 |
+
#: includes/wp-structuring-admin-list.php:53
|
34 |
+
msgid "ShortCode"
|
35 |
+
msgstr "ショートコード"
|
36 |
+
|
37 |
+
#: includes/wp-structuring-admin-list.php:81 wp-structuring-markup.php:159
|
38 |
+
msgid "Edit"
|
39 |
+
msgstr "編集"
|
40 |
+
|
41 |
+
#: includes/wp-structuring-admin-list.php:87
|
42 |
+
msgid "Without registration."
|
43 |
+
msgstr "登録されていません。"
|
44 |
+
|
45 |
+
#: includes/wp-structuring-admin-post.php:117
|
46 |
+
msgid "Schema.org Register"
|
47 |
+
msgstr "Schema.org 登録"
|
48 |
+
|
49 |
+
#: includes/wp-structuring-admin-post.php:147
|
50 |
+
#: includes/wp-structuring-admin-post.php:158
|
51 |
+
#: includes/wp-structuring-admin-post.php:187
|
52 |
+
#: includes/wp-structuring-admin-post.php:199
|
53 |
+
#: includes/wp-structuring-admin-post.php:213
|
54 |
+
#: includes/wp-structuring-admin-post.php:227
|
55 |
+
#: includes/wp-structuring-admin-post.php:249
|
56 |
+
msgid "Posts"
|
57 |
+
msgstr "投稿ページ"
|
58 |
+
|
59 |
+
#: includes/wp-structuring-admin-post.php:148
|
60 |
+
#: includes/wp-structuring-admin-post.php:159
|
61 |
+
#: includes/wp-structuring-admin-post.php:188
|
62 |
+
#: includes/wp-structuring-admin-post.php:200
|
63 |
+
#: includes/wp-structuring-admin-post.php:214
|
64 |
+
#: includes/wp-structuring-admin-post.php:228
|
65 |
+
#: includes/wp-structuring-admin-post.php:250
|
66 |
+
msgid "Pages"
|
67 |
+
msgstr "固定ページ"
|
68 |
+
|
69 |
+
#: includes/wp-structuring-admin-post.php:169
|
70 |
+
#: includes/wp-structuring-admin-post.php:185
|
71 |
+
#: includes/wp-structuring-admin-post.php:211
|
72 |
+
#: includes/wp-structuring-admin-post.php:225
|
73 |
+
#: includes/wp-structuring-admin-post.php:247
|
74 |
+
msgid "All Pages (In Header)"
|
75 |
+
msgstr "全てのページ(ヘッダー)"
|
76 |
+
|
77 |
+
#: includes/wp-structuring-admin-post.php:177
|
78 |
+
msgid "Event Post Page"
|
79 |
+
msgstr "イベント投稿ページ"
|
80 |
+
|
81 |
+
#: includes/wp-structuring-admin-post.php:186
|
82 |
+
#: includes/wp-structuring-admin-post.php:212
|
83 |
+
#: includes/wp-structuring-admin-post.php:226
|
84 |
+
#: includes/wp-structuring-admin-post.php:248
|
85 |
+
msgid "Homepage"
|
86 |
+
msgstr "ホームページ"
|
87 |
+
|
88 |
+
#: includes/wp-structuring-admin-post.php:239
|
89 |
+
msgid "Video Post Page"
|
90 |
+
msgstr "ビデオ投稿ページ"
|
91 |
+
|
92 |
+
#: includes/wp-structuring-admin-post.php:295
|
93 |
+
msgid "Output On(Custom Posts)"
|
94 |
+
msgstr "出力ページ(カスタム投稿)"
|
95 |
+
|
96 |
+
#: includes/wp-structuring-custom-post-event.php:34
|
97 |
+
#: includes/wp-structuring-custom-post-event.php:35
|
98 |
+
msgid "Event Posts"
|
99 |
+
msgstr "イベント投稿"
|
100 |
+
|
101 |
+
#: includes/wp-structuring-custom-post-event.php:36
|
102 |
+
msgid "All Event Posts"
|
103 |
+
msgstr "イベント投稿一覧"
|
104 |
+
|
105 |
+
#: includes/wp-structuring-custom-post-event.php:74
|
106 |
+
msgid "Schema.org Type Event"
|
107 |
+
msgstr "Schema.org Type Event"
|
108 |
+
|
109 |
+
#: includes/wp-structuring-custom-post-event.php:96
|
110 |
+
msgid "USD"
|
111 |
+
msgstr "JPY"
|
112 |
+
|
113 |
+
#: includes/wp-structuring-custom-post-event.php:101
|
114 |
+
msgid "Event Name"
|
115 |
+
msgstr "イベント名"
|
116 |
+
|
117 |
+
#: includes/wp-structuring-custom-post-event.php:106
|
118 |
+
msgid "Start Date"
|
119 |
+
msgstr "開始日"
|
120 |
+
|
121 |
+
#: includes/wp-structuring-custom-post-event.php:112
|
122 |
+
msgid "Event URL"
|
123 |
+
msgstr "イベントURL"
|
124 |
+
|
125 |
+
#: includes/wp-structuring-custom-post-event.php:117
|
126 |
+
msgid "Place Name"
|
127 |
+
msgstr "場所名"
|
128 |
+
|
129 |
+
#: includes/wp-structuring-custom-post-event.php:122
|
130 |
+
msgid "Place URL"
|
131 |
+
msgstr "会場URL"
|
132 |
+
|
133 |
+
#: includes/wp-structuring-custom-post-event.php:127
|
134 |
+
msgid "Place Address"
|
135 |
+
msgstr "会場住所"
|
136 |
+
|
137 |
+
#: includes/wp-structuring-custom-post-event.php:132
|
138 |
+
msgid "Price"
|
139 |
+
msgstr "参加費"
|
140 |
+
|
141 |
+
#: includes/wp-structuring-custom-post-event.php:137
|
142 |
+
msgid "Currency"
|
143 |
+
msgstr "通貨"
|
144 |
+
|
145 |
+
#: includes/wp-structuring-custom-post-video.php:34
|
146 |
+
#: includes/wp-structuring-custom-post-video.php:35
|
147 |
+
msgid "Video Posts"
|
148 |
+
msgstr "ビデオ投稿"
|
149 |
+
|
150 |
+
#: includes/wp-structuring-custom-post-video.php:36
|
151 |
+
msgid "All Video Posts"
|
152 |
+
msgstr "ビデオ投稿一覧"
|
153 |
+
|
154 |
+
#: includes/wp-structuring-custom-post-video.php:74
|
155 |
+
msgid "Schema.org Type Video"
|
156 |
+
msgstr "Schema.org Type Video"
|
157 |
+
|
158 |
+
#: includes/wp-structuring-custom-post-video.php:98
|
159 |
+
msgid "duration"
|
160 |
+
msgstr "所要時間"
|
161 |
+
|
162 |
+
#: includes/wp-structuring-custom-post-video.php:103
|
163 |
+
msgid "contentURL"
|
164 |
+
msgstr "コンテンツURL"
|
165 |
+
|
166 |
+
#: includes/wp-structuring-custom-post-video.php:108
|
167 |
+
msgid "embedURL"
|
168 |
+
msgstr "embedURL"
|
169 |
+
|
170 |
+
#: includes/wp-structuring-custom-post-video.php:113
|
171 |
+
msgid "interactionCount"
|
172 |
+
msgstr "ビデオ視聴回数"
|
173 |
+
|
174 |
+
#: includes/wp-structuring-custom-post-video.php:118
|
175 |
+
msgid "expires"
|
176 |
+
msgstr "有効期限"
|
177 |
+
|
178 |
+
#: includes/wp-structuring-display.php:309
|
179 |
+
#: includes/wp-structuring-display.php:373
|
180 |
+
#: includes/wp-structuring-display.php:630
|
181 |
+
#: includes/wp-structuring-display.php:767
|
182 |
+
msgid "Featured Image not set."
|
183 |
+
msgstr "アイキャッチ画像が設定されていません。"
|
184 |
+
|
185 |
+
#: includes/wp-structuring-display.php:312
|
186 |
+
#: includes/wp-structuring-display.php:376
|
187 |
+
#: includes/wp-structuring-display.php:633
|
188 |
+
msgid "Logo Image not set."
|
189 |
+
msgstr "ロゴ画像が設定されていません。"
|
190 |
+
|
191 |
+
#: wp-structuring-markup.php:150 wp-structuring-markup.php:151
|
192 |
+
msgid "Schema.org Settings"
|
193 |
+
msgstr "Schema.org 設定"
|
194 |
+
|
195 |
+
#: wp-structuring-markup.php:158
|
196 |
+
msgid "Schema.org Setting Edit"
|
197 |
+
msgstr "Schema.org 設定編集"
|
198 |
+
|
199 |
+
#. Plugin Name of the plugin/theme
|
200 |
+
msgid "Markup (JSON-LD) structured in schema.org"
|
201 |
+
msgstr "Markup (JSON-LD) structured in schema.org"
|
202 |
+
|
203 |
+
#. Plugin URI of the plugin/theme
|
204 |
+
msgid "https://wordpress.org/plugins/wp-structuring-markup/"
|
205 |
+
msgstr "https://wordpress.org/plugins/wp-structuring-markup/"
|
206 |
+
|
207 |
+
#. Description of the plugin/theme
|
208 |
+
msgid "Allows you to include Schema.org JSON-LD syntax markup on your website"
|
209 |
+
msgstr "ウェブサイト上でSchema.orgをJSON-LD構文で簡単に導入することができます"
|
210 |
+
|
211 |
+
#. Author of the plugin/theme
|
212 |
+
msgid "Kazuya Takami"
|
213 |
+
msgstr "Kazuya Takami"
|
214 |
+
|
215 |
+
#. Author URI of the plugin/theme
|
216 |
+
msgid "http://programp.com/"
|
217 |
+
msgstr "http://programp.com/"
|
trunk/languages/wp-structuring-markup-tr_TR.mo
ADDED
Binary file
|
trunk/languages/wp-structuring-markup-tr_TR.po
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (C) 2016 Markup (JSON-LD) structured in schema.org
|
2 |
+
# This file is distributed under the same license as the Markup (JSON-LD) structured in schema.org package.
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: Markup (JSON-LD) structured in schema.org 2.4.1\n"
|
6 |
+
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-structuring-"
|
7 |
+
"markup\n"
|
8 |
+
"POT-Creation-Date: 2016-03-01 08:58:28+00:00\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"PO-Revision-Date: 2016-03-08 03:21+0200\n"
|
13 |
+
"Last-Translator: Keremcan Buyuktaskin <keremcan@gmail.com>\n"
|
14 |
+
"Language-Team: Keremcan Buyuktaskin <keremcan@gmail.com>\n"
|
15 |
+
"Plural-Forms: nplurals=1; plural=0;\n"
|
16 |
+
"Language: tr_TR\n"
|
17 |
+
"X-Generator: Poedit 1.6.6\n"
|
18 |
+
"X-Poedit-Basepath: D:\\Google Drive\\Sites\\Tayland Gezi\\wp-content\\plugins"
|
19 |
+
"\\wp-structuring-markup\n"
|
20 |
+
|
21 |
+
#: includes/wp-structuring-admin-list.php:43
|
22 |
+
msgid "Schema.org Settings List"
|
23 |
+
msgstr "Schema.org Ayarları Listesi"
|
24 |
+
|
25 |
+
#: includes/wp-structuring-admin-list.php:50
|
26 |
+
msgid "Status"
|
27 |
+
msgstr "Durum"
|
28 |
+
|
29 |
+
#: includes/wp-structuring-admin-list.php:51
|
30 |
+
msgid "Schema Type"
|
31 |
+
msgstr "Şema Tipi"
|
32 |
+
|
33 |
+
#: includes/wp-structuring-admin-list.php:52
|
34 |
+
#: includes/wp-structuring-admin-post.php:115
|
35 |
+
msgid "Output On"
|
36 |
+
msgstr "Devredeki Çıktı"
|
37 |
+
|
38 |
+
#: includes/wp-structuring-admin-list.php:53
|
39 |
+
msgid "ShortCode"
|
40 |
+
msgstr "Kısa Kod"
|
41 |
+
|
42 |
+
#: includes/wp-structuring-admin-list.php:81 wp-structuring-markup.php:155
|
43 |
+
msgid "Edit"
|
44 |
+
msgstr "Düzenle"
|
45 |
+
|
46 |
+
#: includes/wp-structuring-admin-list.php:87
|
47 |
+
msgid "Without registration."
|
48 |
+
msgstr "Kayıt olmadan."
|
49 |
+
|
50 |
+
#: includes/wp-structuring-admin-post.php:90
|
51 |
+
msgid "Schema.org Register"
|
52 |
+
msgstr "Schema.org Kayıt"
|
53 |
+
|
54 |
+
#: includes/wp-structuring-admin-post.php:120
|
55 |
+
#: includes/wp-structuring-admin-post.php:128
|
56 |
+
#: includes/wp-structuring-admin-post.php:154
|
57 |
+
#: includes/wp-structuring-admin-post.php:163
|
58 |
+
#: includes/wp-structuring-admin-post.php:173
|
59 |
+
#: includes/wp-structuring-admin-post.php:184
|
60 |
+
#: includes/wp-structuring-admin-post.php:195
|
61 |
+
msgid "Posts"
|
62 |
+
msgstr "Yazılar"
|
63 |
+
|
64 |
+
#: includes/wp-structuring-admin-post.php:136
|
65 |
+
#: includes/wp-structuring-admin-post.php:152
|
66 |
+
#: includes/wp-structuring-admin-post.php:171
|
67 |
+
#: includes/wp-structuring-admin-post.php:182
|
68 |
+
#: includes/wp-structuring-admin-post.php:193
|
69 |
+
msgid "All Pages (In Header)"
|
70 |
+
msgstr "Tüm Sayfalar (Üst Kısımda)"
|
71 |
+
|
72 |
+
#: includes/wp-structuring-admin-post.php:144
|
73 |
+
msgid "Event Post Page"
|
74 |
+
msgstr "Etkinlik Yazı Sayfası"
|
75 |
+
|
76 |
+
#: includes/wp-structuring-admin-post.php:153
|
77 |
+
#: includes/wp-structuring-admin-post.php:172
|
78 |
+
#: includes/wp-structuring-admin-post.php:183
|
79 |
+
#: includes/wp-structuring-admin-post.php:194
|
80 |
+
msgid "Homepage"
|
81 |
+
msgstr "Ana Sayfa"
|
82 |
+
|
83 |
+
#: includes/wp-structuring-admin-post.php:155
|
84 |
+
#: includes/wp-structuring-admin-post.php:174
|
85 |
+
#: includes/wp-structuring-admin-post.php:185
|
86 |
+
#: includes/wp-structuring-admin-post.php:196
|
87 |
+
msgid "Pages"
|
88 |
+
msgstr "Sayfalar"
|
89 |
+
|
90 |
+
#: includes/wp-structuring-custom-post-event.php:34
|
91 |
+
#: includes/wp-structuring-custom-post-event.php:35
|
92 |
+
msgid "Event Posts"
|
93 |
+
msgstr "Etkinlik Yazıları"
|
94 |
+
|
95 |
+
#: includes/wp-structuring-custom-post-event.php:73
|
96 |
+
msgid "Schema.org Type Event"
|
97 |
+
msgstr "Schema.org Tip Etkinliği"
|
98 |
+
|
99 |
+
#: includes/wp-structuring-custom-post-event.php:95
|
100 |
+
msgid "USD"
|
101 |
+
msgstr "USD"
|
102 |
+
|
103 |
+
#: includes/wp-structuring-custom-post-event.php:100
|
104 |
+
msgid "Event Name"
|
105 |
+
msgstr "Etkinlik Adı"
|
106 |
+
|
107 |
+
#: includes/wp-structuring-custom-post-event.php:105
|
108 |
+
msgid "Start Date"
|
109 |
+
msgstr "Başlangıç Tarihi"
|
110 |
+
|
111 |
+
#: includes/wp-structuring-custom-post-event.php:111
|
112 |
+
msgid "Event URL"
|
113 |
+
msgstr "Etkinlik URL'si"
|
114 |
+
|
115 |
+
#: includes/wp-structuring-custom-post-event.php:116
|
116 |
+
msgid "Place Name"
|
117 |
+
msgstr "Yer Adı"
|
118 |
+
|
119 |
+
#: includes/wp-structuring-custom-post-event.php:121
|
120 |
+
msgid "Place URL"
|
121 |
+
msgstr "Yer URL'si"
|
122 |
+
|
123 |
+
#: includes/wp-structuring-custom-post-event.php:126
|
124 |
+
msgid "Place Address"
|
125 |
+
msgstr "Yer Adresi"
|
126 |
+
|
127 |
+
#: includes/wp-structuring-custom-post-event.php:131
|
128 |
+
msgid "Price"
|
129 |
+
msgstr "Fiyat"
|
130 |
+
|
131 |
+
#: includes/wp-structuring-custom-post-event.php:136
|
132 |
+
msgid "Currency"
|
133 |
+
msgstr "Para Birimi"
|
134 |
+
|
135 |
+
#: wp-structuring-markup.php:146 wp-structuring-markup.php:147
|
136 |
+
msgid "Schema.org Settings"
|
137 |
+
msgstr "Schema.org Ayarları"
|
138 |
+
|
139 |
+
#: wp-structuring-markup.php:154
|
140 |
+
msgid "Schema.org Setting Edit"
|
141 |
+
msgstr "Schema.org Ayarları Düzenle"
|
142 |
+
|
143 |
+
#. Plugin Name of the plugin/theme
|
144 |
+
msgid "Markup (JSON-LD) structured in schema.org"
|
145 |
+
msgstr "Markup (JSON-LD) structured in schema.org"
|
146 |
+
|
147 |
+
#. Plugin URI of the plugin/theme
|
148 |
+
msgid "https://wordpress.org/plugins/wp-structuring-markup/"
|
149 |
+
msgstr "https://wordpress.org/plugins/wp-structuring-markup/"
|
150 |
+
|
151 |
+
#. Description of the plugin/theme
|
152 |
+
msgid "Allows you to include schema.org JSON-LD syntax markup on your website"
|
153 |
+
msgstr ""
|
154 |
+
"Web sitenizde schema.org JSON-LD sözdizimi biçimlendirmesini dahil etmenize "
|
155 |
+
"izin verir"
|
156 |
+
|
157 |
+
#. Author of the plugin/theme
|
158 |
+
msgid "Kazuya Takami"
|
159 |
+
msgstr "Kazuya Takami"
|
160 |
+
|
161 |
+
#. Author URI of the plugin/theme
|
162 |
+
msgid "http://programp.com/"
|
163 |
+
msgstr "http://programp.com/"
|
trunk/languages/wp-structuring-markup.pot
ADDED
@@ -0,0 +1,217 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (C) 2016 Markup (JSON-LD) structured in schema.org
|
2 |
+
# This file is distributed under the same license as the Markup (JSON-LD) structured in schema.org package.
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: Markup (JSON-LD) structured in schema.org 3.0.0\n"
|
6 |
+
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-structuring-"
|
7 |
+
"markup\n"
|
8 |
+
"POT-Creation-Date: 2016-06-20 10:36:01+00:00\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
|
13 |
+
"Last-Translator: Kazuya Takami <foundationmeister@outlook.com>\n"
|
14 |
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
15 |
+
|
16 |
+
#: includes/wp-structuring-admin-list.php:43
|
17 |
+
msgid "Schema.org Settings List"
|
18 |
+
msgstr ""
|
19 |
+
|
20 |
+
#: includes/wp-structuring-admin-list.php:50
|
21 |
+
msgid "Status"
|
22 |
+
msgstr ""
|
23 |
+
|
24 |
+
#: includes/wp-structuring-admin-list.php:51
|
25 |
+
msgid "Schema.org Type"
|
26 |
+
msgstr ""
|
27 |
+
|
28 |
+
#: includes/wp-structuring-admin-list.php:52
|
29 |
+
#: includes/wp-structuring-admin-post.php:142
|
30 |
+
msgid "Output On"
|
31 |
+
msgstr ""
|
32 |
+
|
33 |
+
#: includes/wp-structuring-admin-list.php:53
|
34 |
+
msgid "ShortCode"
|
35 |
+
msgstr ""
|
36 |
+
|
37 |
+
#: includes/wp-structuring-admin-list.php:81 wp-structuring-markup.php:159
|
38 |
+
msgid "Edit"
|
39 |
+
msgstr ""
|
40 |
+
|
41 |
+
#: includes/wp-structuring-admin-list.php:87
|
42 |
+
msgid "Without registration."
|
43 |
+
msgstr ""
|
44 |
+
|
45 |
+
#: includes/wp-structuring-admin-post.php:117
|
46 |
+
msgid "Schema.org Register"
|
47 |
+
msgstr ""
|
48 |
+
|
49 |
+
#: includes/wp-structuring-admin-post.php:147
|
50 |
+
#: includes/wp-structuring-admin-post.php:158
|
51 |
+
#: includes/wp-structuring-admin-post.php:187
|
52 |
+
#: includes/wp-structuring-admin-post.php:199
|
53 |
+
#: includes/wp-structuring-admin-post.php:213
|
54 |
+
#: includes/wp-structuring-admin-post.php:227
|
55 |
+
#: includes/wp-structuring-admin-post.php:249
|
56 |
+
msgid "Posts"
|
57 |
+
msgstr ""
|
58 |
+
|
59 |
+
#: includes/wp-structuring-admin-post.php:148
|
60 |
+
#: includes/wp-structuring-admin-post.php:159
|
61 |
+
#: includes/wp-structuring-admin-post.php:188
|
62 |
+
#: includes/wp-structuring-admin-post.php:200
|
63 |
+
#: includes/wp-structuring-admin-post.php:214
|
64 |
+
#: includes/wp-structuring-admin-post.php:228
|
65 |
+
#: includes/wp-structuring-admin-post.php:250
|
66 |
+
msgid "Pages"
|
67 |
+
msgstr ""
|
68 |
+
|
69 |
+
#: includes/wp-structuring-admin-post.php:169
|
70 |
+
#: includes/wp-structuring-admin-post.php:185
|
71 |
+
#: includes/wp-structuring-admin-post.php:211
|
72 |
+
#: includes/wp-structuring-admin-post.php:225
|
73 |
+
#: includes/wp-structuring-admin-post.php:247
|
74 |
+
msgid "All Pages (In Header)"
|
75 |
+
msgstr ""
|
76 |
+
|
77 |
+
#: includes/wp-structuring-admin-post.php:177
|
78 |
+
msgid "Event Post Page"
|
79 |
+
msgstr ""
|
80 |
+
|
81 |
+
#: includes/wp-structuring-admin-post.php:186
|
82 |
+
#: includes/wp-structuring-admin-post.php:212
|
83 |
+
#: includes/wp-structuring-admin-post.php:226
|
84 |
+
#: includes/wp-structuring-admin-post.php:248
|
85 |
+
msgid "Homepage"
|
86 |
+
msgstr ""
|
87 |
+
|
88 |
+
#: includes/wp-structuring-admin-post.php:239
|
89 |
+
msgid "Video Post Page"
|
90 |
+
msgstr ""
|
91 |
+
|
92 |
+
#: includes/wp-structuring-admin-post.php:295
|
93 |
+
msgid "Output On(Custom Posts)"
|
94 |
+
msgstr ""
|
95 |
+
|
96 |
+
#: includes/wp-structuring-custom-post-event.php:34
|
97 |
+
#: includes/wp-structuring-custom-post-event.php:35
|
98 |
+
msgid "Event Posts"
|
99 |
+
msgstr ""
|
100 |
+
|
101 |
+
#: includes/wp-structuring-custom-post-event.php:36
|
102 |
+
msgid "All Event Posts"
|
103 |
+
msgstr ""
|
104 |
+
|
105 |
+
#: includes/wp-structuring-custom-post-event.php:74
|
106 |
+
msgid "Schema.org Type Event"
|
107 |
+
msgstr ""
|
108 |
+
|
109 |
+
#: includes/wp-structuring-custom-post-event.php:96
|
110 |
+
msgid "USD"
|
111 |
+
msgstr ""
|
112 |
+
|
113 |
+
#: includes/wp-structuring-custom-post-event.php:101
|
114 |
+
msgid "Event Name"
|
115 |
+
msgstr ""
|
116 |
+
|
117 |
+
#: includes/wp-structuring-custom-post-event.php:106
|
118 |
+
msgid "Start Date"
|
119 |
+
msgstr ""
|
120 |
+
|
121 |
+
#: includes/wp-structuring-custom-post-event.php:112
|
122 |
+
msgid "Event URL"
|
123 |
+
msgstr ""
|
124 |
+
|
125 |
+
#: includes/wp-structuring-custom-post-event.php:117
|
126 |
+
msgid "Place Name"
|
127 |
+
msgstr ""
|
128 |
+
|
129 |
+
#: includes/wp-structuring-custom-post-event.php:122
|
130 |
+
msgid "Place URL"
|
131 |
+
msgstr ""
|
132 |
+
|
133 |
+
#: includes/wp-structuring-custom-post-event.php:127
|
134 |
+
msgid "Place Address"
|
135 |
+
msgstr ""
|
136 |
+
|
137 |
+
#: includes/wp-structuring-custom-post-event.php:132
|
138 |
+
msgid "Price"
|
139 |
+
msgstr ""
|
140 |
+
|
141 |
+
#: includes/wp-structuring-custom-post-event.php:137
|
142 |
+
msgid "Currency"
|
143 |
+
msgstr ""
|
144 |
+
|
145 |
+
#: includes/wp-structuring-custom-post-video.php:34
|
146 |
+
#: includes/wp-structuring-custom-post-video.php:35
|
147 |
+
msgid "Video Posts"
|
148 |
+
msgstr ""
|
149 |
+
|
150 |
+
#: includes/wp-structuring-custom-post-video.php:36
|
151 |
+
msgid "All Video Posts"
|
152 |
+
msgstr ""
|
153 |
+
|
154 |
+
#: includes/wp-structuring-custom-post-video.php:74
|
155 |
+
msgid "Schema.org Type Video"
|
156 |
+
msgstr ""
|
157 |
+
|
158 |
+
#: includes/wp-structuring-custom-post-video.php:98
|
159 |
+
msgid "duration"
|
160 |
+
msgstr ""
|
161 |
+
|
162 |
+
#: includes/wp-structuring-custom-post-video.php:103
|
163 |
+
msgid "contentURL"
|
164 |
+
msgstr ""
|
165 |
+
|
166 |
+
#: includes/wp-structuring-custom-post-video.php:108
|
167 |
+
msgid "embedURL"
|
168 |
+
msgstr ""
|
169 |
+
|
170 |
+
#: includes/wp-structuring-custom-post-video.php:113
|
171 |
+
msgid "interactionCount"
|
172 |
+
msgstr ""
|
173 |
+
|
174 |
+
#: includes/wp-structuring-custom-post-video.php:118
|
175 |
+
msgid "expires"
|
176 |
+
msgstr ""
|
177 |
+
|
178 |
+
#: includes/wp-structuring-display.php:309
|
179 |
+
#: includes/wp-structuring-display.php:373
|
180 |
+
#: includes/wp-structuring-display.php:630
|
181 |
+
#: includes/wp-structuring-display.php:767
|
182 |
+
msgid "Featured Image not set."
|
183 |
+
msgstr ""
|
184 |
+
|
185 |
+
#: includes/wp-structuring-display.php:312
|
186 |
+
#: includes/wp-structuring-display.php:376
|
187 |
+
#: includes/wp-structuring-display.php:633
|
188 |
+
msgid "Logo Image not set."
|
189 |
+
msgstr ""
|
190 |
+
|
191 |
+
#: wp-structuring-markup.php:150 wp-structuring-markup.php:151
|
192 |
+
msgid "Schema.org Settings"
|
193 |
+
msgstr ""
|
194 |
+
|
195 |
+
#: wp-structuring-markup.php:158
|
196 |
+
msgid "Schema.org Setting Edit"
|
197 |
+
msgstr ""
|
198 |
+
|
199 |
+
#. Plugin Name of the plugin/theme
|
200 |
+
msgid "Markup (JSON-LD) structured in schema.org"
|
201 |
+
msgstr ""
|
202 |
+
|
203 |
+
#. Plugin URI of the plugin/theme
|
204 |
+
msgid "https://wordpress.org/plugins/wp-structuring-markup/"
|
205 |
+
msgstr ""
|
206 |
+
|
207 |
+
#. Description of the plugin/theme
|
208 |
+
msgid "Allows you to include schema.org JSON-LD syntax markup on your website"
|
209 |
+
msgstr ""
|
210 |
+
|
211 |
+
#. Author of the plugin/theme
|
212 |
+
msgid "Kazuya Takami"
|
213 |
+
msgstr ""
|
214 |
+
|
215 |
+
#. Author URI of the plugin/theme
|
216 |
+
msgid "http://programp.com/"
|
217 |
+
msgstr ""
|
trunk/readme.txt
ADDED
@@ -0,0 +1,347 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Markup (JSON-LD) structured in schema.org ===
|
2 |
+
Contributors: miiitaka
|
3 |
+
Tags: schema, schema.org, json, json-ld, seo, post, posts, google, shortcode, breadcrumb
|
4 |
+
Requires at least: 4.3.1
|
5 |
+
Tested up to: 4.9.8
|
6 |
+
Stable tag: 4.5.1
|
7 |
+
|
8 |
+
Allows you to include schema.org JSON-LD syntax markup on your website
|
9 |
+
|
10 |
+
== Description ==
|
11 |
+
|
12 |
+
Allows you to include schema.org JSON-LD syntax markup on your website
|
13 |
+
Base knowledge is "https://schema.org/" and "https://developers.google.com/structured-data/"
|
14 |
+
|
15 |
+
= Schema.org Type =
|
16 |
+
|
17 |
+
* Article: http://schema.org/Article
|
18 |
+
* BlogPosting: http://schema.org/BlogPosting
|
19 |
+
* BreadcrumbList: https://schema.org/BreadcrumbList
|
20 |
+
* Event: https://schema.org/Event
|
21 |
+
* LocalBusiness : http://schema.org/LocalBusiness
|
22 |
+
* NewsArticle: http://schema.org/NewsArticle
|
23 |
+
* Organization: https://schema.org/Organization
|
24 |
+
* Person: https://schema.org/Person
|
25 |
+
* SiteNavigation: https://schema.org/SiteNavigationElement
|
26 |
+
* Speakable: https://pending.schema.org/speakable
|
27 |
+
* Video: https://schema.org/Video
|
28 |
+
* Website: https://schema.org/WebSite
|
29 |
+
|
30 |
+
= Breadcrumb =
|
31 |
+
|
32 |
+
You can display the breadcrumbs in the short code. Breadcrumb definition is available even if not active.
|
33 |
+
|
34 |
+
[ Example ]
|
35 |
+
`
|
36 |
+
<?php
|
37 |
+
if ( shortcode_exists( 'wp-structuring-markup-breadcrumb' ) ) {
|
38 |
+
echo do_shortcode( '[wp-structuring-markup-breadcrumb]' );
|
39 |
+
}
|
40 |
+
?>
|
41 |
+
`
|
42 |
+
|
43 |
+
[ ShortCode Options ]
|
44 |
+
|
45 |
+
* Option : id="id_name" attribute additional ol element.
|
46 |
+
* Option : class="class_name" attribute additional ol element.
|
47 |
+
|
48 |
+
|
49 |
+
== Installation ==
|
50 |
+
|
51 |
+
* A plug-in installation screen is displayed in the WordPress admin panel.
|
52 |
+
* It installs in `wp-content/plugins`.
|
53 |
+
* The plug-in is activated.
|
54 |
+
* Open 'Schema.org Setting' menu.
|
55 |
+
|
56 |
+
== Changelog ==
|
57 |
+
|
58 |
+
= 4.5.1 (2018-09-03) =
|
59 |
+
* Fixed : Changed title fixing of breadcrumbs on page 404.
|
60 |
+
|
61 |
+
= 4.5.0 (2018-08-17) =
|
62 |
+
* Checked : WordPress version 4.9.8 operation check.
|
63 |
+
* Added : Speakable structured markup is implemented in "Article", "BlogPosting", "NewsArticle".
|
64 |
+
* Added : Added function to compress output data.
|
65 |
+
|
66 |
+
= 4.4.0 (2018-07-10) =
|
67 |
+
* Checked : WordPress version 4.9.7 operation check.
|
68 |
+
* Updated : Schema.ory Type "Image", "BlogPosting", "NewsArticle" image property added so that default image URL can be set.
|
69 |
+
|
70 |
+
= 4.3.0 (2018-06-16) =
|
71 |
+
* Checked : WordPress version 4.9.6 operation check.
|
72 |
+
* Updated : Enable / disable function of link setting of current page of breadcrumbs.
|
73 |
+
|
74 |
+
= 4.2.2 (2018-05-15) =
|
75 |
+
* Checked : WordPress version 4.9.5 operation check.
|
76 |
+
* Fixed : If there is a child element on that page in the top fixed page, the parent element duplicates.
|
77 |
+
* Fixed : Taxonomy name of custom posting is not displayed in a custom taxonomy archive page.
|
78 |
+
|
79 |
+
= 4.2.1 (2018-03-23) =
|
80 |
+
* Fixed : Taxonomy name of custom posting is not displayed.
|
81 |
+
|
82 |
+
= 4.1.8 (2018-02-16) =
|
83 |
+
* Checked : WordPress version 4.9.4 operation check.
|
84 |
+
* Checked : WordPress version 4.9.3 operation check.
|
85 |
+
|
86 |
+
= 4.1.7 (2018-01-22) =
|
87 |
+
* Checked : WordPress version 4.9.2 operation check.
|
88 |
+
|
89 |
+
= 4.1.6 (2017-12-12) =
|
90 |
+
* Checked : WordPress version 4.9.1 operation check.
|
91 |
+
* Fixed : Hidden if addressRegion and telephone is empty.
|
92 |
+
|
93 |
+
= 4.1.5 (2017-11-22) =
|
94 |
+
* Checked : WordPress version 4.9.0 operation check.
|
95 |
+
|
96 |
+
= 4.1.4 (2017-11-01) =
|
97 |
+
* Checked : WordPress version 4.8.3 operation check.
|
98 |
+
* Fixed : Error setting aria-label.
|
99 |
+
|
100 |
+
= 4.1.3 (2017-09-27) =
|
101 |
+
* Checked : WordPress version 4.8.2 operation check.
|
102 |
+
* Updated : Stop setting the default value.
|
103 |
+
* Fixed : availableLanguage and area_served array setting ( Organization )
|
104 |
+
|
105 |
+
= 4.1.2 (2017-08-23) =
|
106 |
+
* Checked : WordPress version 4.8.1 operation check.
|
107 |
+
|
108 |
+
= 4.1.1 (2017-07-26) =
|
109 |
+
* Added : Correct to display / hide the current page.(BreadcrumbList schema.org)
|
110 |
+
* Updated : Event and Video type css update.
|
111 |
+
* Fixed : Do not display when the search query is empty.
|
112 |
+
|
113 |
+
= 4.1.0 (2017-07-03) =
|
114 |
+
* Added : If there is no feature image setting, set the first image of the post.
|
115 |
+
* Updated : Organization Image recommended.(Article / NewsArticle / BlogPosting)
|
116 |
+
* Fixed : Events and videos of custom posts should not appear in choices.
|
117 |
+
* Fixed : Organization type Notice Error.
|
118 |
+
|
119 |
+
= 4.0.2 (2017-06-14) =
|
120 |
+
* Checked : WordPress version 4.8.0 operation check.
|
121 |
+
* Updated : Warning: Event type schema.org ( availability, validFrom and performer. )
|
122 |
+
* Fixed : Events and videos of custom posts should not appear in choices.
|
123 |
+
|
124 |
+
= 4.0.1 (2017-05-25) =
|
125 |
+
* Added : Hook point of AMP plug-ins (Automattic, Inc. release). https://wordpress.org/plugins/amp/
|
126 |
+
* Added : Site Navigation on only Home Page.
|
127 |
+
* Fixed : Problem with custom taxonomies.(BreadcrumbList)
|
128 |
+
|
129 |
+
= 3.2.6 (2017-05-20) =
|
130 |
+
* Checked : WordPress version 4.7.5 operation check.
|
131 |
+
|
132 |
+
= 3.2.5 (2017-04-24) =
|
133 |
+
* Checked : WordPress version 4.7.4 operation check.
|
134 |
+
|
135 |
+
= 3.2.4 (2017-03-30) =
|
136 |
+
* Fixed : BreadcrumbList - Ignore the Home setting when setting the head fixed page.
|
137 |
+
* Fixed : BreadcrumbList - Categories of two or more levels are not displayed.
|
138 |
+
* Fixed : Minor bug fixed.
|
139 |
+
* Updated : Article,BlogPosting and NewsArticle - Limit headline to 110 chars.
|
140 |
+
|
141 |
+
= 3.2.3 (2017-03-21) =
|
142 |
+
* Fixed : "Warning: Illegal string offset" error occurred on Video and Event Schema.org.
|
143 |
+
* Updated : Event Types add fields.
|
144 |
+
* Updated : Video Types add fields.
|
145 |
+
* Updated : Change selection method of SiteNavigation type.
|
146 |
+
|
147 |
+
= 3.2.2 (2017-03-09) =
|
148 |
+
* Fixed : Article, BlogPosting, and NewsArticle can not display the Publisher attribute.
|
149 |
+
* Added : Add media selection function to the field for inputting image path.
|
150 |
+
* Checked : WordPress version 4.7.3 operation check.
|
151 |
+
|
152 |
+
= 3.2.1 (2017-02-21) =
|
153 |
+
* Fixed : Call to undefined function imagecreatefromstring().
|
154 |
+
|
155 |
+
= 3.2.0 (2017-01-30) =
|
156 |
+
* Fixed : Invalid breadcrumb markup.
|
157 |
+
* Fixed : Some items are not displayed on "Organization schema.org".
|
158 |
+
* Added : Add items to e-mail to "Organization schema.org".
|
159 |
+
* Checked : WordPress version 4.7.2 operation check.
|
160 |
+
|
161 |
+
= 3.1.7 (2017-01-12) =
|
162 |
+
* Checked : WordPress version 4.7.1 operation check.
|
163 |
+
|
164 |
+
= 3.1.6 (2016-12-16) =
|
165 |
+
* Updated : Change ImageObject attribute of Schema.org type "Article", "BlogPosting", "NewsArticle" from "required" to "recommended".
|
166 |
+
* Fixed : Custom post menu control.
|
167 |
+
|
168 |
+
= 3.1.5 (2016-12-08) =
|
169 |
+
* Checked : WordPress version 4.7.0 operation check.
|
170 |
+
|
171 |
+
= 3.1.4 (2016-11-25) =
|
172 |
+
* Added : Schema.org type "LocalBusiness" item added. "Image", "priceRange" and "servesCuisine".
|
173 |
+
* Added : Print plugin version in comments.
|
174 |
+
|
175 |
+
= 3.1.3 (2016-11-22) =
|
176 |
+
* Updated : Event Type select item of Schema.org type "Event".
|
177 |
+
* Updated : Short Code display changed of Schema.org type "BreadcrumbList".
|
178 |
+
|
179 |
+
= 3.1.2 (2016-09-27) =
|
180 |
+
* Updated : homeLocation input item of Schema.org type "Person".
|
181 |
+
|
182 |
+
= 3.1.1 (2016-09-20) =
|
183 |
+
* Added : Schema.org type "SiteNavigation".
|
184 |
+
* Checked : WordPress version 4.6.1 operation check.
|
185 |
+
* Updated : Application URL input item of Schema.org type "WebSite".
|
186 |
+
* Fixed : LocalBusiness Convert data(In the case of version 2.3.x) Logic remove.
|
187 |
+
|
188 |
+
= 3.0.5 (2016-09-06) =
|
189 |
+
* Fixed : CSS & JavaScript version control.
|
190 |
+
* Fixed : Registration screen display adjustment.
|
191 |
+
|
192 |
+
= 3.0.4 (2016-08-17) =
|
193 |
+
* Fixed : Type Person and Organization Non-display case "sameAs" is empty.
|
194 |
+
* Checked : WordPress version 4.6.0 operation check.
|
195 |
+
|
196 |
+
= 3.0.3 (2016-07-27) =
|
197 |
+
* Fixed : If you select a static page in a display of the front page, the home page is not output at the output page. (Added is_front_page function)
|
198 |
+
|
199 |
+
= 3.0.2 (2016-07-15) =
|
200 |
+
* Updated : Security measures of the update process.
|
201 |
+
|
202 |
+
= 3.0.1 (2016-06-25) =
|
203 |
+
|
204 |
+
* Checked : WordPress version 4.5.3 operation check.
|
205 |
+
|
206 |
+
= 3.0.0 (2016-06-20) =
|
207 |
+
|
208 |
+
* Added : Schema.org type "Video".
|
209 |
+
* Added : Display the cause of the JSON-LD is not output in HTML comments.
|
210 |
+
* Fixed : "Schema.org Event" solve the output of JSON-LD is a problem with the double in the custom posts.
|
211 |
+
* Fixed : Changes to the search of the array to remove the SQL statement to get the output page.
|
212 |
+
* Fixed : "Schema.org Organization" If you have not set up a Social Profiles, it does not show an empty array.
|
213 |
+
* Updated : Japanese translation.
|
214 |
+
|
215 |
+
= 2.5.1 (2016-05-09) =
|
216 |
+
|
217 |
+
* Checked : WordPress version 4.5.2 operation check.
|
218 |
+
* Checked : WordPress version 4.5.1 operation check.
|
219 |
+
|
220 |
+
= 2.5.0 (2016-04-19) =
|
221 |
+
|
222 |
+
* Updated : You can select a custom posts at the output page.
|
223 |
+
* Updated : Add the output on "Pages" in the "Article","BlogPosting" and "NewsArticle" Schema.org type.
|
224 |
+
* Updated : It added the Holiday Opening Hour of items to Schema.org Type "LocalBusiness".
|
225 |
+
* Updated : It added the GeoCircle of items to Schema.org Type "LocalBusiness".
|
226 |
+
* Updated : Japanese translation.
|
227 |
+
* Checked : WordPress version 4.5.0 operation check.
|
228 |
+
|
229 |
+
= 2.4.2 (2016-03-09) =
|
230 |
+
|
231 |
+
* Fixed : Updated image size detection to use curl first, as attachment_url_to_postid() hits the database
|
232 |
+
* Updated : Added a transient cache class to cache taxing operations
|
233 |
+
* Updated : Turkish translation.
|
234 |
+
|
235 |
+
= 2.4.1 (2016-03-01) =
|
236 |
+
|
237 |
+
* Updated : Japanese translation.
|
238 |
+
|
239 |
+
= 2.4.0 (2016-02-06) =
|
240 |
+
|
241 |
+
* Added : Schema.org type "Person".
|
242 |
+
* Updated : Schema.org type "LocalBusiness" OpenHours : shift time setting.
|
243 |
+
* Checked : WordPress version 4.4.2 operation check.
|
244 |
+
|
245 |
+
= 2.3.3 (2016-01-19) =
|
246 |
+
|
247 |
+
* Fixed : Improved wording on admin pages.
|
248 |
+
* Fixed : Added alternate methods to get image dimensions for systems running legacy SSL.
|
249 |
+
|
250 |
+
= 2.3.2 (2016-01-10) =
|
251 |
+
|
252 |
+
* Fixed : Fixed a bug that Organization type of display error of contactType comes out.
|
253 |
+
* Fixed : Fixed a bug that can not save LocalBusiness type of latitude and longitude.
|
254 |
+
|
255 |
+
= 2.3.1 (2016-01-07) =
|
256 |
+
|
257 |
+
* Checked : WordPress version 4.4.1 operation check.
|
258 |
+
* Added : Breadcrumb ShortCode option add.
|
259 |
+
|
260 |
+
= 2.3.0 (2016-01-03) =
|
261 |
+
|
262 |
+
* Added : Schema.org type "LocalBusiness".
|
263 |
+
* Fixed : Organization Definition minor bug fixed.
|
264 |
+
|
265 |
+
= 2.2.1 (2015-12-21) =
|
266 |
+
|
267 |
+
* Fixed : Breadcrumb ShortCode minor bug fixed.
|
268 |
+
|
269 |
+
= 2.2.0 (2015-12-16) =
|
270 |
+
|
271 |
+
* Updated : Updated on December 14, 2015 was structured data (Article) AMP correspondence. https://developers.google.com/structured-data/rich-snippets/articles?hl=ja
|
272 |
+
|
273 |
+
= 2.1.3 (2015-12-11) =
|
274 |
+
|
275 |
+
* Fixed : Minor bug fixed.
|
276 |
+
|
277 |
+
= 2.1.2 (2015-12-09) =
|
278 |
+
|
279 |
+
* Check : WordPress version 4.4 operation check.
|
280 |
+
|
281 |
+
= 2.1.1 (2015-12-04) =
|
282 |
+
|
283 |
+
* Added : Add the table update processing at the time of version up.
|
284 |
+
|
285 |
+
= 2.1.0 (2015-12-03) =
|
286 |
+
|
287 |
+
* Added : Schema.org type "Event" schema.org definition Add "Event" custom post output that works.
|
288 |
+
|
289 |
+
= 2.0.2 (2015-11-27) =
|
290 |
+
|
291 |
+
* Fixed : Breadcrumb ShortCode minor bug fixed.
|
292 |
+
|
293 |
+
= 2.0.1 (2015-11-25) =
|
294 |
+
|
295 |
+
* Fixed : Notice error fixed.
|
296 |
+
|
297 |
+
= 2.0.0 (2015-11-23) =
|
298 |
+
|
299 |
+
* Added : Schema.org type "BreadcrumbList" schema.org definition Add breadcrumbs short code output that works.
|
300 |
+
* Updated : Schema.org definition immobilization.
|
301 |
+
|
302 |
+
= 1.3.2 (2015-11-17) =
|
303 |
+
|
304 |
+
* Fixed : Fixed translation.
|
305 |
+
* Added : Additional output comment.
|
306 |
+
|
307 |
+
= 1.3.1 =
|
308 |
+
|
309 |
+
* Fixed : none-function fixed.
|
310 |
+
|
311 |
+
= 1.3.0 =
|
312 |
+
|
313 |
+
* Added : Localizing into Japanese.
|
314 |
+
|
315 |
+
= 1.2.1 =
|
316 |
+
|
317 |
+
* Updated : Read admin menu css -> wp_register_style setting
|
318 |
+
* Fixed : Typo Missing.
|
319 |
+
|
320 |
+
= 1.2.0 =
|
321 |
+
|
322 |
+
* Added : Schema.org type "BlogPosting".
|
323 |
+
|
324 |
+
= 1.1.3 =
|
325 |
+
|
326 |
+
* Fixed : To escape a newline code and the tag of the body attribute in Type "Article" and "NewsArticle".
|
327 |
+
|
328 |
+
= 1.1.2 =
|
329 |
+
|
330 |
+
* Updated : Schema.org type "Article" image attribute.
|
331 |
+
|
332 |
+
= 1.1.0 =
|
333 |
+
|
334 |
+
* Added : Schema.org type "Article".
|
335 |
+
|
336 |
+
= 1.0.1 - 1.0.8 =
|
337 |
+
|
338 |
+
* Fixed : Missing plugin path setting.
|
339 |
+
|
340 |
+
= 1.0.0 =
|
341 |
+
|
342 |
+
* First release of this plugin.
|
343 |
+
|
344 |
+
== Contact ==
|
345 |
+
|
346 |
+
* email to foundationmeister[at]outlook.com
|
347 |
+
* twitter @miiitaka
|
trunk/uninstall.php
ADDED
@@ -0,0 +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 |
+
}
|
trunk/wp-structuring-markup.php
ADDED
@@ -0,0 +1,308 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
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.5.1
|
7 |
+
Author: Kazuya Takami
|
8 |
+
Author URI: https://www.terakoya.work/
|
9 |
+
License: GPLv2 or later
|
10 |
+
Text Domain: wp-structuring-markup
|
11 |
+
Domain Path: /languages
|
12 |
+
*/
|
13 |
+
require_once( plugin_dir_path( __FILE__ ) . 'includes/admin/wp-structuring-admin-db.php' );
|
14 |
+
|
15 |
+
new Structuring_Markup();
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Schema.org Basic Class
|
19 |
+
*
|
20 |
+
* @author Kazuya Takami
|
21 |
+
* @version 4.5.1
|
22 |
+
* @since 1.0.0
|
23 |
+
*/
|
24 |
+
class Structuring_Markup {
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Variable definition version.
|
28 |
+
*
|
29 |
+
* @version 4.5.1
|
30 |
+
* @since 1.3.0
|
31 |
+
*/
|
32 |
+
private $version = '4.5.1';
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Variable definition Text Domain.
|
36 |
+
*
|
37 |
+
* @version 3.2.5
|
38 |
+
* @since 1.3.0
|
39 |
+
*/
|
40 |
+
private $text_domain = 'wp-structuring-markup';
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Constructor Define.
|
44 |
+
*
|
45 |
+
* @version 4.1.1
|
46 |
+
* @since 1.0.0
|
47 |
+
*/
|
48 |
+
public function __construct() {
|
49 |
+
register_activation_hook( __FILE__, array( $this, 'create_table' ) );
|
50 |
+
|
51 |
+
add_shortcode( $this->text_domain . '-breadcrumb', array( $this, 'short_code_init_breadcrumb' ) );
|
52 |
+
|
53 |
+
add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
|
54 |
+
add_action( 'init', array( $this, 'create_post_type' ) );
|
55 |
+
|
56 |
+
if ( is_admin() ) {
|
57 |
+
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
58 |
+
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
59 |
+
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) );
|
60 |
+
} else {
|
61 |
+
add_action( 'wp_head', array( $this, 'wp_head' ) );
|
62 |
+
add_filter( 'amp_post_template_metadata', array( $this, 'amp_post_template_metadata' ), 9 );
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Create table.
|
68 |
+
*
|
69 |
+
* @version 2.0.0
|
70 |
+
* @since 2.0.0
|
71 |
+
*/
|
72 |
+
public function create_table() {
|
73 |
+
$db = new Structuring_Markup_Admin_Db();
|
74 |
+
$db->create_table( $this->text_domain, $this->version );
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Breadcrumb ShortCode Register.
|
79 |
+
*
|
80 |
+
* @version 2.3.1
|
81 |
+
* @since 2.0.0
|
82 |
+
* @param string $args short code params
|
83 |
+
* @return string $html
|
84 |
+
*/
|
85 |
+
public function short_code_init_breadcrumb ( $args ) {
|
86 |
+
$db = new Structuring_Markup_Admin_Db();
|
87 |
+
$results = $db->get_type_options( 'breadcrumb' );
|
88 |
+
|
89 |
+
if ( isset( $results['option'] ) ) {
|
90 |
+
$options = $results['option'];
|
91 |
+
|
92 |
+
require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-short-code-breadcrumb.php');
|
93 |
+
$obj = new Structuring_Markup_ShortCode_Breadcrumb();
|
94 |
+
return $obj->short_code_display( $options, $args );
|
95 |
+
} else {
|
96 |
+
return __return_false();
|
97 |
+
}
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* i18n.
|
102 |
+
*
|
103 |
+
* @version 1.3.0
|
104 |
+
* @since 1.3.0
|
105 |
+
*/
|
106 |
+
public function plugins_loaded () {
|
107 |
+
load_plugin_textdomain( $this->text_domain, __return_false(), dirname( plugin_basename( __FILE__ ) ) . '/languages' );
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Create custom post type.
|
112 |
+
*
|
113 |
+
* @version 4.0.0
|
114 |
+
* @since 2.1.0
|
115 |
+
*/
|
116 |
+
function create_post_type () {
|
117 |
+
require_once( plugin_dir_path( __FILE__ ) . 'includes/custom/wp-structuring-custom-post-event.php' );
|
118 |
+
new Structuring_Markup_Custom_Post_Event( $this->text_domain );
|
119 |
+
require_once( plugin_dir_path( __FILE__ ) . 'includes/custom/wp-structuring-custom-post-video.php' );
|
120 |
+
new Structuring_Markup_Custom_Post_Video( $this->text_domain );
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* admin init.
|
125 |
+
*
|
126 |
+
* @version 4.1.1
|
127 |
+
* @since 1.3.1
|
128 |
+
*/
|
129 |
+
public function admin_init () {
|
130 |
+
/** version up check */
|
131 |
+
$options = get_option( $this->text_domain );
|
132 |
+
if ( !isset( $options['version'] ) || $options['version'] !== $this->version ) {
|
133 |
+
$this->create_table();
|
134 |
+
}
|
135 |
+
|
136 |
+
wp_register_style( 'wp-structuring-markup-admin-style', plugins_url( 'css/style.css', __FILE__ ), array(), $this->version );
|
137 |
+
wp_register_style( 'wp-structuring-markup-admin-post', plugins_url( 'css/schema-custom-post.css', __FILE__ ), array(), $this->version );
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Add Menu to the Admin Screen.
|
142 |
+
*
|
143 |
+
* @version 4.5.0
|
144 |
+
* @since 1.0.0
|
145 |
+
*/
|
146 |
+
public function admin_menu () {
|
147 |
+
add_menu_page(
|
148 |
+
esc_html__( 'Schema.org Settings', $this->text_domain ),
|
149 |
+
esc_html__( 'Schema.org Settings', $this->text_domain ),
|
150 |
+
'manage_options',
|
151 |
+
plugin_basename( __FILE__ ),
|
152 |
+
array( $this, 'list_page_render' )
|
153 |
+
);
|
154 |
+
$list_page = add_submenu_page(
|
155 |
+
__FILE__,
|
156 |
+
esc_html__( 'Schema.org List', $this->text_domain ),
|
157 |
+
esc_html__( 'Schema.org List', $this->text_domain ),
|
158 |
+
'manage_options',
|
159 |
+
plugin_basename( __FILE__ ),
|
160 |
+
array( $this, 'list_page_render' )
|
161 |
+
);
|
162 |
+
$post_page = add_submenu_page(
|
163 |
+
$this->text_domain . '-post',
|
164 |
+
esc_html__( 'Schema.org Setting Edit', $this->text_domain ),
|
165 |
+
esc_html__( 'Edit', $this->text_domain ),
|
166 |
+
'manage_options',
|
167 |
+
$this->text_domain . '-post',
|
168 |
+
array( $this, 'post_page_render' )
|
169 |
+
);
|
170 |
+
$config_page = add_submenu_page(
|
171 |
+
__FILE__,
|
172 |
+
esc_html__( 'Schema.org Config', $this->text_domain ),
|
173 |
+
esc_html__( 'Schema.org Config', $this->text_domain ),
|
174 |
+
'manage_options',
|
175 |
+
$this->text_domain . '-config',
|
176 |
+
array( $this, 'config_page_render' )
|
177 |
+
);
|
178 |
+
|
179 |
+
/** Using registered $page handle to hook stylesheet loading */
|
180 |
+
add_action( 'admin_print_styles-post.php', array( $this, 'add_style_post' ) );
|
181 |
+
add_action( 'admin_print_styles-' . $list_page, array( $this, 'add_style' ) );
|
182 |
+
add_action( 'admin_print_styles-' . $post_page, array( $this, 'add_style' ) );
|
183 |
+
add_action( 'admin_print_styles-' . $config_page, array( $this, 'add_style' ) );
|
184 |
+
add_action( 'admin_print_scripts-' . $post_page, array( $this, 'admin_scripts' ) );
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Add Menu to the Admin Screen.
|
189 |
+
*
|
190 |
+
* @version 4.1.1
|
191 |
+
* @since 4.1.1
|
192 |
+
* @param array $links
|
193 |
+
* @return array $links
|
194 |
+
*/
|
195 |
+
public function plugin_action_links( $links ) {
|
196 |
+
$url = admin_url( 'admin.php?page=' . $this->text_domain . '/' . $this->text_domain . '.php' );
|
197 |
+
$url = '<a href="' . esc_url( $url ) . '">' . __( 'Settings' ) . '</a>';
|
198 |
+
array_unshift( $links, $url );
|
199 |
+
return $links;
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* CSS admin add. (Custom Post)
|
204 |
+
*
|
205 |
+
* @version 4.1.1
|
206 |
+
* @since 4.1.1
|
207 |
+
*/
|
208 |
+
public function add_style_post () {
|
209 |
+
wp_enqueue_style( 'wp-structuring-markup-admin-post' );
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* CSS admin add.
|
214 |
+
*
|
215 |
+
* @version 1.3.1
|
216 |
+
* @since 1.3.1
|
217 |
+
*/
|
218 |
+
public function add_style () {
|
219 |
+
wp_enqueue_style( 'wp-structuring-markup-admin-style' );
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* admin_scripts
|
224 |
+
*
|
225 |
+
* @author Justin Frydman
|
226 |
+
* @author Kazuya Takami
|
227 |
+
* @version 3.2.2
|
228 |
+
* @since 2.4.0
|
229 |
+
*/
|
230 |
+
public function admin_scripts () {
|
231 |
+
if ( isset( $_GET["type"] ) && $_GET["type"] === 'local_business' ) {
|
232 |
+
wp_enqueue_script ( 'wp-structuring-markup-admin-main-js', plugins_url ( 'js/main.min.js', __FILE__ ), array( 'jquery' ), $this->version );
|
233 |
+
}
|
234 |
+
if ( isset( $_GET["type"] ) ) {
|
235 |
+
switch ( $_GET["type"] ) {
|
236 |
+
case "article":
|
237 |
+
case "blog_posting":
|
238 |
+
case "news_article":
|
239 |
+
case "organization":
|
240 |
+
wp_enqueue_script ( 'wp-structuring-markup-admin-media-js', plugins_url ( 'js/media-uploader-main.js', __FILE__ ), array( 'jquery' ), $this->version );
|
241 |
+
wp_enqueue_media();
|
242 |
+
break;
|
243 |
+
}
|
244 |
+
}
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* LIST Page Template Require.
|
249 |
+
*
|
250 |
+
* @version 4.0.0
|
251 |
+
* @since 1.0.0
|
252 |
+
*/
|
253 |
+
public function list_page_render () {
|
254 |
+
require_once( plugin_dir_path( __FILE__ ) . 'includes/admin/wp-structuring-admin-list.php' );
|
255 |
+
new Structuring_Markup_Admin_List( $this->text_domain );
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* POST Page Template Require.
|
260 |
+
*
|
261 |
+
* @version 4.0.0
|
262 |
+
* @since 1.0.0
|
263 |
+
*/
|
264 |
+
public function post_page_render () {
|
265 |
+
require_once( plugin_dir_path( __FILE__ ) . 'includes/admin/wp-structuring-admin-post.php' );
|
266 |
+
new Structuring_Markup_Admin_Post( $this->text_domain );
|
267 |
+
}
|
268 |
+
|
269 |
+
/**
|
270 |
+
* POST Page Template Require.
|
271 |
+
*
|
272 |
+
* @version 4.5.0
|
273 |
+
* @since 1.0.0
|
274 |
+
*/
|
275 |
+
public function config_page_render () {
|
276 |
+
require_once( plugin_dir_path( __FILE__ ) . 'includes/admin/wp-structuring-admin-config.php' );
|
277 |
+
new Structuring_Markup_Admin_Config( $this->text_domain );
|
278 |
+
}
|
279 |
+
|
280 |
+
/**
|
281 |
+
* Display Page Template Require.
|
282 |
+
*
|
283 |
+
* @version 4.5.0
|
284 |
+
* @since 1.3.0
|
285 |
+
*/
|
286 |
+
public function wp_head () {
|
287 |
+
require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-display.php' );
|
288 |
+
new Structuring_Markup_Display( $this->version, $this->text_domain );
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Display Page Template Require.
|
293 |
+
*
|
294 |
+
* @version 4.0.0
|
295 |
+
* @since 4.0.0
|
296 |
+
* @param array $metadata
|
297 |
+
* @return array $metadata
|
298 |
+
*/
|
299 |
+
public function amp_post_template_metadata ( array $metadata ) {
|
300 |
+
require_once( plugin_dir_path( __FILE__ ) . 'includes/wp-structuring-display-amp.php' );
|
301 |
+
$amp = new Structuring_Markup_Display_Amp();
|
302 |
+
|
303 |
+
if ( !empty( $amp->json_ld ) ) {
|
304 |
+
$metadata = $amp->json_ld;
|
305 |
+
}
|
306 |
+
return (array) $metadata;
|
307 |
+
}
|
308 |
+
}
|