Version Description
- Fixed typos when return false in a couple of functions.
- Fixed fatal errors caused due duplicate function names with other plugin in post meta.
- Fixed ImageObject output in the About and Contact pages.
- Fixed the About admin sub menu item url, it was not pointing correctly in some cases.
- Fixed duplicate schema output in some cases when Sitelinks Search Box is enabled.
- Removed the Auto Featured Image feature, it was causing several issues.
- Removed class-settings.php file, which was not used in the plugin.
- Reverted all changes made in version 1.6.9.8 back, since issue has been solved!
- Updated Chosen script and CSS to version 1.8.5 for post meta fields.
- Updated the plugin welcome page.
- Updated readme.txt file to include GPL license details.
Download this release
Release Info
Developer | hishaman |
Plugin | Schema |
Version | 1.6.9.8.2 |
Comparing to | |
See all releases |
Version 1.6.9.8.2
- README.md +85 -0
- assets/css/admin.css +331 -0
- assets/css/admin.min.css +1 -0
- assets/css/jquery-ui-classic.min.css +1 -0
- assets/css/jquery-ui-fresh.min.css +1 -0
- assets/css/schema-bootstrap.css +3049 -0
- assets/css/schema-bootstrap.min.css +1 -0
- assets/fonts/dashicons.eot +0 -0
- assets/fonts/dashicons.svg +11 -0
- assets/fonts/dashicons.ttf +0 -0
- assets/fonts/dashicons.woff +0 -0
- assets/images/admin-bar/google-developers-hover.png +0 -0
- assets/images/admin-bar/google-developers.png +0 -0
- assets/images/banner-772x250.png +0 -0
- assets/images/icon-128x128.png +0 -0
- assets/images/icon-256x256.png +0 -0
- assets/images/schema-badge.png +0 -0
- assets/images/screenshot-1.png +0 -0
- assets/images/screenshot-2.png +0 -0
- assets/images/screenshot-3.png +0 -0
- assets/images/screenshot-4.png +0 -0
- assets/images/serps.png +0 -0
- assets/js/admin.js +247 -0
- assets/js/admin.min.js +1 -0
- includes/admin/admin-bar-menu.php +74 -0
- includes/admin/admin-functions.php +250 -0
- includes/admin/admin-pages.php +34 -0
- includes/admin/class-feedback.php +291 -0
- includes/admin/class-menu.php +87 -0
- includes/admin/class-notices.php +60 -0
- includes/admin/class-welcome.php +477 -0
- includes/admin/extensions.php +185 -0
- includes/admin/meta-exclude.php +77 -0
- includes/admin/meta-tax.php +51 -0
- includes/admin/meta-tax/README.md +142 -0
- includes/admin/meta-tax/class-meta-tax.php +1819 -0
- includes/admin/meta-tax/class-usage-demo.php +89 -0
- includes/admin/meta-tax/css/tax-meta-class.css +63 -0
- includes/admin/meta-tax/images/add.png +0 -0
- includes/admin/meta-tax/images/delete-16.png +0 -0
- includes/admin/meta-tax/images/edit.png +0 -0
- includes/admin/meta-tax/images/remove.png +0 -0
- includes/admin/meta-tax/js/tax-meta-clss.js +493 -0
- includes/admin/meta-tax/lang/default.mo +0 -0
- includes/admin/meta-tax/lang/default.po +54 -0
- includes/admin/meta-tax/lang/fr_FR.mo +0 -0
- includes/admin/meta-tax/lang/fr_FR.po +54 -0
- includes/admin/meta-tax/license.txt +674 -0
- includes/admin/meta-tax/migration/tax_to_term_meta.php +142 -0
- includes/admin/meta.php +335 -0
- includes/admin/meta/class-meta.php +927 -0
- includes/admin/meta/css/chosen-sprite.png +0 -0
- includes/admin/meta/css/chosen-sprite@2x.png +0 -0
- includes/admin/meta/css/chosen.css +11 -0
- includes/admin/meta/css/jqueryui.css +137 -0
- includes/admin/meta/css/meta_box.css +565 -0
- includes/admin/meta/images/chosen-sprite.png +0 -0
- includes/admin/meta/images/image.png +0 -0
- includes/admin/meta/images/sprite.png +0 -0
- includes/admin/meta/js/chosen.js +3 -0
- includes/admin/meta/js/schema.js +56 -0
- includes/admin/meta/js/scripts.js +205 -0
- includes/admin/meta/sample.php +161 -0
- includes/admin/post-type/class-columns.php +356 -0
- includes/admin/post-type/schema-columns.php +91 -0
- includes/admin/post-type/schema-post-type.php +201 -0
- includes/admin/post-type/schema-wp-ajax.php +102 -0
- includes/admin/post-type/schema-wp-submit.php +119 -0
- includes/admin/ref.php +210 -0
- includes/admin/scripts.php +67 -0
- includes/admin/settings/contextual-help.php +69 -0
- includes/admin/settings/display-settings.php +147 -0
- includes/admin/settings/register-settings.php +1530 -0
- includes/admin/updater/class-license-handler.php +482 -0
- includes/admin/updater/class-updater.php +494 -0
- includes/class-capabilities.php +118 -0
- includes/deprecated-functions.php +13 -0
- includes/extensions/audio-object.php +419 -0
- includes/extensions/author.php +151 -0
- includes/extensions/breadcrumbs.php +419 -0
- includes/extensions/comment.php +102 -0
- includes/extensions/page-about.php +129 -0
- includes/extensions/page-contact.php +129 -0
- includes/extensions/post-meta-generator.php +206 -0
- includes/extensions/sameAs.php +145 -0
- includes/extensions/shared-count.php +193 -0
- includes/extensions/video-object.php +409 -0
- includes/install.php +175 -0
- includes/integrations/amp.php +29 -0
- includes/integrations/divi.php +31 -0
- includes/integrations/edd.php +40 -0
- includes/integrations/genesis.php +210 -0
- includes/integrations/seo-framework.php +37 -0
- includes/integrations/thesis.php +41 -0
- includes/integrations/thirstyaffiliates.php +30 -0
- includes/integrations/visual-composer.php +33 -0
- includes/integrations/woocommerce.php +27 -0
- includes/integrations/wp-rich-snippets.php +41 -0
- includes/integrations/yoast-seo.php +124 -0
- includes/json/author.php +82 -0
- includes/json/blog.php +121 -0
- includes/json/category.php +125 -0
- includes/json/knowledge-graph.php +172 -0
- includes/json/post-type-archive.php +133 -0
- includes/json/schema-output.php +269 -0
- includes/json/search-results.php +82 -0
- includes/json/tag.php +101 -0
- includes/json/taxonomy.php +77 -0
- includes/json/web-page-element.php +163 -0
- includes/misc-functions.php +865 -0
- includes/scripts.php +22 -0
- license.txt +661 -0
- readme.txt +731 -0
- schema.php +334 -0
- uninstall.php +98 -0
README.md
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# [Schema](http://schema.press) #
|
2 |
+
============
|
3 |
+
|
4 |
+
### Welcome to our GitHub Repository
|
5 |
+
|
6 |
+
Schema is a light-weight plugin for adding schema.org structured data markup in recommended JSON-LD format automatically to WordPress sites.
|
7 |
+
|
8 |
+
### Enhanced Presentation in Search Results
|
9 |
+
|
10 |
+
By including structured data appropriate to your content, your site can enhance its search results and presentation.
|
11 |
+
|
12 |
+
More information can be found at [scema.press](https://schema.press/).
|
13 |
+
|
14 |
+
### What is Schema markup?
|
15 |
+
|
16 |
+
Schema markup is code (semantic vocabulary) that you put on your website to help the search engines return more informative results for users. So, Schema is not just for SEO reasons, it’s also for the benefit of the searcher.
|
17 |
+
|
18 |
+
### Schema Key Features
|
19 |
+
|
20 |
+
* Easy to use, set it and forget it, with minimal settings.
|
21 |
+
* Enable Schema types at once per post type or post category.
|
22 |
+
* Valid markup, test it in Google Structured Data Testing Tool.
|
23 |
+
* Output JSON-LD format, the most recommended by Google.
|
24 |
+
* Reuse data saved in post meta, which is created by other plugins.
|
25 |
+
* Extensible, means you can extend its functionality via other plugins, extensions or within your Theme’s functions.php file.
|
26 |
+
|
27 |
+
### Plugin Extensions
|
28 |
+
|
29 |
+
* [Schema Review](https://wordpress.org/plugins/schema-review/): Extend Schema functionality by adding review and rating Structured Data functionality for Editors and Authors.
|
30 |
+
* [Schema Default Image](https://wordpress.org/plugins/schema-default-image/): Add ability to set a default WordPress Featured image for schema.org markup.
|
31 |
+
|
32 |
+
### Supported Google/Schema Markups
|
33 |
+
|
34 |
+
* [Knowledge Graph](https://developers.google.com/structured-data/customize/overview)
|
35 |
+
* [Logos](https://developers.google.com/structured-data/customize/logos)
|
36 |
+
* [Company Contact Numbers](https://developers.google.com/structured-data/customize/contact-points)
|
37 |
+
* [Social Profile Links](https://developers.google.com/structured-data/customize/social-profiles)
|
38 |
+
|
39 |
+
* Style Your Search Results:
|
40 |
+
* [Enable Sitelinks Search Box](https://developers.google.com/structured-data/customize/logos)
|
41 |
+
* [Show Your Site Name in Search](https://developers.google.com/structured-data/site-name)
|
42 |
+
|
43 |
+
### Supported Schema Types
|
44 |
+
|
45 |
+
* Creative Work
|
46 |
+
* [Article](https://schema.org/Article) enabled on Pages
|
47 |
+
* [BlogPosting](https://schema.org/BlogPosting) enabled on Posts
|
48 |
+
* [NewsArticle](https://schema.org/NewsArticle)
|
49 |
+
* [Report](https://schema.org/Report)
|
50 |
+
* [ScholarlyArticle](https://schema.org/ScholarlyArticle)
|
51 |
+
* [TechArticle](https://schema.org/TechArticle)
|
52 |
+
|
53 |
+
* [Blog](https://schema.org/Blog) to markup Blog posts list page.
|
54 |
+
* [WPHeader](https://schema.org/WPHeader) to markup Web Page Header.
|
55 |
+
* [WPFooter](https://schema.org/WPFooter) to markup Web Page Footer.
|
56 |
+
* [BreadcrumbList](https://schema.org/BreadcrumbList) to markup Breadcrumbs.
|
57 |
+
* [CollectionPage](https://schema.org/CollectionPage) to markup Categories Archives.
|
58 |
+
* [CollectionPage](https://schema.org/CollectionPage) to markup Tags Archives.
|
59 |
+
* [AboutPage](https://schema.org/AboutPage) to markup the About page.
|
60 |
+
* [ContactPage](https://schema.org/ContactPage) to markup the Contact page.
|
61 |
+
* [Person](https://schema.org/Person) enabled on Author pages
|
62 |
+
* [VideoObject](https://schema.org/VideoObject) enable automatically on all videos embedded with oEmbed. Supports VideoPress, YouTube, TED, Vimeo, Dailymotion, and Vine.
|
63 |
+
* [AudioObject](https://schema.org/AudioObject) enable automatically on all audio embedded with oEmbed. Supports SoundCloud, and Mixcloud.
|
64 |
+
|
65 |
+
|
66 |
+
### Supported Plugins
|
67 |
+
|
68 |
+
Schema plugin integrates, and play nicely with:
|
69 |
+
|
70 |
+
* Yoast SEO
|
71 |
+
* AMP plugin
|
72 |
+
* WPRichSnippets
|
73 |
+
* The SEO Framework
|
74 |
+
* Visual Composer
|
75 |
+
* ThirstyAffiliates
|
76 |
+
* WooCommerce
|
77 |
+
* Easy Digital Downloads (EDD)
|
78 |
+
|
79 |
+
### Supported Themes
|
80 |
+
|
81 |
+
* Genesis 2.x
|
82 |
+
* Thesis 2.x
|
83 |
+
* Divi
|
84 |
+
|
85 |
+
More information and documentation can be found at [scema.press](https://schema.press/).
|
assets/css/admin.css
ADDED
@@ -0,0 +1,331 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* General */
|
2 |
+
@font-face {
|
3 |
+
font-family: "schema-wp-dashicons";
|
4 |
+
src:url("../fonts/dashicons.eot");
|
5 |
+
src:url("../fonts/dashicons.eot?#iefix") format("embedded-opentype"),
|
6 |
+
url("../fonts/dashicons.woff") format("woff"),
|
7 |
+
url("../fonts/dashicons.ttf") format("truetype"),
|
8 |
+
url("../fonts/dashicons.svg#dashicons") format("svg");
|
9 |
+
}
|
10 |
+
|
11 |
+
#adminmenu #toplevel_page_schema div.wp-menu-image:before {
|
12 |
+
font-family: 'schema-wp-dashicons' !important;
|
13 |
+
content: "\e900";
|
14 |
+
}
|
15 |
+
|
16 |
+
.schema-wp-ajax-search-wrap {
|
17 |
+
position: relative;
|
18 |
+
}
|
19 |
+
|
20 |
+
.schema-wp-ajax {
|
21 |
+
position: absolute;
|
22 |
+
right: 8px;
|
23 |
+
top: 1px;
|
24 |
+
}
|
25 |
+
|
26 |
+
/* Welcome */
|
27 |
+
.feature-section ul {
|
28 |
+
list-style: initial;
|
29 |
+
list-style-type: disc;
|
30 |
+
list-style-position: inside;
|
31 |
+
}
|
32 |
+
.return-to-dashboard i {
|
33 |
+
margin-right: 2px;
|
34 |
+
font-size: 16px;
|
35 |
+
margin-top: 1px;
|
36 |
+
}
|
37 |
+
.changelog .sub-section {
|
38 |
+
width:50%;
|
39 |
+
display:block;
|
40 |
+
float:left;
|
41 |
+
}
|
42 |
+
@media (max-width: 800px) {
|
43 |
+
.changelog .sub-section {
|
44 |
+
width: auto;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
/* Creatives */
|
49 |
+
|
50 |
+
#preview_image {
|
51 |
+
margin: 15px 0;
|
52 |
+
width: 300px;
|
53 |
+
}
|
54 |
+
|
55 |
+
#preview_image img {
|
56 |
+
height: auto;
|
57 |
+
display: block;
|
58 |
+
max-width: 100%;
|
59 |
+
}
|
60 |
+
|
61 |
+
.schema-wp-hidden {
|
62 |
+
display: none;
|
63 |
+
}
|
64 |
+
.schema-wp-clearfix:after {
|
65 |
+
content: ".";
|
66 |
+
display: block;
|
67 |
+
height: 0;
|
68 |
+
text-indent: -9999px;
|
69 |
+
visibility: hidden;
|
70 |
+
}
|
71 |
+
.schema-wp-wrap a {
|
72 |
+
text-decoration: none;
|
73 |
+
}
|
74 |
+
a.schema-wp-delete {
|
75 |
+
color: #a00;
|
76 |
+
}
|
77 |
+
a.schema-wp-delete:hover {
|
78 |
+
color: #f00;
|
79 |
+
}
|
80 |
+
|
81 |
+
|
82 |
+
/* Fields */
|
83 |
+
::-webkit-input-placeholder { /* Chrome/Opera/Safari */
|
84 |
+
color: #ccc;
|
85 |
+
}
|
86 |
+
::-moz-placeholder { /* Firefox 19+ */
|
87 |
+
color: #ccc;
|
88 |
+
}
|
89 |
+
:-ms-input-placeholder { /* IE 10+ */
|
90 |
+
color: #ccc;
|
91 |
+
}
|
92 |
+
:-moz-placeholder { /* Firefox 18- */
|
93 |
+
color: #ccc;
|
94 |
+
}
|
95 |
+
|
96 |
+
/* rating scale table */
|
97 |
+
table.schema-review-rating-scale {
|
98 |
+
background: none;
|
99 |
+
background-color:inherit;
|
100 |
+
max-width: 680px;
|
101 |
+
}
|
102 |
+
|
103 |
+
.schema-review-rating-scale tr th {
|
104 |
+
padding: 6px 10px 6px 10px
|
105 |
+
}
|
106 |
+
|
107 |
+
.schema-review-rating-scale td {
|
108 |
+
padding: 6px 5px 6px 10px;
|
109 |
+
}
|
110 |
+
|
111 |
+
/* General Settings Styles
|
112 |
+
-------------------------------------------------------------- */
|
113 |
+
|
114 |
+
.download_page_edd-settings .form-table label {
|
115 |
+
color: #666;
|
116 |
+
font-size: 14px;
|
117 |
+
font-style: italic;
|
118 |
+
margin: 4px 0 0;
|
119 |
+
}
|
120 |
+
|
121 |
+
.download_page_edd-settings .form-table input.small-text ~ label,
|
122 |
+
.download_page_edd-settings .form-table input[type="checkbox"] + label { display: inline; }
|
123 |
+
.download_page_edd-settings .form-table tr > th > strong,
|
124 |
+
.download_page_edd-settings .form-table tr > th > h3 {
|
125 |
+
font-size: 1.2em;
|
126 |
+
font-weight: 600;
|
127 |
+
margin: 0 auto;
|
128 |
+
}
|
129 |
+
|
130 |
+
/* Tooltips */
|
131 |
+
.schema-wp-help-tip {
|
132 |
+
cursor: help;
|
133 |
+
}
|
134 |
+
|
135 |
+
.schema-wp-ui-tooltip {
|
136 |
+
background: #333 !important;
|
137 |
+
border-radius: 3px !important;
|
138 |
+
box-shadow: 1px 1px 2px 1px rgba(214,214,214,0.5);
|
139 |
+
color: #dedede !important;
|
140 |
+
max-width: 300px;
|
141 |
+
padding: 7px;
|
142 |
+
text-rendering: optimizeLegibility;
|
143 |
+
}
|
144 |
+
|
145 |
+
/* Add Ons Styles
|
146 |
+
-------------------------------------------------------------- */
|
147 |
+
|
148 |
+
#schema-wp-add-ons h2.nav-tab-wrapper {
|
149 |
+
position: relative;
|
150 |
+
}
|
151 |
+
|
152 |
+
.schema-wp-tab-span {
|
153 |
+
top: -6px;
|
154 |
+
right: 0;
|
155 |
+
position: absolute;
|
156 |
+
}
|
157 |
+
.schema-wp-add-ons-footer {
|
158 |
+
padding-top: 10px;
|
159 |
+
}
|
160 |
+
#schema-wp-add-ons h2 {
|
161 |
+
margin: 0 0 15px;
|
162 |
+
}
|
163 |
+
#schema-wp-add-ons h2 .button-primary {
|
164 |
+
position: absolute;
|
165 |
+
}
|
166 |
+
#schema-wp-add-ons .schema-wp-extension {
|
167 |
+
background: #fff;
|
168 |
+
border: 1px solid #ccc;
|
169 |
+
float: left;
|
170 |
+
padding: 14px;
|
171 |
+
position: relative;
|
172 |
+
margin: 0 15px 15px 0;
|
173 |
+
width: 320px;
|
174 |
+
height: 315px;
|
175 |
+
}
|
176 |
+
#schema-wp-add-ons .schema-wp-extension h3 {
|
177 |
+
font-size: 13px;
|
178 |
+
margin: 0 0 8px;
|
179 |
+
}
|
180 |
+
#schema-wp-add-ons .schema-wp-extension .button-secondary {
|
181 |
+
position: absolute;
|
182 |
+
bottom: 14px;
|
183 |
+
left: 14px;
|
184 |
+
}
|
185 |
+
#schema-wp-add-ons .schema-wp-browse-all {
|
186 |
+
clear:both;
|
187 |
+
width:100%;
|
188 |
+
}
|
189 |
+
#schema-wp-add-ons .schema-wp-extension .third-party {
|
190 |
+
display: none;
|
191 |
+
}
|
192 |
+
#schema-wp-add-ons .schema-wp-starter-package {
|
193 |
+
background-color: #85c0e5;
|
194 |
+
border-color: #62a9d7;
|
195 |
+
color: #fff;
|
196 |
+
}
|
197 |
+
#schema-wp-add-ons .schema-wp-starter-package h3 {
|
198 |
+
color: #fff;
|
199 |
+
}
|
200 |
+
#schema-wp-add-ons .schema-wp-extension .wp-post-image {
|
201 |
+
width: 100%;
|
202 |
+
height: auto;
|
203 |
+
}
|
204 |
+
|
205 |
+
/* licenses */
|
206 |
+
|
207 |
+
.wrap-licenses .form-table,
|
208 |
+
.wrap-licenses thead,
|
209 |
+
.wrap-licenses tbody,
|
210 |
+
.wrap-licenses tfoot,
|
211 |
+
.wrap-licenses tr,
|
212 |
+
.wrap-licenses td,
|
213 |
+
.wrap-licenses th,
|
214 |
+
.wrap-licenses caption {
|
215 |
+
display: block;
|
216 |
+
}
|
217 |
+
.wrap-licenses .form-table tr {
|
218 |
+
float: left;
|
219 |
+
margin: 0 15px 15px 0;
|
220 |
+
background: #fff;
|
221 |
+
border: 1px solid #ccc;
|
222 |
+
width: 30.5%;
|
223 |
+
max-width: 350px;
|
224 |
+
padding: 14px;
|
225 |
+
min-height: 220px;
|
226 |
+
position: relative;
|
227 |
+
box-sizing: border-box;
|
228 |
+
}
|
229 |
+
.wrap-licenses .form-table th {
|
230 |
+
background: #f9f9f9;
|
231 |
+
padding: 14px;
|
232 |
+
border-bottom: 1px solid #ccc;
|
233 |
+
margin: -14px -14px 20px;
|
234 |
+
width: 100%;
|
235 |
+
}
|
236 |
+
.wrap-licenses .form-table td {
|
237 |
+
padding: 0;
|
238 |
+
}
|
239 |
+
.wrap-licenses td input.regular-text {
|
240 |
+
margin: 0 0 8px;
|
241 |
+
width: 100%;
|
242 |
+
}
|
243 |
+
.wrap-licenses .schema-wp-license-data[class*="schema-wp-license-"] {
|
244 |
+
position: absolute;
|
245 |
+
background: #fafafa;
|
246 |
+
padding: 14px;
|
247 |
+
border-top: 1px solid #eee;
|
248 |
+
margin: 20px -14px -14px;
|
249 |
+
min-height: 67px;
|
250 |
+
width: 100%;
|
251 |
+
bottom: 14px;
|
252 |
+
box-sizing: border-box;
|
253 |
+
}
|
254 |
+
.wrap-licenses .schema-wp-license-data[class*="schema-wp-license-"] a {
|
255 |
+
color: #444;
|
256 |
+
}
|
257 |
+
.wrap-licenses .schema-wp-license-data[class*="schema-wp-license-"] a:hover {
|
258 |
+
text-decoration: none;
|
259 |
+
}
|
260 |
+
.wrap-licenses .schema-wp-license-data.license-expires-soon-notice {
|
261 |
+
background-color: #00a0d2;
|
262 |
+
color: #fff;
|
263 |
+
border-color: #00a0d2;
|
264 |
+
}
|
265 |
+
.wrap-licenses .schema-wp-license-data.schema-wp-license-expired {
|
266 |
+
background-color: #e24e4e;
|
267 |
+
color: #fff;
|
268 |
+
border-color: #e24e4e;
|
269 |
+
}
|
270 |
+
.wrap-licenses .schema-wp-license-data.schema-wp-license-error,
|
271 |
+
.wrap-licenses .schema-wp-license-data.schema-wp-license-missing,
|
272 |
+
.wrap-licenses .schema-wp-license-data.schema-wp-license-invalid,
|
273 |
+
.wrap-licenses .schema-wp-license-data.schema-wp-license-site_inactive,
|
274 |
+
.wrap-licenses .schema-wp-license-data.schema-wp-license-item_name_mismatch {
|
275 |
+
background-color: #ffebcd;
|
276 |
+
border-color: #ffebcd;
|
277 |
+
}
|
278 |
+
.wrap-licenses .schema-wp-license-data p {
|
279 |
+
font-size: 13px;
|
280 |
+
margin-top: 0;
|
281 |
+
}
|
282 |
+
.wrap-licenses .schema-wp-license-data.license-expires-soon-notice a,
|
283 |
+
.wrap-licenses .schema-wp-license-data.schema-wp-license-expired a {
|
284 |
+
color: #fff;
|
285 |
+
}
|
286 |
+
.wrap-licenses .schema-wp-license-data.license-expires-soon-notice a:hover,
|
287 |
+
.wrap-licenses .schema-wp-license-data.schema-wp-license-expired a:hover {
|
288 |
+
text-decoration: none;
|
289 |
+
}
|
290 |
+
.wrap-licenses p.submit {
|
291 |
+
clear: both;
|
292 |
+
}
|
293 |
+
|
294 |
+
/* Extensions */
|
295 |
+
|
296 |
+
#schema-wp-extensions h2 {
|
297 |
+
margin: 0 0 15px;
|
298 |
+
}
|
299 |
+
|
300 |
+
#schema-wp-extensions .schema-wp-extension {
|
301 |
+
display: inline-block;
|
302 |
+
vertical-align: top;
|
303 |
+
margin: 0 11px 14px 0;
|
304 |
+
background: #fff;
|
305 |
+
border: 1px solid #ccc;
|
306 |
+
width: 320px;
|
307 |
+
padding: 14px;
|
308 |
+
min-height: 290px;
|
309 |
+
position: relative;
|
310 |
+
}
|
311 |
+
|
312 |
+
#schema-wp-extensions .schema-wp-extension h3 {
|
313 |
+
margin: 0 0 8px;
|
314 |
+
font-size: 13px;
|
315 |
+
}
|
316 |
+
|
317 |
+
#schema-wp-extensions .schema-wp-extension .button-secondary {
|
318 |
+
position: absolute;
|
319 |
+
bottom: 14px;
|
320 |
+
left: 14px;
|
321 |
+
}
|
322 |
+
|
323 |
+
#schema-wp-extensions .schema-wp-extension .wp-post-image {
|
324 |
+
width: 100%;
|
325 |
+
height: auto;
|
326 |
+
display: block;
|
327 |
+
}
|
328 |
+
|
329 |
+
.schema-wp-extensions-footer {
|
330 |
+
padding-top: 10px;
|
331 |
+
}
|
assets/css/admin.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.schema-wp-wrap a,.wrap-licenses .schema-wp-license-data.license-expires-soon-notice a:hover,.wrap-licenses .schema-wp-license-data.schema-wp-license-expired a:hover,.wrap-licenses .schema-wp-license-data[class*=schema-wp-license-] a:hover{text-decoration:none}@font-face{font-family:schema-wp-dashicons;src:url(../fonts/dashicons.eot);src:url(../fonts/dashicons.eot?#iefix) format("embedded-opentype"),url(../fonts/dashicons.woff) format("woff"),url(../fonts/dashicons.ttf) format("truetype"),url(../fonts/dashicons.svg#dashicons) format("svg")}#adminmenu #toplevel_page_schema div.wp-menu-image:before{font-family:schema-wp-dashicons!important;content:"\e900"}.schema-wp-ajax-search-wrap{position:relative}.schema-wp-ajax{position:absolute;right:8px;top:1px}.feature-section ul{list-style:disc inside}.return-to-dashboard i{margin-right:2px;font-size:16px;margin-top:1px}.changelog .sub-section{width:50%;display:block;float:left}@media (max-width:800px){.changelog .sub-section{width:auto}}#preview_image{margin:15px 0;width:300px}#preview_image img{height:auto;display:block;max-width:100%}.schema-wp-hidden{display:none}.schema-wp-clearfix:after{content:".";display:block;height:0;text-indent:-9999px;visibility:hidden}a.schema-wp-delete{color:#a00}a.schema-wp-delete:hover{color:red}::-webkit-input-placeholder{color:#ccc}::-moz-placeholder{color:#ccc}:-ms-input-placeholder{color:#ccc}:-moz-placeholder{color:#ccc}table.schema-review-rating-scale{background:0 0;background-color:inherit;max-width:680px}.schema-review-rating-scale tr th{padding:6px 10px}.schema-review-rating-scale td{padding:6px 5px 6px 10px}.download_page_edd-settings .form-table label{color:#666;font-size:14px;font-style:italic;margin:4px 0 0}.download_page_edd-settings .form-table input.small-text~label,.download_page_edd-settings .form-table input[type=checkbox]+label{display:inline}.download_page_edd-settings .form-table tr>th>h3,.download_page_edd-settings .form-table tr>th>strong{font-size:1.2em;font-weight:600;margin:0 auto}.schema-wp-help-tip{cursor:help}.schema-wp-ui-tooltip{background:#333!important;border-radius:3px!important;box-shadow:1px 1px 2px 1px rgba(214,214,214,.5);color:#dedede!important;max-width:300px;padding:7px;text-rendering:optimizeLegibility}#schema-wp-add-ons h2.nav-tab-wrapper{position:relative}.schema-wp-tab-span{top:-6px;right:0;position:absolute}.schema-wp-add-ons-footer{padding-top:10px}#schema-wp-add-ons h2{margin:0 0 15px}#schema-wp-add-ons h2 .button-primary{position:absolute}#schema-wp-add-ons .schema-wp-extension{background:#fff;border:1px solid #ccc;float:left;padding:14px;position:relative;margin:0 15px 15px 0;width:320px;height:315px}#schema-wp-add-ons .schema-wp-extension h3{font-size:13px;margin:0 0 8px}#schema-wp-add-ons .schema-wp-extension .button-secondary{position:absolute;bottom:14px;left:14px}#schema-wp-add-ons .schema-wp-browse-all{clear:both;width:100%}#schema-wp-add-ons .schema-wp-extension .third-party{display:none}#schema-wp-add-ons .schema-wp-starter-package{background-color:#85c0e5;border-color:#62a9d7;color:#fff}#schema-wp-add-ons .schema-wp-starter-package h3{color:#fff}#schema-wp-add-ons .schema-wp-extension .wp-post-image{width:100%;height:auto}.wrap-licenses .form-table,.wrap-licenses caption,.wrap-licenses tbody,.wrap-licenses td,.wrap-licenses tfoot,.wrap-licenses th,.wrap-licenses thead,.wrap-licenses tr{display:block}.wrap-licenses .form-table tr{float:left;margin:0 15px 15px 0;background:#fff;border:1px solid #ccc;width:30.5%;max-width:350px;padding:14px;min-height:220px;position:relative;box-sizing:border-box}.wrap-licenses .form-table th{background:#f9f9f9;padding:14px;border-bottom:1px solid #ccc;margin:-14px -14px 20px;width:100%}.wrap-licenses .form-table td{padding:0}.wrap-licenses td input.regular-text{margin:0 0 8px;width:100%}.wrap-licenses .schema-wp-license-data[class*=schema-wp-license-]{position:absolute;background:#fafafa;padding:14px;border-top:1px solid #eee;margin:20px -14px -14px;min-height:67px;width:100%;bottom:14px;box-sizing:border-box}.wrap-licenses .schema-wp-license-data[class*=schema-wp-license-] a{color:#444}.wrap-licenses .schema-wp-license-data.license-expires-soon-notice{background-color:#00a0d2;color:#fff;border-color:#00a0d2}.wrap-licenses .schema-wp-license-data.schema-wp-license-expired{background-color:#e24e4e;color:#fff;border-color:#e24e4e}.wrap-licenses .schema-wp-license-data.schema-wp-license-error,.wrap-licenses .schema-wp-license-data.schema-wp-license-invalid,.wrap-licenses .schema-wp-license-data.schema-wp-license-item_name_mismatch,.wrap-licenses .schema-wp-license-data.schema-wp-license-missing,.wrap-licenses .schema-wp-license-data.schema-wp-license-site_inactive{background-color:#ffebcd;border-color:#ffebcd}.wrap-licenses .schema-wp-license-data p{font-size:13px;margin-top:0}.wrap-licenses .schema-wp-license-data.license-expires-soon-notice a,.wrap-licenses .schema-wp-license-data.schema-wp-license-expired a{color:#fff}.wrap-licenses p.submit{clear:both}#schema-wp-extensions h2{margin:0 0 15px}#schema-wp-extensions .schema-wp-extension{display:inline-block;vertical-align:top;margin:0 11px 14px 0;background:#fff;border:1px solid #ccc;width:320px;padding:14px;min-height:290px;position:relative}#schema-wp-extensions .schema-wp-extension h3{margin:0 0 8px;font-size:13px}#schema-wp-extensions .schema-wp-extension .button-secondary{position:absolute;bottom:14px;left:14px}#schema-wp-extensions .schema-wp-extension .wp-post-image{width:100%;height:auto;display:block}.schema-wp-extensions-footer{padding-top:10px}
|
assets/css/jquery-ui-classic.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{position:absolute!important;clip:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px)}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}.ui-helper-clearfix{display:inline-block}/*\*/* html .ui-helper-clearfix{height:1%}.ui-helper-clearfix{display:block}/**/.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:absolute;top:0;left:0;width:100%;height:100%}.ui-widget{font-family:sans-serif;font-size:12px}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:sans-serif;font-size:1em}.ui-widget-content{border:1px solid #d1e5ee;background:#fff;color:#333}.ui-widget-header{border:1px solid #d1e5ee;background-color:#f5fafd;background-image:-ms-linear-gradient(top,#f7fcfe,#eff8ff);background-image:-moz-linear-gradient(top,#f7fcfe,#eff8ff);background-image:-o-linear-gradient(top,#f7fcfe,#eff8ff);background-image:-webkit-gradient(linear,left top,left bottom,from(#f7fcfe),to(#eff8ff));background-image:-webkit-linear-gradient(top,#f7fcfe,#eff8ff);background-image:linear-gradient(top,#f7fcfe,#eff8ff);color:#333;font-weight:bold}.ui-widget-header a{color:#333}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #d1e5ee;background-color:#f5fafd;background-image:-ms-linear-gradient(top,#f7fcfe,#eff8ff);background-image:-moz-linear-gradient(top,#f7fcfe,#eff8ff);background-image:-o-linear-gradient(top,#f7fcfe,#eff8ff);background-image:-webkit-gradient(linear,left top,left bottom,from(#f7fcfe),to(#eff8ff));background-image:-webkit-linear-gradient(top,#f7fcfe,#eff8ff);background-image:linear-gradient(top,#f7fcfe,#eff8ff);font-weight:normal;color:#333}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#333;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #b8d7e5;background-color:#f7fcfe;background-image:-ms-linear-gradient(top,#eff8ff,#f7fcfe);background-image:-moz-linear-gradient(top,#eff8ff,#f7fcfe);background-image:-o-linear-gradient(top,#eff8ff,#f7fcfe);background-image:-webkit-gradient(linear,left top,left bottom,from(#eff8ff),to(#f7fcfe));background-image:-webkit-linear-gradient(top,#eff8ff,#f7fcfe);background-image:linear-gradient(top,#eff8ff,#f7fcfe);font-weight:normal;color:#000}.ui-state-hover a,.ui-state-hover a:hover{color:#000;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #d1e5ee;background:#fff;font-weight:normal;color:#333}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#333;text-decoration:none}.ui-widget :active{outline:0}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #e6db55;background:#ffffe0;color:#333}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#333}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #c00;background:#ffebe8;color:#c00}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#c00}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#c00}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-icon{width:16px;height:16px;background-image:url(../images/ui-icons_333333_256x240.png)}.ui-widget-content .ui-icon{background-image:url(../images/ui-icons_333333_256x240.png)}.ui-widget-header .ui-icon{background-image:url(../images/ui-icons_999999_256x240.png)}.ui-state-default .ui-icon{background-image:url(../images/ui-icons_333333_256x240.png)}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url(../images/ui-icons_333333_256x240.png)}.ui-state-active .ui-icon{background-image:url(../images/ui-icons_333333_256x240.png)}.ui-state-highlight .ui-icon{background-image:url(../images/ui-icons_21759b_256x240.png)}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url(../images/ui-icons_cc0000_256x240.png)}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-off{background-position:-96px -144px}.ui-icon-radio-on{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{-moz-border-radius-bottomleft:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-bottom-left-radius:3px;border-bottom-left-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{-moz-border-radius-bottomright:3px;-webkit-border-bottom-right-radius:3px;-khtml-border-bottom-right-radius:3px;border-bottom-right-radius:3px}.ui-widget-overlay{background:#000;opacity:.6;filter:Alpha(Opacity=60)}.ui-widget-shadow{box-shadow:0 0 16px rgba(0,0,0,0.3)}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:.1px;z-index:99999;display:block}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-accordion{width:100%}.ui-accordion .ui-accordion-header{cursor:pointer;position:relative;margin-top:1px;zoom:1}.ui-accordion .ui-accordion-li-fix{display:inline}.ui-accordion .ui-accordion-header-active{border-bottom:0!important}.ui-accordion .ui-accordion-header a{display:block;font-size:1em;padding:.5em .5em .5em .7em}.ui-accordion-icons .ui-accordion-header a{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-icon{position:absolute;left:.5em;top:50%;margin-top:-8px}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;margin-top:-2px;position:relative;top:1px;margin-bottom:2px;overflow:auto;display:none;zoom:1}.ui-accordion .ui-accordion-content-active{display:block}.ui-autocomplete{position:absolute;cursor:default}* html .ui-autocomplete{width:1px}.ui-menu{list-style:none;padding:2px;margin:0;display:block;float:left}.ui-menu .ui-menu{margin-top:-3px}.ui-menu .ui-menu-item{margin:0;padding:0;zoom:1;float:left;clear:left;width:100%}.ui-menu .ui-menu-item a{text-decoration:none;display:block;padding:.2em .4em;line-height:1.5;zoom:1}.ui-menu .ui-menu-item a.ui-state-hover,.ui-menu .ui-menu-item a.ui-state-active{font-weight:normal;margin:-1px}.ui-button{display:inline-block;position:relative;padding:0;margin-right:.1em;text-decoration:none!important;cursor:pointer;text-align:center;zoom:1;overflow:visible}.ui-button-icon-only{width:2.2em}button.ui-button-icon-only{width:2.4em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button .ui-button-text{display:block;line-height:1.4}.ui-button-text-only .ui-button-text{padding:.4em 1em}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon,.ui-button-icons-only .ui-icon{position:absolute;top:50%;margin-top:-8px}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px}.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary,.ui-button-icons-only .ui-button-icon-primary{left:.5em}.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-button{margin-left:0;margin-right:-.3em}button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-dialog{position:absolute;padding:.2em;width:300px;overflow:hidden}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 16px .1em 0}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:19px;margin:-10px 0 0 0;padding:1px;height:18px}.ui-dialog .ui-dialog-titlebar-close span{display:block;margin:1px}.ui-dialog .ui-dialog-titlebar-close:hover,.ui-dialog .ui-dialog-titlebar-close:focus{padding:0}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:0;overflow:auto;zoom:1}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin:.5em 0 0 0;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:14px;height:14px;right:3px;bottom:3px}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-tabs{position:relative;padding:.2em;zoom:1}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:1px;margin:0 .2em 1px 0;border-bottom:0!important;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav li a{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-selected{margin-bottom:0;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-selected a,.ui-tabs .ui-tabs-nav li.ui-state-disabled a,.ui-tabs .ui-tabs-nav li.ui-state-processing a{cursor:text}.ui-tabs .ui-tabs-nav li a,.ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:0}.ui-tabs .ui-tabs-hide{display:none!important}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month-year{width:100%}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:49%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current{float:right}.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker-cover{display:none;display:block;position:absolute;z-index:-1;filter:mask();top:-4px;left:-4px;width:200px;height:200px}.ui-progressbar{height:2em;text-align:left}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-widget-header{background-color:#83b4d8;background-image:linear-gradient(bottom,#72a7cf 0,#90c5ee 100%);background-image:-o-linear-gradient(bottom,#72a7cf 0,#90c5ee 100%);background-image:-moz-linear-gradient(bottom,#72a7cf 0,#90c5ee 100%);background-image:-webkit-linear-gradient(bottom,#72a7cf 0,#90c5ee 100%);background-image:-ms-linear-gradient(bottom,#72a7cf 0,#90c5ee 100%)}
|
assets/css/jquery-ui-fresh.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{position:absolute!important;clip:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px)}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}.ui-helper-clearfix{display:inline-block}/*\*/* html .ui-helper-clearfix{height:1%}.ui-helper-clearfix{display:block}/**/.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:absolute;top:0;left:0;width:100%;height:100%}.ui-widget{font-family:sans-serif;font-size:12px}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:sans-serif;font-size:1em}.ui-widget-content{border:1px solid #dfdfdf;background:#fff;color:#333}.ui-widget-header{border:1px solid #dfdfdf;color:#333;font-weight:bold;background-color:#f1f1f1;background-image:-ms-linear-gradient(top,#f9f9f9,#ececec);background-image:-moz-linear-gradient(top,#f9f9f9,#ececec);background-image:-o-linear-gradient(top,#f9f9f9,#ececec);background-image:-webkit-gradient(linear,left top,left bottom,from(#f9f9f9),to(#ececec));background-image:-webkit-linear-gradient(top,#f9f9f9,#ececec);background-image:linear-gradient(top,#f9f9f9,#ececec)}.ui-widget-header a{color:#333}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #dfdfdf;background-color:#f1f1f1;background-image:-ms-linear-gradient(top,#f9f9f9,#ececec);background-image:-moz-linear-gradient(top,#f9f9f9,#ececec);background-image:-o-linear-gradient(top,#f9f9f9,#ececec);background-image:-webkit-gradient(linear,left top,left bottom,from(#f9f9f9),to(#ececec));background-image:-webkit-linear-gradient(top,#f9f9f9,#ececec);background-image:linear-gradient(top,#f9f9f9,#ececec);font-weight:normal;color:#333}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#333;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #ccc;background-color:#ececec;background-image:-ms-linear-gradient(top,#ececec,#f9f9f9);background-image:-moz-linear-gradient(top,#ececec,#f9f9f9);background-image:-o-linear-gradient(top,#ececec,#f9f9f9);background-image:-webkit-gradient(linear,left top,left bottom,from(#ececec),to(#f9f9f9));background-image:-webkit-linear-gradient(top,#ececec,#f9f9f9);background-image:linear-gradient(top,#ececec,#f9f9f9);font-weight:normal;color:#000}.ui-state-hover a,.ui-state-hover a:hover{color:#000;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #dfdfdf;background:#fff;font-weight:normal;color:#333}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#333;text-decoration:none}.ui-widget :active{outline:0}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #e6db55;background:#ffffe0;color:#333}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#333}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #c00;background:#ffebe8;color:#c00}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#c00}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#c00}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-icon{width:16px;height:16px;background-image:url(../images/ui-icons_333333_256x240.png)}.ui-widget-content .ui-icon{background-image:url(../images/ui-icons_333333_256x240.png)}.ui-widget-header .ui-icon{background-image:url(../images/ui-icons_999999_256x240.png)}.ui-state-default .ui-icon{background-image:url(../images/ui-icons_333333_256x240.png)}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url(../images/ui-icons_333333_256x240.png)}.ui-state-active .ui-icon{background-image:url(../images/ui-icons_333333_256x240.png)}.ui-state-highlight .ui-icon{background-image:url(../images/ui-icons_21759b_256x240.png)}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url(../images/ui-icons_cc0000_256x240.png)}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-off{background-position:-96px -144px}.ui-icon-radio-on{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;border-top-left-radius:3px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;border-top-right-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{-moz-border-radius-bottomleft:3px;-webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{-moz-border-radius-bottomright:3px;-webkit-border-bottom-right-radius:3px;border-bottom-right-radius:3px}.ui-widget-overlay{background:#000;opacity:.6;filter:Alpha(Opacity=60)}.ui-widget-shadow{box-shadow:0 0 16px rgba(0,0,0,0.3)}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:.1px;z-index:99999;display:block}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-accordion{width:100%}.ui-accordion .ui-accordion-header{cursor:pointer;position:relative;margin-top:1px;zoom:1}.ui-accordion .ui-accordion-li-fix{display:inline}.ui-accordion .ui-accordion-header-active{border-bottom:0!important}.ui-accordion .ui-accordion-header a{display:block;font-size:1em;padding:.5em .5em .5em .7em}.ui-accordion-icons .ui-accordion-header a{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-icon{position:absolute;left:.5em;top:50%;margin-top:-8px}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;margin-top:-2px;position:relative;top:1px;margin-bottom:2px;overflow:auto;display:none;zoom:1}.ui-accordion .ui-accordion-content-active{display:block}.ui-autocomplete{position:absolute;cursor:default}* html .ui-autocomplete{width:1px}.ui-menu{list-style:none;padding:2px;margin:0;display:block;float:left}.ui-menu .ui-menu{margin-top:-3px}.ui-menu .ui-menu-item{margin:0;padding:0;zoom:1;float:left;clear:left;width:100%}.ui-menu .ui-menu-item a{text-decoration:none;display:block;padding:.2em .4em;line-height:1.5;zoom:1}.ui-menu .ui-menu-item a.ui-state-hover,.ui-menu .ui-menu-item a.ui-state-active{font-weight:normal;margin:-1px}.ui-button{display:inline-block;position:relative;padding:0;margin-right:.1em;text-decoration:none!important;cursor:pointer;text-align:center;zoom:1;overflow:visible}.ui-button-icon-only{width:2.2em}button.ui-button-icon-only{width:2.4em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button .ui-button-text{display:block;line-height:1.4}.ui-button-text-only .ui-button-text{padding:.4em 1em}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon,.ui-button-icons-only .ui-icon{position:absolute;top:50%;margin-top:-8px}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px}.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary,.ui-button-icons-only .ui-button-icon-primary{left:.5em}.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-button{margin-left:0;margin-right:-.3em}button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-dialog{position:fixed;padding:.2em;width:300px;overflow:hidden}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 16px .1em 0}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:19px;margin:-10px 0 0 0;padding:1px;height:18px}.ui-dialog .ui-dialog-titlebar-close span{display:block;margin:1px}.ui-dialog .ui-dialog-titlebar-close:hover,.ui-dialog .ui-dialog-titlebar-close:focus{padding:0}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:0;overflow:auto;zoom:1}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin:.5em 0 0 0;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:14px;height:14px;right:3px;bottom:3px}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-tabs{position:relative;padding:.2em;zoom:1}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:1px;margin:0 .2em 1px 0;border-bottom:0!important;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav li a{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-selected{margin-bottom:0;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-selected a,.ui-tabs .ui-tabs-nav li.ui-state-disabled a,.ui-tabs .ui-tabs-nav li.ui-state-processing a{cursor:text}.ui-tabs .ui-tabs-nav li a,.ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:0}.ui-tabs .ui-tabs-hide{display:none!important}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month-year{width:100%}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:49%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current{float:right}.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker-cover{display:none;display:block;position:absolute;z-index:-1;filter:mask();top:-4px;left:-4px;width:200px;height:200px}.ui-progressbar{height:2em;text-align:left}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-widget-header{background-color:#83b4d8;background-image:linear-gradient(bottom,#72a7cf 0,#90c5ee 100%);background-image:-o-linear-gradient(bottom,#72a7cf 0,#90c5ee 100%);background-image:-moz-linear-gradient(bottom,#72a7cf 0,#90c5ee 100%);background-image:-webkit-linear-gradient(bottom,#72a7cf 0,#90c5ee 100%);background-image:-ms-linear-gradient(bottom,#72a7cf 0,#90c5ee 100%)}
|
assets/css/schema-bootstrap.css
ADDED
@@ -0,0 +1,3049 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.schema-container {
|
2 |
+
margin-right: auto;
|
3 |
+
margin-left: auto;
|
4 |
+
padding-right: 15px;
|
5 |
+
padding-left: 15px;
|
6 |
+
width: 100%;
|
7 |
+
}
|
8 |
+
|
9 |
+
@media (min-width: 576px) {
|
10 |
+
.schema-container {
|
11 |
+
max-width: 540px;
|
12 |
+
}
|
13 |
+
}
|
14 |
+
|
15 |
+
@media (min-width: 768px) {
|
16 |
+
.schema-container {
|
17 |
+
max-width: 720px;
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
@media (min-width: 992px) {
|
22 |
+
.schema-container {
|
23 |
+
max-width: 960px;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
@media (min-width: 1200px) {
|
28 |
+
.schema-container {
|
29 |
+
max-width: 1140px;
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
.schema-container-fluid {
|
34 |
+
width: 100%;
|
35 |
+
margin-right: auto;
|
36 |
+
margin-left: auto;
|
37 |
+
padding-right: 15px;
|
38 |
+
padding-left: 15px;
|
39 |
+
width: 100%;
|
40 |
+
}
|
41 |
+
|
42 |
+
.schema-row {
|
43 |
+
display: -ms-flexbox;
|
44 |
+
display: flex;
|
45 |
+
-ms-flex-wrap: wrap;
|
46 |
+
flex-wrap: wrap;
|
47 |
+
margin-right: -15px;
|
48 |
+
margin-left: -15px;
|
49 |
+
}
|
50 |
+
|
51 |
+
.schema-no-gutters {
|
52 |
+
margin-right: 0;
|
53 |
+
margin-left: 0;
|
54 |
+
}
|
55 |
+
|
56 |
+
.schema-no-gutters > .schema-col,
|
57 |
+
.schema-no-gutters > [class*="schema-col-"] {
|
58 |
+
padding-right: 0;
|
59 |
+
padding-left: 0;
|
60 |
+
}
|
61 |
+
|
62 |
+
.schema-col-1, .schema-col-2, .schema-col-3, .schema-col-4, .schema-col-5, .schema-col-6, .schema-col-7, .schema-col-8, .schema-col-9, .schema-col-10, .schema-col-11, .schema-col-12, .schema-col,
|
63 |
+
.schema-col-auto, .schema-col-sm-1, .schema-col-sm-2, .schema-col-sm-3, .schema-col-sm-4, .schema-col-sm-5, .schema-col-sm-6, .schema-col-sm-7, .schema-col-sm-8, .schema-col-sm-9, .schema-col-sm-10, .schema-col-sm-11, .schema-col-sm-12, .schema-col-sm,
|
64 |
+
.schema-col-sm-auto, .schema-col-md-1, .schema-col-md-2, .schema-col-md-3, .schema-col-md-4, .schema-col-md-5, .schema-col-md-6, .schema-col-md-7, .schema-col-md-8, .schema-col-md-9, .schema-col-md-10, .schema-col-md-11, .schema-col-md-12, .schema-col-md,
|
65 |
+
.schema-col-md-auto, .schema-col-lg-1, .schema-col-lg-2, .schema-col-lg-3, .schema-col-lg-4, .schema-col-lg-5, .schema-col-lg-6, .schema-col-lg-7, .schema-col-lg-8, .schema-col-lg-9, .schema-col-lg-10, .schema-col-lg-11, .schema-col-lg-12, .schema-col-lg,
|
66 |
+
.schema-col-lg-auto, .schema-col-xl-1, .schema-col-xl-2, .schema-col-xl-3, .schema-col-xl-4, .schema-col-xl-5, .schema-col-xl-6, .schema-col-xl-7, .schema-col-xl-8, .schema-col-xl-9, .schema-col-xl-10, .schema-col-xl-11, .schema-col-xl-12, .schema-col-xl,
|
67 |
+
.schema-col-xl-auto {
|
68 |
+
position: relative;
|
69 |
+
width: 100%;
|
70 |
+
min-height: 1px;
|
71 |
+
padding-right: 15px;
|
72 |
+
padding-left: 15px;
|
73 |
+
}
|
74 |
+
|
75 |
+
.schema-col {
|
76 |
+
-ms-flex-preferred-size: 0;
|
77 |
+
flex-basis: 0;
|
78 |
+
-ms-flex-positive: 1;
|
79 |
+
flex-grow: 1;
|
80 |
+
max-width: 100%;
|
81 |
+
}
|
82 |
+
|
83 |
+
.schema-col-auto {
|
84 |
+
-ms-flex: 0 0 auto;
|
85 |
+
flex: 0 0 auto;
|
86 |
+
width: auto;
|
87 |
+
max-width: none;
|
88 |
+
}
|
89 |
+
|
90 |
+
.schema-col-1 {
|
91 |
+
-ms-flex: 0 0 8.333333%;
|
92 |
+
flex: 0 0 8.333333%;
|
93 |
+
max-width: 8.333333%;
|
94 |
+
}
|
95 |
+
|
96 |
+
.schema-col-2 {
|
97 |
+
-ms-flex: 0 0 16.666667%;
|
98 |
+
flex: 0 0 16.666667%;
|
99 |
+
max-width: 16.666667%;
|
100 |
+
}
|
101 |
+
|
102 |
+
.schema-col-3 {
|
103 |
+
-ms-flex: 0 0 25%;
|
104 |
+
flex: 0 0 25%;
|
105 |
+
max-width: 25%;
|
106 |
+
}
|
107 |
+
|
108 |
+
.schema-col-4 {
|
109 |
+
-ms-flex: 0 0 33.333333%;
|
110 |
+
flex: 0 0 33.333333%;
|
111 |
+
max-width: 33.333333%;
|
112 |
+
}
|
113 |
+
|
114 |
+
.schema-col-5 {
|
115 |
+
-ms-flex: 0 0 41.666667%;
|
116 |
+
flex: 0 0 41.666667%;
|
117 |
+
max-width: 41.666667%;
|
118 |
+
}
|
119 |
+
|
120 |
+
.schema-col-6 {
|
121 |
+
-ms-flex: 0 0 50%;
|
122 |
+
flex: 0 0 50%;
|
123 |
+
max-width: 50%;
|
124 |
+
}
|
125 |
+
|
126 |
+
.schema-col-7 {
|
127 |
+
-ms-flex: 0 0 58.333333%;
|
128 |
+
flex: 0 0 58.333333%;
|
129 |
+
max-width: 58.333333%;
|
130 |
+
}
|
131 |
+
|
132 |
+
.schema-col-8 {
|
133 |
+
-ms-flex: 0 0 66.666667%;
|
134 |
+
flex: 0 0 66.666667%;
|
135 |
+
max-width: 66.666667%;
|
136 |
+
}
|
137 |
+
|
138 |
+
.schema-col-9 {
|
139 |
+
-ms-flex: 0 0 75%;
|
140 |
+
flex: 0 0 75%;
|
141 |
+
max-width: 75%;
|
142 |
+
}
|
143 |
+
|
144 |
+
.schema-col-10 {
|
145 |
+
-ms-flex: 0 0 83.333333%;
|
146 |
+
flex: 0 0 83.333333%;
|
147 |
+
max-width: 83.333333%;
|
148 |
+
}
|
149 |
+
|
150 |
+
.schema-col-11 {
|
151 |
+
-ms-flex: 0 0 91.666667%;
|
152 |
+
flex: 0 0 91.666667%;
|
153 |
+
max-width: 91.666667%;
|
154 |
+
}
|
155 |
+
|
156 |
+
.schema-col-12 {
|
157 |
+
-ms-flex: 0 0 100%;
|
158 |
+
flex: 0 0 100%;
|
159 |
+
max-width: 100%;
|
160 |
+
}
|
161 |
+
|
162 |
+
.schema-order-1 {
|
163 |
+
-ms-flex-order: 1;
|
164 |
+
order: 1;
|
165 |
+
}
|
166 |
+
|
167 |
+
.schema-order-2 {
|
168 |
+
-ms-flex-order: 2;
|
169 |
+
order: 2;
|
170 |
+
}
|
171 |
+
|
172 |
+
.schema-order-3 {
|
173 |
+
-ms-flex-order: 3;
|
174 |
+
order: 3;
|
175 |
+
}
|
176 |
+
|
177 |
+
.schema-order-4 {
|
178 |
+
-ms-flex-order: 4;
|
179 |
+
order: 4;
|
180 |
+
}
|
181 |
+
|
182 |
+
.schema-order-5 {
|
183 |
+
-ms-flex-order: 5;
|
184 |
+
order: 5;
|
185 |
+
}
|
186 |
+
|
187 |
+
.schema-order-6 {
|
188 |
+
-ms-flex-order: 6;
|
189 |
+
order: 6;
|
190 |
+
}
|
191 |
+
|
192 |
+
.schema-order-7 {
|
193 |
+
-ms-flex-order: 7;
|
194 |
+
order: 7;
|
195 |
+
}
|
196 |
+
|
197 |
+
.schema-order-8 {
|
198 |
+
-ms-flex-order: 8;
|
199 |
+
order: 8;
|
200 |
+
}
|
201 |
+
|
202 |
+
.schema-order-9 {
|
203 |
+
-ms-flex-order: 9;
|
204 |
+
order: 9;
|
205 |
+
}
|
206 |
+
|
207 |
+
.schema-order-10 {
|
208 |
+
-ms-flex-order: 10;
|
209 |
+
order: 10;
|
210 |
+
}
|
211 |
+
|
212 |
+
.schema-order-11 {
|
213 |
+
-ms-flex-order: 11;
|
214 |
+
order: 11;
|
215 |
+
}
|
216 |
+
|
217 |
+
.schema-order-12 {
|
218 |
+
-ms-flex-order: 12;
|
219 |
+
order: 12;
|
220 |
+
}
|
221 |
+
|
222 |
+
@media (min-width: 576px) {
|
223 |
+
.schema-col-sm {
|
224 |
+
-ms-flex-preferred-size: 0;
|
225 |
+
flex-basis: 0;
|
226 |
+
-ms-flex-positive: 1;
|
227 |
+
flex-grow: 1;
|
228 |
+
max-width: 100%;
|
229 |
+
}
|
230 |
+
.schema-col-sm-auto {
|
231 |
+
-ms-flex: 0 0 auto;
|
232 |
+
flex: 0 0 auto;
|
233 |
+
width: auto;
|
234 |
+
max-width: none;
|
235 |
+
}
|
236 |
+
.schema-col-sm-1 {
|
237 |
+
-ms-flex: 0 0 8.333333%;
|
238 |
+
flex: 0 0 8.333333%;
|
239 |
+
max-width: 8.333333%;
|
240 |
+
}
|
241 |
+
.schema-col-sm-2 {
|
242 |
+
-ms-flex: 0 0 16.666667%;
|
243 |
+
flex: 0 0 16.666667%;
|
244 |
+
max-width: 16.666667%;
|
245 |
+
}
|
246 |
+
.schema-col-sm-3 {
|
247 |
+
-ms-flex: 0 0 25%;
|
248 |
+
flex: 0 0 25%;
|
249 |
+
max-width: 25%;
|
250 |
+
}
|
251 |
+
.schema-col-sm-4 {
|
252 |
+
-ms-flex: 0 0 33.333333%;
|
253 |
+
flex: 0 0 33.333333%;
|
254 |
+
max-width: 33.333333%;
|
255 |
+
}
|
256 |
+
.schema-col-sm-5 {
|
257 |
+
-ms-flex: 0 0 41.666667%;
|
258 |
+
flex: 0 0 41.666667%;
|
259 |
+
max-width: 41.666667%;
|
260 |
+
}
|
261 |
+
.schema-col-sm-6 {
|
262 |
+
-ms-flex: 0 0 50%;
|
263 |
+
flex: 0 0 50%;
|
264 |
+
max-width: 50%;
|
265 |
+
}
|
266 |
+
.schema-col-sm-7 {
|
267 |
+
-ms-flex: 0 0 58.333333%;
|
268 |
+
flex: 0 0 58.333333%;
|
269 |
+
max-width: 58.333333%;
|
270 |
+
}
|
271 |
+
.schema-col-sm-8 {
|
272 |
+
-ms-flex: 0 0 66.666667%;
|
273 |
+
flex: 0 0 66.666667%;
|
274 |
+
max-width: 66.666667%;
|
275 |
+
}
|
276 |
+
.schema-col-sm-9 {
|
277 |
+
-ms-flex: 0 0 75%;
|
278 |
+
flex: 0 0 75%;
|
279 |
+
max-width: 75%;
|
280 |
+
}
|
281 |
+
.schema-col-sm-10 {
|
282 |
+
-ms-flex: 0 0 83.333333%;
|
283 |
+
flex: 0 0 83.333333%;
|
284 |
+
max-width: 83.333333%;
|
285 |
+
}
|
286 |
+
.schema-col-sm-11 {
|
287 |
+
-ms-flex: 0 0 91.666667%;
|
288 |
+
flex: 0 0 91.666667%;
|
289 |
+
max-width: 91.666667%;
|
290 |
+
}
|
291 |
+
.schema-col-sm-12 {
|
292 |
+
-ms-flex: 0 0 100%;
|
293 |
+
flex: 0 0 100%;
|
294 |
+
max-width: 100%;
|
295 |
+
}
|
296 |
+
.schema-order-sm-1 {
|
297 |
+
-ms-flex-order: 1;
|
298 |
+
order: 1;
|
299 |
+
}
|
300 |
+
.schema-order-sm-2 {
|
301 |
+
-ms-flex-order: 2;
|
302 |
+
order: 2;
|
303 |
+
}
|
304 |
+
.schema-order-sm-3 {
|
305 |
+
-ms-flex-order: 3;
|
306 |
+
order: 3;
|
307 |
+
}
|
308 |
+
.schema-order-sm-4 {
|
309 |
+
-ms-flex-order: 4;
|
310 |
+
order: 4;
|
311 |
+
}
|
312 |
+
.schema-order-sm-5 {
|
313 |
+
-ms-flex-order: 5;
|
314 |
+
order: 5;
|
315 |
+
}
|
316 |
+
.schema-order-sm-6 {
|
317 |
+
-ms-flex-order: 6;
|
318 |
+
order: 6;
|
319 |
+
}
|
320 |
+
.schema-order-sm-7 {
|
321 |
+
-ms-flex-order: 7;
|
322 |
+
order: 7;
|
323 |
+
}
|
324 |
+
.schema-order-sm-8 {
|
325 |
+
-ms-flex-order: 8;
|
326 |
+
order: 8;
|
327 |
+
}
|
328 |
+
.schema-order-sm-9 {
|
329 |
+
-ms-flex-order: 9;
|
330 |
+
order: 9;
|
331 |
+
}
|
332 |
+
.schema-order-sm-10 {
|
333 |
+
-ms-flex-order: 10;
|
334 |
+
order: 10;
|
335 |
+
}
|
336 |
+
.schema-order-sm-11 {
|
337 |
+
-ms-flex-order: 11;
|
338 |
+
order: 11;
|
339 |
+
}
|
340 |
+
.schema-order-sm-12 {
|
341 |
+
-ms-flex-order: 12;
|
342 |
+
order: 12;
|
343 |
+
}
|
344 |
+
}
|
345 |
+
|
346 |
+
@media (min-width: 768px) {
|
347 |
+
.schema-col-md {
|
348 |
+
-ms-flex-preferred-size: 0;
|
349 |
+
flex-basis: 0;
|
350 |
+
-ms-flex-positive: 1;
|
351 |
+
flex-grow: 1;
|
352 |
+
max-width: 100%;
|
353 |
+
}
|
354 |
+
.schema-col-md-auto {
|
355 |
+
-ms-flex: 0 0 auto;
|
356 |
+
flex: 0 0 auto;
|
357 |
+
width: auto;
|
358 |
+
max-width: none;
|
359 |
+
}
|
360 |
+
.schema-col-md-1 {
|
361 |
+
-ms-flex: 0 0 8.333333%;
|
362 |
+
flex: 0 0 8.333333%;
|
363 |
+
max-width: 8.333333%;
|
364 |
+
}
|
365 |
+
.schema-col-md-2 {
|
366 |
+
-ms-flex: 0 0 16.666667%;
|
367 |
+
flex: 0 0 16.666667%;
|
368 |
+
max-width: 16.666667%;
|
369 |
+
}
|
370 |
+
.schema-col-md-3 {
|
371 |
+
-ms-flex: 0 0 25%;
|
372 |
+
flex: 0 0 25%;
|
373 |
+
max-width: 25%;
|
374 |
+
}
|
375 |
+
.schema-col-md-4 {
|
376 |
+
-ms-flex: 0 0 33.333333%;
|
377 |
+
flex: 0 0 33.333333%;
|
378 |
+
max-width: 33.333333%;
|
379 |
+
}
|
380 |
+
.schema-col-md-5 {
|
381 |
+
-ms-flex: 0 0 41.666667%;
|
382 |
+
flex: 0 0 41.666667%;
|
383 |
+
max-width: 41.666667%;
|
384 |
+
}
|
385 |
+
.schema-col-md-6 {
|
386 |
+
-ms-flex: 0 0 50%;
|
387 |
+
flex: 0 0 50%;
|
388 |
+
max-width: 50%;
|
389 |
+
}
|
390 |
+
.schema-col-md-7 {
|
391 |
+
-ms-flex: 0 0 58.333333%;
|
392 |
+
flex: 0 0 58.333333%;
|
393 |
+
max-width: 58.333333%;
|
394 |
+
}
|
395 |
+
.schema-col-md-8 {
|
396 |
+
-ms-flex: 0 0 66.666667%;
|
397 |
+
flex: 0 0 66.666667%;
|
398 |
+
max-width: 66.666667%;
|
399 |
+
}
|
400 |
+
.schema-col-md-9 {
|
401 |
+
-ms-flex: 0 0 75%;
|
402 |
+
flex: 0 0 75%;
|
403 |
+
max-width: 75%;
|
404 |
+
}
|
405 |
+
.schema-col-md-10 {
|
406 |
+
-ms-flex: 0 0 83.333333%;
|
407 |
+
flex: 0 0 83.333333%;
|
408 |
+
max-width: 83.333333%;
|
409 |
+
}
|
410 |
+
.schema-col-md-11 {
|
411 |
+
-ms-flex: 0 0 91.666667%;
|
412 |
+
flex: 0 0 91.666667%;
|
413 |
+
max-width: 91.666667%;
|
414 |
+
}
|
415 |
+
.schema-col-md-12 {
|
416 |
+
-ms-flex: 0 0 100%;
|
417 |
+
flex: 0 0 100%;
|
418 |
+
max-width: 100%;
|
419 |
+
}
|
420 |
+
.schema-order-md-1 {
|
421 |
+
-ms-flex-order: 1;
|
422 |
+
order: 1;
|
423 |
+
}
|
424 |
+
.schema-order-md-2 {
|
425 |
+
-ms-flex-order: 2;
|
426 |
+
order: 2;
|
427 |
+
}
|
428 |
+
.schema-order-md-3 {
|
429 |
+
-ms-flex-order: 3;
|
430 |
+
order: 3;
|
431 |
+
}
|
432 |
+
.schema-order-md-4 {
|
433 |
+
-ms-flex-order: 4;
|
434 |
+
order: 4;
|
435 |
+
}
|
436 |
+
.schema-order-md-5 {
|
437 |
+
-ms-flex-order: 5;
|
438 |
+
order: 5;
|
439 |
+
}
|
440 |
+
.schema-order-md-6 {
|
441 |
+
-ms-flex-order: 6;
|
442 |
+
order: 6;
|
443 |
+
}
|
444 |
+
.schema-order-md-7 {
|
445 |
+
-ms-flex-order: 7;
|
446 |
+
order: 7;
|
447 |
+
}
|
448 |
+
.schema-order-md-8 {
|
449 |
+
-ms-flex-order: 8;
|
450 |
+
order: 8;
|
451 |
+
}
|
452 |
+
.schema-order-md-9 {
|
453 |
+
-ms-flex-order: 9;
|
454 |
+
order: 9;
|
455 |
+
}
|
456 |
+
.schema-order-md-10 {
|
457 |
+
-ms-flex-order: 10;
|
458 |
+
order: 10;
|
459 |
+
}
|
460 |
+
.schema-order-md-11 {
|
461 |
+
-ms-flex-order: 11;
|
462 |
+
order: 11;
|
463 |
+
}
|
464 |
+
.schema-order-md-12 {
|
465 |
+
-ms-flex-order: 12;
|
466 |
+
order: 12;
|
467 |
+
}
|
468 |
+
}
|
469 |
+
|
470 |
+
@media (min-width: 992px) {
|
471 |
+
.schema-col-lg {
|
472 |
+
-ms-flex-preferred-size: 0;
|
473 |
+
flex-basis: 0;
|
474 |
+
-ms-flex-positive: 1;
|
475 |
+
flex-grow: 1;
|
476 |
+
max-width: 100%;
|
477 |
+
}
|
478 |
+
.schema-col-lg-auto {
|
479 |
+
-ms-flex: 0 0 auto;
|
480 |
+
flex: 0 0 auto;
|
481 |
+
width: auto;
|
482 |
+
max-width: none;
|
483 |
+
}
|
484 |
+
.schema-col-lg-1 {
|
485 |
+
-ms-flex: 0 0 8.333333%;
|
486 |
+
flex: 0 0 8.333333%;
|
487 |
+
max-width: 8.333333%;
|
488 |
+
}
|
489 |
+
.schema-col-lg-2 {
|
490 |
+
-ms-flex: 0 0 16.666667%;
|
491 |
+
flex: 0 0 16.666667%;
|
492 |
+
max-width: 16.666667%;
|
493 |
+
}
|
494 |
+
.schema-col-lg-3 {
|
495 |
+
-ms-flex: 0 0 25%;
|
496 |
+
flex: 0 0 25%;
|
497 |
+
max-width: 25%;
|
498 |
+
}
|
499 |
+
.schema-col-lg-4 {
|
500 |
+
-ms-flex: 0 0 33.333333%;
|
501 |
+
flex: 0 0 33.333333%;
|
502 |
+
max-width: 33.333333%;
|
503 |
+
}
|
504 |
+
.schema-col-lg-5 {
|
505 |
+
-ms-flex: 0 0 41.666667%;
|
506 |
+
flex: 0 0 41.666667%;
|
507 |
+
max-width: 41.666667%;
|
508 |
+
}
|
509 |
+
.schema-col-lg-6 {
|
510 |
+
-ms-flex: 0 0 50%;
|
511 |
+
flex: 0 0 50%;
|
512 |
+
max-width: 50%;
|
513 |
+
}
|
514 |
+
.schema-col-lg-7 {
|
515 |
+
-ms-flex: 0 0 58.333333%;
|
516 |
+
flex: 0 0 58.333333%;
|
517 |
+
max-width: 58.333333%;
|
518 |
+
}
|
519 |
+
.schema-col-lg-8 {
|
520 |
+
-ms-flex: 0 0 66.666667%;
|
521 |
+
flex: 0 0 66.666667%;
|
522 |
+
max-width: 66.666667%;
|
523 |
+
}
|
524 |
+
.schema-col-lg-9 {
|
525 |
+
-ms-flex: 0 0 75%;
|
526 |
+
flex: 0 0 75%;
|
527 |
+
max-width: 75%;
|
528 |
+
}
|
529 |
+
.schema-col-lg-10 {
|
530 |
+
-ms-flex: 0 0 83.333333%;
|
531 |
+
flex: 0 0 83.333333%;
|
532 |
+
max-width: 83.333333%;
|
533 |
+
}
|
534 |
+
.schema-col-lg-11 {
|
535 |
+
-ms-flex: 0 0 91.666667%;
|
536 |
+
flex: 0 0 91.666667%;
|
537 |
+
max-width: 91.666667%;
|
538 |
+
}
|
539 |
+
.schema-col-lg-12 {
|
540 |
+
-ms-flex: 0 0 100%;
|
541 |
+
flex: 0 0 100%;
|
542 |
+
max-width: 100%;
|
543 |
+
}
|
544 |
+
.schema-order-lg-1 {
|
545 |
+
-ms-flex-order: 1;
|
546 |
+
order: 1;
|
547 |
+
}
|
548 |
+
.schema-order-lg-2 {
|
549 |
+
-ms-flex-order: 2;
|
550 |
+
order: 2;
|
551 |
+
}
|
552 |
+
.schema-order-lg-3 {
|
553 |
+
-ms-flex-order: 3;
|
554 |
+
order: 3;
|
555 |
+
}
|
556 |
+
.schema-order-lg-4 {
|
557 |
+
-ms-flex-order: 4;
|
558 |
+
order: 4;
|
559 |
+
}
|
560 |
+
.schema-order-lg-5 {
|
561 |
+
-ms-flex-order: 5;
|
562 |
+
order: 5;
|
563 |
+
}
|
564 |
+
.schema-order-lg-6 {
|
565 |
+
-ms-flex-order: 6;
|
566 |
+
order: 6;
|
567 |
+
}
|
568 |
+
.schema-order-lg-7 {
|
569 |
+
-ms-flex-order: 7;
|
570 |
+
order: 7;
|
571 |
+
}
|
572 |
+
.schema-order-lg-8 {
|
573 |
+
-ms-flex-order: 8;
|
574 |
+
order: 8;
|
575 |
+
}
|
576 |
+
.schema-order-lg-9 {
|
577 |
+
-ms-flex-order: 9;
|
578 |
+
order: 9;
|
579 |
+
}
|
580 |
+
.schema-order-lg-10 {
|
581 |
+
-ms-flex-order: 10;
|
582 |
+
order: 10;
|
583 |
+
}
|
584 |
+
.schema-order-lg-11 {
|
585 |
+
-ms-flex-order: 11;
|
586 |
+
order: 11;
|
587 |
+
}
|
588 |
+
.schema-order-lg-12 {
|
589 |
+
-ms-flex-order: 12;
|
590 |
+
order: 12;
|
591 |
+
}
|
592 |
+
}
|
593 |
+
|
594 |
+
@media (min-width: 1200px) {
|
595 |
+
.schema-col-xl {
|
596 |
+
-ms-flex-preferred-size: 0;
|
597 |
+
flex-basis: 0;
|
598 |
+
-ms-flex-positive: 1;
|
599 |
+
flex-grow: 1;
|
600 |
+
max-width: 100%;
|
601 |
+
}
|
602 |
+
.schema-col-xl-auto {
|
603 |
+
-ms-flex: 0 0 auto;
|
604 |
+
flex: 0 0 auto;
|
605 |
+
width: auto;
|
606 |
+
max-width: none;
|
607 |
+
}
|
608 |
+
.schema-col-xl-1 {
|
609 |
+
-ms-flex: 0 0 8.333333%;
|
610 |
+
flex: 0 0 8.333333%;
|
611 |
+
max-width: 8.333333%;
|
612 |
+
}
|
613 |
+
.schema-col-xl-2 {
|
614 |
+
-ms-flex: 0 0 16.666667%;
|
615 |
+
flex: 0 0 16.666667%;
|
616 |
+
max-width: 16.666667%;
|
617 |
+
}
|
618 |
+
.schema-col-xl-3 {
|
619 |
+
-ms-flex: 0 0 25%;
|
620 |
+
flex: 0 0 25%;
|
621 |
+
max-width: 25%;
|
622 |
+
}
|
623 |
+
.schema-col-xl-4 {
|
624 |
+
-ms-flex: 0 0 33.333333%;
|
625 |
+
flex: 0 0 33.333333%;
|
626 |
+
max-width: 33.333333%;
|
627 |
+
}
|
628 |
+
.schema-col-xl-5 {
|
629 |
+
-ms-flex: 0 0 41.666667%;
|
630 |
+
flex: 0 0 41.666667%;
|
631 |
+
max-width: 41.666667%;
|
632 |
+
}
|
633 |
+
.schema-col-xl-6 {
|
634 |
+
-ms-flex: 0 0 50%;
|
635 |
+
flex: 0 0 50%;
|
636 |
+
max-width: 50%;
|
637 |
+
}
|
638 |
+
.schema-col-xl-7 {
|
639 |
+
-ms-flex: 0 0 58.333333%;
|
640 |
+
flex: 0 0 58.333333%;
|
641 |
+
max-width: 58.333333%;
|
642 |
+
}
|
643 |
+
.schema-col-xl-8 {
|
644 |
+
-ms-flex: 0 0 66.666667%;
|
645 |
+
flex: 0 0 66.666667%;
|
646 |
+
max-width: 66.666667%;
|
647 |
+
}
|
648 |
+
.schema-col-xl-9 {
|
649 |
+
-ms-flex: 0 0 75%;
|
650 |
+
flex: 0 0 75%;
|
651 |
+
max-width: 75%;
|
652 |
+
}
|
653 |
+
.schema-col-xl-10 {
|
654 |
+
-ms-flex: 0 0 83.333333%;
|
655 |
+
flex: 0 0 83.333333%;
|
656 |
+
max-width: 83.333333%;
|
657 |
+
}
|
658 |
+
.schema-col-xl-11 {
|
659 |
+
-ms-flex: 0 0 91.666667%;
|
660 |
+
flex: 0 0 91.666667%;
|
661 |
+
max-width: 91.666667%;
|
662 |
+
}
|
663 |
+
.schema-col-xl-12 {
|
664 |
+
-ms-flex: 0 0 100%;
|
665 |
+
flex: 0 0 100%;
|
666 |
+
max-width: 100%;
|
667 |
+
}
|
668 |
+
.schema-order-xl-1 {
|
669 |
+
-ms-flex-order: 1;
|
670 |
+
order: 1;
|
671 |
+
}
|
672 |
+
.schema-order-xl-2 {
|
673 |
+
-ms-flex-order: 2;
|
674 |
+
order: 2;
|
675 |
+
}
|
676 |
+
.schema-order-xl-3 {
|
677 |
+
-ms-flex-order: 3;
|
678 |
+
order: 3;
|
679 |
+
}
|
680 |
+
.schema-order-xl-4 {
|
681 |
+
-ms-flex-order: 4;
|
682 |
+
order: 4;
|
683 |
+
}
|
684 |
+
.schema-order-xl-5 {
|
685 |
+
-ms-flex-order: 5;
|
686 |
+
order: 5;
|
687 |
+
}
|
688 |
+
.schema-order-xl-6 {
|
689 |
+
-ms-flex-order: 6;
|
690 |
+
order: 6;
|
691 |
+
}
|
692 |
+
.schema-order-xl-7 {
|
693 |
+
-ms-flex-order: 7;
|
694 |
+
order: 7;
|
695 |
+
}
|
696 |
+
.schema-order-xl-8 {
|
697 |
+
-ms-flex-order: 8;
|
698 |
+
order: 8;
|
699 |
+
}
|
700 |
+
.schema-order-xl-9 {
|
701 |
+
-ms-flex-order: 9;
|
702 |
+
order: 9;
|
703 |
+
}
|
704 |
+
.schema-order-xl-10 {
|
705 |
+
-ms-flex-order: 10;
|
706 |
+
order: 10;
|
707 |
+
}
|
708 |
+
.schema-order-xl-11 {
|
709 |
+
-ms-flex-order: 11;
|
710 |
+
order: 11;
|
711 |
+
}
|
712 |
+
.schema-order-xl-12 {
|
713 |
+
-ms-flex-order: 12;
|
714 |
+
order: 12;
|
715 |
+
}
|
716 |
+
}
|
717 |
+
|
718 |
+
.schema-flex-row {
|
719 |
+
-ms-flex-direction: row !important;
|
720 |
+
flex-direction: row !important;
|
721 |
+
}
|
722 |
+
|
723 |
+
.schema-flex-column {
|
724 |
+
-ms-flex-direction: column !important;
|
725 |
+
flex-direction: column !important;
|
726 |
+
}
|
727 |
+
|
728 |
+
.schema-flex-row-reverse {
|
729 |
+
-ms-flex-direction: row-reverse !important;
|
730 |
+
flex-direction: row-reverse !important;
|
731 |
+
}
|
732 |
+
|
733 |
+
.schema-flex-column-reverse {
|
734 |
+
-ms-flex-direction: column-reverse !important;
|
735 |
+
flex-direction: column-reverse !important;
|
736 |
+
}
|
737 |
+
|
738 |
+
.schema-flex-wrap {
|
739 |
+
-ms-flex-wrap: wrap !important;
|
740 |
+
flex-wrap: wrap !important;
|
741 |
+
}
|
742 |
+
|
743 |
+
.schema-flex-nowrap {
|
744 |
+
-ms-flex-wrap: nowrap !important;
|
745 |
+
flex-wrap: nowrap !important;
|
746 |
+
}
|
747 |
+
|
748 |
+
.schema-flex-wrap-reverse {
|
749 |
+
-ms-flex-wrap: wrap-reverse !important;
|
750 |
+
flex-wrap: wrap-reverse !important;
|
751 |
+
}
|
752 |
+
|
753 |
+
.schema-justify-content-start {
|
754 |
+
-ms-flex-pack: start !important;
|
755 |
+
justify-content: flex-start !important;
|
756 |
+
}
|
757 |
+
|
758 |
+
.schema-justify-content-end {
|
759 |
+
-ms-flex-pack: end !important;
|
760 |
+
justify-content: flex-end !important;
|
761 |
+
}
|
762 |
+
|
763 |
+
.schema-justify-content-center {
|
764 |
+
-ms-flex-pack: center !important;
|
765 |
+
justify-content: center !important;
|
766 |
+
}
|
767 |
+
|
768 |
+
.schema-justify-content-between {
|
769 |
+
-ms-flex-pack: justify !important;
|
770 |
+
justify-content: space-between !important;
|
771 |
+
}
|
772 |
+
|
773 |
+
.schema-justify-content-around {
|
774 |
+
-ms-flex-pack: distribute !important;
|
775 |
+
justify-content: space-around !important;
|
776 |
+
}
|
777 |
+
|
778 |
+
.schema-align-items-start {
|
779 |
+
-ms-flex-align: start !important;
|
780 |
+
align-items: flex-start !important;
|
781 |
+
}
|
782 |
+
|
783 |
+
.schema-align-items-end {
|
784 |
+
-ms-flex-align: end !important;
|
785 |
+
align-items: flex-end !important;
|
786 |
+
}
|
787 |
+
|
788 |
+
.schema-align-items-center {
|
789 |
+
-ms-flex-align: center !important;
|
790 |
+
align-items: center !important;
|
791 |
+
}
|
792 |
+
|
793 |
+
.schema-align-items-baseline {
|
794 |
+
-ms-flex-align: baseline !important;
|
795 |
+
align-items: baseline !important;
|
796 |
+
}
|
797 |
+
|
798 |
+
.schema-align-items-stretch {
|
799 |
+
-ms-flex-align: stretch !important;
|
800 |
+
align-items: stretch !important;
|
801 |
+
}
|
802 |
+
|
803 |
+
.schema-align-content-start {
|
804 |
+
-ms-flex-line-pack: start !important;
|
805 |
+
align-content: flex-start !important;
|
806 |
+
}
|
807 |
+
|
808 |
+
.schema-align-content-end {
|
809 |
+
-ms-flex-line-pack: end !important;
|
810 |
+
align-content: flex-end !important;
|
811 |
+
}
|
812 |
+
|
813 |
+
.schema-align-content-center {
|
814 |
+
-ms-flex-line-pack: center !important;
|
815 |
+
align-content: center !important;
|
816 |
+
}
|
817 |
+
|
818 |
+
.schema-align-content-between {
|
819 |
+
-ms-flex-line-pack: justify !important;
|
820 |
+
align-content: space-between !important;
|
821 |
+
}
|
822 |
+
|
823 |
+
.schema-align-content-around {
|
824 |
+
-ms-flex-line-pack: distribute !important;
|
825 |
+
align-content: space-around !important;
|
826 |
+
}
|
827 |
+
|
828 |
+
.schema-align-content-stretch {
|
829 |
+
-ms-flex-line-pack: stretch !important;
|
830 |
+
align-content: stretch !important;
|
831 |
+
}
|
832 |
+
|
833 |
+
.schema-align-self-auto {
|
834 |
+
-ms-flex-item-align: auto !important;
|
835 |
+
align-self: auto !important;
|
836 |
+
}
|
837 |
+
|
838 |
+
.schema-align-self-start {
|
839 |
+
-ms-flex-item-align: start !important;
|
840 |
+
align-self: flex-start !important;
|
841 |
+
}
|
842 |
+
|
843 |
+
.schema-align-self-end {
|
844 |
+
-ms-flex-item-align: end !important;
|
845 |
+
align-self: flex-end !important;
|
846 |
+
}
|
847 |
+
|
848 |
+
.schema-align-self-center {
|
849 |
+
-ms-flex-item-align: center !important;
|
850 |
+
align-self: center !important;
|
851 |
+
}
|
852 |
+
|
853 |
+
.schema-align-self-baseline {
|
854 |
+
-ms-flex-item-align: baseline !important;
|
855 |
+
align-self: baseline !important;
|
856 |
+
}
|
857 |
+
|
858 |
+
.schema-align-self-stretch {
|
859 |
+
-ms-flex-item-align: stretch !important;
|
860 |
+
align-self: stretch !important;
|
861 |
+
}
|
862 |
+
|
863 |
+
@media (min-width: 576px) {
|
864 |
+
.schema-flex-sm-row {
|
865 |
+
-ms-flex-direction: row !important;
|
866 |
+
flex-direction: row !important;
|
867 |
+
}
|
868 |
+
.schema-flex-sm-column {
|
869 |
+
-ms-flex-direction: column !important;
|
870 |
+
flex-direction: column !important;
|
871 |
+
}
|
872 |
+
.schema-flex-sm-row-reverse {
|
873 |
+
-ms-flex-direction: row-reverse !important;
|
874 |
+
flex-direction: row-reverse !important;
|
875 |
+
}
|
876 |
+
.schema-flex-sm-column-reverse {
|
877 |
+
-ms-flex-direction: column-reverse !important;
|
878 |
+
flex-direction: column-reverse !important;
|
879 |
+
}
|
880 |
+
.schema-flex-sm-wrap {
|
881 |
+
-ms-flex-wrap: wrap !important;
|
882 |
+
flex-wrap: wrap !important;
|
883 |
+
}
|
884 |
+
.schema-flex-sm-nowrap {
|
885 |
+
-ms-flex-wrap: nowrap !important;
|
886 |
+
flex-wrap: nowrap !important;
|
887 |
+
}
|
888 |
+
.schema-flex-sm-wrap-reverse {
|
889 |
+
-ms-flex-wrap: wrap-reverse !important;
|
890 |
+
flex-wrap: wrap-reverse !important;
|
891 |
+
}
|
892 |
+
.schema-justify-content-sm-start {
|
893 |
+
-ms-flex-pack: start !important;
|
894 |
+
justify-content: flex-start !important;
|
895 |
+
}
|
896 |
+
.schema-justify-content-sm-end {
|
897 |
+
-ms-flex-pack: end !important;
|
898 |
+
justify-content: flex-end !important;
|
899 |
+
}
|
900 |
+
.schema-justify-content-sm-center {
|
901 |
+
-ms-flex-pack: center !important;
|
902 |
+
justify-content: center !important;
|
903 |
+
}
|
904 |
+
.schema-justify-content-sm-between {
|
905 |
+
-ms-flex-pack: justify !important;
|
906 |
+
justify-content: space-between !important;
|
907 |
+
}
|
908 |
+
.schema-justify-content-sm-around {
|
909 |
+
-ms-flex-pack: distribute !important;
|
910 |
+
justify-content: space-around !important;
|
911 |
+
}
|
912 |
+
.schema-align-items-sm-start {
|
913 |
+
-ms-flex-align: start !important;
|
914 |
+
align-items: flex-start !important;
|
915 |
+
}
|
916 |
+
.schema-align-items-sm-end {
|
917 |
+
-ms-flex-align: end !important;
|
918 |
+
align-items: flex-end !important;
|
919 |
+
}
|
920 |
+
.schema-align-items-sm-center {
|
921 |
+
-ms-flex-align: center !important;
|
922 |
+
align-items: center !important;
|
923 |
+
}
|
924 |
+
.schema-align-items-sm-baseline {
|
925 |
+
-ms-flex-align: baseline !important;
|
926 |
+
align-items: baseline !important;
|
927 |
+
}
|
928 |
+
.schema-align-items-sm-stretch {
|
929 |
+
-ms-flex-align: stretch !important;
|
930 |
+
align-items: stretch !important;
|
931 |
+
}
|
932 |
+
.schema-align-content-sm-start {
|
933 |
+
-ms-flex-line-pack: start !important;
|
934 |
+
align-content: flex-start !important;
|
935 |
+
}
|
936 |
+
.schema-align-content-sm-end {
|
937 |
+
-ms-flex-line-pack: end !important;
|
938 |
+
align-content: flex-end !important;
|
939 |
+
}
|
940 |
+
.schema-align-content-sm-center {
|
941 |
+
-ms-flex-line-pack: center !important;
|
942 |
+
align-content: center !important;
|
943 |
+
}
|
944 |
+
.schema-align-content-sm-between {
|
945 |
+
-ms-flex-line-pack: justify !important;
|
946 |
+
align-content: space-between !important;
|
947 |
+
}
|
948 |
+
.schema-align-content-sm-around {
|
949 |
+
-ms-flex-line-pack: distribute !important;
|
950 |
+
align-content: space-around !important;
|
951 |
+
}
|
952 |
+
.schema-align-content-sm-stretch {
|
953 |
+
-ms-flex-line-pack: stretch !important;
|
954 |
+
align-content: stretch !important;
|
955 |
+
}
|
956 |
+
.schema-align-self-sm-auto {
|
957 |
+
-ms-flex-item-align: auto !important;
|
958 |
+
align-self: auto !important;
|
959 |
+
}
|
960 |
+
.schema-align-self-sm-start {
|
961 |
+
-ms-flex-item-align: start !important;
|
962 |
+
align-self: flex-start !important;
|
963 |
+
}
|
964 |
+
.schema-align-self-sm-end {
|
965 |
+
-ms-flex-item-align: end !important;
|
966 |
+
align-self: flex-end !important;
|
967 |
+
}
|
968 |
+
.schema-align-self-sm-center {
|
969 |
+
-ms-flex-item-align: center !important;
|
970 |
+
align-self: center !important;
|
971 |
+
}
|
972 |
+
.schema-align-self-sm-baseline {
|
973 |
+
-ms-flex-item-align: baseline !important;
|
974 |
+
align-self: baseline !important;
|
975 |
+
}
|
976 |
+
.schema-align-self-sm-stretch {
|
977 |
+
-ms-flex-item-align: stretch !important;
|
978 |
+
align-self: stretch !important;
|
979 |
+
}
|
980 |
+
}
|
981 |
+
|
982 |
+
@media (min-width: 768px) {
|
983 |
+
.schema-flex-md-row {
|
984 |
+
-ms-flex-direction: row !important;
|
985 |
+
flex-direction: row !important;
|
986 |
+
}
|
987 |
+
.schema-flex-md-column {
|
988 |
+
-ms-flex-direction: column !important;
|
989 |
+
flex-direction: column !important;
|
990 |
+
}
|
991 |
+
.schema-flex-md-row-reverse {
|
992 |
+
-ms-flex-direction: row-reverse !important;
|
993 |
+
flex-direction: row-reverse !important;
|
994 |
+
}
|
995 |
+
.schema-flex-md-column-reverse {
|
996 |
+
-ms-flex-direction: column-reverse !important;
|
997 |
+
flex-direction: column-reverse !important;
|
998 |
+
}
|
999 |
+
.schema-flex-md-wrap {
|
1000 |
+
-ms-flex-wrap: wrap !important;
|
1001 |
+
flex-wrap: wrap !important;
|
1002 |
+
}
|
1003 |
+
.schema-flex-md-nowrap {
|
1004 |
+
-ms-flex-wrap: nowrap !important;
|
1005 |
+
flex-wrap: nowrap !important;
|
1006 |
+
}
|
1007 |
+
.schema-flex-md-wrap-reverse {
|
1008 |
+
-ms-flex-wrap: wrap-reverse !important;
|
1009 |
+
flex-wrap: wrap-reverse !important;
|
1010 |
+
}
|
1011 |
+
.schema-justify-content-md-start {
|
1012 |
+
-ms-flex-pack: start !important;
|
1013 |
+
justify-content: flex-start !important;
|
1014 |
+
}
|
1015 |
+
.schema-justify-content-md-end {
|
1016 |
+
-ms-flex-pack: end !important;
|
1017 |
+
justify-content: flex-end !important;
|
1018 |
+
}
|
1019 |
+
.schema-justify-content-md-center {
|
1020 |
+
-ms-flex-pack: center !important;
|
1021 |
+
justify-content: center !important;
|
1022 |
+
}
|
1023 |
+
.schema-justify-content-md-between {
|
1024 |
+
-ms-flex-pack: justify !important;
|
1025 |
+
justify-content: space-between !important;
|
1026 |
+
}
|
1027 |
+
.schema-justify-content-md-around {
|
1028 |
+
-ms-flex-pack: distribute !important;
|
1029 |
+
justify-content: space-around !important;
|
1030 |
+
}
|
1031 |
+
.schema-align-items-md-start {
|
1032 |
+
-ms-flex-align: start !important;
|
1033 |
+
align-items: flex-start !important;
|
1034 |
+
}
|
1035 |
+
.schema-align-items-md-end {
|
1036 |
+
-ms-flex-align: end !important;
|
1037 |
+
align-items: flex-end !important;
|
1038 |
+
}
|
1039 |
+
.schema-align-items-md-center {
|
1040 |
+
-ms-flex-align: center !important;
|
1041 |
+
align-items: center !important;
|
1042 |
+
}
|
1043 |
+
.schema-align-items-md-baseline {
|
1044 |
+
-ms-flex-align: baseline !important;
|
1045 |
+
align-items: baseline !important;
|
1046 |
+
}
|
1047 |
+
.schema-align-items-md-stretch {
|
1048 |
+
-ms-flex-align: stretch !important;
|
1049 |
+
align-items: stretch !important;
|
1050 |
+
}
|
1051 |
+
.schema-align-content-md-start {
|
1052 |
+
-ms-flex-line-pack: start !important;
|
1053 |
+
align-content: flex-start !important;
|
1054 |
+
}
|
1055 |
+
.schema-align-content-md-end {
|
1056 |
+
-ms-flex-line-pack: end !important;
|
1057 |
+
align-content: flex-end !important;
|
1058 |
+
}
|
1059 |
+
.schema-align-content-md-center {
|
1060 |
+
-ms-flex-line-pack: center !important;
|
1061 |
+
align-content: center !important;
|
1062 |
+
}
|
1063 |
+
.schema-align-content-md-between {
|
1064 |
+
-ms-flex-line-pack: justify !important;
|
1065 |
+
align-content: space-between !important;
|
1066 |
+
}
|
1067 |
+
.schema-align-content-md-around {
|
1068 |
+
-ms-flex-line-pack: distribute !important;
|
1069 |
+
align-content: space-around !important;
|
1070 |
+
}
|
1071 |
+
.schema-align-content-md-stretch {
|
1072 |
+
-ms-flex-line-pack: stretch !important;
|
1073 |
+
align-content: stretch !important;
|
1074 |
+
}
|
1075 |
+
.schema-align-self-md-auto {
|
1076 |
+
-ms-flex-item-align: auto !important;
|
1077 |
+
align-self: auto !important;
|
1078 |
+
}
|
1079 |
+
.schema-align-self-md-start {
|
1080 |
+
-ms-flex-item-align: start !important;
|
1081 |
+
align-self: flex-start !important;
|
1082 |
+
}
|
1083 |
+
.schema-align-self-md-end {
|
1084 |
+
-ms-flex-item-align: end !important;
|
1085 |
+
align-self: flex-end !important;
|
1086 |
+
}
|
1087 |
+
.schema-align-self-md-center {
|
1088 |
+
-ms-flex-item-align: center !important;
|
1089 |
+
align-self: center !important;
|
1090 |
+
}
|
1091 |
+
.schema-align-self-md-baseline {
|
1092 |
+
-ms-flex-item-align: baseline !important;
|
1093 |
+
align-self: baseline !important;
|
1094 |
+
}
|
1095 |
+
.schema-align-self-md-stretch {
|
1096 |
+
-ms-flex-item-align: stretch !important;
|
1097 |
+
align-self: stretch !important;
|
1098 |
+
}
|
1099 |
+
}
|
1100 |
+
|
1101 |
+
@media (min-width: 992px) {
|
1102 |
+
.schema-flex-lg-row {
|
1103 |
+
-ms-flex-direction: row !important;
|
1104 |
+
flex-direction: row !important;
|
1105 |
+
}
|
1106 |
+
.schema-flex-lg-column {
|
1107 |
+
-ms-flex-direction: column !important;
|
1108 |
+
flex-direction: column !important;
|
1109 |
+
}
|
1110 |
+
.schema-flex-lg-row-reverse {
|
1111 |
+
-ms-flex-direction: row-reverse !important;
|
1112 |
+
flex-direction: row-reverse !important;
|
1113 |
+
}
|
1114 |
+
.schema-flex-lg-column-reverse {
|
1115 |
+
-ms-flex-direction: column-reverse !important;
|
1116 |
+
flex-direction: column-reverse !important;
|
1117 |
+
}
|
1118 |
+
.schema-flex-lg-wrap {
|
1119 |
+
-ms-flex-wrap: wrap !important;
|
1120 |
+
flex-wrap: wrap !important;
|
1121 |
+
}
|
1122 |
+
.schema-flex-lg-nowrap {
|
1123 |
+
-ms-flex-wrap: nowrap !important;
|
1124 |
+
flex-wrap: nowrap !important;
|
1125 |
+
}
|
1126 |
+
.schema-flex-lg-wrap-reverse {
|
1127 |
+
-ms-flex-wrap: wrap-reverse !important;
|
1128 |
+
flex-wrap: wrap-reverse !important;
|
1129 |
+
}
|
1130 |
+
.schema-justify-content-lg-start {
|
1131 |
+
-ms-flex-pack: start !important;
|
1132 |
+
justify-content: flex-start !important;
|
1133 |
+
}
|
1134 |
+
.schema-justify-content-lg-end {
|
1135 |
+
-ms-flex-pack: end !important;
|
1136 |
+
justify-content: flex-end !important;
|
1137 |
+
}
|
1138 |
+
.schema-justify-content-lg-center {
|
1139 |
+
-ms-flex-pack: center !important;
|
1140 |
+
justify-content: center !important;
|
1141 |
+
}
|
1142 |
+
.schema-justify-content-lg-between {
|
1143 |
+
-ms-flex-pack: justify !important;
|
1144 |
+
justify-content: space-between !important;
|
1145 |
+
}
|
1146 |
+
.schema-justify-content-lg-around {
|
1147 |
+
-ms-flex-pack: distribute !important;
|
1148 |
+
justify-content: space-around !important;
|
1149 |
+
}
|
1150 |
+
.schema-align-items-lg-start {
|
1151 |
+
-ms-flex-align: start !important;
|
1152 |
+
align-items: flex-start !important;
|
1153 |
+
}
|
1154 |
+
.schema-align-items-lg-end {
|
1155 |
+
-ms-flex-align: end !important;
|
1156 |
+
align-items: flex-end !important;
|
1157 |
+
}
|
1158 |
+
.schema-align-items-lg-center {
|
1159 |
+
-ms-flex-align: center !important;
|
1160 |
+
align-items: center !important;
|
1161 |
+
}
|
1162 |
+
.schema-align-items-lg-baseline {
|
1163 |
+
-ms-flex-align: baseline !important;
|
1164 |
+
align-items: baseline !important;
|
1165 |
+
}
|
1166 |
+
.schema-align-items-lg-stretch {
|
1167 |
+
-ms-flex-align: stretch !important;
|
1168 |
+
align-items: stretch !important;
|
1169 |
+
}
|
1170 |
+
.schema-align-content-lg-start {
|
1171 |
+
-ms-flex-line-pack: start !important;
|
1172 |
+
align-content: flex-start !important;
|
1173 |
+
}
|
1174 |
+
.schema-align-content-lg-end {
|
1175 |
+
-ms-flex-line-pack: end !important;
|
1176 |
+
align-content: flex-end !important;
|
1177 |
+
}
|
1178 |
+
.schema-align-content-lg-center {
|
1179 |
+
-ms-flex-line-pack: center !important;
|
1180 |
+
align-content: center !important;
|
1181 |
+
}
|
1182 |
+
.schema-align-content-lg-between {
|
1183 |
+
-ms-flex-line-pack: justify !important;
|
1184 |
+
align-content: space-between !important;
|
1185 |
+
}
|
1186 |
+
.schema-align-content-lg-around {
|
1187 |
+
-ms-flex-line-pack: distribute !important;
|
1188 |
+
align-content: space-around !important;
|
1189 |
+
}
|
1190 |
+
.schema-align-content-lg-stretch {
|
1191 |
+
-ms-flex-line-pack: stretch !important;
|
1192 |
+
align-content: stretch !important;
|
1193 |
+
}
|
1194 |
+
.schema-align-self-lg-auto {
|
1195 |
+
-ms-flex-item-align: auto !important;
|
1196 |
+
align-self: auto !important;
|
1197 |
+
}
|
1198 |
+
.schema-align-self-lg-start {
|
1199 |
+
-ms-flex-item-align: start !important;
|
1200 |
+
align-self: flex-start !important;
|
1201 |
+
}
|
1202 |
+
.schema-align-self-lg-end {
|
1203 |
+
-ms-flex-item-align: end !important;
|
1204 |
+
align-self: flex-end !important;
|
1205 |
+
}
|
1206 |
+
.schema-align-self-lg-center {
|
1207 |
+
-ms-flex-item-align: center !important;
|
1208 |
+
align-self: center !important;
|
1209 |
+
}
|
1210 |
+
.schema-align-self-lg-baseline {
|
1211 |
+
-ms-flex-item-align: baseline !important;
|
1212 |
+
align-self: baseline !important;
|
1213 |
+
}
|
1214 |
+
.schema-align-self-lg-stretch {
|
1215 |
+
-ms-flex-item-align: stretch !important;
|
1216 |
+
align-self: stretch !important;
|
1217 |
+
}
|
1218 |
+
}
|
1219 |
+
|
1220 |
+
@media (min-width: 1200px) {
|
1221 |
+
.schema-flex-xl-row {
|
1222 |
+
-ms-flex-direction: row !important;
|
1223 |
+
flex-direction: row !important;
|
1224 |
+
}
|
1225 |
+
.schema-flex-xl-column {
|
1226 |
+
-ms-flex-direction: column !important;
|
1227 |
+
flex-direction: column !important;
|
1228 |
+
}
|
1229 |
+
.schema-flex-xl-row-reverse {
|
1230 |
+
-ms-flex-direction: row-reverse !important;
|
1231 |
+
flex-direction: row-reverse !important;
|
1232 |
+
}
|
1233 |
+
.schema-flex-xl-column-reverse {
|
1234 |
+
-ms-flex-direction: column-reverse !important;
|
1235 |
+
flex-direction: column-reverse !important;
|
1236 |
+
}
|
1237 |
+
.schema-flex-xl-wrap {
|
1238 |
+
-ms-flex-wrap: wrap !important;
|
1239 |
+
flex-wrap: wrap !important;
|
1240 |
+
}
|
1241 |
+
.schema-flex-xl-nowrap {
|
1242 |
+
-ms-flex-wrap: nowrap !important;
|
1243 |
+
flex-wrap: nowrap !important;
|
1244 |
+
}
|
1245 |
+
.schema-flex-xl-wrap-reverse {
|
1246 |
+
-ms-flex-wrap: wrap-reverse !important;
|
1247 |
+
flex-wrap: wrap-reverse !important;
|
1248 |
+
}
|
1249 |
+
.schema-justify-content-xl-start {
|
1250 |
+
-ms-flex-pack: start !important;
|
1251 |
+
justify-content: flex-start !important;
|
1252 |
+
}
|
1253 |
+
.schema-justify-content-xl-end {
|
1254 |
+
-ms-flex-pack: end !important;
|
1255 |
+
justify-content: flex-end !important;
|
1256 |
+
}
|
1257 |
+
.schema-justify-content-xl-center {
|
1258 |
+
-ms-flex-pack: center !important;
|
1259 |
+
justify-content: center !important;
|
1260 |
+
}
|
1261 |
+
.schema-justify-content-xl-between {
|
1262 |
+
-ms-flex-pack: justify !important;
|
1263 |
+
justify-content: space-between !important;
|
1264 |
+
}
|
1265 |
+
.schema-justify-content-xl-around {
|
1266 |
+
-ms-flex-pack: distribute !important;
|
1267 |
+
justify-content: space-around !important;
|
1268 |
+
}
|
1269 |
+
.schema-align-items-xl-start {
|
1270 |
+
-ms-flex-align: start !important;
|
1271 |
+
align-items: flex-start !important;
|
1272 |
+
}
|
1273 |
+
.schema-align-items-xl-end {
|
1274 |
+
-ms-flex-align: end !important;
|
1275 |
+
align-items: flex-end !important;
|
1276 |
+
}
|
1277 |
+
.schema-align-items-xl-center {
|
1278 |
+
-ms-flex-align: center !important;
|
1279 |
+
align-items: center !important;
|
1280 |
+
}
|
1281 |
+
.schema-align-items-xl-baseline {
|
1282 |
+
-ms-flex-align: baseline !important;
|
1283 |
+
align-items: baseline !important;
|
1284 |
+
}
|
1285 |
+
.schema-align-items-xl-stretch {
|
1286 |
+
-ms-flex-align: stretch !important;
|
1287 |
+
align-items: stretch !important;
|
1288 |
+
}
|
1289 |
+
.schema-align-content-xl-start {
|
1290 |
+
-ms-flex-line-pack: start !important;
|
1291 |
+
align-content: flex-start !important;
|
1292 |
+
}
|
1293 |
+
.schema-align-content-xl-end {
|
1294 |
+
-ms-flex-line-pack: end !important;
|
1295 |
+
align-content: flex-end !important;
|
1296 |
+
}
|
1297 |
+
.schema-align-content-xl-center {
|
1298 |
+
-ms-flex-line-pack: center !important;
|
1299 |
+
align-content: center !important;
|
1300 |
+
}
|
1301 |
+
.schema-align-content-xl-between {
|
1302 |
+
-ms-flex-line-pack: justify !important;
|
1303 |
+
align-content: space-between !important;
|
1304 |
+
}
|
1305 |
+
.schema-align-content-xl-around {
|
1306 |
+
-ms-flex-line-pack: distribute !important;
|
1307 |
+
align-content: space-around !important;
|
1308 |
+
}
|
1309 |
+
.schema-align-content-xl-stretch {
|
1310 |
+
-ms-flex-line-pack: stretch !important;
|
1311 |
+
align-content: stretch !important;
|
1312 |
+
}
|
1313 |
+
.schema-align-self-xl-auto {
|
1314 |
+
-ms-flex-item-align: auto !important;
|
1315 |
+
align-self: auto !important;
|
1316 |
+
}
|
1317 |
+
.schema-align-self-xl-start {
|
1318 |
+
-ms-flex-item-align: start !important;
|
1319 |
+
align-self: flex-start !important;
|
1320 |
+
}
|
1321 |
+
.schema-align-self-xl-end {
|
1322 |
+
-ms-flex-item-align: end !important;
|
1323 |
+
align-self: flex-end !important;
|
1324 |
+
}
|
1325 |
+
.schema-align-self-xl-center {
|
1326 |
+
-ms-flex-item-align: center !important;
|
1327 |
+
align-self: center !important;
|
1328 |
+
}
|
1329 |
+
.schema-align-self-xl-baseline {
|
1330 |
+
-ms-flex-item-align: baseline !important;
|
1331 |
+
align-self: baseline !important;
|
1332 |
+
}
|
1333 |
+
.schema-align-self-xl-stretch {
|
1334 |
+
-ms-flex-item-align: stretch !important;
|
1335 |
+
align-self: stretch !important;
|
1336 |
+
}
|
1337 |
+
}
|
1338 |
+
|
1339 |
+
.schema-img {
|
1340 |
+
vertical-align: middle;
|
1341 |
+
border-style: none;
|
1342 |
+
}
|
1343 |
+
|
1344 |
+
.schema a,
|
1345 |
+
.schema area,
|
1346 |
+
.schema button,
|
1347 |
+
.schema [role="button"],
|
1348 |
+
.schema input,
|
1349 |
+
.schema label,
|
1350 |
+
.schema select,
|
1351 |
+
.schema summary,
|
1352 |
+
.schema textarea {
|
1353 |
+
-ms-touch-action: manipulation;
|
1354 |
+
touch-action: manipulation;
|
1355 |
+
}
|
1356 |
+
|
1357 |
+
.schema table {
|
1358 |
+
border-collapse: collapse;
|
1359 |
+
}
|
1360 |
+
|
1361 |
+
.schema caption {
|
1362 |
+
padding-top: 0.75rem;
|
1363 |
+
padding-bottom: 0.75rem;
|
1364 |
+
color: #868e96;
|
1365 |
+
text-align: left;
|
1366 |
+
caption-side: bottom;
|
1367 |
+
}
|
1368 |
+
|
1369 |
+
.schema th {
|
1370 |
+
text-align: left;
|
1371 |
+
}
|
1372 |
+
|
1373 |
+
.schema label {
|
1374 |
+
display: inline-block;
|
1375 |
+
margin-bottom: .5rem;
|
1376 |
+
}
|
1377 |
+
|
1378 |
+
.schema button:focus {
|
1379 |
+
outline: 1px dotted;
|
1380 |
+
outline: 5px auto -webkit-focus-ring-color;
|
1381 |
+
}
|
1382 |
+
|
1383 |
+
.schema input,
|
1384 |
+
.schema button,
|
1385 |
+
.schema select,
|
1386 |
+
.schema optgroup,
|
1387 |
+
.schema textarea {
|
1388 |
+
margin: 0;
|
1389 |
+
font-family: inherit;
|
1390 |
+
font-size: inherit;
|
1391 |
+
line-height: inherit;
|
1392 |
+
}
|
1393 |
+
|
1394 |
+
.schema button,
|
1395 |
+
.schema input {
|
1396 |
+
overflow: visible;
|
1397 |
+
}
|
1398 |
+
|
1399 |
+
.schema button,
|
1400 |
+
.schema select {
|
1401 |
+
text-transform: none;
|
1402 |
+
}
|
1403 |
+
|
1404 |
+
.schema button,
|
1405 |
+
.schema html [type="button"],
|
1406 |
+
.schema [type="reset"],
|
1407 |
+
.schema [type="submit"] {
|
1408 |
+
-webkit-appearance: button;
|
1409 |
+
}
|
1410 |
+
|
1411 |
+
.schema button::-moz-focus-inner,
|
1412 |
+
.schema [type="button"]::-moz-focus-inner,
|
1413 |
+
.schema [type="reset"]::-moz-focus-inner,
|
1414 |
+
.schema [type="submit"]::-moz-focus-inner {
|
1415 |
+
padding: 0;
|
1416 |
+
border-style: none;
|
1417 |
+
}
|
1418 |
+
|
1419 |
+
input[type="radio"],
|
1420 |
+
input[type="checkbox"] {
|
1421 |
+
box-sizing: border-box;
|
1422 |
+
padding: 0;
|
1423 |
+
}
|
1424 |
+
|
1425 |
+
.schema input[type="date"],
|
1426 |
+
.schema input[type="time"],
|
1427 |
+
.schema input[type="datetime-local"],
|
1428 |
+
.schema input[type="month"] {
|
1429 |
+
-webkit-appearance: listbox;
|
1430 |
+
}
|
1431 |
+
|
1432 |
+
.schema textarea {
|
1433 |
+
overflow: auto;
|
1434 |
+
resize: vertical;
|
1435 |
+
}
|
1436 |
+
|
1437 |
+
.schema fieldset {
|
1438 |
+
min-width: 0;
|
1439 |
+
padding: 0;
|
1440 |
+
margin: 0;
|
1441 |
+
border: 0;
|
1442 |
+
}
|
1443 |
+
|
1444 |
+
.schema legend {
|
1445 |
+
display: block;
|
1446 |
+
width: 100%;
|
1447 |
+
max-width: 100%;
|
1448 |
+
padding: 0;
|
1449 |
+
margin-bottom: .5rem;
|
1450 |
+
font-size: 1.5rem;
|
1451 |
+
line-height: inherit;
|
1452 |
+
color: inherit;
|
1453 |
+
white-space: normal;
|
1454 |
+
}
|
1455 |
+
|
1456 |
+
|
1457 |
+
|
1458 |
+
/* Table */
|
1459 |
+
|
1460 |
+
.schema-table {
|
1461 |
+
width: 100%;
|
1462 |
+
max-width: 100%;
|
1463 |
+
margin-bottom: 1rem;
|
1464 |
+
background-color: transparent;
|
1465 |
+
}
|
1466 |
+
|
1467 |
+
.schema-table th,
|
1468 |
+
.schema-table td {
|
1469 |
+
padding: 0.75rem;
|
1470 |
+
vertical-align: top;
|
1471 |
+
border-top: 1px solid #e9ecef;
|
1472 |
+
}
|
1473 |
+
|
1474 |
+
.schema-table thead th {
|
1475 |
+
vertical-align: bottom;
|
1476 |
+
border-bottom: 2px solid #e9ecef;
|
1477 |
+
}
|
1478 |
+
|
1479 |
+
.schema-table tbody + tbody {
|
1480 |
+
border-top: 2px solid #e9ecef;
|
1481 |
+
}
|
1482 |
+
|
1483 |
+
.schema-table .schema-table {
|
1484 |
+
background-color: #fff;
|
1485 |
+
}
|
1486 |
+
|
1487 |
+
.schema-table-sm th,
|
1488 |
+
.schema-table-sm td {
|
1489 |
+
padding: 0.3rem;
|
1490 |
+
}
|
1491 |
+
|
1492 |
+
.schema-table-bordered {
|
1493 |
+
border: 1px solid #e9ecef;
|
1494 |
+
}
|
1495 |
+
|
1496 |
+
.schema-table-bordered th,
|
1497 |
+
.schema-table-bordered td {
|
1498 |
+
border: 1px solid #e9ecef;
|
1499 |
+
}
|
1500 |
+
|
1501 |
+
.schema-table-bordered thead th,
|
1502 |
+
.schema-table-bordered thead td {
|
1503 |
+
border-bottom-width: 2px;
|
1504 |
+
}
|
1505 |
+
|
1506 |
+
.schema-table-striped tbody tr:nth-of-type(odd) {
|
1507 |
+
background-color: rgba(0, 0, 0, 0.05);
|
1508 |
+
}
|
1509 |
+
|
1510 |
+
.schema-table-hover tbody tr:hover {
|
1511 |
+
background-color: rgba(0, 0, 0, 0.075);
|
1512 |
+
}
|
1513 |
+
|
1514 |
+
.schema-table-primary,
|
1515 |
+
.schema-table-primary > th,
|
1516 |
+
.schema-table-primary > td {
|
1517 |
+
background-color: #b8daff;
|
1518 |
+
}
|
1519 |
+
|
1520 |
+
.schema-table-hover .schema-table-primary:hover {
|
1521 |
+
background-color: #9fcdff;
|
1522 |
+
}
|
1523 |
+
|
1524 |
+
.schema-table-hover .schema-table-primary:hover > td,
|
1525 |
+
.schema-table-hover .schema-table-primary:hover > th {
|
1526 |
+
background-color: #9fcdff;
|
1527 |
+
}
|
1528 |
+
|
1529 |
+
.schema-table-secondary,
|
1530 |
+
.schema-table-secondary > th,
|
1531 |
+
.schema-table-secondary > td {
|
1532 |
+
background-color: #dddfe2;
|
1533 |
+
}
|
1534 |
+
|
1535 |
+
.schema-table-hover .schema-table-secondary:hover {
|
1536 |
+
background-color: #cfd2d6;
|
1537 |
+
}
|
1538 |
+
|
1539 |
+
.schema-table-hover .schema-table-secondary:hover > td,
|
1540 |
+
.schema-table-hover .schema-table-secondary:hover > th {
|
1541 |
+
background-color: #cfd2d6;
|
1542 |
+
}
|
1543 |
+
|
1544 |
+
.schema-table-success,
|
1545 |
+
.schema-table-success > th,
|
1546 |
+
.schema-table-success > td {
|
1547 |
+
background-color: #c3e6cb;
|
1548 |
+
}
|
1549 |
+
|
1550 |
+
.schema-table-hover .schema-table-success:hover {
|
1551 |
+
background-color: #b1dfbb;
|
1552 |
+
}
|
1553 |
+
|
1554 |
+
.schema-table-hover .schema-table-success:hover > td,
|
1555 |
+
.schema-table-hover .schema-table-success:hover > th {
|
1556 |
+
background-color: #b1dfbb;
|
1557 |
+
}
|
1558 |
+
|
1559 |
+
.schema-table-info,
|
1560 |
+
.schema-table-info > th,
|
1561 |
+
.schema-table-info > td {
|
1562 |
+
background-color: #bee5eb;
|
1563 |
+
}
|
1564 |
+
|
1565 |
+
.schema-table-hover .schema-table-info:hover {
|
1566 |
+
background-color: #abdde5;
|
1567 |
+
}
|
1568 |
+
|
1569 |
+
.schema-table-hover .schema-table-info:hover > td,
|
1570 |
+
.schema-table-hover .schema-table-info:hover > th {
|
1571 |
+
background-color: #abdde5;
|
1572 |
+
}
|
1573 |
+
|
1574 |
+
.schema-table-warning,
|
1575 |
+
.schema-table-warning > th,
|
1576 |
+
.schema-table-warning > td {
|
1577 |
+
background-color: #ffeeba;
|
1578 |
+
}
|
1579 |
+
|
1580 |
+
.schema-table-hover .schema-table-warning:hover {
|
1581 |
+
background-color: #ffe8a1;
|
1582 |
+
}
|
1583 |
+
|
1584 |
+
.schema-table-hover .schema-table-warning:hover > td,
|
1585 |
+
.schema-table-hover .schema-table-warning:hover > th {
|
1586 |
+
background-color: #ffe8a1;
|
1587 |
+
}
|
1588 |
+
|
1589 |
+
.schema-table-danger,
|
1590 |
+
.schema-table-danger > th,
|
1591 |
+
.schema-table-danger > td {
|
1592 |
+
background-color: #f5c6cb;
|
1593 |
+
}
|
1594 |
+
|
1595 |
+
.schema-table-hover .schema-table-danger:hover {
|
1596 |
+
background-color: #f1b0b7;
|
1597 |
+
}
|
1598 |
+
|
1599 |
+
.schema-table-hover .schema-table-danger:hover > td,
|
1600 |
+
.schema-table-hover .schema-table-danger:hover > th {
|
1601 |
+
background-color: #f1b0b7;
|
1602 |
+
}
|
1603 |
+
|
1604 |
+
.schema-table-light,
|
1605 |
+
.schema-table-light > th,
|
1606 |
+
.schema-table-light > td {
|
1607 |
+
background-color: #fdfdfe;
|
1608 |
+
}
|
1609 |
+
|
1610 |
+
.schema-table-hover .schema-table-light:hover {
|
1611 |
+
background-color: #ececf6;
|
1612 |
+
}
|
1613 |
+
|
1614 |
+
.schema-table-hover .schema-table-light:hover > td,
|
1615 |
+
.schema-table-hover .schema-table-light:hover > th {
|
1616 |
+
background-color: #ececf6;
|
1617 |
+
}
|
1618 |
+
|
1619 |
+
.schema-table-dark,
|
1620 |
+
.schema-table-dark > th,
|
1621 |
+
.schema-table-dark > td {
|
1622 |
+
background-color: #c6c8ca;
|
1623 |
+
}
|
1624 |
+
|
1625 |
+
.schema-table-hover .schema-table-dark:hover {
|
1626 |
+
background-color: #b9bbbe;
|
1627 |
+
}
|
1628 |
+
|
1629 |
+
.schema-table-hover .schema-table-dark:hover > td,
|
1630 |
+
.schema-table-hover .schema-table-dark:hover > th {
|
1631 |
+
background-color: #b9bbbe;
|
1632 |
+
}
|
1633 |
+
|
1634 |
+
.schema-table-active,
|
1635 |
+
.schema-table-active > th,
|
1636 |
+
.schema-table-active > td {
|
1637 |
+
background-color: rgba(0, 0, 0, 0.075);
|
1638 |
+
}
|
1639 |
+
|
1640 |
+
.schema-table-hover .schema-table-active:hover {
|
1641 |
+
background-color: rgba(0, 0, 0, 0.075);
|
1642 |
+
}
|
1643 |
+
|
1644 |
+
.schema-table-hover .schema-table-active:hover > td,
|
1645 |
+
.schema-table-hover .schema-table-active:hover > th {
|
1646 |
+
background-color: rgba(0, 0, 0, 0.075);
|
1647 |
+
}
|
1648 |
+
|
1649 |
+
.thead-inverse th {
|
1650 |
+
color: #fff;
|
1651 |
+
background-color: #212529;
|
1652 |
+
}
|
1653 |
+
|
1654 |
+
.thead-default th {
|
1655 |
+
color: #495057;
|
1656 |
+
background-color: #e9ecef;
|
1657 |
+
}
|
1658 |
+
|
1659 |
+
.schema-table-inverse {
|
1660 |
+
color: #fff;
|
1661 |
+
background-color: #212529;
|
1662 |
+
}
|
1663 |
+
|
1664 |
+
.schema-table-inverse th,
|
1665 |
+
.schema-table-inverse td,
|
1666 |
+
.schema-table-inverse thead th {
|
1667 |
+
border-color: #32383e;
|
1668 |
+
}
|
1669 |
+
|
1670 |
+
.schema-table-inverse.schema-table-bordered {
|
1671 |
+
border: 0;
|
1672 |
+
}
|
1673 |
+
|
1674 |
+
.schema-table-inverse.schema-table-striped tbody tr:nth-of-type(odd) {
|
1675 |
+
background-color: rgba(255, 255, 255, 0.05);
|
1676 |
+
}
|
1677 |
+
|
1678 |
+
.schema-table-inverse.schema-table-hover tbody tr:hover {
|
1679 |
+
background-color: rgba(255, 255, 255, 0.075);
|
1680 |
+
}
|
1681 |
+
|
1682 |
+
@media (max-width: 991px) {
|
1683 |
+
.schema-table-responsive {
|
1684 |
+
display: block;
|
1685 |
+
width: 100%;
|
1686 |
+
overflow-x: auto;
|
1687 |
+
-ms-overflow-style: -ms-autohiding-scrollbar;
|
1688 |
+
}
|
1689 |
+
.schema-table-responsive.schema-table-bordered {
|
1690 |
+
border: 0;
|
1691 |
+
}
|
1692 |
+
}
|
1693 |
+
|
1694 |
+
.schema-form-control {
|
1695 |
+
display: block;
|
1696 |
+
width: 100%;
|
1697 |
+
padding: 0.5rem 0.75rem;
|
1698 |
+
/*font-size: 1rem;*/
|
1699 |
+
line-height: 1.25;
|
1700 |
+
color: #495057;
|
1701 |
+
background-color: #fff;
|
1702 |
+
background-image: none;
|
1703 |
+
background-clip: padding-box;
|
1704 |
+
border: 1px solid rgba(0, 0, 0, 0.15);
|
1705 |
+
border-radius: 0.25rem;
|
1706 |
+
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
|
1707 |
+
}
|
1708 |
+
|
1709 |
+
.schema-form-control::-ms-expand {
|
1710 |
+
background-color: transparent;
|
1711 |
+
border: 0;
|
1712 |
+
}
|
1713 |
+
|
1714 |
+
.schema-form-control:focus {
|
1715 |
+
color: #495057;
|
1716 |
+
background-color: #fff;
|
1717 |
+
border-color: #80bdff;
|
1718 |
+
outline: none;
|
1719 |
+
}
|
1720 |
+
|
1721 |
+
.schema-form-control::-webkit-input-placeholder {
|
1722 |
+
color: #868e96;
|
1723 |
+
opacity: 1;
|
1724 |
+
}
|
1725 |
+
|
1726 |
+
.schema-form-control:-ms-input-placeholder {
|
1727 |
+
color: #868e96;
|
1728 |
+
opacity: 1;
|
1729 |
+
}
|
1730 |
+
|
1731 |
+
.schema-form-control::placeholder {
|
1732 |
+
color: #868e96;
|
1733 |
+
opacity: 1;
|
1734 |
+
}
|
1735 |
+
|
1736 |
+
.schema-form-control:disabled, .schema-form-control[readonly] {
|
1737 |
+
background-color: #e9ecef;
|
1738 |
+
opacity: 1;
|
1739 |
+
}
|
1740 |
+
|
1741 |
+
select.schema-form-control:not([size]):not([multiple]) {
|
1742 |
+
height: calc(2.25rem + 2px);
|
1743 |
+
}
|
1744 |
+
|
1745 |
+
select.schema-form-control:focus::-ms-value {
|
1746 |
+
color: #495057;
|
1747 |
+
background-color: #fff;
|
1748 |
+
}
|
1749 |
+
|
1750 |
+
.schema-form-control-file,
|
1751 |
+
.schema-form-control-range {
|
1752 |
+
display: block;
|
1753 |
+
}
|
1754 |
+
|
1755 |
+
.schema-col-form-label {
|
1756 |
+
padding-top: calc(0.5rem - 1px * 2);
|
1757 |
+
padding-bottom: calc(0.5rem - 1px * 2);
|
1758 |
+
margin-bottom: 0;
|
1759 |
+
}
|
1760 |
+
|
1761 |
+
.schema-col-form-label-lg {
|
1762 |
+
padding-top: calc(0.5rem - 1px * 2);
|
1763 |
+
padding-bottom: calc(0.5rem - 1px * 2);
|
1764 |
+
font-size: 1.25rem;
|
1765 |
+
}
|
1766 |
+
|
1767 |
+
.schema-col-form-label-sm {
|
1768 |
+
padding-top: calc(0.25rem - 1px * 2);
|
1769 |
+
padding-bottom: calc(0.25rem - 1px * 2);
|
1770 |
+
font-size: 0.875rem;
|
1771 |
+
}
|
1772 |
+
|
1773 |
+
.schema-col-form-legend {
|
1774 |
+
padding-top: 0.5rem;
|
1775 |
+
padding-bottom: 0.5rem;
|
1776 |
+
margin-bottom: 0;
|
1777 |
+
font-size: 1rem;
|
1778 |
+
}
|
1779 |
+
|
1780 |
+
.schema-form-control-plaintext {
|
1781 |
+
padding-top: 0.5rem;
|
1782 |
+
padding-bottom: 0.5rem;
|
1783 |
+
margin-bottom: 0;
|
1784 |
+
line-height: 1.25;
|
1785 |
+
border: solid transparent;
|
1786 |
+
border-width: 1px 0;
|
1787 |
+
}
|
1788 |
+
|
1789 |
+
.schema-form-control-plaintext.schema-form-control-sm, .schema-input-group-sm > .schema-form-control-plaintext.schema-form-control,
|
1790 |
+
.schema-input-group-sm > .schema-form-control-plaintext.schema-input-group-addon,
|
1791 |
+
.schema-input-group-sm > .schema-input-group-btn > .schema-form-control-plaintext.schema-btn, .schema-form-control-plaintext.schema-form-control-lg, .schema-input-group-lg > .schema-form-control-plaintext.schema-form-control,
|
1792 |
+
.schema-input-group-lg > .schema-form-control-plaintext.schema-input-group-addon,
|
1793 |
+
.schema-input-group-lg > .schema-input-group-btn > .schema-form-control-plaintext.schema-btn {
|
1794 |
+
padding-right: 0;
|
1795 |
+
padding-left: 0;
|
1796 |
+
}
|
1797 |
+
|
1798 |
+
.schema-form-control-sm, .schema-input-group-sm > .schema-form-control,
|
1799 |
+
.schema-input-group-sm > .schema-input-group-addon,
|
1800 |
+
.schema-input-group-sm > .schema-input-group-btn > .schema-btn {
|
1801 |
+
padding: 0.25rem 0.5rem;
|
1802 |
+
font-size: 0.875rem;
|
1803 |
+
line-height: 1.5;
|
1804 |
+
border-radius: 0.2rem;
|
1805 |
+
}
|
1806 |
+
|
1807 |
+
select.schema-form-control-sm:not([size]):not([multiple]), .schema-input-group-sm > select.schema-form-control:not([size]):not([multiple]),
|
1808 |
+
.schema-input-group-sm > select.schema-input-group-addon:not([size]):not([multiple]),
|
1809 |
+
.schema-input-group-sm > .schema-input-group-btn > select.schema-btn:not([size]):not([multiple]) {
|
1810 |
+
height: calc(1.8125rem + 2px);
|
1811 |
+
}
|
1812 |
+
|
1813 |
+
.schema-form-control-lg, .schema-input-group-lg > .schema-form-control,
|
1814 |
+
.schema-input-group-lg > .schema-input-group-addon,
|
1815 |
+
.schema-input-group-lg > .schema-input-group-btn > .schema-btn {
|
1816 |
+
padding: 0.5rem 1rem;
|
1817 |
+
font-size: 1.25rem;
|
1818 |
+
line-height: 1.5;
|
1819 |
+
border-radius: 0.3rem;
|
1820 |
+
}
|
1821 |
+
|
1822 |
+
select.schema-form-control-lg:not([size]):not([multiple]), .schema-input-group-lg > select.schema-form-control:not([size]):not([multiple]),
|
1823 |
+
.schema-input-group-lg > select.schema-input-group-addon:not([size]):not([multiple]),
|
1824 |
+
.schema-input-group-lg > .schema-input-group-btn > select.schema-btn:not([size]):not([multiple]) {
|
1825 |
+
height: calc(2.3125rem + 2px);
|
1826 |
+
}
|
1827 |
+
|
1828 |
+
.schema-form-group {
|
1829 |
+
margin-bottom: 1rem;
|
1830 |
+
}
|
1831 |
+
|
1832 |
+
.schema-form-text {
|
1833 |
+
display: block;
|
1834 |
+
margin-top: 0.25rem;
|
1835 |
+
}
|
1836 |
+
|
1837 |
+
.schema-form-row {
|
1838 |
+
display: -ms-flexbox;
|
1839 |
+
display: flex;
|
1840 |
+
-ms-flex-wrap: wrap;
|
1841 |
+
flex-wrap: wrap;
|
1842 |
+
margin-right: -5px;
|
1843 |
+
margin-left: -5px;
|
1844 |
+
}
|
1845 |
+
|
1846 |
+
.schema-form-row > .schema-col,
|
1847 |
+
.schema-form-row > [class*="col-"] {
|
1848 |
+
padding-right: 5px;
|
1849 |
+
padding-left: 5px;
|
1850 |
+
}
|
1851 |
+
|
1852 |
+
.schema-form-check {
|
1853 |
+
position: relative;
|
1854 |
+
display: block;
|
1855 |
+
margin-bottom: 0.5rem;
|
1856 |
+
}
|
1857 |
+
|
1858 |
+
.schema-form-check.disabled .schema-form-check-label {
|
1859 |
+
color: #868e96;
|
1860 |
+
}
|
1861 |
+
|
1862 |
+
.schema-form-check-label {
|
1863 |
+
padding-left: 1.25rem;
|
1864 |
+
margin-bottom: 0;
|
1865 |
+
}
|
1866 |
+
|
1867 |
+
.schema-form-check-input {
|
1868 |
+
position: absolute;
|
1869 |
+
margin-top: 0.25rem;
|
1870 |
+
margin-left: -1.25rem;
|
1871 |
+
}
|
1872 |
+
|
1873 |
+
.schema-form-check-input:only-child {
|
1874 |
+
position: static;
|
1875 |
+
}
|
1876 |
+
|
1877 |
+
.schema-form-check-inline {
|
1878 |
+
display: inline-block;
|
1879 |
+
}
|
1880 |
+
|
1881 |
+
.schema-form-check-inline .schema-form-check-label {
|
1882 |
+
vertical-align: middle;
|
1883 |
+
}
|
1884 |
+
|
1885 |
+
.schema-form-check-inline + .schema-form-check-inline {
|
1886 |
+
margin-left: 0.75rem;
|
1887 |
+
}
|
1888 |
+
|
1889 |
+
.schema-invalid-feedback {
|
1890 |
+
display: none;
|
1891 |
+
margin-top: .25rem;
|
1892 |
+
font-size: .875rem;
|
1893 |
+
color: #dc3545;
|
1894 |
+
}
|
1895 |
+
|
1896 |
+
.schema-invalid-tooltip {
|
1897 |
+
position: absolute;
|
1898 |
+
top: 100%;
|
1899 |
+
z-index: 5;
|
1900 |
+
display: none;
|
1901 |
+
width: 250px;
|
1902 |
+
padding: .5rem;
|
1903 |
+
margin-top: .1rem;
|
1904 |
+
font-size: .875rem;
|
1905 |
+
line-height: 1;
|
1906 |
+
color: #fff;
|
1907 |
+
background-color: rgba(220, 53, 69, 0.8);
|
1908 |
+
border-radius: .2rem;
|
1909 |
+
}
|
1910 |
+
|
1911 |
+
.schema-was-validated .schema-form-control:valid, .schema-form-control.is-valid, .schema-was-validated
|
1912 |
+
.schema-custom-select:valid,
|
1913 |
+
.schema-custom-select.is-valid {
|
1914 |
+
border-color: #28a745;
|
1915 |
+
}
|
1916 |
+
|
1917 |
+
.schema-was-validated .schema-form-control:valid:focus, .schema-form-control.is-valid:focus, .schema-was-validated
|
1918 |
+
.schema-custom-select:valid:focus,
|
1919 |
+
.schema-custom-select.is-valid:focus {
|
1920 |
+
box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
|
1921 |
+
}
|
1922 |
+
|
1923 |
+
.schema-was-validated .schema-form-control:valid ~ .schema-invalid-feedback,
|
1924 |
+
.schema-was-validated .schema-form-control:valid ~ .schema-invalid-tooltip, .schema-form-control.is-valid ~ .schema-invalid-feedback,
|
1925 |
+
.schema-form-control.is-valid ~ .schema-invalid-tooltip, .schema-was-validated
|
1926 |
+
.schema-custom-select:valid ~ .schema-invalid-feedback,
|
1927 |
+
.schema-was-validated
|
1928 |
+
.schema-custom-select:valid ~ .schema-invalid-tooltip,
|
1929 |
+
.schema-custom-select.is-valid ~ .schema-invalid-feedback,
|
1930 |
+
.schema-custom-select.is-valid ~ .schema-invalid-tooltip {
|
1931 |
+
display: block;
|
1932 |
+
}
|
1933 |
+
|
1934 |
+
.schema-was-validated .schema-form-check-input:valid + .schema-form-check-label, .schema-form-check-input.is-valid + .schema-form-check-label {
|
1935 |
+
color: #28a745;
|
1936 |
+
}
|
1937 |
+
|
1938 |
+
.schema-was-validated .schema-custom-control-input:valid ~ .schema-custom-control-indicator, .schema-custom-control-input.is-valid ~ .schema-custom-control-indicator {
|
1939 |
+
background-color: rgba(40, 167, 69, 0.25);
|
1940 |
+
}
|
1941 |
+
|
1942 |
+
.schema-was-validated .schema-custom-control-input:valid ~ .schema-custom-control-description, .schema-custom-control-input.is-valid ~ .schema-custom-control-description {
|
1943 |
+
color: #28a745;
|
1944 |
+
}
|
1945 |
+
|
1946 |
+
.schema-was-validated .schema-custom-file-input:valid ~ .schema-custom-file-control, .schema-custom-file-input.is-valid ~ .schema-custom-file-control {
|
1947 |
+
border-color: #28a745;
|
1948 |
+
}
|
1949 |
+
|
1950 |
+
.schema-was-validated .schema-custom-file-input:valid ~ .schema-custom-file-control::before, .schema-custom-file-input.is-valid ~ .schema-custom-file-control::before {
|
1951 |
+
border-color: inherit;
|
1952 |
+
}
|
1953 |
+
|
1954 |
+
.schema-was-validated .schema-custom-file-input:valid:focus, .schema-custom-file-input.is-valid:focus {
|
1955 |
+
box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
|
1956 |
+
}
|
1957 |
+
|
1958 |
+
.schema-was-validated .schema-form-control:invalid, .schema-form-control.is-invalid, .schema-was-validated
|
1959 |
+
.schema-custom-select:invalid,
|
1960 |
+
.schema-custom-select.is-invalid {
|
1961 |
+
border-color: #dc3545;
|
1962 |
+
}
|
1963 |
+
|
1964 |
+
.schema-was-validated .schema-form-control:invalid:focus, .schema-form-control.is-invalid:focus, .schema-was-validated
|
1965 |
+
.schema-custom-select:invalid:focus,
|
1966 |
+
.schema-custom-select.is-invalid:focus {
|
1967 |
+
box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
|
1968 |
+
}
|
1969 |
+
|
1970 |
+
.schema-was-validated .schema-form-control:invalid ~ .schema-invalid-feedback,
|
1971 |
+
.schema-was-validated .schema-form-control:invalid ~ .schema-invalid-tooltip, .schema-form-control.is-invalid ~ .schema-invalid-feedback,
|
1972 |
+
.schema-form-control.is-invalid ~ .schema-invalid-tooltip, .schema-was-validated
|
1973 |
+
.schema-custom-select:invalid ~ .schema-invalid-feedback,
|
1974 |
+
.schema-was-validated
|
1975 |
+
.schema-custom-select:invalid ~ .schema-invalid-tooltip,
|
1976 |
+
.schema-custom-select.is-invalid ~ .schema-invalid-feedback,
|
1977 |
+
.schema-custom-select.is-invalid ~ .schema-invalid-tooltip {
|
1978 |
+
display: block;
|
1979 |
+
}
|
1980 |
+
|
1981 |
+
.schema-was-validated .schema-form-check-input:invalid + .schema-form-check-label, .schema-form-check-input.is-invalid + .schema-form-check-label {
|
1982 |
+
color: #dc3545;
|
1983 |
+
}
|
1984 |
+
|
1985 |
+
.schema-was-validated .schema-custom-control-input:invalid ~ .schema-custom-control-indicator, .schema-custom-control-input.is-invalid ~ .schema-custom-control-indicator {
|
1986 |
+
background-color: rgba(220, 53, 69, 0.25);
|
1987 |
+
}
|
1988 |
+
|
1989 |
+
.schema-was-validated .schema-custom-control-input:invalid ~ .schema-custom-control-description, .schema-custom-control-input.is-invalid ~ .schema-custom-control-description {
|
1990 |
+
color: #dc3545;
|
1991 |
+
}
|
1992 |
+
|
1993 |
+
.schema-was-validated .schema-custom-file-input:invalid ~ .schema-custom-file-control, .schema-custom-file-input.is-invalid ~ .schema-custom-file-control {
|
1994 |
+
border-color: #dc3545;
|
1995 |
+
}
|
1996 |
+
|
1997 |
+
.schema-was-validated .schema-custom-file-input:invalid ~ .schema-custom-file-control::before, .schema-custom-file-input.is-invalid ~ .schema-custom-file-control::before {
|
1998 |
+
border-color: inherit;
|
1999 |
+
}
|
2000 |
+
|
2001 |
+
.schema-was-validated .schema-custom-file-input:invalid:focus, .schema-custom-file-input.is-invalid:focus {
|
2002 |
+
box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
|
2003 |
+
}
|
2004 |
+
|
2005 |
+
.schema-form-inline {
|
2006 |
+
display: -ms-flexbox;
|
2007 |
+
display: flex;
|
2008 |
+
-ms-flex-flow: row wrap;
|
2009 |
+
flex-flow: row wrap;
|
2010 |
+
-ms-flex-align: center;
|
2011 |
+
align-items: center;
|
2012 |
+
}
|
2013 |
+
|
2014 |
+
.schema-form-inline .schema-form-check {
|
2015 |
+
width: 100%;
|
2016 |
+
}
|
2017 |
+
|
2018 |
+
@media (min-width: 576px) {
|
2019 |
+
.schema-form-inline label {
|
2020 |
+
display: -ms-flexbox;
|
2021 |
+
display: flex;
|
2022 |
+
-ms-flex-align: center;
|
2023 |
+
align-items: center;
|
2024 |
+
-ms-flex-pack: center;
|
2025 |
+
justify-content: center;
|
2026 |
+
margin-bottom: 0;
|
2027 |
+
}
|
2028 |
+
.schema-form-inline .schema-form-group {
|
2029 |
+
display: -ms-flexbox;
|
2030 |
+
display: flex;
|
2031 |
+
-ms-flex: 0 0 auto;
|
2032 |
+
flex: 0 0 auto;
|
2033 |
+
-ms-flex-flow: row wrap;
|
2034 |
+
flex-flow: row wrap;
|
2035 |
+
-ms-flex-align: center;
|
2036 |
+
align-items: center;
|
2037 |
+
margin-bottom: 0;
|
2038 |
+
}
|
2039 |
+
.schema-form-inline .schema-form-control {
|
2040 |
+
display: inline-block;
|
2041 |
+
width: auto;
|
2042 |
+
vertical-align: middle;
|
2043 |
+
}
|
2044 |
+
.schema-form-inline .schema-form-control-plaintext {
|
2045 |
+
display: inline-block;
|
2046 |
+
}
|
2047 |
+
.schema-form-inline .schema-input-group {
|
2048 |
+
width: auto;
|
2049 |
+
}
|
2050 |
+
.schema-form-inline .schema-form-control-label {
|
2051 |
+
margin-bottom: 0;
|
2052 |
+
vertical-align: middle;
|
2053 |
+
}
|
2054 |
+
.schema-form-inline .schema-form-check {
|
2055 |
+
display: -ms-flexbox;
|
2056 |
+
display: flex;
|
2057 |
+
-ms-flex-align: center;
|
2058 |
+
align-items: center;
|
2059 |
+
-ms-flex-pack: center;
|
2060 |
+
justify-content: center;
|
2061 |
+
width: auto;
|
2062 |
+
margin-top: 0;
|
2063 |
+
margin-bottom: 0;
|
2064 |
+
}
|
2065 |
+
.schema-form-inline .schema-form-check-label {
|
2066 |
+
padding-left: 0;
|
2067 |
+
}
|
2068 |
+
.schema-form-inline .schema-form-check-input {
|
2069 |
+
position: relative;
|
2070 |
+
margin-top: 0;
|
2071 |
+
margin-right: 0.25rem;
|
2072 |
+
margin-left: 0;
|
2073 |
+
}
|
2074 |
+
.schema-form-inline .schema-custom-control {
|
2075 |
+
display: -ms-flexbox;
|
2076 |
+
display: flex;
|
2077 |
+
-ms-flex-align: center;
|
2078 |
+
align-items: center;
|
2079 |
+
-ms-flex-pack: center;
|
2080 |
+
justify-content: center;
|
2081 |
+
padding-left: 0;
|
2082 |
+
}
|
2083 |
+
.schema-form-inline .schema-custom-control-indicator {
|
2084 |
+
position: static;
|
2085 |
+
display: inline-block;
|
2086 |
+
margin-right: 0.25rem;
|
2087 |
+
vertical-align: text-bottom;
|
2088 |
+
}
|
2089 |
+
.schema-form-inline .schema-has-feedback .schema-form-control-feedback {
|
2090 |
+
top: 0;
|
2091 |
+
}
|
2092 |
+
}
|
2093 |
+
|
2094 |
+
|
2095 |
+
|
2096 |
+
.schema-btn{display:inline-block;font-weight:400;line-height:1.25;text-align:center;white-space:nowrap;vertical-align:middle;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:1px solid transparent;padding:.5rem 1rem;font-size:1rem;border-radius:.25rem;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.schema-btn:focus,.schema-btn:hover{text-decoration:none}.schema-btn.focus,.schema-btn:focus{outline:0;-webkit-box-shadow:0 0 0 2px rgba(2,117,216,.25);box-shadow:0 0 0 2px rgba(2,117,216,.25)}.schema-btn.disabled,.schema-btn:disabled{cursor:not-allowed;opacity:.65}.schema-btn.active,.schema-btn:active{background-image:none}a.schema-btn.disabled,fieldset[disabled] a.schema-btn{pointer-events:none}.schema-btn-primary{color:#fff;background-color:#0275d8;border-color:#0275d8}.schema-btn-primary:hover{color:#fff;background-color:#025aa5;border-color:#01549b}.schema-btn-primary.focus,.schema-btn-primary:focus{-webkit-box-shadow:0 0 0 2px rgba(2,117,216,.5);box-shadow:0 0 0 2px rgba(2,117,216,.5)}.schema-btn-primary.disabled,.schema-btn-primary:disabled{background-color:#0275d8;border-color:#0275d8}.schema-btn-primary.active,.schema-btn-primary:active,.show>.schema-btn-primary.dropdown-toggle{color:#fff;background-color:#025aa5;background-image:none;border-color:#01549b}.schema-btn-secondary{color:#292b2c;background-color:#fff;border-color:#ccc}.schema-btn-secondary:hover{color:#292b2c;background-color:#e6e6e6;border-color:#adadad}.schema-btn-secondary.focus,.schema-btn-secondary:focus{-webkit-box-shadow:0 0 0 2px rgba(204,204,204,.5);box-shadow:0 0 0 2px rgba(204,204,204,.5)}.schema-btn-secondary.disabled,.schema-btn-secondary:disabled{background-color:#fff;border-color:#ccc}.schema-btn-secondary.active,.schema-btn-secondary:active,.show>.schema-btn-secondary.dropdown-toggle{color:#292b2c;background-color:#e6e6e6;background-image:none;border-color:#adadad}.schema-btn-info{color:#fff;background-color:#5bc0de;border-color:#5bc0de}.schema-btn-info:hover{color:#fff;background-color:#31b0d5;border-color:#2aabd2}.schema-btn-info.focus,.schema-btn-info:focus{-webkit-box-shadow:0 0 0 2px rgba(91,192,222,.5);box-shadow:0 0 0 2px rgba(91,192,222,.5)}.schema-btn-info.disabled,.schema-btn-info:disabled{background-color:#5bc0de;border-color:#5bc0de}.schema-btn-info.active,.schema-btn-info:active,.show>.schema-btn-info.dropdown-toggle{color:#fff;background-color:#31b0d5;background-image:none;border-color:#2aabd2}.schema-btn-success{color:#fff;background-color:#5cb85c;border-color:#5cb85c}.schema-btn-success:hover{color:#fff;background-color:#449d44;border-color:#419641}.schema-btn-success.focus,.schema-btn-success:focus{-webkit-box-shadow:0 0 0 2px rgba(92,184,92,.5);box-shadow:0 0 0 2px rgba(92,184,92,.5)}.schema-btn-success.disabled,.schema-btn-success:disabled{background-color:#5cb85c;border-color:#5cb85c}.schema-btn-success.active,.schema-btn-success:active,.show>.schema-btn-success.dropdown-toggle{color:#fff;background-color:#449d44;background-image:none;border-color:#419641}.schema-btn-warning{color:#fff;background-color:#f0ad4e;border-color:#f0ad4e}.schema-btn-warning:hover{color:#fff;background-color:#ec971f;border-color:#eb9316}.schema-btn-warning.focus,.schema-btn-warning:focus{-webkit-box-shadow:0 0 0 2px rgba(240,173,78,.5);box-shadow:0 0 0 2px rgba(240,173,78,.5)}.schema-btn-warning.disabled,.schema-btn-warning:disabled{background-color:#f0ad4e;border-color:#f0ad4e}.schema-btn-warning.active,.schema-btn-warning:active,.show>.schema-btn-warning.dropdown-toggle{color:#fff;background-color:#ec971f;background-image:none;border-color:#eb9316}.schema-btn-danger{color:#fff;background-color:#d9534f;border-color:#d9534f}.schema-btn-danger:hover{color:#fff;background-color:#c9302c;border-color:#c12e2a}.schema-btn-danger.focus,.schema-btn-danger:focus{-webkit-box-shadow:0 0 0 2px rgba(217,83,79,.5);box-shadow:0 0 0 2px rgba(217,83,79,.5)}.schema-btn-danger.disabled,.schema-btn-danger:disabled{background-color:#d9534f;border-color:#d9534f}.schema-btn-danger.active,.schema-btn-danger:active,.show>.schema-btn-danger.dropdown-toggle{color:#fff;background-color:#c9302c;background-image:none;border-color:#c12e2a}.schema-btn-outline-primary{color:#0275d8;background-image:none;background-color:transparent;border-color:#0275d8}.schema-btn-outline-primary:hover{color:#fff;background-color:#0275d8;border-color:#0275d8}.schema-btn-outline-primary.focus,.schema-btn-outline-primary:focus{-webkit-box-shadow:0 0 0 2px rgba(2,117,216,.5);box-shadow:0 0 0 2px rgba(2,117,216,.5)}.schema-btn-outline-primary.disabled,.schema-btn-outline-primary:disabled{color:#0275d8;background-color:transparent}.schema-btn-outline-primary.active,.schema-btn-outline-primary:active,.show>.schema-btn-outline-primary.dropdown-toggle{color:#fff;background-color:#0275d8;border-color:#0275d8}.schema-btn-outline-secondary{color:#ccc;background-image:none;background-color:transparent;border-color:#ccc}.schema-btn-outline-secondary:hover{color:#fff;background-color:#ccc;border-color:#ccc}.schema-btn-outline-secondary.focus,.schema-btn-outline-secondary:focus{-webkit-box-shadow:0 0 0 2px rgba(204,204,204,.5);box-shadow:0 0 0 2px rgba(204,204,204,.5)}.schema-btn-outline-secondary.disabled,.schema-btn-outline-secondary:disabled{color:#ccc;background-color:transparent}.schema-btn-outline-secondary.active,.schema-btn-outline-secondary:active,.show>.schema-btn-outline-secondary.dropdown-toggle{color:#fff;background-color:#ccc;border-color:#ccc}.schema-btn-outline-info{color:#5bc0de;background-image:none;background-color:transparent;border-color:#5bc0de}.schema-btn-outline-info:hover{color:#fff;background-color:#5bc0de;border-color:#5bc0de}.schema-btn-outline-info.focus,.schema-btn-outline-info:focus{-webkit-box-shadow:0 0 0 2px rgba(91,192,222,.5);box-shadow:0 0 0 2px rgba(91,192,222,.5)}.schema-btn-outline-info.disabled,.schema-btn-outline-info:disabled{color:#5bc0de;background-color:transparent}.schema-btn-outline-info.active,.schema-btn-outline-info:active,.show>.schema-btn-outline-info.dropdown-toggle{color:#fff;background-color:#5bc0de;border-color:#5bc0de}.schema-btn-outline-success{color:#5cb85c;background-image:none;background-color:transparent;border-color:#5cb85c}.schema-btn-outline-success:hover{color:#fff;background-color:#5cb85c;border-color:#5cb85c}.schema-btn-outline-success.focus,.schema-btn-outline-success:focus{-webkit-box-shadow:0 0 0 2px rgba(92,184,92,.5);box-shadow:0 0 0 2px rgba(92,184,92,.5)}.schema-btn-outline-success.disabled,.schema-btn-outline-success:disabled{color:#5cb85c;background-color:transparent}.schema-btn-outline-success.active,.schema-btn-outline-success:active,.show>.schema-btn-outline-success.dropdown-toggle{color:#fff;background-color:#5cb85c;border-color:#5cb85c}.schema-btn-outline-warning{color:#f0ad4e;background-image:none;background-color:transparent;border-color:#f0ad4e}.schema-btn-outline-warning:hover{color:#fff;background-color:#f0ad4e;border-color:#f0ad4e}.schema-btn-outline-warning.focus,.schema-btn-outline-warning:focus{-webkit-box-shadow:0 0 0 2px rgba(240,173,78,.5);box-shadow:0 0 0 2px rgba(240,173,78,.5)}.schema-btn-outline-warning.disabled,.schema-btn-outline-warning:disabled{color:#f0ad4e;background-color:transparent}.schema-btn-outline-warning.active,.schema-btn-outline-warning:active,.show>.schema-btn-outline-warning.dropdown-toggle{color:#fff;background-color:#f0ad4e;border-color:#f0ad4e}.schema-btn-outline-danger{color:#d9534f;background-image:none;background-color:transparent;border-color:#d9534f}.schema-btn-outline-danger:hover{color:#fff;background-color:#d9534f;border-color:#d9534f}.schema-btn-outline-danger.focus,.schema-btn-outline-danger:focus{-webkit-box-shadow:0 0 0 2px rgba(217,83,79,.5);box-shadow:0 0 0 2px rgba(217,83,79,.5)}.schema-btn-outline-danger.disabled,.schema-btn-outline-danger:disabled{color:#d9534f;background-color:transparent}.schema-btn-outline-danger.active,.schema-btn-outline-danger:active,.show>.schema-btn-outline-danger.dropdown-toggle{color:#fff;background-color:#d9534f;border-color:#d9534f}.schema-btn-link{font-weight:400;color:#0275d8;border-radius:0}.schema-btn-link,.schema-btn-link.active,.schema-btn-link:active,.schema-btn-link:disabled{background-color:transparent}.schema-btn-link,.schema-btn-link:active,.schema-btn-link:focus{border-color:transparent}.schema-btn-link:hover{border-color:transparent}.schema-btn-link:focus,.schema-btn-link:hover{color:#014c8c;text-decoration:underline;background-color:transparent}.schema-btn-link:disabled{color:#636c72}.schema-btn-link:disabled:focus,.schema-btn-link:disabled:hover{text-decoration:none}.schema-btn-group-lg>.schema-btn,.schema-btn-lg{padding:.75rem 1.5rem;font-size:1.25rem;border-radius:.3rem}.schema-btn-group-sm>.schema-btn,.schema-btn-sm{padding:.25rem .5rem;font-size:.875rem;border-radius:.2rem}.schema-btn-block{display:block;width:100%}.schema-btn-block+.schema-btn-block{margin-top:.5rem}input[type=button].schema-btn-block,input[type=reset].schema-btn-block,input[type=submit].schema-btn-block{width:100%}
|
2097 |
+
.schema-fade {
|
2098 |
+
opacity: 0;
|
2099 |
+
transition: opacity 0.15s linear;
|
2100 |
+
}
|
2101 |
+
|
2102 |
+
.schema-fade.schema-show {
|
2103 |
+
opacity: 1;
|
2104 |
+
}
|
2105 |
+
|
2106 |
+
.schema-collapse {
|
2107 |
+
display: none;
|
2108 |
+
}
|
2109 |
+
|
2110 |
+
.schema-collapse.schema-show {
|
2111 |
+
display: block;
|
2112 |
+
}
|
2113 |
+
|
2114 |
+
tr.schema-collapse.schema-show {
|
2115 |
+
display: table-row;
|
2116 |
+
}
|
2117 |
+
|
2118 |
+
tbody.schema-collapse.schema-show {
|
2119 |
+
display: table-row-group;
|
2120 |
+
}
|
2121 |
+
|
2122 |
+
.schema-collapsing {
|
2123 |
+
position: relative;
|
2124 |
+
height: 0;
|
2125 |
+
overflow: hidden;
|
2126 |
+
transition: height 0.35s ease;
|
2127 |
+
}
|
2128 |
+
|
2129 |
+
.schema-dropup,
|
2130 |
+
.schema-dropdown {
|
2131 |
+
position: relative;
|
2132 |
+
}
|
2133 |
+
|
2134 |
+
.schema-dropdown-toggle::after {
|
2135 |
+
display: inline-block;
|
2136 |
+
width: 0;
|
2137 |
+
height: 0;
|
2138 |
+
margin-left: 0.255em;
|
2139 |
+
vertical-align: 0.255em;
|
2140 |
+
content: "";
|
2141 |
+
border-top: 0.3em solid;
|
2142 |
+
border-right: 0.3em solid transparent;
|
2143 |
+
border-left: 0.3em solid transparent;
|
2144 |
+
}
|
2145 |
+
|
2146 |
+
.schema-dropdown-toggle:empty::after {
|
2147 |
+
margin-left: 0;
|
2148 |
+
}
|
2149 |
+
|
2150 |
+
.schema-dropup .schema-dropdown-menu {
|
2151 |
+
margin-top: 0;
|
2152 |
+
margin-bottom: 0.125rem;
|
2153 |
+
}
|
2154 |
+
|
2155 |
+
.schema-dropup .schema-dropdown-toggle::after {
|
2156 |
+
border-top: 0;
|
2157 |
+
border-bottom: 0.3em solid;
|
2158 |
+
}
|
2159 |
+
|
2160 |
+
.schema-dropdown-menu {
|
2161 |
+
position: absolute;
|
2162 |
+
top: 100%;
|
2163 |
+
left: 0;
|
2164 |
+
z-index: 1000;
|
2165 |
+
display: none;
|
2166 |
+
float: left;
|
2167 |
+
min-width: 10rem;
|
2168 |
+
padding: 0.5rem 0;
|
2169 |
+
margin: 0.125rem 0 0;
|
2170 |
+
font-size: 1rem;
|
2171 |
+
color: #212529;
|
2172 |
+
text-align: left;
|
2173 |
+
list-style: none;
|
2174 |
+
background-color: #fff;
|
2175 |
+
background-clip: padding-box;
|
2176 |
+
border: 1px solid rgba(0, 0, 0, 0.15);
|
2177 |
+
border-radius: 0.25rem;
|
2178 |
+
}
|
2179 |
+
|
2180 |
+
.schema-dropdown-divider {
|
2181 |
+
height: 0;
|
2182 |
+
margin: 0.5rem 0;
|
2183 |
+
overflow: hidden;
|
2184 |
+
border-top: 1px solid #e9ecef;
|
2185 |
+
}
|
2186 |
+
|
2187 |
+
.schema-dropdown-item {
|
2188 |
+
display: block;
|
2189 |
+
width: 100%;
|
2190 |
+
padding: 0.25rem 1.5rem;
|
2191 |
+
clear: both;
|
2192 |
+
font-weight: normal;
|
2193 |
+
color: #212529;
|
2194 |
+
text-align: inherit;
|
2195 |
+
white-space: nowrap;
|
2196 |
+
background: none;
|
2197 |
+
border: 0;
|
2198 |
+
}
|
2199 |
+
|
2200 |
+
.schema-dropdown-item:focus, .schema-dropdown-item:hover {
|
2201 |
+
color: #16181b;
|
2202 |
+
text-decoration: none;
|
2203 |
+
background-color: #f8f9fa;
|
2204 |
+
}
|
2205 |
+
|
2206 |
+
.schema-dropdown-item.active, .schema-dropdown-item:active {
|
2207 |
+
color: #fff;
|
2208 |
+
text-decoration: none;
|
2209 |
+
background-color: #007bff;
|
2210 |
+
}
|
2211 |
+
|
2212 |
+
.schema-dropdown-item.disabled, .schema-dropdown-item:disabled {
|
2213 |
+
color: #868e96;
|
2214 |
+
background-color: transparent;
|
2215 |
+
}
|
2216 |
+
|
2217 |
+
.schema-show > a {
|
2218 |
+
outline: 0;
|
2219 |
+
}
|
2220 |
+
|
2221 |
+
.schema-dropdown-menu.schema-show {
|
2222 |
+
display: block;
|
2223 |
+
}
|
2224 |
+
|
2225 |
+
.schema-dropdown-header {
|
2226 |
+
display: block;
|
2227 |
+
padding: 0.5rem 1.5rem;
|
2228 |
+
margin-bottom: 0;
|
2229 |
+
font-size: 0.875rem;
|
2230 |
+
color: #868e96;
|
2231 |
+
white-space: nowrap;
|
2232 |
+
}
|
2233 |
+
|
2234 |
+
.schema-btn-group,
|
2235 |
+
.schema-btn-group-vertical {
|
2236 |
+
position: relative;
|
2237 |
+
display: -ms-inline-flexbox;
|
2238 |
+
display: inline-flex;
|
2239 |
+
vertical-align: middle;
|
2240 |
+
}
|
2241 |
+
|
2242 |
+
.schema-btn-group > .schema-btn,
|
2243 |
+
.schema-btn-group-vertical > .schema-btn {
|
2244 |
+
position: relative;
|
2245 |
+
-ms-flex: 0 1 auto;
|
2246 |
+
flex: 0 1 auto;
|
2247 |
+
margin-bottom: 0;
|
2248 |
+
}
|
2249 |
+
|
2250 |
+
.schema-btn-group > .schema-btn:hover,
|
2251 |
+
.schema-btn-group-vertical > .schema-btn:hover {
|
2252 |
+
z-index: 2;
|
2253 |
+
}
|
2254 |
+
|
2255 |
+
.schema-btn-group > .schema-btn:focus, .schema-btn-group > .schema-btn:active, .schema-btn-group > .schema-btn.active,
|
2256 |
+
.schema-btn-group-vertical > .schema-btn:focus,
|
2257 |
+
.schema-btn-group-vertical > .schema-btn:active,
|
2258 |
+
.schema-btn-group-vertical > .schema-btn.active {
|
2259 |
+
z-index: 2;
|
2260 |
+
}
|
2261 |
+
|
2262 |
+
.schema-btn-group .schema-btn + .schema-btn,
|
2263 |
+
.schema-btn-group .schema-btn + .schema-btn-group,
|
2264 |
+
.schema-btn-group .schema-btn-group + .schema-btn,
|
2265 |
+
.schema-btn-group .schema-btn-group + .schema-btn-group,
|
2266 |
+
.schema-btn-group-vertical .schema-btn + .schema-btn,
|
2267 |
+
.schema-btn-group-vertical .schema-btn + .schema-btn-group,
|
2268 |
+
.schema-btn-group-vertical .schema-btn-group + .schema-btn,
|
2269 |
+
.schema-btn-group-vertical .schema-btn-group + .schema-btn-group {
|
2270 |
+
margin-left: -1px;
|
2271 |
+
}
|
2272 |
+
|
2273 |
+
.schema-btn-toolbar {
|
2274 |
+
display: -ms-flexbox;
|
2275 |
+
display: flex;
|
2276 |
+
-ms-flex-wrap: wrap;
|
2277 |
+
flex-wrap: wrap;
|
2278 |
+
-ms-flex-pack: start;
|
2279 |
+
justify-content: flex-start;
|
2280 |
+
}
|
2281 |
+
|
2282 |
+
.schema-btn-toolbar .schema-input-group {
|
2283 |
+
width: auto;
|
2284 |
+
}
|
2285 |
+
|
2286 |
+
.schema-btn-group > .schema-btn:not(:first-child):not(:last-child):not(.schema-dropdown-toggle) {
|
2287 |
+
border-radius: 0;
|
2288 |
+
}
|
2289 |
+
|
2290 |
+
.schema-btn-group > .schema-btn:first-child {
|
2291 |
+
margin-left: 0;
|
2292 |
+
}
|
2293 |
+
|
2294 |
+
.schema-btn-group > .schema-btn:first-child:not(:last-child):not(.schema-dropdown-toggle) {
|
2295 |
+
border-top-right-radius: 0;
|
2296 |
+
border-bottom-right-radius: 0;
|
2297 |
+
}
|
2298 |
+
|
2299 |
+
.schema-btn-group > .schema-btn:last-child:not(:first-child),
|
2300 |
+
.schema-btn-group > .schema-dropdown-toggle:not(:first-child) {
|
2301 |
+
border-top-left-radius: 0;
|
2302 |
+
border-bottom-left-radius: 0;
|
2303 |
+
}
|
2304 |
+
|
2305 |
+
.schema-btn-group > .schema-btn-group {
|
2306 |
+
float: left;
|
2307 |
+
}
|
2308 |
+
|
2309 |
+
.schema-btn-group > .schema-btn-group:not(:first-child):not(:last-child) > .schema-btn {
|
2310 |
+
border-radius: 0;
|
2311 |
+
}
|
2312 |
+
|
2313 |
+
.schema-btn-group > .schema-btn-group:first-child:not(:last-child) > .schema-btn:last-child,
|
2314 |
+
.schema-btn-group > .schema-btn-group:first-child:not(:last-child) > .schema-dropdown-toggle {
|
2315 |
+
border-top-right-radius: 0;
|
2316 |
+
border-bottom-right-radius: 0;
|
2317 |
+
}
|
2318 |
+
|
2319 |
+
.schema-btn-group > .schema-btn-group:last-child:not(:first-child) > .schema-btn:first-child {
|
2320 |
+
border-top-left-radius: 0;
|
2321 |
+
border-bottom-left-radius: 0;
|
2322 |
+
}
|
2323 |
+
|
2324 |
+
.schema-btn + .schema-dropdown-toggle-split {
|
2325 |
+
padding-right: 0.5625rem;
|
2326 |
+
padding-left: 0.5625rem;
|
2327 |
+
}
|
2328 |
+
|
2329 |
+
.schema-btn + .schema-dropdown-toggle-split::after {
|
2330 |
+
margin-left: 0;
|
2331 |
+
}
|
2332 |
+
|
2333 |
+
.schema-btn-sm + .schema-dropdown-toggle-split, .schema-btn-group-sm > .schema-btn + .schema-dropdown-toggle-split {
|
2334 |
+
padding-right: 0.375rem;
|
2335 |
+
padding-left: 0.375rem;
|
2336 |
+
}
|
2337 |
+
|
2338 |
+
.schema-btn-lg + .schema-dropdown-toggle-split, .schema-btn-group-lg > .schema-btn + .schema-dropdown-toggle-split {
|
2339 |
+
padding-right: 0.75rem;
|
2340 |
+
padding-left: 0.75rem;
|
2341 |
+
}
|
2342 |
+
|
2343 |
+
.schema-btn-group-vertical {
|
2344 |
+
display: -ms-inline-flexbox;
|
2345 |
+
display: inline-flex;
|
2346 |
+
-ms-flex-direction: column;
|
2347 |
+
flex-direction: column;
|
2348 |
+
-ms-flex-align: start;
|
2349 |
+
align-items: flex-start;
|
2350 |
+
-ms-flex-pack: center;
|
2351 |
+
justify-content: center;
|
2352 |
+
}
|
2353 |
+
|
2354 |
+
.schema-btn-group-vertical .schema-btn,
|
2355 |
+
.schema-btn-group-vertical .schema-btn-group {
|
2356 |
+
width: 100%;
|
2357 |
+
}
|
2358 |
+
|
2359 |
+
.schema-btn-group-vertical > .schema-btn + .schema-btn,
|
2360 |
+
.schema-btn-group-vertical > .schema-btn + .schema-btn-group,
|
2361 |
+
.schema-btn-group-vertical > .schema-btn-group + .schema-btn,
|
2362 |
+
.schema-btn-group-vertical > .schema-btn-group + .schema-btn-group {
|
2363 |
+
margin-top: -1px;
|
2364 |
+
margin-left: 0;
|
2365 |
+
}
|
2366 |
+
|
2367 |
+
.schema-btn-group-vertical > .schema-btn:not(:first-child):not(:last-child) {
|
2368 |
+
border-radius: 0;
|
2369 |
+
}
|
2370 |
+
|
2371 |
+
.schema-btn-group-vertical > .schema-btn:first-child:not(:last-child) {
|
2372 |
+
border-bottom-right-radius: 0;
|
2373 |
+
border-bottom-left-radius: 0;
|
2374 |
+
}
|
2375 |
+
|
2376 |
+
.schema-btn-group-vertical > .schema-btn:last-child:not(:first-child) {
|
2377 |
+
border-top-left-radius: 0;
|
2378 |
+
border-top-right-radius: 0;
|
2379 |
+
}
|
2380 |
+
|
2381 |
+
.schema-btn-group-vertical > .schema-btn-group:not(:first-child):not(:last-child) > .schema-btn {
|
2382 |
+
border-radius: 0;
|
2383 |
+
}
|
2384 |
+
|
2385 |
+
.schema-btn-group-vertical > .schema-btn-group:first-child:not(:last-child) > .schema-btn:last-child,
|
2386 |
+
.schema-btn-group-vertical > .schema-btn-group:first-child:not(:last-child) > .schema-dropdown-toggle {
|
2387 |
+
border-bottom-right-radius: 0;
|
2388 |
+
border-bottom-left-radius: 0;
|
2389 |
+
}
|
2390 |
+
|
2391 |
+
.schema-btn-group-vertical > .schema-btn-group:last-child:not(:first-child) > .schema-btn:first-child {
|
2392 |
+
border-top-left-radius: 0;
|
2393 |
+
border-top-right-radius: 0;
|
2394 |
+
}
|
2395 |
+
|
2396 |
+
.schema [data-toggle="buttons"] > .schema-btn input[type="radio"],
|
2397 |
+
.schema [data-toggle="buttons"] > .schema-btn input[type="checkbox"],
|
2398 |
+
.schema [data-toggle="buttons"] > .schema-btn-group > .schema-btn input[type="radio"],
|
2399 |
+
.schema [data-toggle="buttons"] > .schema-btn-group > .schema-btn input[type="checkbox"] {
|
2400 |
+
position: absolute;
|
2401 |
+
clip: rect(0, 0, 0, 0);
|
2402 |
+
pointer-events: none;
|
2403 |
+
}
|
2404 |
+
|
2405 |
+
.schema-input-group {
|
2406 |
+
position: relative;
|
2407 |
+
display: -ms-flexbox;
|
2408 |
+
display: flex;
|
2409 |
+
width: 100%;
|
2410 |
+
}
|
2411 |
+
|
2412 |
+
.schema-input-group .schema-form-control {
|
2413 |
+
position: relative;
|
2414 |
+
z-index: 2;
|
2415 |
+
-ms-flex: 1 1 auto;
|
2416 |
+
flex: 1 1 auto;
|
2417 |
+
width: 1%;
|
2418 |
+
margin-bottom: 0;
|
2419 |
+
}
|
2420 |
+
|
2421 |
+
.schema-input-group .schema-form-control:focus, .schema-input-group .schema-form-control:active, .schema-input-group .schema-form-control:hover {
|
2422 |
+
z-index: 3;
|
2423 |
+
}
|
2424 |
+
|
2425 |
+
.schema-input-group-addon,
|
2426 |
+
.schema-input-group-btn,
|
2427 |
+
.schema-input-group .schema-form-control {
|
2428 |
+
display: -ms-flexbox;
|
2429 |
+
display: flex;
|
2430 |
+
-ms-flex-align: center;
|
2431 |
+
align-items: center;
|
2432 |
+
}
|
2433 |
+
|
2434 |
+
.schema-input-group-addon:not(:first-child):not(:last-child),
|
2435 |
+
.schema-input-group-btn:not(:first-child):not(:last-child),
|
2436 |
+
.schema-input-group .schema-form-control:not(:first-child):not(:last-child) {
|
2437 |
+
border-radius: 0;
|
2438 |
+
}
|
2439 |
+
|
2440 |
+
.schema-input-group-addon,
|
2441 |
+
.schema-input-group-btn {
|
2442 |
+
white-space: nowrap;
|
2443 |
+
vertical-align: middle;
|
2444 |
+
}
|
2445 |
+
|
2446 |
+
.schema-input-group-addon {
|
2447 |
+
padding: 0.5rem 0.75rem;
|
2448 |
+
margin-bottom: 0;
|
2449 |
+
font-size: 1rem;
|
2450 |
+
font-weight: normal;
|
2451 |
+
line-height: 1.25;
|
2452 |
+
color: #495057;
|
2453 |
+
text-align: center;
|
2454 |
+
background-color: #e9ecef;
|
2455 |
+
border: 1px solid rgba(0, 0, 0, 0.15);
|
2456 |
+
border-radius: 0.25rem;
|
2457 |
+
}
|
2458 |
+
|
2459 |
+
.schema-input-group-addon.schema-form-control-sm,
|
2460 |
+
.schema-input-group-sm > .schema-input-group-addon,
|
2461 |
+
.schema-input-group-sm > .schema-input-group-btn > .schema-input-group-addon.schema-btn {
|
2462 |
+
padding: 0.25rem 0.5rem;
|
2463 |
+
font-size: 0.875rem;
|
2464 |
+
border-radius: 0.2rem;
|
2465 |
+
}
|
2466 |
+
|
2467 |
+
.schema-input-group-addon.schema-form-control-lg,
|
2468 |
+
.schema-input-group-lg > .schema-input-group-addon,
|
2469 |
+
.schema-input-group-lg > .schema-input-group-btn > .schema-input-group-addon.schema-btn {
|
2470 |
+
padding: 0.5rem 1rem;
|
2471 |
+
font-size: 1.25rem;
|
2472 |
+
border-radius: 0.3rem;
|
2473 |
+
}
|
2474 |
+
|
2475 |
+
.schema-input-group-addon input[type="radio"],
|
2476 |
+
.schema-input-group-addon input[type="checkbox"] {
|
2477 |
+
margin-top: 0;
|
2478 |
+
}
|
2479 |
+
|
2480 |
+
.schema-input-group .schema-form-control:not(:last-child),
|
2481 |
+
.schema-input-group-addon:not(:last-child),
|
2482 |
+
.schema-input-group-btn:not(:last-child) > .schema-btn,
|
2483 |
+
.schema-input-group-btn:not(:last-child) > .schema-btn-group > .schema-btn,
|
2484 |
+
.schema-input-group-btn:not(:last-child) > .schema-dropdown-toggle,
|
2485 |
+
.schema-input-group-btn:not(:first-child) > .schema-btn:not(:last-child):not(.schema-dropdown-toggle),
|
2486 |
+
.schema-input-group-btn:not(:first-child) > .schema-btn-group:not(:last-child) > .schema-btn {
|
2487 |
+
border-top-right-radius: 0;
|
2488 |
+
border-bottom-right-radius: 0;
|
2489 |
+
}
|
2490 |
+
|
2491 |
+
.schema-input-group-addon:not(:last-child) {
|
2492 |
+
border-right: 0;
|
2493 |
+
}
|
2494 |
+
|
2495 |
+
.schema-input-group-addon {
|
2496 |
+
vertical-align:top;
|
2497 |
+
display: inline-block;
|
2498 |
+
}
|
2499 |
+
|
2500 |
+
.schema-input-group .schema-form-control:not(:first-child),
|
2501 |
+
.schema-input-group-addon:not(:first-child),
|
2502 |
+
.schema-input-group-btn:not(:first-child) > .schema-btn,
|
2503 |
+
.schema-input-group-btn:not(:first-child) > .schema-btn-group > .schema-btn,
|
2504 |
+
.schema-input-group-btn:not(:first-child) > .schema-dropdown-toggle,
|
2505 |
+
.schema-input-group-btn:not(:last-child) > .schema-btn:not(:first-child),
|
2506 |
+
.schema-input-group-btn:not(:last-child) > .schema-btn-group:not(:first-child) > .schema-btn {
|
2507 |
+
border-top-left-radius: 0;
|
2508 |
+
border-bottom-left-radius: 0;
|
2509 |
+
}
|
2510 |
+
|
2511 |
+
.schema-form-control + .schema-input-group-addon:not(:first-child) {
|
2512 |
+
border-left: 0;
|
2513 |
+
}
|
2514 |
+
|
2515 |
+
.schema-input-group-btn {
|
2516 |
+
position: relative;
|
2517 |
+
font-size: 0;
|
2518 |
+
white-space: nowrap;
|
2519 |
+
}
|
2520 |
+
|
2521 |
+
.schema-input-group-btn > .schema-btn {
|
2522 |
+
position: relative;
|
2523 |
+
}
|
2524 |
+
|
2525 |
+
.schema-input-group-btn > .schema-btn + .schema-btn {
|
2526 |
+
margin-left: -1px;
|
2527 |
+
}
|
2528 |
+
|
2529 |
+
.schema-input-group-btn > .schema-btn:focus, .schema-input-group-btn > .schema-btn:active, .schema-input-group-btn > .schema-btn:hover {
|
2530 |
+
z-index: 3;
|
2531 |
+
}
|
2532 |
+
|
2533 |
+
.schema-input-group-btn:not(:last-child) > .schema-btn,
|
2534 |
+
.schema-input-group-btn:not(:last-child) > .schema-btn-group {
|
2535 |
+
margin-right: -1px;
|
2536 |
+
}
|
2537 |
+
|
2538 |
+
.schema-input-group-btn:not(:first-child) > .schema-btn,
|
2539 |
+
.schema-input-group-btn:not(:first-child) > .schema-btn-group {
|
2540 |
+
z-index: 2;
|
2541 |
+
margin-left: -1px;
|
2542 |
+
}
|
2543 |
+
|
2544 |
+
.schema-input-group-btn:not(:first-child) > .schema-btn:focus, .schema-input-group-btn:not(:first-child) > .schema-btn:active, .schema-input-group-btn:not(:first-child) > .schema-btn:hover,
|
2545 |
+
.schema-input-group-btn:not(:first-child) > .schema-btn-group:focus,
|
2546 |
+
.schema-input-group-btn:not(:first-child) > .schema-btn-group:active,
|
2547 |
+
.schema-input-group-btn:not(:first-child) > .schema-btn-group:hover {
|
2548 |
+
z-index: 3;
|
2549 |
+
}
|
2550 |
+
|
2551 |
+
.schema-custom-control {
|
2552 |
+
position: relative;
|
2553 |
+
display: -ms-inline-flexbox;
|
2554 |
+
display: inline-flex;
|
2555 |
+
min-height: 1.5rem;
|
2556 |
+
padding-left: 1.5rem;
|
2557 |
+
margin-right: 1rem;
|
2558 |
+
}
|
2559 |
+
|
2560 |
+
.schema-custom-control-input {
|
2561 |
+
position: absolute;
|
2562 |
+
z-index: -1;
|
2563 |
+
opacity: 0;
|
2564 |
+
}
|
2565 |
+
|
2566 |
+
.schema-custom-control-input:checked ~ .schema-custom-control-indicator {
|
2567 |
+
color: #fff;
|
2568 |
+
background-color: #007bff;
|
2569 |
+
}
|
2570 |
+
|
2571 |
+
.schema-custom-control-input:focus ~ .schema-custom-control-indicator {
|
2572 |
+
box-shadow: 0 0 0 1px #fff, 0 0 0 3px #007bff;
|
2573 |
+
}
|
2574 |
+
|
2575 |
+
.schema-custom-control-input:active ~ .schema-custom-control-indicator {
|
2576 |
+
color: #fff;
|
2577 |
+
background-color: #b3d7ff;
|
2578 |
+
}
|
2579 |
+
|
2580 |
+
.schema-custom-control-input:disabled ~ .schema-custom-control-indicator {
|
2581 |
+
background-color: #e9ecef;
|
2582 |
+
}
|
2583 |
+
|
2584 |
+
.schema-custom-control-input:disabled ~ .schema-custom-control-description {
|
2585 |
+
color: #868e96;
|
2586 |
+
}
|
2587 |
+
|
2588 |
+
.schema-custom-control-indicator {
|
2589 |
+
position: absolute;
|
2590 |
+
top: 0.25rem;
|
2591 |
+
left: 0;
|
2592 |
+
display: block;
|
2593 |
+
width: 1rem;
|
2594 |
+
height: 1rem;
|
2595 |
+
pointer-events: none;
|
2596 |
+
-webkit-user-select: none;
|
2597 |
+
-moz-user-select: none;
|
2598 |
+
-ms-user-select: none;
|
2599 |
+
user-select: none;
|
2600 |
+
background-color: #ddd;
|
2601 |
+
background-repeat: no-repeat;
|
2602 |
+
background-position: center center;
|
2603 |
+
background-size: 50% 50%;
|
2604 |
+
}
|
2605 |
+
|
2606 |
+
.schema-custom-checkbox .schema-custom-control-indicator {
|
2607 |
+
border-radius: 0.25rem;
|
2608 |
+
}
|
2609 |
+
|
2610 |
+
.schema-custom-checkbox .schema-custom-control-input:checked ~ .schema-custom-control-indicator {
|
2611 |
+
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z'/%3E%3C/svg%3E");
|
2612 |
+
}
|
2613 |
+
|
2614 |
+
.schema-custom-checkbox .schema-custom-control-input:indeterminate ~ .schema-custom-control-indicator {
|
2615 |
+
background-color: #007bff;
|
2616 |
+
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 4'%3E%3Cpath stroke='%23fff' d='M0 2h4'/%3E%3C/svg%3E");
|
2617 |
+
}
|
2618 |
+
|
2619 |
+
.schema-custom-radio .schema-custom-control-indicator {
|
2620 |
+
border-radius: 50%;
|
2621 |
+
}
|
2622 |
+
|
2623 |
+
.schema-custom-radio .schema-custom-control-input:checked ~ .schema-custom-control-indicator {
|
2624 |
+
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3E%3Ccircle r='3' fill='%23fff'/%3E%3C/svg%3E");
|
2625 |
+
}
|
2626 |
+
|
2627 |
+
.schema-custom-controls-stacked {
|
2628 |
+
display: -ms-flexbox;
|
2629 |
+
display: flex;
|
2630 |
+
-ms-flex-direction: column;
|
2631 |
+
flex-direction: column;
|
2632 |
+
}
|
2633 |
+
|
2634 |
+
.schema-custom-controls-stacked .schema-custom-control {
|
2635 |
+
margin-bottom: 0.25rem;
|
2636 |
+
}
|
2637 |
+
|
2638 |
+
.schema-custom-controls-stacked .schema-custom-control + .schema-custom-control {
|
2639 |
+
margin-left: 0;
|
2640 |
+
}
|
2641 |
+
|
2642 |
+
.schema-custom-select {
|
2643 |
+
display: inline-block;
|
2644 |
+
max-width: 100%;
|
2645 |
+
height: calc(2.25rem + 2px);
|
2646 |
+
padding: 0.375rem 1.75rem 0.375rem 0.75rem;
|
2647 |
+
line-height: 1.25;
|
2648 |
+
color: #495057;
|
2649 |
+
vertical-align: middle;
|
2650 |
+
background: #fff url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23333' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
|
2651 |
+
background-size: 8px 10px;
|
2652 |
+
border: 1px solid rgba(0, 0, 0, 0.15);
|
2653 |
+
border-radius: 0.25rem;
|
2654 |
+
-webkit-appearance: none;
|
2655 |
+
-moz-appearance: none;
|
2656 |
+
appearance: none;
|
2657 |
+
}
|
2658 |
+
|
2659 |
+
.schema-custom-select:focus {
|
2660 |
+
border-color: #80bdff;
|
2661 |
+
outline: none;
|
2662 |
+
}
|
2663 |
+
|
2664 |
+
.schema-custom-select:focus::-ms-value {
|
2665 |
+
color: #495057;
|
2666 |
+
background-color: #fff;
|
2667 |
+
}
|
2668 |
+
|
2669 |
+
.schema-custom-select:disabled {
|
2670 |
+
color: #868e96;
|
2671 |
+
background-color: #e9ecef;
|
2672 |
+
}
|
2673 |
+
|
2674 |
+
.schema-custom-select::-ms-expand {
|
2675 |
+
opacity: 0;
|
2676 |
+
}
|
2677 |
+
|
2678 |
+
.schema-custom-select-sm {
|
2679 |
+
height: calc(1.8125rem + 2px);
|
2680 |
+
padding-top: 0.375rem;
|
2681 |
+
padding-bottom: 0.375rem;
|
2682 |
+
font-size: 75%;
|
2683 |
+
}
|
2684 |
+
|
2685 |
+
.schema-custom-file {
|
2686 |
+
position: relative;
|
2687 |
+
display: inline-block;
|
2688 |
+
max-width: 100%;
|
2689 |
+
height: 2.5rem;
|
2690 |
+
margin-bottom: 0;
|
2691 |
+
}
|
2692 |
+
|
2693 |
+
.schema-custom-file-input {
|
2694 |
+
min-width: 14rem;
|
2695 |
+
max-width: 100%;
|
2696 |
+
height: 2.5rem;
|
2697 |
+
margin: 0;
|
2698 |
+
opacity: 0;
|
2699 |
+
}
|
2700 |
+
|
2701 |
+
.schema-custom-file-control {
|
2702 |
+
position: absolute;
|
2703 |
+
top: 0;
|
2704 |
+
right: 0;
|
2705 |
+
left: 0;
|
2706 |
+
z-index: 5;
|
2707 |
+
height: 2.5rem;
|
2708 |
+
padding: 0.5rem 1rem;
|
2709 |
+
line-height: 1.5;
|
2710 |
+
color: #495057;
|
2711 |
+
pointer-events: none;
|
2712 |
+
-webkit-user-select: none;
|
2713 |
+
-moz-user-select: none;
|
2714 |
+
-ms-user-select: none;
|
2715 |
+
user-select: none;
|
2716 |
+
background-color: #fff;
|
2717 |
+
border: 1px solid rgba(0, 0, 0, 0.15);
|
2718 |
+
border-radius: 0.25rem;
|
2719 |
+
}
|
2720 |
+
|
2721 |
+
.schema-custom-file-control:lang(en):empty::after {
|
2722 |
+
content: "Choose file...";
|
2723 |
+
}
|
2724 |
+
|
2725 |
+
.schema-custom-file-control::before {
|
2726 |
+
position: absolute;
|
2727 |
+
top: -1px;
|
2728 |
+
right: -1px;
|
2729 |
+
bottom: -1px;
|
2730 |
+
z-index: 6;
|
2731 |
+
display: block;
|
2732 |
+
height: 2.5rem;
|
2733 |
+
padding: 0.5rem 1rem;
|
2734 |
+
line-height: 1.5;
|
2735 |
+
color: #495057;
|
2736 |
+
background-color: #e9ecef;
|
2737 |
+
border: 1px solid rgba(0, 0, 0, 0.15);
|
2738 |
+
border-radius: 0 0.25rem 0.25rem 0;
|
2739 |
+
}
|
2740 |
+
|
2741 |
+
.schema-custom-file-control:lang(en)::before {
|
2742 |
+
content: "Browse";
|
2743 |
+
}
|
2744 |
+
|
2745 |
+
|
2746 |
+
.schema-modal-open {
|
2747 |
+
overflow: hidden;
|
2748 |
+
}
|
2749 |
+
|
2750 |
+
.schema-modal {
|
2751 |
+
position: fixed;
|
2752 |
+
top: 0;
|
2753 |
+
right: 0;
|
2754 |
+
bottom: 0;
|
2755 |
+
left: 0;
|
2756 |
+
z-index: 1050;
|
2757 |
+
display: none;
|
2758 |
+
overflow: hidden;
|
2759 |
+
outline: 0;
|
2760 |
+
}
|
2761 |
+
|
2762 |
+
.schema-modal.fade .schema-modal-dialog {
|
2763 |
+
transition: -webkit-transform 0.3s ease-out;
|
2764 |
+
transition: transform 0.3s ease-out;
|
2765 |
+
transition: transform 0.3s ease-out, -webkit-transform 0.3s ease-out;
|
2766 |
+
-webkit-transform: translate(0, -25%);
|
2767 |
+
transform: translate(0, -25%);
|
2768 |
+
}
|
2769 |
+
|
2770 |
+
.schema-modal.show .schema-modal-dialog {
|
2771 |
+
-webkit-transform: translate(0, 0);
|
2772 |
+
transform: translate(0, 0);
|
2773 |
+
}
|
2774 |
+
|
2775 |
+
.schema-modal-open .schema-modal {
|
2776 |
+
overflow-x: hidden;
|
2777 |
+
overflow-y: auto;
|
2778 |
+
}
|
2779 |
+
|
2780 |
+
.schema-modal-dialog {
|
2781 |
+
position: relative;
|
2782 |
+
width: auto;
|
2783 |
+
margin: 10px;
|
2784 |
+
}
|
2785 |
+
|
2786 |
+
.schema-modal-content {
|
2787 |
+
position: relative;
|
2788 |
+
display: -ms-flexbox;
|
2789 |
+
display: flex;
|
2790 |
+
-ms-flex-direction: column;
|
2791 |
+
flex-direction: column;
|
2792 |
+
background-color: #fff;
|
2793 |
+
background-clip: padding-box;
|
2794 |
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
2795 |
+
border-radius: 0.3rem;
|
2796 |
+
outline: 0;
|
2797 |
+
}
|
2798 |
+
|
2799 |
+
.schema-modal-backdrop {
|
2800 |
+
position: fixed;
|
2801 |
+
top: 0;
|
2802 |
+
right: 0;
|
2803 |
+
bottom: 0;
|
2804 |
+
left: 0;
|
2805 |
+
z-index: 1040;
|
2806 |
+
background-color: #000;
|
2807 |
+
}
|
2808 |
+
|
2809 |
+
.schema-modal-backdrop.fade {
|
2810 |
+
opacity: 0;
|
2811 |
+
}
|
2812 |
+
|
2813 |
+
.schema-modal-backdrop.show {
|
2814 |
+
opacity: 0.5;
|
2815 |
+
}
|
2816 |
+
|
2817 |
+
.schema-modal-header {
|
2818 |
+
display: -ms-flexbox;
|
2819 |
+
display: flex;
|
2820 |
+
-ms-flex-align: center;
|
2821 |
+
align-items: center;
|
2822 |
+
-ms-flex-pack: justify;
|
2823 |
+
justify-content: space-between;
|
2824 |
+
padding: 15px;
|
2825 |
+
border-bottom: 1px solid #e9ecef;
|
2826 |
+
}
|
2827 |
+
|
2828 |
+
.schema-modal-title {
|
2829 |
+
margin-bottom: 0;
|
2830 |
+
line-height: 1.5;
|
2831 |
+
}
|
2832 |
+
|
2833 |
+
.schema-modal-body {
|
2834 |
+
position: relative;
|
2835 |
+
-ms-flex: 1 1 auto;
|
2836 |
+
flex: 1 1 auto;
|
2837 |
+
padding: 15px;
|
2838 |
+
}
|
2839 |
+
|
2840 |
+
.schema-modal-footer {
|
2841 |
+
display: -ms-flexbox;
|
2842 |
+
display: flex;
|
2843 |
+
-ms-flex-align: center;
|
2844 |
+
align-items: center;
|
2845 |
+
-ms-flex-pack: end;
|
2846 |
+
justify-content: flex-end;
|
2847 |
+
padding: 15px;
|
2848 |
+
border-top: 1px solid #e9ecef;
|
2849 |
+
}
|
2850 |
+
|
2851 |
+
.schema-modal-footer > :not(:first-child) {
|
2852 |
+
margin-left: .25rem;
|
2853 |
+
}
|
2854 |
+
|
2855 |
+
.schema-modal-footer > :not(:last-child) {
|
2856 |
+
margin-right: .25rem;
|
2857 |
+
}
|
2858 |
+
|
2859 |
+
.schema-modal-scrollbar-measure {
|
2860 |
+
position: absolute;
|
2861 |
+
top: -9999px;
|
2862 |
+
width: 50px;
|
2863 |
+
height: 50px;
|
2864 |
+
overflow: scroll;
|
2865 |
+
}
|
2866 |
+
|
2867 |
+
@media (min-width: 576px) {
|
2868 |
+
.schema-modal-dialog {
|
2869 |
+
max-width: 500px;
|
2870 |
+
margin: 30px auto;
|
2871 |
+
}
|
2872 |
+
.schema-modal-sm {
|
2873 |
+
max-width: 300px;
|
2874 |
+
}
|
2875 |
+
}
|
2876 |
+
|
2877 |
+
@media (min-width: 992px) {
|
2878 |
+
.schema-modal-lg {
|
2879 |
+
max-width: 800px;
|
2880 |
+
}
|
2881 |
+
}
|
2882 |
+
|
2883 |
+
|
2884 |
+
/* progress */
|
2885 |
+
@-webkit-keyframes progress-bar-stripes {
|
2886 |
+
from {
|
2887 |
+
background-position: 1rem 0;
|
2888 |
+
}
|
2889 |
+
to {
|
2890 |
+
background-position: 0 0;
|
2891 |
+
}
|
2892 |
+
}
|
2893 |
+
|
2894 |
+
@keyframes progress-bar-stripes {
|
2895 |
+
from {
|
2896 |
+
background-position: 1rem 0;
|
2897 |
+
}
|
2898 |
+
to {
|
2899 |
+
background-position: 0 0;
|
2900 |
+
}
|
2901 |
+
}
|
2902 |
+
|
2903 |
+
/* progress */
|
2904 |
+
.schema-progress {
|
2905 |
+
display: -ms-flexbox;
|
2906 |
+
display: flex;
|
2907 |
+
overflow: hidden;
|
2908 |
+
font-size: 0.75rem;
|
2909 |
+
line-height: 1rem;
|
2910 |
+
text-align: center;
|
2911 |
+
background-color: #e9ecef;
|
2912 |
+
border-radius: 0.25rem;
|
2913 |
+
}
|
2914 |
+
|
2915 |
+
.schema-progress-bar {
|
2916 |
+
height: 1rem;
|
2917 |
+
line-height: 1rem;
|
2918 |
+
color: #fff;
|
2919 |
+
background-color: #007bff;
|
2920 |
+
transition: width 0.6s ease;
|
2921 |
+
}
|
2922 |
+
|
2923 |
+
.schema-progress-bar-striped {
|
2924 |
+
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
2925 |
+
background-size: 1rem 1rem;
|
2926 |
+
}
|
2927 |
+
|
2928 |
+
.schema-progress-bar-animated {
|
2929 |
+
-webkit-animation: progress-bar-stripes 1s linear infinite;
|
2930 |
+
animation: progress-bar-stripes 1s linear infinite;
|
2931 |
+
}
|
2932 |
+
|
2933 |
+
/* badge */
|
2934 |
+
.schema-badge {
|
2935 |
+
display: inline-block;
|
2936 |
+
padding: 0.25em 0.4em;
|
2937 |
+
font-size: 75%;
|
2938 |
+
font-weight: bold;
|
2939 |
+
line-height: 1;
|
2940 |
+
color: #fff;
|
2941 |
+
text-align: center;
|
2942 |
+
white-space: nowrap;
|
2943 |
+
vertical-align: baseline;
|
2944 |
+
border-radius: 0.25rem;
|
2945 |
+
}
|
2946 |
+
|
2947 |
+
.schema-badge:empty {
|
2948 |
+
display: none;
|
2949 |
+
}
|
2950 |
+
|
2951 |
+
.schema-btn .schema-badge {
|
2952 |
+
position: relative;
|
2953 |
+
top: -1px;
|
2954 |
+
}
|
2955 |
+
|
2956 |
+
.schema-badge-pill {
|
2957 |
+
padding-right: 0.6em;
|
2958 |
+
padding-left: 0.6em;
|
2959 |
+
border-radius: 10rem;
|
2960 |
+
}
|
2961 |
+
|
2962 |
+
.schema-badge-primary {
|
2963 |
+
color: #fff;
|
2964 |
+
background-color: #007bff;
|
2965 |
+
}
|
2966 |
+
|
2967 |
+
.schema-badge-primary[href]:focus, .schema-badge-primary[href]:hover {
|
2968 |
+
color: #fff;
|
2969 |
+
text-decoration: none;
|
2970 |
+
background-color: #0062cc;
|
2971 |
+
}
|
2972 |
+
|
2973 |
+
.schema-badge-secondary {
|
2974 |
+
color: #fff;
|
2975 |
+
background-color: #868e96;
|
2976 |
+
}
|
2977 |
+
|
2978 |
+
.schema-badge-secondary[href]:focus, .schema-badge-secondary[href]:hover {
|
2979 |
+
color: #fff;
|
2980 |
+
text-decoration: none;
|
2981 |
+
background-color: #6c757d;
|
2982 |
+
}
|
2983 |
+
|
2984 |
+
.schema-badge-success {
|
2985 |
+
color: #fff;
|
2986 |
+
background-color: #28a745;
|
2987 |
+
}
|
2988 |
+
|
2989 |
+
.schema-badge-success[href]:focus, .schema-badge-success[href]:hover {
|
2990 |
+
color: #fff;
|
2991 |
+
text-decoration: none;
|
2992 |
+
background-color: #1e7e34;
|
2993 |
+
}
|
2994 |
+
|
2995 |
+
.schema-badge-info {
|
2996 |
+
color: #fff;
|
2997 |
+
background-color: #17a2b8;
|
2998 |
+
}
|
2999 |
+
|
3000 |
+
.schema-badge-info[href]:focus, .schema-badge-info[href]:hover {
|
3001 |
+
color: #fff;
|
3002 |
+
text-decoration: none;
|
3003 |
+
background-color: #117a8b;
|
3004 |
+
}
|
3005 |
+
|
3006 |
+
.schema-badge-warning {
|
3007 |
+
color: #111;
|
3008 |
+
background-color: #ffc107;
|
3009 |
+
}
|
3010 |
+
|
3011 |
+
.schema-badge-warning[href]:focus, .schema-badge-warning[href]:hover {
|
3012 |
+
color: #111;
|
3013 |
+
text-decoration: none;
|
3014 |
+
background-color: #d39e00;
|
3015 |
+
}
|
3016 |
+
|
3017 |
+
.schema-badge-danger {
|
3018 |
+
color: #fff;
|
3019 |
+
background-color: #dc3545;
|
3020 |
+
}
|
3021 |
+
|
3022 |
+
.schema-badge-danger[href]:focus, .schema-badge-danger[href]:hover {
|
3023 |
+
color: #fff;
|
3024 |
+
text-decoration: none;
|
3025 |
+
background-color: #bd2130;
|
3026 |
+
}
|
3027 |
+
|
3028 |
+
.schema-badge-light {
|
3029 |
+
color: #111;
|
3030 |
+
background-color: #f8f9fa;
|
3031 |
+
}
|
3032 |
+
|
3033 |
+
.schema-badge-light[href]:focus, .schema-badge-light[href]:hover {
|
3034 |
+
color: #111;
|
3035 |
+
text-decoration: none;
|
3036 |
+
background-color: #dae0e5;
|
3037 |
+
}
|
3038 |
+
|
3039 |
+
.schema-badge-dark {
|
3040 |
+
color: #fff;
|
3041 |
+
background-color: #343a40;
|
3042 |
+
}
|
3043 |
+
|
3044 |
+
.schema-badge-dark[href]:focus, .schema-badge-dark[href]:hover {
|
3045 |
+
color: #fff;
|
3046 |
+
text-decoration: none;
|
3047 |
+
background-color: #1d2124;
|
3048 |
+
}
|
3049 |
+
|
assets/css/schema-bootstrap.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.schema-container,.schema-container-fluid{margin-right:auto;margin-left:auto;padding-right:15px;padding-left:15px;width:100%}.schema caption,.schema th{text-align:left}.schema-custom-file-input.is-valid:focus,.schema-custom-select.is-valid:focus,.schema-form-control.is-valid:focus,.schema-was-validated .schema-custom-file-input:valid:focus,.schema-was-validated .schema-custom-select:valid:focus,.schema-was-validated .schema-form-control:valid:focus{box-shadow:0 0 0 .2rem rgba(40,167,69,.25)}.schema-btn,.schema-custom-control-indicator{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}@media (min-width:576px){.schema-container{max-width:540px}}@media (min-width:768px){.schema-container{max-width:720px}}@media (min-width:992px){.schema-container{max-width:960px}}@media (min-width:1200px){.schema-container{max-width:1140px}}.schema-row{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-right:-15px;margin-left:-15px}.schema-no-gutters{margin-right:0;margin-left:0}.schema-no-gutters>.schema-col,.schema-no-gutters>[class*=schema-col-]{padding-right:0;padding-left:0}.schema-col,.schema-col-1,.schema-col-10,.schema-col-11,.schema-col-12,.schema-col-2,.schema-col-3,.schema-col-4,.schema-col-5,.schema-col-6,.schema-col-7,.schema-col-8,.schema-col-9,.schema-col-auto,.schema-col-lg,.schema-col-lg-1,.schema-col-lg-10,.schema-col-lg-11,.schema-col-lg-12,.schema-col-lg-2,.schema-col-lg-3,.schema-col-lg-4,.schema-col-lg-5,.schema-col-lg-6,.schema-col-lg-7,.schema-col-lg-8,.schema-col-lg-9,.schema-col-lg-auto,.schema-col-md,.schema-col-md-1,.schema-col-md-10,.schema-col-md-11,.schema-col-md-12,.schema-col-md-2,.schema-col-md-3,.schema-col-md-4,.schema-col-md-5,.schema-col-md-6,.schema-col-md-7,.schema-col-md-8,.schema-col-md-9,.schema-col-md-auto,.schema-col-sm,.schema-col-sm-1,.schema-col-sm-10,.schema-col-sm-11,.schema-col-sm-12,.schema-col-sm-2,.schema-col-sm-3,.schema-col-sm-4,.schema-col-sm-5,.schema-col-sm-6,.schema-col-sm-7,.schema-col-sm-8,.schema-col-sm-9,.schema-col-sm-auto,.schema-col-xl,.schema-col-xl-1,.schema-col-xl-10,.schema-col-xl-11,.schema-col-xl-12,.schema-col-xl-2,.schema-col-xl-3,.schema-col-xl-4,.schema-col-xl-5,.schema-col-xl-6,.schema-col-xl-7,.schema-col-xl-8,.schema-col-xl-9,.schema-col-xl-auto{position:relative;width:100%;min-height:1px;padding-right:15px;padding-left:15px}.schema-col{-ms-flex-preferred-size:0;flex-basis:0;-ms-flex-positive:1;flex-grow:1;max-width:100%}.schema-col-auto{-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.schema-col-1{-ms-flex:0 0 8.333333%;flex:0 0 8.333333%;max-width:8.333333%}.schema-col-2{-ms-flex:0 0 16.666667%;flex:0 0 16.666667%;max-width:16.666667%}.schema-col-3{-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.schema-col-4{-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}.schema-col-5{-ms-flex:0 0 41.666667%;flex:0 0 41.666667%;max-width:41.666667%}.schema-col-6{-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.schema-col-7{-ms-flex:0 0 58.333333%;flex:0 0 58.333333%;max-width:58.333333%}.schema-col-8{-ms-flex:0 0 66.666667%;flex:0 0 66.666667%;max-width:66.666667%}.schema-col-9{-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.schema-col-10{-ms-flex:0 0 83.333333%;flex:0 0 83.333333%;max-width:83.333333%}.schema-col-11{-ms-flex:0 0 91.666667%;flex:0 0 91.666667%;max-width:91.666667%}.schema-col-12{-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.schema-order-1{-ms-flex-order:1;order:1}.schema-order-2{-ms-flex-order:2;order:2}.schema-order-3{-ms-flex-order:3;order:3}.schema-order-4{-ms-flex-order:4;order:4}.schema-order-5{-ms-flex-order:5;order:5}.schema-order-6{-ms-flex-order:6;order:6}.schema-order-7{-ms-flex-order:7;order:7}.schema-order-8{-ms-flex-order:8;order:8}.schema-order-9{-ms-flex-order:9;order:9}.schema-order-10{-ms-flex-order:10;order:10}.schema-order-11{-ms-flex-order:11;order:11}.schema-order-12{-ms-flex-order:12;order:12}@media (min-width:576px){.schema-col-sm{-ms-flex-preferred-size:0;flex-basis:0;-ms-flex-positive:1;flex-grow:1;max-width:100%}.schema-col-sm-auto{-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.schema-col-sm-1{-ms-flex:0 0 8.333333%;flex:0 0 8.333333%;max-width:8.333333%}.schema-col-sm-2{-ms-flex:0 0 16.666667%;flex:0 0 16.666667%;max-width:16.666667%}.schema-col-sm-3{-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.schema-col-sm-4{-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}.schema-col-sm-5{-ms-flex:0 0 41.666667%;flex:0 0 41.666667%;max-width:41.666667%}.schema-col-sm-6{-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.schema-col-sm-7{-ms-flex:0 0 58.333333%;flex:0 0 58.333333%;max-width:58.333333%}.schema-col-sm-8{-ms-flex:0 0 66.666667%;flex:0 0 66.666667%;max-width:66.666667%}.schema-col-sm-9{-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.schema-col-sm-10{-ms-flex:0 0 83.333333%;flex:0 0 83.333333%;max-width:83.333333%}.schema-col-sm-11{-ms-flex:0 0 91.666667%;flex:0 0 91.666667%;max-width:91.666667%}.schema-col-sm-12{-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.schema-order-sm-1{-ms-flex-order:1;order:1}.schema-order-sm-2{-ms-flex-order:2;order:2}.schema-order-sm-3{-ms-flex-order:3;order:3}.schema-order-sm-4{-ms-flex-order:4;order:4}.schema-order-sm-5{-ms-flex-order:5;order:5}.schema-order-sm-6{-ms-flex-order:6;order:6}.schema-order-sm-7{-ms-flex-order:7;order:7}.schema-order-sm-8{-ms-flex-order:8;order:8}.schema-order-sm-9{-ms-flex-order:9;order:9}.schema-order-sm-10{-ms-flex-order:10;order:10}.schema-order-sm-11{-ms-flex-order:11;order:11}.schema-order-sm-12{-ms-flex-order:12;order:12}}@media (min-width:768px){.schema-col-md{-ms-flex-preferred-size:0;flex-basis:0;-ms-flex-positive:1;flex-grow:1;max-width:100%}.schema-col-md-auto{-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.schema-col-md-1{-ms-flex:0 0 8.333333%;flex:0 0 8.333333%;max-width:8.333333%}.schema-col-md-2{-ms-flex:0 0 16.666667%;flex:0 0 16.666667%;max-width:16.666667%}.schema-col-md-3{-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.schema-col-md-4{-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}.schema-col-md-5{-ms-flex:0 0 41.666667%;flex:0 0 41.666667%;max-width:41.666667%}.schema-col-md-6{-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.schema-col-md-7{-ms-flex:0 0 58.333333%;flex:0 0 58.333333%;max-width:58.333333%}.schema-col-md-8{-ms-flex:0 0 66.666667%;flex:0 0 66.666667%;max-width:66.666667%}.schema-col-md-9{-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.schema-col-md-10{-ms-flex:0 0 83.333333%;flex:0 0 83.333333%;max-width:83.333333%}.schema-col-md-11{-ms-flex:0 0 91.666667%;flex:0 0 91.666667%;max-width:91.666667%}.schema-col-md-12{-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.schema-order-md-1{-ms-flex-order:1;order:1}.schema-order-md-2{-ms-flex-order:2;order:2}.schema-order-md-3{-ms-flex-order:3;order:3}.schema-order-md-4{-ms-flex-order:4;order:4}.schema-order-md-5{-ms-flex-order:5;order:5}.schema-order-md-6{-ms-flex-order:6;order:6}.schema-order-md-7{-ms-flex-order:7;order:7}.schema-order-md-8{-ms-flex-order:8;order:8}.schema-order-md-9{-ms-flex-order:9;order:9}.schema-order-md-10{-ms-flex-order:10;order:10}.schema-order-md-11{-ms-flex-order:11;order:11}.schema-order-md-12{-ms-flex-order:12;order:12}}@media (min-width:992px){.schema-col-lg{-ms-flex-preferred-size:0;flex-basis:0;-ms-flex-positive:1;flex-grow:1;max-width:100%}.schema-col-lg-auto{-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.schema-col-lg-1{-ms-flex:0 0 8.333333%;flex:0 0 8.333333%;max-width:8.333333%}.schema-col-lg-2{-ms-flex:0 0 16.666667%;flex:0 0 16.666667%;max-width:16.666667%}.schema-col-lg-3{-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.schema-col-lg-4{-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}.schema-col-lg-5{-ms-flex:0 0 41.666667%;flex:0 0 41.666667%;max-width:41.666667%}.schema-col-lg-6{-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.schema-col-lg-7{-ms-flex:0 0 58.333333%;flex:0 0 58.333333%;max-width:58.333333%}.schema-col-lg-8{-ms-flex:0 0 66.666667%;flex:0 0 66.666667%;max-width:66.666667%}.schema-col-lg-9{-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.schema-col-lg-10{-ms-flex:0 0 83.333333%;flex:0 0 83.333333%;max-width:83.333333%}.schema-col-lg-11{-ms-flex:0 0 91.666667%;flex:0 0 91.666667%;max-width:91.666667%}.schema-col-lg-12{-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.schema-order-lg-1{-ms-flex-order:1;order:1}.schema-order-lg-2{-ms-flex-order:2;order:2}.schema-order-lg-3{-ms-flex-order:3;order:3}.schema-order-lg-4{-ms-flex-order:4;order:4}.schema-order-lg-5{-ms-flex-order:5;order:5}.schema-order-lg-6{-ms-flex-order:6;order:6}.schema-order-lg-7{-ms-flex-order:7;order:7}.schema-order-lg-8{-ms-flex-order:8;order:8}.schema-order-lg-9{-ms-flex-order:9;order:9}.schema-order-lg-10{-ms-flex-order:10;order:10}.schema-order-lg-11{-ms-flex-order:11;order:11}.schema-order-lg-12{-ms-flex-order:12;order:12}}@media (min-width:1200px){.schema-col-xl{-ms-flex-preferred-size:0;flex-basis:0;-ms-flex-positive:1;flex-grow:1;max-width:100%}.schema-col-xl-auto{-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.schema-col-xl-1{-ms-flex:0 0 8.333333%;flex:0 0 8.333333%;max-width:8.333333%}.schema-col-xl-2{-ms-flex:0 0 16.666667%;flex:0 0 16.666667%;max-width:16.666667%}.schema-col-xl-3{-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.schema-col-xl-4{-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}.schema-col-xl-5{-ms-flex:0 0 41.666667%;flex:0 0 41.666667%;max-width:41.666667%}.schema-col-xl-6{-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.schema-col-xl-7{-ms-flex:0 0 58.333333%;flex:0 0 58.333333%;max-width:58.333333%}.schema-col-xl-8{-ms-flex:0 0 66.666667%;flex:0 0 66.666667%;max-width:66.666667%}.schema-col-xl-9{-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.schema-col-xl-10{-ms-flex:0 0 83.333333%;flex:0 0 83.333333%;max-width:83.333333%}.schema-col-xl-11{-ms-flex:0 0 91.666667%;flex:0 0 91.666667%;max-width:91.666667%}.schema-col-xl-12{-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.schema-order-xl-1{-ms-flex-order:1;order:1}.schema-order-xl-2{-ms-flex-order:2;order:2}.schema-order-xl-3{-ms-flex-order:3;order:3}.schema-order-xl-4{-ms-flex-order:4;order:4}.schema-order-xl-5{-ms-flex-order:5;order:5}.schema-order-xl-6{-ms-flex-order:6;order:6}.schema-order-xl-7{-ms-flex-order:7;order:7}.schema-order-xl-8{-ms-flex-order:8;order:8}.schema-order-xl-9{-ms-flex-order:9;order:9}.schema-order-xl-10{-ms-flex-order:10;order:10}.schema-order-xl-11{-ms-flex-order:11;order:11}.schema-order-xl-12{-ms-flex-order:12;order:12}}.schema-flex-row{-ms-flex-direction:row!important;flex-direction:row!important}.schema-flex-column{-ms-flex-direction:column!important;flex-direction:column!important}.schema-flex-row-reverse{-ms-flex-direction:row-reverse!important;flex-direction:row-reverse!important}.schema-flex-column-reverse{-ms-flex-direction:column-reverse!important;flex-direction:column-reverse!important}.schema-flex-wrap{-ms-flex-wrap:wrap!important;flex-wrap:wrap!important}.schema-flex-nowrap{-ms-flex-wrap:nowrap!important;flex-wrap:nowrap!important}.schema-flex-wrap-reverse{-ms-flex-wrap:wrap-reverse!important;flex-wrap:wrap-reverse!important}.schema-justify-content-start{-ms-flex-pack:start!important;justify-content:flex-start!important}.schema-justify-content-end{-ms-flex-pack:end!important;justify-content:flex-end!important}.schema-justify-content-center{-ms-flex-pack:center!important;justify-content:center!important}.schema-justify-content-between{-ms-flex-pack:justify!important;justify-content:space-between!important}.schema-justify-content-around{-ms-flex-pack:distribute!important;justify-content:space-around!important}.schema-align-items-start{-ms-flex-align:start!important;align-items:flex-start!important}.schema-align-items-end{-ms-flex-align:end!important;align-items:flex-end!important}.schema-align-items-center{-ms-flex-align:center!important;align-items:center!important}.schema-align-items-baseline{-ms-flex-align:baseline!important;align-items:baseline!important}.schema-align-items-stretch{-ms-flex-align:stretch!important;align-items:stretch!important}.schema-align-content-start{-ms-flex-line-pack:start!important;align-content:flex-start!important}.schema-align-content-end{-ms-flex-line-pack:end!important;align-content:flex-end!important}.schema-align-content-center{-ms-flex-line-pack:center!important;align-content:center!important}.schema-align-content-between{-ms-flex-line-pack:justify!important;align-content:space-between!important}.schema-align-content-around{-ms-flex-line-pack:distribute!important;align-content:space-around!important}.schema-align-content-stretch{-ms-flex-line-pack:stretch!important;align-content:stretch!important}.schema-align-self-auto{-ms-flex-item-align:auto!important;align-self:auto!important}.schema-align-self-start{-ms-flex-item-align:start!important;align-self:flex-start!important}.schema-align-self-end{-ms-flex-item-align:end!important;align-self:flex-end!important}.schema-align-self-center{-ms-flex-item-align:center!important;align-self:center!important}.schema-align-self-baseline{-ms-flex-item-align:baseline!important;align-self:baseline!important}.schema-align-self-stretch{-ms-flex-item-align:stretch!important;align-self:stretch!important}@media (min-width:576px){.schema-flex-sm-row{-ms-flex-direction:row!important;flex-direction:row!important}.schema-flex-sm-column{-ms-flex-direction:column!important;flex-direction:column!important}.schema-flex-sm-row-reverse{-ms-flex-direction:row-reverse!important;flex-direction:row-reverse!important}.schema-flex-sm-column-reverse{-ms-flex-direction:column-reverse!important;flex-direction:column-reverse!important}.schema-flex-sm-wrap{-ms-flex-wrap:wrap!important;flex-wrap:wrap!important}.schema-flex-sm-nowrap{-ms-flex-wrap:nowrap!important;flex-wrap:nowrap!important}.schema-flex-sm-wrap-reverse{-ms-flex-wrap:wrap-reverse!important;flex-wrap:wrap-reverse!important}.schema-justify-content-sm-start{-ms-flex-pack:start!important;justify-content:flex-start!important}.schema-justify-content-sm-end{-ms-flex-pack:end!important;justify-content:flex-end!important}.schema-justify-content-sm-center{-ms-flex-pack:center!important;justify-content:center!important}.schema-justify-content-sm-between{-ms-flex-pack:justify!important;justify-content:space-between!important}.schema-justify-content-sm-around{-ms-flex-pack:distribute!important;justify-content:space-around!important}.schema-align-items-sm-start{-ms-flex-align:start!important;align-items:flex-start!important}.schema-align-items-sm-end{-ms-flex-align:end!important;align-items:flex-end!important}.schema-align-items-sm-center{-ms-flex-align:center!important;align-items:center!important}.schema-align-items-sm-baseline{-ms-flex-align:baseline!important;align-items:baseline!important}.schema-align-items-sm-stretch{-ms-flex-align:stretch!important;align-items:stretch!important}.schema-align-content-sm-start{-ms-flex-line-pack:start!important;align-content:flex-start!important}.schema-align-content-sm-end{-ms-flex-line-pack:end!important;align-content:flex-end!important}.schema-align-content-sm-center{-ms-flex-line-pack:center!important;align-content:center!important}.schema-align-content-sm-between{-ms-flex-line-pack:justify!important;align-content:space-between!important}.schema-align-content-sm-around{-ms-flex-line-pack:distribute!important;align-content:space-around!important}.schema-align-content-sm-stretch{-ms-flex-line-pack:stretch!important;align-content:stretch!important}.schema-align-self-sm-auto{-ms-flex-item-align:auto!important;align-self:auto!important}.schema-align-self-sm-start{-ms-flex-item-align:start!important;align-self:flex-start!important}.schema-align-self-sm-end{-ms-flex-item-align:end!important;align-self:flex-end!important}.schema-align-self-sm-center{-ms-flex-item-align:center!important;align-self:center!important}.schema-align-self-sm-baseline{-ms-flex-item-align:baseline!important;align-self:baseline!important}.schema-align-self-sm-stretch{-ms-flex-item-align:stretch!important;align-self:stretch!important}}@media (min-width:768px){.schema-flex-md-row{-ms-flex-direction:row!important;flex-direction:row!important}.schema-flex-md-column{-ms-flex-direction:column!important;flex-direction:column!important}.schema-flex-md-row-reverse{-ms-flex-direction:row-reverse!important;flex-direction:row-reverse!important}.schema-flex-md-column-reverse{-ms-flex-direction:column-reverse!important;flex-direction:column-reverse!important}.schema-flex-md-wrap{-ms-flex-wrap:wrap!important;flex-wrap:wrap!important}.schema-flex-md-nowrap{-ms-flex-wrap:nowrap!important;flex-wrap:nowrap!important}.schema-flex-md-wrap-reverse{-ms-flex-wrap:wrap-reverse!important;flex-wrap:wrap-reverse!important}.schema-justify-content-md-start{-ms-flex-pack:start!important;justify-content:flex-start!important}.schema-justify-content-md-end{-ms-flex-pack:end!important;justify-content:flex-end!important}.schema-justify-content-md-center{-ms-flex-pack:center!important;justify-content:center!important}.schema-justify-content-md-between{-ms-flex-pack:justify!important;justify-content:space-between!important}.schema-justify-content-md-around{-ms-flex-pack:distribute!important;justify-content:space-around!important}.schema-align-items-md-start{-ms-flex-align:start!important;align-items:flex-start!important}.schema-align-items-md-end{-ms-flex-align:end!important;align-items:flex-end!important}.schema-align-items-md-center{-ms-flex-align:center!important;align-items:center!important}.schema-align-items-md-baseline{-ms-flex-align:baseline!important;align-items:baseline!important}.schema-align-items-md-stretch{-ms-flex-align:stretch!important;align-items:stretch!important}.schema-align-content-md-start{-ms-flex-line-pack:start!important;align-content:flex-start!important}.schema-align-content-md-end{-ms-flex-line-pack:end!important;align-content:flex-end!important}.schema-align-content-md-center{-ms-flex-line-pack:center!important;align-content:center!important}.schema-align-content-md-between{-ms-flex-line-pack:justify!important;align-content:space-between!important}.schema-align-content-md-around{-ms-flex-line-pack:distribute!important;align-content:space-around!important}.schema-align-content-md-stretch{-ms-flex-line-pack:stretch!important;align-content:stretch!important}.schema-align-self-md-auto{-ms-flex-item-align:auto!important;align-self:auto!important}.schema-align-self-md-start{-ms-flex-item-align:start!important;align-self:flex-start!important}.schema-align-self-md-end{-ms-flex-item-align:end!important;align-self:flex-end!important}.schema-align-self-md-center{-ms-flex-item-align:center!important;align-self:center!important}.schema-align-self-md-baseline{-ms-flex-item-align:baseline!important;align-self:baseline!important}.schema-align-self-md-stretch{-ms-flex-item-align:stretch!important;align-self:stretch!important}}@media (min-width:992px){.schema-flex-lg-row{-ms-flex-direction:row!important;flex-direction:row!important}.schema-flex-lg-column{-ms-flex-direction:column!important;flex-direction:column!important}.schema-flex-lg-row-reverse{-ms-flex-direction:row-reverse!important;flex-direction:row-reverse!important}.schema-flex-lg-column-reverse{-ms-flex-direction:column-reverse!important;flex-direction:column-reverse!important}.schema-flex-lg-wrap{-ms-flex-wrap:wrap!important;flex-wrap:wrap!important}.schema-flex-lg-nowrap{-ms-flex-wrap:nowrap!important;flex-wrap:nowrap!important}.schema-flex-lg-wrap-reverse{-ms-flex-wrap:wrap-reverse!important;flex-wrap:wrap-reverse!important}.schema-justify-content-lg-start{-ms-flex-pack:start!important;justify-content:flex-start!important}.schema-justify-content-lg-end{-ms-flex-pack:end!important;justify-content:flex-end!important}.schema-justify-content-lg-center{-ms-flex-pack:center!important;justify-content:center!important}.schema-justify-content-lg-between{-ms-flex-pack:justify!important;justify-content:space-between!important}.schema-justify-content-lg-around{-ms-flex-pack:distribute!important;justify-content:space-around!important}.schema-align-items-lg-start{-ms-flex-align:start!important;align-items:flex-start!important}.schema-align-items-lg-end{-ms-flex-align:end!important;align-items:flex-end!important}.schema-align-items-lg-center{-ms-flex-align:center!important;align-items:center!important}.schema-align-items-lg-baseline{-ms-flex-align:baseline!important;align-items:baseline!important}.schema-align-items-lg-stretch{-ms-flex-align:stretch!important;align-items:stretch!important}.schema-align-content-lg-start{-ms-flex-line-pack:start!important;align-content:flex-start!important}.schema-align-content-lg-end{-ms-flex-line-pack:end!important;align-content:flex-end!important}.schema-align-content-lg-center{-ms-flex-line-pack:center!important;align-content:center!important}.schema-align-content-lg-between{-ms-flex-line-pack:justify!important;align-content:space-between!important}.schema-align-content-lg-around{-ms-flex-line-pack:distribute!important;align-content:space-around!important}.schema-align-content-lg-stretch{-ms-flex-line-pack:stretch!important;align-content:stretch!important}.schema-align-self-lg-auto{-ms-flex-item-align:auto!important;align-self:auto!important}.schema-align-self-lg-start{-ms-flex-item-align:start!important;align-self:flex-start!important}.schema-align-self-lg-end{-ms-flex-item-align:end!important;align-self:flex-end!important}.schema-align-self-lg-center{-ms-flex-item-align:center!important;align-self:center!important}.schema-align-self-lg-baseline{-ms-flex-item-align:baseline!important;align-self:baseline!important}.schema-align-self-lg-stretch{-ms-flex-item-align:stretch!important;align-self:stretch!important}}@media (min-width:1200px){.schema-flex-xl-row{-ms-flex-direction:row!important;flex-direction:row!important}.schema-flex-xl-column{-ms-flex-direction:column!important;flex-direction:column!important}.schema-flex-xl-row-reverse{-ms-flex-direction:row-reverse!important;flex-direction:row-reverse!important}.schema-flex-xl-column-reverse{-ms-flex-direction:column-reverse!important;flex-direction:column-reverse!important}.schema-flex-xl-wrap{-ms-flex-wrap:wrap!important;flex-wrap:wrap!important}.schema-flex-xl-nowrap{-ms-flex-wrap:nowrap!important;flex-wrap:nowrap!important}.schema-flex-xl-wrap-reverse{-ms-flex-wrap:wrap-reverse!important;flex-wrap:wrap-reverse!important}.schema-justify-content-xl-start{-ms-flex-pack:start!important;justify-content:flex-start!important}.schema-justify-content-xl-end{-ms-flex-pack:end!important;justify-content:flex-end!important}.schema-justify-content-xl-center{-ms-flex-pack:center!important;justify-content:center!important}.schema-justify-content-xl-between{-ms-flex-pack:justify!important;justify-content:space-between!important}.schema-justify-content-xl-around{-ms-flex-pack:distribute!important;justify-content:space-around!important}.schema-align-items-xl-start{-ms-flex-align:start!important;align-items:flex-start!important}.schema-align-items-xl-end{-ms-flex-align:end!important;align-items:flex-end!important}.schema-align-items-xl-center{-ms-flex-align:center!important;align-items:center!important}.schema-align-items-xl-baseline{-ms-flex-align:baseline!important;align-items:baseline!important}.schema-align-items-xl-stretch{-ms-flex-align:stretch!important;align-items:stretch!important}.schema-align-content-xl-start{-ms-flex-line-pack:start!important;align-content:flex-start!important}.schema-align-content-xl-end{-ms-flex-line-pack:end!important;align-content:flex-end!important}.schema-align-content-xl-center{-ms-flex-line-pack:center!important;align-content:center!important}.schema-align-content-xl-between{-ms-flex-line-pack:justify!important;align-content:space-between!important}.schema-align-content-xl-around{-ms-flex-line-pack:distribute!important;align-content:space-around!important}.schema-align-content-xl-stretch{-ms-flex-line-pack:stretch!important;align-content:stretch!important}.schema-align-self-xl-auto{-ms-flex-item-align:auto!important;align-self:auto!important}.schema-align-self-xl-start{-ms-flex-item-align:start!important;align-self:flex-start!important}.schema-align-self-xl-end{-ms-flex-item-align:end!important;align-self:flex-end!important}.schema-align-self-xl-center{-ms-flex-item-align:center!important;align-self:center!important}.schema-align-self-xl-baseline{-ms-flex-item-align:baseline!important;align-self:baseline!important}.schema-align-self-xl-stretch{-ms-flex-item-align:stretch!important;align-self:stretch!important}}.schema-img{vertical-align:middle;border-style:none}.schema [role=button],.schema a,.schema area,.schema button,.schema input,.schema label,.schema select,.schema summary,.schema textarea{-ms-touch-action:manipulation;touch-action:manipulation}.schema table{border-collapse:collapse}.schema caption{padding-top:.75rem;padding-bottom:.75rem;color:#868e96;caption-side:bottom}.schema label{display:inline-block;margin-bottom:.5rem}.schema button:focus{outline:dotted 1px;outline:-webkit-focus-ring-color auto 5px}.schema button,.schema input,.schema optgroup,.schema select,.schema textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}.schema button,.schema input{overflow:visible}.schema button,.schema select{text-transform:none}.schema [type=reset],.schema [type=submit],.schema button,.schema html [type=button]{-webkit-appearance:button}.schema [type=button]::-moz-focus-inner,.schema [type=reset]::-moz-focus-inner,.schema [type=submit]::-moz-focus-inner,.schema button::-moz-focus-inner{padding:0;border-style:none}input[type=radio],input[type=checkbox]{box-sizing:border-box;padding:0}.schema input[type=date],.schema input[type=time],.schema input[type=datetime-local],.schema input[type=month]{-webkit-appearance:listbox}.schema textarea{overflow:auto;resize:vertical}.schema fieldset{min-width:0;padding:0;margin:0;border:0}.schema legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}.schema-table{width:100%;max-width:100%;margin-bottom:1rem;background-color:transparent}.schema-table td,.schema-table th{padding:.75rem;vertical-align:top;border-top:1px solid #e9ecef}.schema-table thead th{vertical-align:bottom;border-bottom:2px solid #e9ecef}.schema-table tbody+tbody{border-top:2px solid #e9ecef}.schema-table .schema-table{background-color:#fff}.schema-table-sm td,.schema-table-sm th{padding:.3rem}.schema-table-bordered,.schema-table-bordered td,.schema-table-bordered th{border:1px solid #e9ecef}.schema-table-bordered thead td,.schema-table-bordered thead th{border-bottom-width:2px}.schema-table-striped tbody tr:nth-of-type(odd){background-color:rgba(0,0,0,.05)}.schema-table-hover tbody tr:hover{background-color:rgba(0,0,0,.075)}.schema-table-primary,.schema-table-primary>td,.schema-table-primary>th{background-color:#b8daff}.schema-table-hover .schema-table-primary:hover,.schema-table-hover .schema-table-primary:hover>td,.schema-table-hover .schema-table-primary:hover>th{background-color:#9fcdff}.schema-table-secondary,.schema-table-secondary>td,.schema-table-secondary>th{background-color:#dddfe2}.schema-table-hover .schema-table-secondary:hover,.schema-table-hover .schema-table-secondary:hover>td,.schema-table-hover .schema-table-secondary:hover>th{background-color:#cfd2d6}.schema-table-success,.schema-table-success>td,.schema-table-success>th{background-color:#c3e6cb}.schema-table-hover .schema-table-success:hover,.schema-table-hover .schema-table-success:hover>td,.schema-table-hover .schema-table-success:hover>th{background-color:#b1dfbb}.schema-table-info,.schema-table-info>td,.schema-table-info>th{background-color:#bee5eb}.schema-table-hover .schema-table-info:hover,.schema-table-hover .schema-table-info:hover>td,.schema-table-hover .schema-table-info:hover>th{background-color:#abdde5}.schema-table-warning,.schema-table-warning>td,.schema-table-warning>th{background-color:#ffeeba}.schema-table-hover .schema-table-warning:hover,.schema-table-hover .schema-table-warning:hover>td,.schema-table-hover .schema-table-warning:hover>th{background-color:#ffe8a1}.schema-table-danger,.schema-table-danger>td,.schema-table-danger>th{background-color:#f5c6cb}.schema-table-hover .schema-table-danger:hover,.schema-table-hover .schema-table-danger:hover>td,.schema-table-hover .schema-table-danger:hover>th{background-color:#f1b0b7}.schema-table-light,.schema-table-light>td,.schema-table-light>th{background-color:#fdfdfe}.schema-table-hover .schema-table-light:hover,.schema-table-hover .schema-table-light:hover>td,.schema-table-hover .schema-table-light:hover>th{background-color:#ececf6}.schema-table-dark,.schema-table-dark>td,.schema-table-dark>th{background-color:#c6c8ca}.schema-table-hover .schema-table-dark:hover,.schema-table-hover .schema-table-dark:hover>td,.schema-table-hover .schema-table-dark:hover>th{background-color:#b9bbbe}.schema-table-active,.schema-table-active>td,.schema-table-active>th,.schema-table-hover .schema-table-active:hover,.schema-table-hover .schema-table-active:hover>td,.schema-table-hover .schema-table-active:hover>th{background-color:rgba(0,0,0,.075)}.thead-inverse th{color:#fff;background-color:#212529}.thead-default th{color:#495057;background-color:#e9ecef}.schema-table-inverse{color:#fff;background-color:#212529}.schema-table-inverse td,.schema-table-inverse th,.schema-table-inverse thead th{border-color:#32383e}.schema-table-inverse.schema-table-bordered{border:0}.schema-table-inverse.schema-table-striped tbody tr:nth-of-type(odd){background-color:rgba(255,255,255,.05)}.schema-table-inverse.schema-table-hover tbody tr:hover{background-color:rgba(255,255,255,.075)}@media (max-width:991px){.schema-table-responsive{display:block;width:100%;overflow-x:auto;-ms-overflow-style:-ms-autohiding-scrollbar}.schema-table-responsive.schema-table-bordered{border:0}}.schema-form-control{display:block;width:100%;padding:.5rem .75rem;line-height:1.25;color:#495057;background-color:#fff;background-image:none;background-clip:padding-box;border:1px solid rgba(0,0,0,.15);border-radius:.25rem;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.schema-col-form-label,.schema-col-form-label-lg{padding-top:calc(.5rem - 1px * 2);padding-bottom:calc(.5rem - 1px * 2)}.schema-form-control::-ms-expand{background-color:transparent;border:0}.schema-form-control:focus{color:#495057;background-color:#fff;border-color:#80bdff;outline:0}.schema-form-control::-webkit-input-placeholder{color:#868e96;opacity:1}.schema-form-control:-ms-input-placeholder{color:#868e96;opacity:1}.schema-form-control::placeholder{color:#868e96;opacity:1}.schema-form-control:disabled,.schema-form-control[readonly]{background-color:#e9ecef;opacity:1}select.schema-form-control:not([size]):not([multiple]){height:calc(2.25rem + 2px)}select.schema-form-control:focus::-ms-value{color:#495057;background-color:#fff}.schema-form-control-file,.schema-form-control-range{display:block}.schema-col-form-label{margin-bottom:0}.schema-col-form-label-lg{font-size:1.25rem}.schema-col-form-label-sm{padding-top:calc(.25rem - 1px * 2);padding-bottom:calc(.25rem - 1px * 2);font-size:.875rem}.schema-col-form-legend,.schema-form-control-plaintext{padding-top:.5rem;padding-bottom:.5rem;margin-bottom:0}.schema-col-form-legend{font-size:1rem}.schema-form-control-plaintext{line-height:1.25;border:solid transparent;border-width:1px 0}.schema-custom-file-input.is-valid~.schema-custom-file-control,.schema-custom-select.is-valid,.schema-form-control.is-valid,.schema-was-validated .schema-custom-file-input:valid~.schema-custom-file-control,.schema-was-validated .schema-custom-select:valid,.schema-was-validated .schema-form-control:valid{border-color:#28a745}.schema-form-control-plaintext.schema-form-control-lg,.schema-form-control-plaintext.schema-form-control-sm,.schema-input-group-lg>.schema-form-control-plaintext.schema-form-control,.schema-input-group-lg>.schema-form-control-plaintext.schema-input-group-addon,.schema-input-group-lg>.schema-input-group-btn>.schema-form-control-plaintext.schema-btn,.schema-input-group-sm>.schema-form-control-plaintext.schema-form-control,.schema-input-group-sm>.schema-form-control-plaintext.schema-input-group-addon,.schema-input-group-sm>.schema-input-group-btn>.schema-form-control-plaintext.schema-btn{padding-right:0;padding-left:0}.schema-form-control-sm,.schema-input-group-sm>.schema-form-control,.schema-input-group-sm>.schema-input-group-addon,.schema-input-group-sm>.schema-input-group-btn>.schema-btn{padding:.25rem .5rem;font-size:.875rem;line-height:1.5;border-radius:.2rem}.schema-input-group-sm>.schema-input-group-btn>select.schema-btn:not([size]):not([multiple]),.schema-input-group-sm>select.schema-form-control:not([size]):not([multiple]),.schema-input-group-sm>select.schema-input-group-addon:not([size]):not([multiple]),select.schema-form-control-sm:not([size]):not([multiple]){height:calc(1.8125rem + 2px)}.schema-form-control-lg,.schema-input-group-lg>.schema-form-control,.schema-input-group-lg>.schema-input-group-addon,.schema-input-group-lg>.schema-input-group-btn>.schema-btn{padding:.5rem 1rem;font-size:1.25rem;line-height:1.5;border-radius:.3rem}.schema-input-group-lg>.schema-input-group-btn>select.schema-btn:not([size]):not([multiple]),.schema-input-group-lg>select.schema-form-control:not([size]):not([multiple]),.schema-input-group-lg>select.schema-input-group-addon:not([size]):not([multiple]),select.schema-form-control-lg:not([size]):not([multiple]){height:calc(2.3125rem + 2px)}.schema-form-group{margin-bottom:1rem}.schema-form-text{display:block;margin-top:.25rem}.schema-form-row{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-right:-5px;margin-left:-5px}.schema-form-row>.schema-col,.schema-form-row>[class*=col-]{padding-right:5px;padding-left:5px}.schema-form-check{position:relative;display:block;margin-bottom:.5rem}.schema-form-check.disabled .schema-form-check-label{color:#868e96}.schema-form-check-label{padding-left:1.25rem;margin-bottom:0}.schema-form-check-input{position:absolute;margin-top:.25rem;margin-left:-1.25rem}.schema-form-check-input:only-child{position:static}.schema-form-check-inline{display:inline-block}.schema-form-check-inline .schema-form-check-label{vertical-align:middle}.schema-form-check-inline+.schema-form-check-inline{margin-left:.75rem}.schema-invalid-feedback{display:none;margin-top:.25rem;font-size:.875rem;color:#dc3545}.schema-invalid-tooltip{position:absolute;top:100%;z-index:5;display:none;width:250px;padding:.5rem;margin-top:.1rem;font-size:.875rem;line-height:1;color:#fff;background-color:rgba(220,53,69,.8);border-radius:.2rem}.schema-custom-select.is-invalid~.schema-invalid-feedback,.schema-custom-select.is-invalid~.schema-invalid-tooltip,.schema-custom-select.is-valid~.schema-invalid-feedback,.schema-custom-select.is-valid~.schema-invalid-tooltip,.schema-form-control.is-invalid~.schema-invalid-feedback,.schema-form-control.is-invalid~.schema-invalid-tooltip,.schema-form-control.is-valid~.schema-invalid-feedback,.schema-form-control.is-valid~.schema-invalid-tooltip,.schema-was-validated .schema-custom-select:invalid~.schema-invalid-feedback,.schema-was-validated .schema-custom-select:invalid~.schema-invalid-tooltip,.schema-was-validated .schema-custom-select:valid~.schema-invalid-feedback,.schema-was-validated .schema-custom-select:valid~.schema-invalid-tooltip,.schema-was-validated .schema-form-control:invalid~.schema-invalid-feedback,.schema-was-validated .schema-form-control:invalid~.schema-invalid-tooltip,.schema-was-validated .schema-form-control:valid~.schema-invalid-feedback,.schema-was-validated .schema-form-control:valid~.schema-invalid-tooltip{display:block}.schema-custom-control-input.is-valid~.schema-custom-control-description,.schema-form-check-input.is-valid+.schema-form-check-label,.schema-was-validated .schema-custom-control-input:valid~.schema-custom-control-description,.schema-was-validated .schema-form-check-input:valid+.schema-form-check-label{color:#28a745}.schema-custom-control-input.is-valid~.schema-custom-control-indicator,.schema-was-validated .schema-custom-control-input:valid~.schema-custom-control-indicator{background-color:rgba(40,167,69,.25)}.schema-custom-control-input.is-invalid~.schema-custom-control-description,.schema-form-check-input.is-invalid+.schema-form-check-label,.schema-was-validated .schema-custom-control-input:invalid~.schema-custom-control-description,.schema-was-validated .schema-form-check-input:invalid+.schema-form-check-label{color:#dc3545}.schema-custom-file-input.is-valid~.schema-custom-file-control::before,.schema-was-validated .schema-custom-file-input:valid~.schema-custom-file-control::before{border-color:inherit}.schema-custom-file-input.is-invalid~.schema-custom-file-control,.schema-custom-select.is-invalid,.schema-form-control.is-invalid,.schema-was-validated .schema-custom-file-input:invalid~.schema-custom-file-control,.schema-was-validated .schema-custom-select:invalid,.schema-was-validated .schema-form-control:invalid{border-color:#dc3545}.schema-custom-file-input.is-invalid:focus,.schema-custom-select.is-invalid:focus,.schema-form-control.is-invalid:focus,.schema-was-validated .schema-custom-file-input:invalid:focus,.schema-was-validated .schema-custom-select:invalid:focus,.schema-was-validated .schema-form-control:invalid:focus{box-shadow:0 0 0 .2rem rgba(220,53,69,.25)}.schema-custom-control-input.is-invalid~.schema-custom-control-indicator,.schema-was-validated .schema-custom-control-input:invalid~.schema-custom-control-indicator{background-color:rgba(220,53,69,.25)}.schema-custom-file-input.is-invalid~.schema-custom-file-control::before,.schema-was-validated .schema-custom-file-input:invalid~.schema-custom-file-control::before{border-color:inherit}.schema-form-inline{display:-ms-flexbox;display:flex;-ms-flex-flow:row wrap;flex-flow:row wrap;-ms-flex-align:center;align-items:center}.schema-form-inline .schema-form-check{width:100%}@media (min-width:576px){.schema-form-inline label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;margin-bottom:0}.schema-form-inline .schema-form-group{display:-ms-flexbox;display:flex;-ms-flex:0 0 auto;flex:0 0 auto;-ms-flex-flow:row wrap;flex-flow:row wrap;-ms-flex-align:center;align-items:center;margin-bottom:0}.schema-form-inline .schema-form-control{display:inline-block;width:auto;vertical-align:middle}.schema-form-inline .schema-form-control-plaintext{display:inline-block}.schema-form-inline .schema-input-group{width:auto}.schema-form-inline .schema-form-control-label{margin-bottom:0;vertical-align:middle}.schema-form-inline .schema-form-check{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:auto;margin-top:0;margin-bottom:0}.schema-form-inline .schema-form-check-label{padding-left:0}.schema-form-inline .schema-form-check-input{position:relative;margin-top:0;margin-right:.25rem;margin-left:0}.schema-form-inline .schema-custom-control{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding-left:0}.schema-form-inline .schema-custom-control-indicator{position:static;display:inline-block;margin-right:.25rem;vertical-align:text-bottom}.schema-form-inline .schema-has-feedback .schema-form-control-feedback{top:0}}.schema-btn{display:inline-block;font-weight:400;line-height:1.25;text-align:center;white-space:nowrap;vertical-align:middle;user-select:none;border:1px solid transparent;padding:.5rem 1rem;font-size:1rem;border-radius:.25rem;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.schema-btn:focus,.schema-btn:hover{text-decoration:none}.schema-btn.focus,.schema-btn:focus{outline:0;-webkit-box-shadow:0 0 0 2px rgba(2,117,216,.25);box-shadow:0 0 0 2px rgba(2,117,216,.25)}.schema-btn.disabled,.schema-btn:disabled{cursor:not-allowed;opacity:.65}.schema-btn.active,.schema-btn:active{background-image:none}a.schema-btn.disabled,fieldset[disabled] a.schema-btn{pointer-events:none}.schema-btn-primary{color:#fff;background-color:#0275d8;border-color:#0275d8}.schema-btn-primary:hover{color:#fff;background-color:#025aa5;border-color:#01549b}.schema-btn-primary.focus,.schema-btn-primary:focus{-webkit-box-shadow:0 0 0 2px rgba(2,117,216,.5);box-shadow:0 0 0 2px rgba(2,117,216,.5)}.schema-btn-primary.disabled,.schema-btn-primary:disabled{background-color:#0275d8;border-color:#0275d8}.schema-btn-primary.active,.schema-btn-primary:active,.show>.schema-btn-primary.dropdown-toggle{color:#fff;background-color:#025aa5;background-image:none;border-color:#01549b}.schema-btn-secondary{color:#292b2c;background-color:#fff;border-color:#ccc}.schema-btn-secondary:hover{color:#292b2c;background-color:#e6e6e6;border-color:#adadad}.schema-btn-secondary.focus,.schema-btn-secondary:focus{-webkit-box-shadow:0 0 0 2px rgba(204,204,204,.5);box-shadow:0 0 0 2px rgba(204,204,204,.5)}.schema-btn-secondary.disabled,.schema-btn-secondary:disabled{background-color:#fff;border-color:#ccc}.schema-btn-secondary.active,.schema-btn-secondary:active,.show>.schema-btn-secondary.dropdown-toggle{color:#292b2c;background-color:#e6e6e6;background-image:none;border-color:#adadad}.schema-btn-info{color:#fff;background-color:#5bc0de;border-color:#5bc0de}.schema-btn-info:hover{color:#fff;background-color:#31b0d5;border-color:#2aabd2}.schema-btn-info.focus,.schema-btn-info:focus{-webkit-box-shadow:0 0 0 2px rgba(91,192,222,.5);box-shadow:0 0 0 2px rgba(91,192,222,.5)}.schema-btn-info.disabled,.schema-btn-info:disabled{background-color:#5bc0de;border-color:#5bc0de}.schema-btn-info.active,.schema-btn-info:active,.show>.schema-btn-info.dropdown-toggle{color:#fff;background-color:#31b0d5;background-image:none;border-color:#2aabd2}.schema-btn-success{color:#fff;background-color:#5cb85c;border-color:#5cb85c}.schema-btn-success:hover{color:#fff;background-color:#449d44;border-color:#419641}.schema-btn-success.focus,.schema-btn-success:focus{-webkit-box-shadow:0 0 0 2px rgba(92,184,92,.5);box-shadow:0 0 0 2px rgba(92,184,92,.5)}.schema-btn-success.disabled,.schema-btn-success:disabled{background-color:#5cb85c;border-color:#5cb85c}.schema-btn-success.active,.schema-btn-success:active,.show>.schema-btn-success.dropdown-toggle{color:#fff;background-color:#449d44;background-image:none;border-color:#419641}.schema-btn-warning{color:#fff;background-color:#f0ad4e;border-color:#f0ad4e}.schema-btn-warning:hover{color:#fff;background-color:#ec971f;border-color:#eb9316}.schema-btn-warning.focus,.schema-btn-warning:focus{-webkit-box-shadow:0 0 0 2px rgba(240,173,78,.5);box-shadow:0 0 0 2px rgba(240,173,78,.5)}.schema-btn-warning.disabled,.schema-btn-warning:disabled{background-color:#f0ad4e;border-color:#f0ad4e}.schema-btn-warning.active,.schema-btn-warning:active,.show>.schema-btn-warning.dropdown-toggle{color:#fff;background-color:#ec971f;background-image:none;border-color:#eb9316}.schema-btn-danger{color:#fff;background-color:#d9534f;border-color:#d9534f}.schema-btn-danger:hover{color:#fff;background-color:#c9302c;border-color:#c12e2a}.schema-btn-danger.focus,.schema-btn-danger:focus{-webkit-box-shadow:0 0 0 2px rgba(217,83,79,.5);box-shadow:0 0 0 2px rgba(217,83,79,.5)}.schema-btn-danger.disabled,.schema-btn-danger:disabled{background-color:#d9534f;border-color:#d9534f}.schema-btn-danger.active,.schema-btn-danger:active,.show>.schema-btn-danger.dropdown-toggle{color:#fff;background-color:#c9302c;background-image:none;border-color:#c12e2a}.schema-btn-outline-primary{color:#0275d8;background-image:none;background-color:transparent;border-color:#0275d8}.schema-btn-outline-primary:hover{color:#fff;background-color:#0275d8;border-color:#0275d8}.schema-btn-outline-primary.focus,.schema-btn-outline-primary:focus{-webkit-box-shadow:0 0 0 2px rgba(2,117,216,.5);box-shadow:0 0 0 2px rgba(2,117,216,.5)}.schema-btn-outline-primary.disabled,.schema-btn-outline-primary:disabled{color:#0275d8;background-color:transparent}.schema-btn-outline-primary.active,.schema-btn-outline-primary:active,.show>.schema-btn-outline-primary.dropdown-toggle{color:#fff;background-color:#0275d8;border-color:#0275d8}.schema-btn-outline-secondary{color:#ccc;background-image:none;background-color:transparent;border-color:#ccc}.schema-btn-outline-secondary:hover{color:#fff;background-color:#ccc;border-color:#ccc}.schema-btn-outline-secondary.focus,.schema-btn-outline-secondary:focus{-webkit-box-shadow:0 0 0 2px rgba(204,204,204,.5);box-shadow:0 0 0 2px rgba(204,204,204,.5)}.schema-btn-outline-secondary.disabled,.schema-btn-outline-secondary:disabled{color:#ccc;background-color:transparent}.schema-btn-outline-secondary.active,.schema-btn-outline-secondary:active,.show>.schema-btn-outline-secondary.dropdown-toggle{color:#fff;background-color:#ccc;border-color:#ccc}.schema-btn-outline-info{color:#5bc0de;background-image:none;background-color:transparent;border-color:#5bc0de}.schema-btn-outline-info:hover{color:#fff;background-color:#5bc0de;border-color:#5bc0de}.schema-btn-outline-info.focus,.schema-btn-outline-info:focus{-webkit-box-shadow:0 0 0 2px rgba(91,192,222,.5);box-shadow:0 0 0 2px rgba(91,192,222,.5)}.schema-btn-outline-info.disabled,.schema-btn-outline-info:disabled{color:#5bc0de;background-color:transparent}.schema-btn-outline-info.active,.schema-btn-outline-info:active,.show>.schema-btn-outline-info.dropdown-toggle{color:#fff;background-color:#5bc0de;border-color:#5bc0de}.schema-btn-outline-success{color:#5cb85c;background-image:none;background-color:transparent;border-color:#5cb85c}.schema-btn-outline-success:hover{color:#fff;background-color:#5cb85c;border-color:#5cb85c}.schema-btn-outline-success.focus,.schema-btn-outline-success:focus{-webkit-box-shadow:0 0 0 2px rgba(92,184,92,.5);box-shadow:0 0 0 2px rgba(92,184,92,.5)}.schema-btn-outline-success.disabled,.schema-btn-outline-success:disabled{color:#5cb85c;background-color:transparent}.schema-btn-outline-success.active,.schema-btn-outline-success:active,.show>.schema-btn-outline-success.dropdown-toggle{color:#fff;background-color:#5cb85c;border-color:#5cb85c}.schema-btn-outline-warning{color:#f0ad4e;background-image:none;background-color:transparent;border-color:#f0ad4e}.schema-btn-outline-warning:hover{color:#fff;background-color:#f0ad4e;border-color:#f0ad4e}.schema-btn-outline-warning.focus,.schema-btn-outline-warning:focus{-webkit-box-shadow:0 0 0 2px rgba(240,173,78,.5);box-shadow:0 0 0 2px rgba(240,173,78,.5)}.schema-btn-outline-warning.disabled,.schema-btn-outline-warning:disabled{color:#f0ad4e;background-color:transparent}.schema-btn-outline-warning.active,.schema-btn-outline-warning:active,.show>.schema-btn-outline-warning.dropdown-toggle{color:#fff;background-color:#f0ad4e;border-color:#f0ad4e}.schema-btn-outline-danger{color:#d9534f;background-image:none;background-color:transparent;border-color:#d9534f}.schema-btn-outline-danger:hover{color:#fff;background-color:#d9534f;border-color:#d9534f}.schema-btn-outline-danger.focus,.schema-btn-outline-danger:focus{-webkit-box-shadow:0 0 0 2px rgba(217,83,79,.5);box-shadow:0 0 0 2px rgba(217,83,79,.5)}.schema-btn-outline-danger.disabled,.schema-btn-outline-danger:disabled{color:#d9534f;background-color:transparent}.schema-btn-outline-danger.active,.schema-btn-outline-danger:active,.show>.schema-btn-outline-danger.dropdown-toggle{color:#fff;background-color:#d9534f;border-color:#d9534f}.schema-btn-link{font-weight:400;color:#0275d8;border-radius:0}.schema-btn-link,.schema-btn-link.active,.schema-btn-link:active,.schema-btn-link:disabled{background-color:transparent}.schema-btn-link,.schema-btn-link:active,.schema-btn-link:focus,.schema-btn-link:hover{border-color:transparent}.schema-btn-link:focus,.schema-btn-link:hover{color:#014c8c;text-decoration:underline;background-color:transparent}.schema-btn-link:disabled{color:#636c72}.schema-btn-link:disabled:focus,.schema-btn-link:disabled:hover{text-decoration:none}.schema-btn-group-lg>.schema-btn,.schema-btn-lg{padding:.75rem 1.5rem;font-size:1.25rem;border-radius:.3rem}.schema-btn-group-sm>.schema-btn,.schema-btn-sm{padding:.25rem .5rem;font-size:.875rem;border-radius:.2rem}.schema-btn-block{display:block;width:100%}.schema-btn-block+.schema-btn-block{margin-top:.5rem}input[type=button].schema-btn-block,input[type=reset].schema-btn-block,input[type=submit].schema-btn-block{width:100%}.schema-fade{opacity:0;transition:opacity .15s linear}.schema-fade.schema-show{opacity:1}.schema-collapse{display:none}.schema-collapse.schema-show{display:block}tr.schema-collapse.schema-show{display:table-row}tbody.schema-collapse.schema-show{display:table-row-group}.schema-collapsing{position:relative;height:0;overflow:hidden;transition:height .35s ease}.schema-dropdown,.schema-dropup{position:relative}.schema-dropdown-toggle::after{display:inline-block;width:0;height:0;margin-left:.255em;vertical-align:.255em;content:"";border-top:.3em solid;border-right:.3em solid transparent;border-left:.3em solid transparent}.schema-dropdown-toggle:empty::after{margin-left:0}.schema-dropup .schema-dropdown-menu{margin-top:0;margin-bottom:.125rem}.schema-dropup .schema-dropdown-toggle::after{border-top:0;border-bottom:.3em solid}.schema-dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:10rem;padding:.5rem 0;margin:.125rem 0 0;font-size:1rem;color:#212529;text-align:left;list-style:none;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,0,0,.15);border-radius:.25rem}.schema-dropdown-divider{height:0;margin:.5rem 0;overflow:hidden;border-top:1px solid #e9ecef}.schema-dropdown-item{display:block;width:100%;padding:.25rem 1.5rem;clear:both;font-weight:400;color:#212529;text-align:inherit;white-space:nowrap;background:0 0;border:0}.schema-btn-group-vertical>.schema-btn-group:not(:first-child):not(:last-child)>.schema-btn,.schema-btn-group-vertical>.schema-btn:not(:first-child):not(:last-child),.schema-btn-group>.schema-btn-group:not(:first-child):not(:last-child)>.schema-btn,.schema-btn-group>.schema-btn:not(:first-child):not(:last-child):not(.schema-dropdown-toggle),.schema-input-group .schema-form-control:not(:first-child):not(:last-child),.schema-input-group-addon:not(:first-child):not(:last-child),.schema-input-group-btn:not(:first-child):not(:last-child){border-radius:0}.schema-dropdown-item:focus,.schema-dropdown-item:hover{color:#16181b;text-decoration:none;background-color:#f8f9fa}.schema-dropdown-item.active,.schema-dropdown-item:active{color:#fff;text-decoration:none;background-color:#007bff}.schema-dropdown-item.disabled,.schema-dropdown-item:disabled{color:#868e96;background-color:transparent}.schema-show>a{outline:0}.schema-dropdown-menu.schema-show{display:block}.schema-dropdown-header{display:block;padding:.5rem 1.5rem;margin-bottom:0;font-size:.875rem;color:#868e96;white-space:nowrap}.schema-btn-group,.schema-btn-group-vertical{position:relative;display:-ms-inline-flexbox;display:inline-flex;vertical-align:middle}.schema-btn-group-vertical>.schema-btn,.schema-btn-group>.schema-btn{position:relative;-ms-flex:0 1 auto;flex:0 1 auto;margin-bottom:0}.schema-btn-group-vertical>.schema-btn.active,.schema-btn-group-vertical>.schema-btn:active,.schema-btn-group-vertical>.schema-btn:focus,.schema-btn-group-vertical>.schema-btn:hover,.schema-btn-group>.schema-btn.active,.schema-btn-group>.schema-btn:active,.schema-btn-group>.schema-btn:focus,.schema-btn-group>.schema-btn:hover{z-index:2}.schema-btn-group .schema-btn+.schema-btn,.schema-btn-group .schema-btn+.schema-btn-group,.schema-btn-group .schema-btn-group+.schema-btn,.schema-btn-group .schema-btn-group+.schema-btn-group,.schema-btn-group-vertical .schema-btn+.schema-btn,.schema-btn-group-vertical .schema-btn+.schema-btn-group,.schema-btn-group-vertical .schema-btn-group+.schema-btn,.schema-btn-group-vertical .schema-btn-group+.schema-btn-group{margin-left:-1px}.schema-btn+.schema-dropdown-toggle-split::after,.schema-btn-group>.schema-btn:first-child{margin-left:0}.schema-btn-toolbar{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-pack:start;justify-content:flex-start}.schema-btn-toolbar .schema-input-group{width:auto}.schema-btn-group>.schema-btn:first-child:not(:last-child):not(.schema-dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.schema-btn-group>.schema-btn:last-child:not(:first-child),.schema-btn-group>.schema-dropdown-toggle:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.schema-btn-group>.schema-btn-group{float:left}.schema-btn-group>.schema-btn-group:first-child:not(:last-child)>.schema-btn:last-child,.schema-btn-group>.schema-btn-group:first-child:not(:last-child)>.schema-dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.schema-btn-group>.schema-btn-group:last-child:not(:first-child)>.schema-btn:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.schema-btn+.schema-dropdown-toggle-split{padding-right:.5625rem;padding-left:.5625rem}.schema-btn-group-sm>.schema-btn+.schema-dropdown-toggle-split,.schema-btn-sm+.schema-dropdown-toggle-split{padding-right:.375rem;padding-left:.375rem}.schema-btn-group-lg>.schema-btn+.schema-dropdown-toggle-split,.schema-btn-lg+.schema-dropdown-toggle-split{padding-right:.75rem;padding-left:.75rem}.schema-btn-group-vertical{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:flex-start;-ms-flex-pack:center;justify-content:center}.schema-btn-group-vertical .schema-btn,.schema-btn-group-vertical .schema-btn-group{width:100%}.schema-btn-group-vertical>.schema-btn+.schema-btn,.schema-btn-group-vertical>.schema-btn+.schema-btn-group,.schema-btn-group-vertical>.schema-btn-group+.schema-btn,.schema-btn-group-vertical>.schema-btn-group+.schema-btn-group{margin-top:-1px;margin-left:0}.schema-btn-group-vertical>.schema-btn:first-child:not(:last-child){border-bottom-right-radius:0;border-bottom-left-radius:0}.schema-btn-group-vertical>.schema-btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0}.schema-btn-group-vertical>.schema-btn-group:first-child:not(:last-child)>.schema-btn:last-child,.schema-btn-group-vertical>.schema-btn-group:first-child:not(:last-child)>.schema-dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.schema-btn-group-vertical>.schema-btn-group:last-child:not(:first-child)>.schema-btn:first-child{border-top-left-radius:0;border-top-right-radius:0}.schema [data-toggle=buttons]>.schema-btn input[type=radio],.schema [data-toggle=buttons]>.schema-btn input[type=checkbox],.schema [data-toggle=buttons]>.schema-btn-group>.schema-btn input[type=radio],.schema [data-toggle=buttons]>.schema-btn-group>.schema-btn input[type=checkbox]{position:absolute;clip:rect(0,0,0,0);pointer-events:none}.schema-input-group{position:relative;display:-ms-flexbox;display:flex;width:100%}.schema-input-group .schema-form-control{position:relative;z-index:2;-ms-flex:1 1 auto;flex:1 1 auto;width:1%;margin-bottom:0}.schema-input-group .schema-form-control:active,.schema-input-group .schema-form-control:focus,.schema-input-group .schema-form-control:hover,.schema-input-group-btn>.schema-btn:active,.schema-input-group-btn>.schema-btn:focus,.schema-input-group-btn>.schema-btn:hover{z-index:3}.schema-input-group .schema-form-control,.schema-input-group-addon,.schema-input-group-btn{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.schema-input-group-addon,.schema-input-group-btn{white-space:nowrap;vertical-align:middle}.schema-input-group-addon{padding:.5rem .75rem;margin-bottom:0;font-size:1rem;font-weight:400;line-height:1.25;color:#495057;text-align:center;background-color:#e9ecef;border:1px solid rgba(0,0,0,.15);border-radius:.25rem;vertical-align:top;display:inline-block}.schema-input-group-addon.schema-form-control-sm,.schema-input-group-sm>.schema-input-group-addon,.schema-input-group-sm>.schema-input-group-btn>.schema-input-group-addon.schema-btn{padding:.25rem .5rem;font-size:.875rem;border-radius:.2rem}.schema-input-group-addon.schema-form-control-lg,.schema-input-group-lg>.schema-input-group-addon,.schema-input-group-lg>.schema-input-group-btn>.schema-input-group-addon.schema-btn{padding:.5rem 1rem;font-size:1.25rem;border-radius:.3rem}.schema-input-group-addon input[type=radio],.schema-input-group-addon input[type=checkbox]{margin-top:0}.schema-input-group .schema-form-control:not(:last-child),.schema-input-group-addon:not(:last-child),.schema-input-group-btn:not(:first-child)>.schema-btn-group:not(:last-child)>.schema-btn,.schema-input-group-btn:not(:first-child)>.schema-btn:not(:last-child):not(.schema-dropdown-toggle),.schema-input-group-btn:not(:last-child)>.schema-btn,.schema-input-group-btn:not(:last-child)>.schema-btn-group>.schema-btn,.schema-input-group-btn:not(:last-child)>.schema-dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.schema-input-group-addon:not(:last-child){border-right:0}.schema-input-group .schema-form-control:not(:first-child),.schema-input-group-addon:not(:first-child),.schema-input-group-btn:not(:first-child)>.schema-btn,.schema-input-group-btn:not(:first-child)>.schema-btn-group>.schema-btn,.schema-input-group-btn:not(:first-child)>.schema-dropdown-toggle,.schema-input-group-btn:not(:last-child)>.schema-btn-group:not(:first-child)>.schema-btn,.schema-input-group-btn:not(:last-child)>.schema-btn:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.schema-form-control+.schema-input-group-addon:not(:first-child){border-left:0}.schema-input-group-btn{position:relative;font-size:0;white-space:nowrap}.schema-input-group-btn>.schema-btn{position:relative}.schema-input-group-btn>.schema-btn+.schema-btn{margin-left:-1px}.schema-input-group-btn:not(:last-child)>.schema-btn,.schema-input-group-btn:not(:last-child)>.schema-btn-group{margin-right:-1px}.schema-input-group-btn:not(:first-child)>.schema-btn,.schema-input-group-btn:not(:first-child)>.schema-btn-group{z-index:2;margin-left:-1px}.schema-input-group-btn:not(:first-child)>.schema-btn-group:active,.schema-input-group-btn:not(:first-child)>.schema-btn-group:focus,.schema-input-group-btn:not(:first-child)>.schema-btn-group:hover,.schema-input-group-btn:not(:first-child)>.schema-btn:active,.schema-input-group-btn:not(:first-child)>.schema-btn:focus,.schema-input-group-btn:not(:first-child)>.schema-btn:hover{z-index:3}.schema-custom-control{position:relative;display:-ms-inline-flexbox;display:inline-flex;min-height:1.5rem;padding-left:1.5rem;margin-right:1rem}.schema-custom-control-input{position:absolute;z-index:-1;opacity:0}.schema-custom-control-input:checked~.schema-custom-control-indicator{color:#fff;background-color:#007bff}.schema-custom-control-input:focus~.schema-custom-control-indicator{box-shadow:0 0 0 1px #fff,0 0 0 3px #007bff}.schema-custom-control-input:active~.schema-custom-control-indicator{color:#fff;background-color:#b3d7ff}.schema-custom-control-input:disabled~.schema-custom-control-indicator{background-color:#e9ecef}.schema-custom-control-input:disabled~.schema-custom-control-description{color:#868e96}.schema-custom-control-indicator{position:absolute;top:.25rem;left:0;display:block;width:1rem;height:1rem;pointer-events:none;user-select:none;background-color:#ddd;background-repeat:no-repeat;background-position:center center;background-size:50% 50%}.schema-custom-checkbox .schema-custom-control-indicator{border-radius:.25rem}.schema-custom-checkbox .schema-custom-control-input:checked~.schema-custom-control-indicator{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z'/%3E%3C/svg%3E")}.schema-custom-checkbox .schema-custom-control-input:indeterminate~.schema-custom-control-indicator{background-color:#007bff;background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 4'%3E%3Cpath stroke='%23fff' d='M0 2h4'/%3E%3C/svg%3E")}.schema-custom-radio .schema-custom-control-indicator{border-radius:50%}.schema-custom-radio .schema-custom-control-input:checked~.schema-custom-control-indicator{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3E%3Ccircle r='3' fill='%23fff'/%3E%3C/svg%3E")}.schema-custom-controls-stacked{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.schema-custom-controls-stacked .schema-custom-control{margin-bottom:.25rem}.schema-custom-controls-stacked .schema-custom-control+.schema-custom-control{margin-left:0}.schema-custom-select{display:inline-block;max-width:100%;height:calc(2.25rem + 2px);padding:.375rem 1.75rem .375rem .75rem;line-height:1.25;color:#495057;vertical-align:middle;background:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23333' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E") right .75rem center no-repeat #fff;background-size:8px 10px;border:1px solid rgba(0,0,0,.15);border-radius:.25rem;-webkit-appearance:none;-moz-appearance:none;appearance:none}.schema-custom-select:focus{border-color:#80bdff;outline:0}.schema-custom-select:focus::-ms-value{color:#495057;background-color:#fff}.schema-custom-select:disabled{color:#868e96;background-color:#e9ecef}.schema-custom-select::-ms-expand{opacity:0}.schema-custom-select-sm{height:calc(1.8125rem + 2px);padding-top:.375rem;padding-bottom:.375rem;font-size:75%}.schema-custom-file{position:relative;display:inline-block;max-width:100%;height:2.5rem;margin-bottom:0}.schema-custom-file-control,.schema-custom-file-control::before{position:absolute;height:2.5rem;padding:.5rem 1rem;color:#495057;line-height:1.5}.schema-custom-file-input{min-width:14rem;max-width:100%;height:2.5rem;margin:0;opacity:0}.schema-custom-file-control{top:0;right:0;left:0;z-index:5;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#fff;border:1px solid rgba(0,0,0,.15);border-radius:.25rem}.schema-custom-file-control:lang(en):empty::after{content:"Choose file..."}.schema-custom-file-control::before{top:-1px;right:-1px;bottom:-1px;z-index:6;display:block;background-color:#e9ecef;border:1px solid rgba(0,0,0,.15);border-radius:0 .25rem .25rem 0}.schema-custom-file-control:lang(en)::before{content:"Browse"}.schema-modal-open{overflow:hidden}.schema-modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;display:none;overflow:hidden;outline:0}.schema-modal.fade .schema-modal-dialog{transition:-webkit-transform .3s ease-out;transition:transform .3s ease-out;transition:transform .3s ease-out,-webkit-transform .3s ease-out;-webkit-transform:translate(0,-25%);transform:translate(0,-25%)}.schema-modal.show .schema-modal-dialog{-webkit-transform:translate(0,0);transform:translate(0,0)}.schema-modal-open .schema-modal{overflow-x:hidden;overflow-y:auto}.schema-modal-dialog{position:relative;width:auto;margin:10px}.schema-modal-content{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:.3rem;outline:0}.schema-badge,.schema-progress{text-align:center;border-radius:.25rem}.schema-modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.schema-modal-backdrop.fade{opacity:0}.schema-modal-backdrop.show{opacity:.5}.schema-modal-header{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;padding:15px;border-bottom:1px solid #e9ecef}.schema-modal-title{margin-bottom:0;line-height:1.5}.schema-modal-body{position:relative;-ms-flex:1 1 auto;flex:1 1 auto;padding:15px}.schema-modal-footer{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:end;justify-content:flex-end;padding:15px;border-top:1px solid #e9ecef}.schema-modal-footer>:not(:first-child){margin-left:.25rem}.schema-modal-footer>:not(:last-child){margin-right:.25rem}.schema-modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:576px){.schema-modal-dialog{max-width:500px;margin:30px auto}.schema-modal-sm{max-width:300px}}@media (min-width:992px){.schema-modal-lg{max-width:800px}}@-webkit-keyframes progress-bar-stripes{from{background-position:1rem 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:1rem 0}to{background-position:0 0}}.schema-progress{display:-ms-flexbox;display:flex;overflow:hidden;font-size:.75rem;line-height:1rem;background-color:#e9ecef}.schema-badge-primary,.schema-progress-bar{background-color:#007bff;color:#fff}.schema-progress-bar{height:1rem;line-height:1rem;transition:width .6s ease}.schema-progress-bar-striped{background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-size:1rem 1rem}.schema-progress-bar-animated{-webkit-animation:progress-bar-stripes 1s linear infinite;animation:progress-bar-stripes 1s linear infinite}.schema-badge{display:inline-block;padding:.25em .4em;font-size:75%;font-weight:700;line-height:1;color:#fff;white-space:nowrap;vertical-align:baseline}.schema-badge:empty{display:none}.schema-btn .schema-badge{position:relative;top:-1px}.schema-badge-pill{padding-right:.6em;padding-left:.6em;border-radius:10rem}.schema-badge-primary[href]:focus,.schema-badge-primary[href]:hover{color:#fff;text-decoration:none;background-color:#0062cc}.schema-badge-secondary{color:#fff;background-color:#868e96}.schema-badge-secondary[href]:focus,.schema-badge-secondary[href]:hover{color:#fff;text-decoration:none;background-color:#6c757d}.schema-badge-success{color:#fff;background-color:#28a745}.schema-badge-success[href]:focus,.schema-badge-success[href]:hover{color:#fff;text-decoration:none;background-color:#1e7e34}.schema-badge-info{color:#fff;background-color:#17a2b8}.schema-badge-info[href]:focus,.schema-badge-info[href]:hover{color:#fff;text-decoration:none;background-color:#117a8b}.schema-badge-warning{color:#111;background-color:#ffc107}.schema-badge-warning[href]:focus,.schema-badge-warning[href]:hover{color:#111;text-decoration:none;background-color:#d39e00}.schema-badge-danger{color:#fff;background-color:#dc3545}.schema-badge-danger[href]:focus,.schema-badge-danger[href]:hover{color:#fff;text-decoration:none;background-color:#bd2130}.schema-badge-light{color:#111;background-color:#f8f9fa}.schema-badge-light[href]:focus,.schema-badge-light[href]:hover{color:#111;text-decoration:none;background-color:#dae0e5}.schema-badge-dark{color:#fff;background-color:#343a40}.schema-badge-dark[href]:focus,.schema-badge-dark[href]:hover{color:#fff;text-decoration:none;background-color:#1d2124}
|
assets/fonts/dashicons.eot
ADDED
Binary file
|
assets/fonts/dashicons.svg
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" standalone="no"?>
|
2 |
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
3 |
+
<svg xmlns="http://www.w3.org/2000/svg">
|
4 |
+
<metadata>Generated by IcoMoon</metadata>
|
5 |
+
<defs>
|
6 |
+
<font id="icomoon" horiz-adv-x="1024">
|
7 |
+
<font-face units-per-em="1024" ascent="960" descent="-64" />
|
8 |
+
<missing-glyph horiz-adv-x="1024" />
|
9 |
+
<glyph unicode=" " horiz-adv-x="512" d="" />
|
10 |
+
<glyph unicode="" glyph-name="compass2" d="M512 960c-282.77 0-512-229.23-512-512s229.23-512 512-512 512 229.23 512 512-229.23 512-512 512zM96 448c0 229.75 186.25 416 416 416 109.574 0 209.232-42.386 283.534-111.628l-411.534-176.372-176.372-411.534c-69.242 74.302-111.628 173.96-111.628 283.534zM585.166 374.834l-256.082-109.75 109.75 256.082 146.332-146.332zM512 32c-109.574 0-209.234 42.386-283.532 111.628l411.532 176.372 176.372 411.532c69.242-74.298 111.628-173.958 111.628-283.532 0-229.75-186.25-416-416-416z" />
|
11 |
+
</font></defs></svg>
|
assets/fonts/dashicons.ttf
ADDED
Binary file
|
assets/fonts/dashicons.woff
ADDED
Binary file
|
assets/images/admin-bar/google-developers-hover.png
ADDED
Binary file
|
assets/images/admin-bar/google-developers.png
ADDED
Binary file
|
assets/images/banner-772x250.png
ADDED
Binary file
|
assets/images/icon-128x128.png
ADDED
Binary file
|
assets/images/icon-256x256.png
ADDED
Binary file
|
assets/images/schema-badge.png
ADDED
Binary file
|
assets/images/screenshot-1.png
ADDED
Binary file
|
assets/images/screenshot-2.png
ADDED
Binary file
|
assets/images/screenshot-3.png
ADDED
Binary file
|
assets/images/screenshot-4.png
ADDED
Binary file
|
assets/images/serps.png
ADDED
Binary file
|
assets/js/admin.js
ADDED
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function($) {
|
2 |
+
|
3 |
+
// Tooltips
|
4 |
+
$('.schema-wp-help-tip').tooltip({
|
5 |
+
content: function() {
|
6 |
+
return $(this).prop('title');
|
7 |
+
},
|
8 |
+
tooltipClass: 'schema-wp-ui-tooltip',
|
9 |
+
position: {
|
10 |
+
my: 'center top',
|
11 |
+
at: 'center bottom+10',
|
12 |
+
collision: 'flipfit',
|
13 |
+
},
|
14 |
+
hide: {
|
15 |
+
duration: 200,
|
16 |
+
},
|
17 |
+
show: {
|
18 |
+
duration: 200,
|
19 |
+
},
|
20 |
+
});
|
21 |
+
|
22 |
+
// Date picker
|
23 |
+
var schema_wp_datepicker = $( '.schema_wp_datepicker' );
|
24 |
+
if ( schema_wp_datepicker.length > 0 ) {
|
25 |
+
var dateFormat = 'mm/dd/yy';
|
26 |
+
schema_wp_datepicker.datepicker( {
|
27 |
+
dateFormat: dateFormat
|
28 |
+
} );
|
29 |
+
}
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Settings screen JS
|
35 |
+
*/
|
36 |
+
var Schema_WP_Settings = {
|
37 |
+
|
38 |
+
init : function() {
|
39 |
+
this.general();
|
40 |
+
},
|
41 |
+
|
42 |
+
general : function() {
|
43 |
+
|
44 |
+
var schema_wp_color_picker = $('.schema-wp-color-picker');
|
45 |
+
|
46 |
+
if( schema_wp_color_picker.length ) {
|
47 |
+
schema_wp_color_picker.wpColorPicker();
|
48 |
+
}
|
49 |
+
|
50 |
+
// Settings Upload field JS
|
51 |
+
if ( typeof wp === "undefined" || '1' !== schema_wp_vars.new_media_ui ) {
|
52 |
+
//Old Thickbox uploader
|
53 |
+
var schema_wp_settings_upload_button = $( '.schema_wp_settings_upload_button' );
|
54 |
+
if ( schema_wp_settings_upload_button.length > 0 ) {
|
55 |
+
window.formfield = '';
|
56 |
+
|
57 |
+
$( document.body ).on('click', schema_wp_settings_upload_button, function(e) {
|
58 |
+
e.preventDefault();
|
59 |
+
window.formfield = $(this).parent().prev();
|
60 |
+
window.tbframe_interval = setInterval(function() {
|
61 |
+
jQuery('#TB_iframeContent').contents().find('.savesend .button').val(schema_wp_vars.use_this_file).end().find('#insert-gallery, .wp-post-thumbnail').hide();
|
62 |
+
}, 2000);
|
63 |
+
tb_show( schema_wp_vars.add_new_download, 'media-upload.php?TB_iframe=true' );
|
64 |
+
});
|
65 |
+
|
66 |
+
window.schema_wp_send_to_editor = window.send_to_editor;
|
67 |
+
window.send_to_editor = function (html) {
|
68 |
+
if (window.formfield) {
|
69 |
+
imgurl = $('a', '<div>' + html + '</div>').attr('href');
|
70 |
+
window.formfield.val(imgurl);
|
71 |
+
window.clearInterval(window.tbframe_interval);
|
72 |
+
tb_remove();
|
73 |
+
} else {
|
74 |
+
window.schema_wp_send_to_editor(html);
|
75 |
+
}
|
76 |
+
window.send_to_editor = window.schema_wp_send_to_editor;
|
77 |
+
window.formfield = '';
|
78 |
+
window.imagefield = false;
|
79 |
+
};
|
80 |
+
}
|
81 |
+
} else {
|
82 |
+
// WP 3.5+ uploader
|
83 |
+
var file_frame;
|
84 |
+
window.formfield = '';
|
85 |
+
|
86 |
+
$( document.body ).on('click', '.schema_wp_settings_upload_button', function(e) {
|
87 |
+
|
88 |
+
e.preventDefault();
|
89 |
+
|
90 |
+
var button = $(this);
|
91 |
+
|
92 |
+
window.formfield = $(this).parent().prev();
|
93 |
+
|
94 |
+
// If the media frame already exists, reopen it.
|
95 |
+
if ( file_frame ) {
|
96 |
+
//file_frame.uploader.uploader.param( 'post_id', set_to_post_id );
|
97 |
+
file_frame.open();
|
98 |
+
return;
|
99 |
+
}
|
100 |
+
|
101 |
+
/*
|
102 |
+
// Create the media frame.
|
103 |
+
file_frame = wp.media.frames.file_frame = wp.media({
|
104 |
+
frame: 'post',
|
105 |
+
state: 'insert',
|
106 |
+
title: button.data( 'uploader_title' ),
|
107 |
+
button: {
|
108 |
+
text: button.data( 'uploader_button_text' )
|
109 |
+
},
|
110 |
+
multiple: false
|
111 |
+
});
|
112 |
+
*/
|
113 |
+
|
114 |
+
// Create the media frame.
|
115 |
+
file_frame = wp.media.frames.file_frame = wp.media({
|
116 |
+
frame: 'post',
|
117 |
+
title: 'Choose Image',
|
118 |
+
multiple: false,
|
119 |
+
library: {
|
120 |
+
type: 'image'
|
121 |
+
},
|
122 |
+
button: {
|
123 |
+
text: 'Use Image'
|
124 |
+
}
|
125 |
+
});
|
126 |
+
|
127 |
+
file_frame.on( 'menu:render:default', function( view ) {
|
128 |
+
// Store our views in an object.
|
129 |
+
var views = {};
|
130 |
+
|
131 |
+
// Unset default menu items
|
132 |
+
view.unset( 'library-separator' );
|
133 |
+
view.unset( 'gallery' );
|
134 |
+
view.unset( 'featured-image' );
|
135 |
+
view.unset( 'embed' );
|
136 |
+
|
137 |
+
// Initialize the views in our view object.
|
138 |
+
view.set( views );
|
139 |
+
} );
|
140 |
+
|
141 |
+
// When an image is selected, run a callback.
|
142 |
+
file_frame.on( 'insert', function() {
|
143 |
+
|
144 |
+
var selection = file_frame.state().get('selection');
|
145 |
+
selection.each( function( attachment, index ) {
|
146 |
+
attachment = attachment.toJSON();
|
147 |
+
window.formfield.val(attachment.url);
|
148 |
+
|
149 |
+
/* image prevoew */
|
150 |
+
var img = $('<img />');
|
151 |
+
img.attr('src', attachment.url);
|
152 |
+
// replace previous image with new one if selected
|
153 |
+
$('#preview_image').empty().append( img );
|
154 |
+
|
155 |
+
// show preview div when image exists
|
156 |
+
if ( $('#preview_image img') ) {
|
157 |
+
$('#preview_image').show();
|
158 |
+
}
|
159 |
+
|
160 |
+
});
|
161 |
+
|
162 |
+
});
|
163 |
+
|
164 |
+
// Finally, open the modal
|
165 |
+
file_frame.open();
|
166 |
+
});
|
167 |
+
|
168 |
+
|
169 |
+
// WP 3.5+ uploader
|
170 |
+
var file_frame;
|
171 |
+
window.formfield = '';
|
172 |
+
}
|
173 |
+
|
174 |
+
},
|
175 |
+
|
176 |
+
}
|
177 |
+
Schema_WP_Settings.init();
|
178 |
+
|
179 |
+
/*
|
180 |
+
// Settings media uploader
|
181 |
+
var file_frame;
|
182 |
+
window.formfield = '';
|
183 |
+
|
184 |
+
$('body').on('click', '.schema_wp_settings_upload_button', function(e) {
|
185 |
+
|
186 |
+
e.preventDefault();
|
187 |
+
|
188 |
+
window.formfield = $(this).parent().prev();
|
189 |
+
|
190 |
+
// If the media frame already exists, reopen it.
|
191 |
+
if ( file_frame ) {
|
192 |
+
//file_frame.uploader.uploader.param( 'post_id', set_to_post_id );
|
193 |
+
file_frame.open();
|
194 |
+
return;
|
195 |
+
}
|
196 |
+
|
197 |
+
// Create the media frame.
|
198 |
+
file_frame = wp.media.frames.file_frame = wp.media({
|
199 |
+
frame: 'select',
|
200 |
+
title: 'Choose Image',
|
201 |
+
multiple: false,
|
202 |
+
library: {
|
203 |
+
type: 'image'
|
204 |
+
},
|
205 |
+
button: {
|
206 |
+
text: 'Use Image'
|
207 |
+
}
|
208 |
+
});
|
209 |
+
|
210 |
+
file_frame.on( 'menu:render:default', function(view) {
|
211 |
+
// Store our views in an object.
|
212 |
+
var views = {};
|
213 |
+
|
214 |
+
// Unset default menu items
|
215 |
+
view.unset('library-separator');
|
216 |
+
view.unset('gallery');
|
217 |
+
view.unset('featured-image');
|
218 |
+
view.unset('embed');
|
219 |
+
|
220 |
+
// Initialize the views in our view object.
|
221 |
+
view.set(views);
|
222 |
+
});
|
223 |
+
|
224 |
+
// When an image is selected, run a callback.
|
225 |
+
file_frame.on( 'select', function() {
|
226 |
+
var attachment = file_frame.state().get('selection').first().toJSON();
|
227 |
+
formfield.val(attachment.url);
|
228 |
+
|
229 |
+
var img = $('<img />');
|
230 |
+
img.attr('src', attachment.url);
|
231 |
+
// replace previous image with new one if selected
|
232 |
+
$('#preview_image').empty().append( img );
|
233 |
+
|
234 |
+
// show preview div when image exists
|
235 |
+
if ( $('#preview_image img') ) {
|
236 |
+
$('#preview_image').show();
|
237 |
+
}
|
238 |
+
});
|
239 |
+
|
240 |
+
// Finally, open the modal
|
241 |
+
file_frame.open();
|
242 |
+
});
|
243 |
+
|
244 |
+
var file_frame;
|
245 |
+
window.formfield = '';
|
246 |
+
*/
|
247 |
+
});
|
assets/js/admin.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
jQuery(document).ready(function(a){a(".schema-wp-help-tip").tooltip({content:function(){return a(this).prop("title")},tooltipClass:"schema-wp-ui-tooltip",position:{my:"center top",at:"center bottom+10",collision:"flipfit"},hide:{duration:200},show:{duration:200}});var b=a(".schema_wp_datepicker");if(b.length>0){var c="mm/dd/yy";b.datepicker({dateFormat:c})}var d={init:function(){this.general()},general:function(){var b=a(".schema-wp-color-picker");if(b.length&&b.wpColorPicker(),"undefined"==typeof wp||"1"!==schema_wp_vars.new_media_ui){var c=a(".schema_wp_settings_upload_button");c.length>0&&(window.formfield="",a(document.body).on("click",c,function(b){b.preventDefault(),window.formfield=a(this).parent().prev(),window.tbframe_interval=setInterval(function(){jQuery("#TB_iframeContent").contents().find(".savesend .button").val(schema_wp_vars.use_this_file).end().find("#insert-gallery, .wp-post-thumbnail").hide()},2e3),tb_show(schema_wp_vars.add_new_download,"media-upload.php?TB_iframe=true")}),window.schema_wp_send_to_editor=window.send_to_editor,window.send_to_editor=function(b){window.formfield?(imgurl=a("a","<div>"+b+"</div>").attr("href"),window.formfield.val(imgurl),window.clearInterval(window.tbframe_interval),tb_remove()):window.schema_wp_send_to_editor(b),window.send_to_editor=window.schema_wp_send_to_editor,window.formfield="",window.imagefield=!1})}else{var d;window.formfield="",a(document.body).on("click",".schema_wp_settings_upload_button",function(b){b.preventDefault();a(this);return window.formfield=a(this).parent().prev(),d?void d.open():(d=wp.media.frames.file_frame=wp.media({frame:"post",title:"Choose Image",multiple:!1,library:{type:"image"},button:{text:"Use Image"}}),d.on("menu:render:default",function(a){var b={};a.unset("library-separator"),a.unset("gallery"),a.unset("featured-image"),a.unset("embed"),a.set(b)}),d.on("insert",function(){var b=d.state().get("selection");b.each(function(b,c){b=b.toJSON(),window.formfield.val(b.url);var d=a("<img />");d.attr("src",b.url),a("#preview_image").empty().append(d),a("#preview_image img")&&a("#preview_image").show()})}),void d.open())});var d;window.formfield=""}}};d.init()});
|
includes/admin/admin-bar-menu.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
*
|
4 |
+
* Admin Bar Menu
|
5 |
+
*
|
6 |
+
* @since 1.5.4
|
7 |
+
*/
|
8 |
+
|
9 |
+
// Exit if accessed directly
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
+
|
12 |
+
|
13 |
+
add_action( 'admin_bar_menu', 'schema_wp_admin_bar_menu_items', 99 );
|
14 |
+
/*
|
15 |
+
* Add Google Rich Snippet Test Tool link to admin bar menu
|
16 |
+
*
|
17 |
+
* @since 1.5.4
|
18 |
+
*/
|
19 |
+
function schema_wp_admin_bar_menu_items( $admin_bar ) {
|
20 |
+
|
21 |
+
/* This print_r will show you the current contents of the admin menu bar, use it if you want to examine the $admin_bar array
|
22 |
+
* echo "<pre>";
|
23 |
+
* print_r($admin_bar);
|
24 |
+
* echo "</pre>";
|
25 |
+
*/
|
26 |
+
|
27 |
+
// If it's admin page, then get out!
|
28 |
+
if (is_admin()) return;
|
29 |
+
|
30 |
+
// Get current page url
|
31 |
+
$url = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
|
32 |
+
|
33 |
+
// If user can't publish posts, then get out
|
34 |
+
if ( ! current_user_can( 'publish_posts' ) ) return;
|
35 |
+
|
36 |
+
$admin_bar->add_menu( array(
|
37 |
+
'id' => 'schema-test-item',
|
38 |
+
'title' => __('', 'schema-wp'),
|
39 |
+
'href' => 'https://developers.google.com/structured-data/testing-tool/?url='.$url,
|
40 |
+
'meta' => array(
|
41 |
+
'title' => __('Structured Data Testing Tool', 'schema-wp'),
|
42 |
+
'class' => 'schema_google_developers',
|
43 |
+
'target' => __('_blank')
|
44 |
+
),
|
45 |
+
) );
|
46 |
+
}
|
47 |
+
|
48 |
+
|
49 |
+
// on backend area
|
50 |
+
//add_action( 'admin_head', 'schema_wp_admin_bar_styles' );
|
51 |
+
// on frontend area
|
52 |
+
add_action( 'wp_head', 'schema_wp_admin_bar_styles' );
|
53 |
+
/*
|
54 |
+
* Add styles to admin bar
|
55 |
+
*
|
56 |
+
* @since 1.5.4
|
57 |
+
*/
|
58 |
+
function schema_wp_admin_bar_styles() {
|
59 |
+
|
60 |
+
if ( ! is_admin_bar_showing() ) return;
|
61 |
+
|
62 |
+
?>
|
63 |
+
<style type="text/css">
|
64 |
+
/* admin bar */
|
65 |
+
.schema_google_developers a {
|
66 |
+
padding-left:30px !important;
|
67 |
+
background: transparent url('<?php echo SCHEMAWP_PLUGIN_URL; ?>assets/images/admin-bar/google-developers.png') 8px 50% no-repeat !important;
|
68 |
+
}
|
69 |
+
.schema_google_developers a:hover {
|
70 |
+
background: transparent url('<?php echo SCHEMAWP_PLUGIN_URL; ?>assets/images/admin-bar/google-developers-hover.png') 8px 50% no-repeat !important;
|
71 |
+
}
|
72 |
+
</style>
|
73 |
+
<?php
|
74 |
+
}
|
includes/admin/admin-functions.php
ADDED
@@ -0,0 +1,250 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Admin Functions
|
4 |
+
*
|
5 |
+
* @package Schema
|
6 |
+
* @subpackage Admin Functions/Formatting
|
7 |
+
* @copyright Copyright (c) 2016, Hesham Zebida
|
8 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
+
* @since 1.0
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
|
16 |
+
add_action( 'schema_wp_do_after_settings_updated', 'schema_wp_after_update_settings' );
|
17 |
+
/**
|
18 |
+
* Delete Schema KSON-LD cached data in post meta on plugin settings update
|
19 |
+
*
|
20 |
+
*
|
21 |
+
* @since 1.6.1
|
22 |
+
*/
|
23 |
+
function schema_wp_after_update_settings() {
|
24 |
+
|
25 |
+
// Delete cached data in post meta
|
26 |
+
schema_wp_json_delete_cache();
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Delete Schema KSON-LD cached data in post meta
|
31 |
+
*
|
32 |
+
*
|
33 |
+
* @since 1.6.1
|
34 |
+
*/
|
35 |
+
function schema_wp_json_delete_cache() {
|
36 |
+
|
37 |
+
// Delete cached data in post meta
|
38 |
+
delete_post_meta_by_key( '_schema_json' );
|
39 |
+
delete_post_meta_by_key( '_schema_json_timestamp' );
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Sanitizes a string key for Schema Settings
|
44 |
+
*
|
45 |
+
* Keys are used as internal identifiers. Alphanumeric characters, dashes, underscores, stops, colons and slashes are allowed
|
46 |
+
*
|
47 |
+
* @since 1.5.9.3
|
48 |
+
* @param string $key String key
|
49 |
+
* @return string Sanitized key
|
50 |
+
*/
|
51 |
+
function schema_wp_sanitize_key( $key ) {
|
52 |
+
$raw_key = $key;
|
53 |
+
$key = preg_replace( '/[^a-zA-Z0-9_\-\.\:\/]/', '', $key );
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Filter a sanitized key string.
|
57 |
+
*
|
58 |
+
* @since 2.5.8
|
59 |
+
* @param string $key Sanitized key.
|
60 |
+
* @param string $raw_key The key prior to sanitization.
|
61 |
+
*/
|
62 |
+
return apply_filters( 'schema_wp_sanitize_key', $key, $raw_key );
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Convert an object to an associative array.
|
67 |
+
*
|
68 |
+
* Can handle multidimensional arrays
|
69 |
+
*
|
70 |
+
* @since 1.0
|
71 |
+
*
|
72 |
+
* @param unknown $data
|
73 |
+
* @return array
|
74 |
+
*/
|
75 |
+
function schema_wp_object_to_array( $data ) {
|
76 |
+
if ( is_array( $data ) || is_object( $data ) ) {
|
77 |
+
$result = array();
|
78 |
+
foreach ( $data as $key => $value ) {
|
79 |
+
$result[ $key ] = schema_wp_object_to_array( $value );
|
80 |
+
}
|
81 |
+
return $result;
|
82 |
+
}
|
83 |
+
return $data;
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Flatten an array
|
88 |
+
*
|
89 |
+
* @since 1.4.7
|
90 |
+
* @return flat array
|
91 |
+
*/
|
92 |
+
function schema_wp_array_flatten($array) {
|
93 |
+
|
94 |
+
$return = array();
|
95 |
+
foreach ($array as $key => $value) {
|
96 |
+
if (is_array($value)){ $return = array_merge($return, array_flatten($value));}
|
97 |
+
else {$return[$key] = $value;}
|
98 |
+
}
|
99 |
+
|
100 |
+
return $return;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Retrieve a post given its title.
|
105 |
+
*
|
106 |
+
* @link http://wordpress.stackexchange.com/questions/11292/how-do-i-get-a-post-page-or-cpt-id-from-a-title-or-slug/11296#11296
|
107 |
+
*
|
108 |
+
* @since 1.6
|
109 |
+
*
|
110 |
+
* @uses $wpdb
|
111 |
+
*
|
112 |
+
* @param string $post_title Page title
|
113 |
+
* @param string $post_type post type ('post','page','any custom type')
|
114 |
+
* @param string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A.
|
115 |
+
* @return mixed
|
116 |
+
*/
|
117 |
+
function schema_wp_get_post_by_title($page_title, $post_type = 'post' , $output = OBJECT) {
|
118 |
+
global $wpdb;
|
119 |
+
$post = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type= %s", $page_title, $post_type));
|
120 |
+
if ( $post )
|
121 |
+
return get_post($post, $output);
|
122 |
+
|
123 |
+
return null;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Recursive array search
|
128 |
+
*
|
129 |
+
* #link http://php.net/manual/en/function.array-search.php
|
130 |
+
*
|
131 |
+
* @since 1.6
|
132 |
+
* @return Returns the key for needle if it is found in the array, FALSE otherwise.
|
133 |
+
*/
|
134 |
+
function schema_wp_recursive_array_search( $needle, $haystack ) {
|
135 |
+
foreach($haystack as $key=>$value) {
|
136 |
+
$current_key=$key;
|
137 |
+
if($needle===$value OR (is_array($value) && schema_wp_recursive_array_search($needle,$value) !== false)) {
|
138 |
+
return $current_key;
|
139 |
+
}
|
140 |
+
}
|
141 |
+
return false;
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Get corporate contacts types
|
146 |
+
*
|
147 |
+
* @since 1.0
|
148 |
+
* @return array $corporate_contacts_types A list of the available types
|
149 |
+
*/
|
150 |
+
function schema_wp_get_corporate_contacts_types() {
|
151 |
+
|
152 |
+
$corporate_contacts_types = array(
|
153 |
+
'customer_support' => __( 'Customer Support', 'schema-wp' ),
|
154 |
+
'technical_support' => __( 'Technical Support', 'schema-wp' ),
|
155 |
+
'billing_support' => __( 'Billing Support', 'schema-wp' ),
|
156 |
+
'bill_payment' => __( 'Bill Payment', 'schema-wp' ),
|
157 |
+
'sales' => __( 'Sales', 'schema-wp' ),
|
158 |
+
'reservations' => __( 'Reservations', 'schema-wp' ),
|
159 |
+
'credit_card_support' => __( 'Credit Card Support', 'schema-wp' ),
|
160 |
+
'emergency' => __( 'Emergency', 'schema-wp' ),
|
161 |
+
'baggage_tracking' => __( 'Baggage Tracking', 'schema-wp' ),
|
162 |
+
'roadside_assistance' => __( 'Roadside Assistance', 'schema-wp' ),
|
163 |
+
'package_tracking' => __( 'Package Tracking', 'schema-wp' ),
|
164 |
+
);
|
165 |
+
|
166 |
+
return apply_filters( 'schema_wp_corporate_contacts_types', $corporate_contacts_types );
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Get post types
|
171 |
+
*
|
172 |
+
* @since 1.6.9.1
|
173 |
+
* @return array $post_types of all registered post types
|
174 |
+
*/
|
175 |
+
function schema_wp_get_post_types() {
|
176 |
+
|
177 |
+
$post_types = array();
|
178 |
+
$builtin = array();
|
179 |
+
|
180 |
+
$builtin['post'] = array(
|
181 |
+
'name' => 'post',
|
182 |
+
'label' => 'Post'
|
183 |
+
);
|
184 |
+
|
185 |
+
$builtin['page'] = array(
|
186 |
+
'name' => 'page',
|
187 |
+
'label' => 'Page'
|
188 |
+
);
|
189 |
+
|
190 |
+
// all CPTs.
|
191 |
+
$cpts_obj = get_post_types( array(
|
192 |
+
'public' => true,
|
193 |
+
'_builtin' => false
|
194 |
+
) ,
|
195 |
+
'objects'); // return post types 'objects'
|
196 |
+
|
197 |
+
if ( ! empty($cpts_obj) ) {
|
198 |
+
// prepare array
|
199 |
+
foreach ( $cpts_obj as $cpt => $info ) {
|
200 |
+
$cpts[$cpt] = array(
|
201 |
+
'name' => $cpt,
|
202 |
+
'label' => $info->label
|
203 |
+
);
|
204 |
+
}
|
205 |
+
|
206 |
+
// merge Builtin types and 'important' CPTs to resulting array to use as argument.
|
207 |
+
$post_types = array_merge( $builtin, $cpts );
|
208 |
+
} else {
|
209 |
+
|
210 |
+
$post_types = $builtin;
|
211 |
+
}
|
212 |
+
|
213 |
+
// debug
|
214 |
+
//echo'<pre>';print_r($post_types);echo'</pre>';
|
215 |
+
|
216 |
+
return apply_filters( 'schema_wp_post_types', $post_types );
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Get the current post type in the WordPress Admin
|
221 |
+
*
|
222 |
+
* @url https://gist.github.com/DomenicF/3ebcf7d53ce3182854716c4d8f1ab2e2
|
223 |
+
* @since 1.6.9.6
|
224 |
+
* @return array $post_types of all registered post types
|
225 |
+
*/
|
226 |
+
function schema_wp_get_current_post_type() {
|
227 |
+
global $post, $typenow, $current_screen;
|
228 |
+
//we have a post so we can just get the post type from that
|
229 |
+
if ( $post && $post->post_type ) {
|
230 |
+
return $post->post_type;
|
231 |
+
}
|
232 |
+
//check the global $typenow - set in admin.php
|
233 |
+
elseif ( $typenow ) {
|
234 |
+
return $typenow;
|
235 |
+
}
|
236 |
+
//check the global $current_screen object - set in sceen.php
|
237 |
+
elseif ( $current_screen && $current_screen->post_type ) {
|
238 |
+
return $current_screen->post_type;
|
239 |
+
}
|
240 |
+
//check the post_type querystring
|
241 |
+
elseif ( isset( $_REQUEST['post_type'] ) ) {
|
242 |
+
return sanitize_key( $_REQUEST['post_type'] );
|
243 |
+
}
|
244 |
+
//lastly check if post ID is in query string
|
245 |
+
elseif ( isset( $_REQUEST['post'] ) ) {
|
246 |
+
return get_post_type( $_REQUEST['post'] );
|
247 |
+
}
|
248 |
+
//we do not know the post type!
|
249 |
+
return null;
|
250 |
+
}
|
includes/admin/admin-pages.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Determines whether the current admin page is an Schema admin page.
|
4 |
+
*
|
5 |
+
* Only works after the `wp_loaded` hook, & most effective
|
6 |
+
* starting on `admin_menu` hook.
|
7 |
+
*
|
8 |
+
* @since 1.0
|
9 |
+
* @return bool True if Schema admin page.
|
10 |
+
*/
|
11 |
+
function schema_wp_is_admin_page() {
|
12 |
+
|
13 |
+
if ( ! is_admin() || ! did_action( 'wp_loaded' ) ) {
|
14 |
+
$ret = false;
|
15 |
+
}
|
16 |
+
|
17 |
+
if( ! isset( $_GET['page'] ) ) {
|
18 |
+
$ret = false;
|
19 |
+
}
|
20 |
+
|
21 |
+
$page = isset( $_GET['page'] ) ? $_GET['page'] : '';
|
22 |
+
|
23 |
+
$pages = array(
|
24 |
+
'schema',
|
25 |
+
'schema-extensions',
|
26 |
+
'schema-wp-getting-started',
|
27 |
+
'schema-wp-what-is-new',
|
28 |
+
'schema-wp-credits'
|
29 |
+
);
|
30 |
+
|
31 |
+
$ret = in_array( $page, $pages );
|
32 |
+
|
33 |
+
return apply_filters( 'schema_wp_is_admin_page', $ret );
|
34 |
+
}
|
includes/admin/class-feedback.php
ADDED
@@ -0,0 +1,291 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin review class.
|
4 |
+
* Prompts users to give a review of the plugin on WordPress.org after a period of usage.
|
5 |
+
*
|
6 |
+
* Heavily based on code by Rhys Wynne
|
7 |
+
* https://winwar.co.uk/2014/10/ask-wordpress-plugin-reviews-week/
|
8 |
+
*
|
9 |
+
* @version 1.0
|
10 |
+
* @copyright Copyright (c), Ryan Hellyer
|
11 |
+
* @author Ryan Hellyer <ryanhellyer@gmail.com>
|
12 |
+
*/
|
13 |
+
if ( ! class_exists( 'Schema_DotOrg_Plugin_Feedback' ) ) :
|
14 |
+
class Schema_DotOrg_Plugin_Feedback {
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Private variables.
|
18 |
+
*
|
19 |
+
* These should be customised for each project.
|
20 |
+
*/
|
21 |
+
private $slug; // The plugin slug
|
22 |
+
private $name; // The plugin name
|
23 |
+
private $time_limit; // The time limit at which notice is shown
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Variables.
|
27 |
+
*/
|
28 |
+
public $nobug_option;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Fire the constructor up :)
|
32 |
+
*/
|
33 |
+
public function __construct( $args ) {
|
34 |
+
|
35 |
+
$this->slug = $args['slug'];
|
36 |
+
$this->name = $args['name'];
|
37 |
+
if ( isset( $args['time_limit'] ) ) {
|
38 |
+
$this->time_limit = $args['time_limit'];
|
39 |
+
} else {
|
40 |
+
$this->time_limit = WEEK_IN_SECONDS;
|
41 |
+
}
|
42 |
+
|
43 |
+
$this->nobug_option = $this->slug . '-no-bug';
|
44 |
+
|
45 |
+
// Loading main functionality
|
46 |
+
add_action( 'admin_init', array( $this, 'check_installation_date' ) );
|
47 |
+
add_action( 'admin_init', array( $this, 'set_no_bug' ), 5 );
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Seconds to words.
|
52 |
+
*/
|
53 |
+
public function seconds_to_words( $seconds ) {
|
54 |
+
|
55 |
+
// Get the years
|
56 |
+
$years = ( intval( $seconds ) / YEAR_IN_SECONDS ) % 100;
|
57 |
+
if ( $years > 1 ) {
|
58 |
+
return sprintf( __( '%s years', $this->slug ), $years );
|
59 |
+
} elseif ( $years > 0) {
|
60 |
+
return __( 'a year', $this->slug );
|
61 |
+
}
|
62 |
+
|
63 |
+
// Get the weeks
|
64 |
+
$weeks = ( intval( $seconds ) / WEEK_IN_SECONDS ) % 52;
|
65 |
+
if ( $weeks > 1 ) {
|
66 |
+
return sprintf( __( '%s weeks', $this->slug ), $weeks );
|
67 |
+
} elseif ( $weeks > 0) {
|
68 |
+
return __( 'a week', $this->slug );
|
69 |
+
}
|
70 |
+
|
71 |
+
// Get the days
|
72 |
+
$days = ( intval( $seconds ) / DAY_IN_SECONDS ) % 7;
|
73 |
+
if ( $days > 1 ) {
|
74 |
+
return sprintf( __( '%s days', $this->slug ), $days );
|
75 |
+
} elseif ( $days > 0) {
|
76 |
+
return __( 'a day', $this->slug );
|
77 |
+
}
|
78 |
+
|
79 |
+
// Get the hours
|
80 |
+
$hours = ( intval( $seconds ) / HOUR_IN_SECONDS ) % 24;
|
81 |
+
if ( $hours > 1 ) {
|
82 |
+
return sprintf( __( '%s hours', $this->slug ), $hours );
|
83 |
+
} elseif ( $hours > 0) {
|
84 |
+
return __( 'an hour', $this->slug );
|
85 |
+
}
|
86 |
+
|
87 |
+
// Get the minutes
|
88 |
+
$minutes = ( intval( $seconds ) / MINUTE_IN_SECONDS ) % 60;
|
89 |
+
if ( $minutes > 1 ) {
|
90 |
+
return sprintf( __( '%s minutes', $this->slug ), $minutes );
|
91 |
+
} elseif ( $minutes > 0) {
|
92 |
+
return __( 'a minute', $this->slug );
|
93 |
+
}
|
94 |
+
|
95 |
+
// Get the seconds
|
96 |
+
$seconds = intval( $seconds ) % 60;
|
97 |
+
if ( $seconds > 1 ) {
|
98 |
+
return sprintf( __( '%s seconds', $this->slug ), $seconds );
|
99 |
+
} elseif ( $seconds > 0) {
|
100 |
+
return __( 'a second', $this->slug );
|
101 |
+
}
|
102 |
+
|
103 |
+
return;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Check date on admin initiation and add to admin notice if it was more than the time limit.
|
108 |
+
*/
|
109 |
+
public function check_installation_date() {
|
110 |
+
|
111 |
+
if ( true != get_site_option( $this->nobug_option ) ) {
|
112 |
+
|
113 |
+
// If not installation date set, then add it
|
114 |
+
$install_date = get_site_option( $this->slug . '-activation-date' );
|
115 |
+
if ( '' == $install_date ) {
|
116 |
+
add_site_option( $this->slug . '-activation-date', time() );
|
117 |
+
}
|
118 |
+
|
119 |
+
// If difference between install date and now is greater than time limit, then display notice
|
120 |
+
if ( ( time() - $install_date ) > $this->time_limit ) {
|
121 |
+
add_action( 'admin_notices', array( $this, 'display_admin_notice' ) );
|
122 |
+
}
|
123 |
+
|
124 |
+
}
|
125 |
+
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Display Admin Notice, asking for a review.
|
130 |
+
*/
|
131 |
+
public function display_admin_notice() {
|
132 |
+
|
133 |
+
$screen = get_current_screen();
|
134 |
+
if ( isset( $screen->base ) && 'plugins' == $screen->base ) {
|
135 |
+
|
136 |
+
$no_bug_url = wp_nonce_url( admin_url( '?' . $this->nobug_option . '=true' ), 'review-nonce' );
|
137 |
+
$time = $this->seconds_to_words( time() - get_site_option( $this->slug . '-activation-date' ) );
|
138 |
+
|
139 |
+
|
140 |
+
?>
|
141 |
+
<style>
|
142 |
+
.notice.schema-notice {
|
143 |
+
border-left-color: #990000 !important;
|
144 |
+
padding: 20px;
|
145 |
+
}
|
146 |
+
.rtl .notice.schema-notice {
|
147 |
+
border-right-color: #990000 !important;
|
148 |
+
}
|
149 |
+
.notice.notice.schema-notice .schema-notice-inner {
|
150 |
+
display: table;
|
151 |
+
width: 100%;
|
152 |
+
}
|
153 |
+
.notice.schema-notice .schema-notice-inner .schema-notice-icon,
|
154 |
+
.notice.schema-notice .schema-notice-inner .schema-notice-content,
|
155 |
+
.notice.schema-notice .schema-notice-inner .schema-install-now {
|
156 |
+
display: table-cell;
|
157 |
+
vertical-align: middle;
|
158 |
+
}
|
159 |
+
.notice.schema-notice .schema-notice-icon {
|
160 |
+
color: #990000;
|
161 |
+
font-size: 50px;
|
162 |
+
width: 60px;
|
163 |
+
}
|
164 |
+
.notice.schema-notice .schema-notice-icon img {
|
165 |
+
width: 60px;
|
166 |
+
}
|
167 |
+
.notice.schema-notice .schema-notice-content {
|
168 |
+
padding: 0 20px;
|
169 |
+
}
|
170 |
+
.notice.schema-notice p {
|
171 |
+
padding: 0;
|
172 |
+
margin: 0;
|
173 |
+
}
|
174 |
+
.notice.schema-notice h3 {
|
175 |
+
margin: 0 0 5px;
|
176 |
+
}
|
177 |
+
.notice.schema-notice .schema-install-now {
|
178 |
+
text-align: center;
|
179 |
+
}
|
180 |
+
.notice.schema-notice .schema-install-now .schema-install-button {
|
181 |
+
background-color: #990000;
|
182 |
+
color: #fff;
|
183 |
+
border-color: #660000;
|
184 |
+
box-shadow: 0 1px 0 #660000;
|
185 |
+
padding: 5px 30px;
|
186 |
+
height: auto;
|
187 |
+
line-height: 20px;
|
188 |
+
text-transform: capitalize;
|
189 |
+
}
|
190 |
+
.notice.schema-notice .schema-install-now .schema-install-button span {
|
191 |
+
padding-left: 20px;
|
192 |
+
}
|
193 |
+
.rtl .notice.schema-notice .schema-install-now .schema-install-button i {
|
194 |
+
padding-right: 0;
|
195 |
+
padding-left: 20px;
|
196 |
+
}
|
197 |
+
.notice.schema-notice .schema-install-now .schema-install-button:hover {
|
198 |
+
background-color: #cc0000;
|
199 |
+
}
|
200 |
+
.notice.schema-notice .schema-install-now .schema-install-button:active {
|
201 |
+
box-shadow: inset 0 1px 0 #cc0000;
|
202 |
+
transform: translateY(1px);
|
203 |
+
}
|
204 |
+
@media (max-width: 767px) {
|
205 |
+
.notice.schema-notice {
|
206 |
+
padding: 10px;
|
207 |
+
}
|
208 |
+
.notice.schema-noticee .schema-notice-inner {
|
209 |
+
display: block;
|
210 |
+
}
|
211 |
+
.notice.schema-notice .schema-notice-inner .schema-notice-content {
|
212 |
+
display: block;
|
213 |
+
padding: 0;
|
214 |
+
}
|
215 |
+
.notice.schema-notice .schema-notice-inner .schema-notice-icon,
|
216 |
+
.notice.schema-notice .schema-notice-inner .schema-install-now {
|
217 |
+
display: none;
|
218 |
+
}
|
219 |
+
}
|
220 |
+
</style>
|
221 |
+
<div class="notice updated schema-notice">
|
222 |
+
<div class="schema-notice-inner">
|
223 |
+
<div class="schema-notice-icon">
|
224 |
+
<img src="<?php echo esc_url( SCHEMAWP_PLUGIN_URL . 'assets/images/icon-128x128.png' ); ?>" alt="Schema Logo" />
|
225 |
+
</div>
|
226 |
+
|
227 |
+
<div class="schema-notice-content">
|
228 |
+
<h3><?php _e( 'How do you like Schema?', 'schema-wp' ); ?></h3>
|
229 |
+
|
230 |
+
<p><?php echo sprintf( __( 'You have been using the %s plugin for %s now!', 'schema-wp' ), $this->name, $time ) ?>
|
231 |
+
|
232 |
+
<?php echo ' '. __( 'Let us know what you think about the plugin, what is missing, and how we can make it better. Leave us a review with', 'schema-wp' ) . ' <a onclick="location.href=\'' . esc_url( $no_bug_url ) . '\';" href="' . esc_url( 'https://wordpress.org/support/view/plugin-reviews/' . $this->slug . '#postform' ) . '" target="_blank">' . __( 'your feedback', 'schema-wp' ) . '</a>.'; ?></p>
|
233 |
+
|
234 |
+
</div>
|
235 |
+
|
236 |
+
<div class="schema-install-now">
|
237 |
+
<?php echo '
|
238 |
+
<a onclick="location.href=\'' . esc_url( $no_bug_url ) . '\';" class="button schema-install-button" href="' . esc_url( 'https://wordpress.org/support/view/plugin-reviews/' . $this->slug . '#postform' ) . '" target="_blank">' . __( 'Leave Feedback', 'schema-wp' ) . ' <span class="dashicons dashicons-smiley"></span></a>
|
239 |
+
'; ?>
|
240 |
+
<br /><br />
|
241 |
+
<a href="<?php echo esc_url( $no_bug_url ); ?>"><?php echo __( 'No thanks', 'schema-wp' ); ?></a>
|
242 |
+
</div>
|
243 |
+
</div>
|
244 |
+
</div>
|
245 |
+
<?php
|
246 |
+
|
247 |
+
|
248 |
+
}
|
249 |
+
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* Set the plugin to no longer bug users if user asks not to be.
|
254 |
+
*/
|
255 |
+
public function set_no_bug() {
|
256 |
+
|
257 |
+
// Bail out if not on correct page
|
258 |
+
if (
|
259 |
+
! isset( $_GET['_wpnonce'] )
|
260 |
+
||
|
261 |
+
(
|
262 |
+
! wp_verify_nonce( $_GET['_wpnonce'], 'review-nonce' )
|
263 |
+
||
|
264 |
+
! is_admin()
|
265 |
+
||
|
266 |
+
! isset( $_GET[$this->nobug_option] )
|
267 |
+
||
|
268 |
+
! current_user_can( 'manage_options' )
|
269 |
+
)
|
270 |
+
) {
|
271 |
+
return;
|
272 |
+
}
|
273 |
+
|
274 |
+
add_site_option( $this->nobug_option, true );
|
275 |
+
|
276 |
+
}
|
277 |
+
|
278 |
+
}
|
279 |
+
endif;
|
280 |
+
|
281 |
+
|
282 |
+
/*
|
283 |
+
* Instantiate DotOrg_Plugin_Review class
|
284 |
+
*
|
285 |
+
* @since 1.5.4
|
286 |
+
*/
|
287 |
+
new Schema_DotOrg_Plugin_Feedback( array(
|
288 |
+
'slug' => 'schema', // The plugin slug
|
289 |
+
'name' => __('Schema', 'schema-wp'), // The plugin name
|
290 |
+
'time_limit' => WEEK_IN_SECONDS, // The time limit at which notice is shown
|
291 |
+
) );
|
includes/admin/class-menu.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class Menu - admin menues
|
4 |
+
*
|
5 |
+
* @package Schema
|
6 |
+
* @subpackage Admin Functions/Formatting
|
7 |
+
* @copyright Copyright (c) 2016, Hesham Zebida
|
8 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
+
* @since 1.0
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
class Schema_WP_Admin_Menu {
|
16 |
+
|
17 |
+
public function __construct() {
|
18 |
+
add_action( 'admin_menu', array( $this, 'register_main_menus' ), 10 );
|
19 |
+
add_action( 'admin_menu', array( $this, 'register_types_menus' ), 20 );
|
20 |
+
add_action( 'admin_menu', array( $this, 'register_extensions_menus' ), 30 );
|
21 |
+
add_action( 'admin_menu', array( $this, 'register_about_menus' ), 40 );
|
22 |
+
}
|
23 |
+
|
24 |
+
public function register_main_menus() {
|
25 |
+
|
26 |
+
global $schema_wp_options_page;
|
27 |
+
|
28 |
+
$schema_wp_options_page = add_menu_page(
|
29 |
+
__( 'Schema', 'schema-wp' ),
|
30 |
+
__( 'Schema', 'schema-wp' ),
|
31 |
+
'manage_schema_options',
|
32 |
+
'schema',
|
33 |
+
'schema_wp_options_page'
|
34 |
+
);
|
35 |
+
|
36 |
+
add_submenu_page(
|
37 |
+
'schema',
|
38 |
+
__( 'Schema Settings', 'schema-wp' ),
|
39 |
+
__( 'Settings', 'schema-wp' ),
|
40 |
+
'manage_schema_options',
|
41 |
+
'schema',
|
42 |
+
'schema_wp_options_page'
|
43 |
+
);
|
44 |
+
|
45 |
+
// Contextual Help
|
46 |
+
// @since 1.5.9.3
|
47 |
+
if ( $schema_wp_options_page )
|
48 |
+
add_action( 'load-' . $schema_wp_options_page, 'schema_wp_settings_contextual_help' );
|
49 |
+
}
|
50 |
+
|
51 |
+
public function register_types_menus() {
|
52 |
+
|
53 |
+
add_submenu_page(
|
54 |
+
'schema',
|
55 |
+
__( 'Types', 'schema-wp' ),
|
56 |
+
__( 'Types', 'schema-wp' ),
|
57 |
+
'manage_schema_options',
|
58 |
+
'edit.php?post_type=schema'
|
59 |
+
);
|
60 |
+
}
|
61 |
+
|
62 |
+
public function register_extensions_menus() {
|
63 |
+
|
64 |
+
add_submenu_page(
|
65 |
+
'schema',
|
66 |
+
__( 'Extensions', 'schema-wp' ),
|
67 |
+
__( 'Extensions', 'schema-wp' ),
|
68 |
+
'manage_schema_options',
|
69 |
+
'schema-extensions',
|
70 |
+
'schema_wp_admin_extensions_page'
|
71 |
+
);
|
72 |
+
}
|
73 |
+
|
74 |
+
public function register_about_menus() {
|
75 |
+
|
76 |
+
add_submenu_page(
|
77 |
+
'schema',
|
78 |
+
__( 'About', 'schema-wp' ),
|
79 |
+
__( 'About', 'schema-wp' ),
|
80 |
+
'manage_schema_options',
|
81 |
+
'admin.php?page=schema-wp-what-is-new'
|
82 |
+
);
|
83 |
+
}
|
84 |
+
|
85 |
+
}
|
86 |
+
|
87 |
+
$schema_wp_menu = new Schema_WP_Admin_Menu;
|
includes/admin/class-notices.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Schema_WP_Admin_Notices {
|
4 |
+
|
5 |
+
public function __construct() {
|
6 |
+
|
7 |
+
add_action( 'admin_notices', array( $this, 'show_notices' ) );
|
8 |
+
add_action( 'schema_wp_dismiss_notices', array( $this, 'dismiss_notices' ) );
|
9 |
+
}
|
10 |
+
|
11 |
+
|
12 |
+
public function show_notices() {
|
13 |
+
|
14 |
+
$class = 'updated';
|
15 |
+
|
16 |
+
if ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] && isset( $_GET['page'] ) && $_GET['page'] == 'schema' ) {
|
17 |
+
$message = __( 'Settings updated.', 'schema-wp' );
|
18 |
+
|
19 |
+
// do action after settings updated
|
20 |
+
do_action( 'schema_wp_do_after_settings_updated' );
|
21 |
+
}
|
22 |
+
|
23 |
+
if ( isset( $_GET['schema_wp_notice'] ) && $_GET['schema_wp_notice'] ) {
|
24 |
+
|
25 |
+
switch( $_GET['schema_wp_notice'] ) {
|
26 |
+
|
27 |
+
case 'settings-imported' :
|
28 |
+
|
29 |
+
$message = __( 'Settings successfully imported', 'schema-wp' );
|
30 |
+
|
31 |
+
break;
|
32 |
+
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
if ( ! empty( $message ) ) {
|
37 |
+
echo '<div class="' . esc_attr( $class ) . '"><p><strong>' . $message . '</strong></p></div>';
|
38 |
+
}
|
39 |
+
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Dismiss admin notices when Dismiss links are clicked
|
44 |
+
*
|
45 |
+
* @since 1.0
|
46 |
+
* @return void
|
47 |
+
*/
|
48 |
+
function dismiss_notices() {
|
49 |
+
if( ! isset( $_GET['schema_wp_dismiss_notice_nonce'] ) || ! wp_verify_nonce( $_GET['schema_wp_dismiss_notice_nonce'], 'schema_wp_dismiss_notice') ) {
|
50 |
+
wp_die( __( 'Security check failed', 'schema-wp' ), __( 'Error', 'schema-wp' ), array( 'response' => 403 ) );
|
51 |
+
}
|
52 |
+
|
53 |
+
if( isset( $_GET['schema_wp_notice'] ) ) {
|
54 |
+
update_user_meta( get_current_user_id(), '_schema_wp_' . $_GET['schema_wp_notice'] . '_dismissed', 1 );
|
55 |
+
wp_redirect( remove_query_arg( array( 'schema_wp_action', 'schema_wp_notice' ) ) );
|
56 |
+
exit;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
}
|
60 |
+
new Schema_WP_Admin_Notices;
|
includes/admin/class-welcome.php
ADDED
@@ -0,0 +1,477 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Welcome Page Class
|
4 |
+
*
|
5 |
+
* @package Schema
|
6 |
+
* @subpackage Admin/Welcome
|
7 |
+
* @copyright Copyright (c) 2016, Hesham Zebida
|
8 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
+
* @since 1.0
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Schema_WP_Welcome Class
|
17 |
+
*
|
18 |
+
* A general class for About and Credits page.
|
19 |
+
*
|
20 |
+
* @since 1.0
|
21 |
+
*/
|
22 |
+
class Schema_WP_Welcome {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @var string The capability users should have to view the page
|
26 |
+
*/
|
27 |
+
public $minimum_capability = 'manage_options';
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Get things started
|
31 |
+
*
|
32 |
+
* @since 1.0
|
33 |
+
*/
|
34 |
+
public function __construct() {
|
35 |
+
add_action( 'admin_menu', array( $this, 'admin_menus' ) );
|
36 |
+
add_action( 'admin_head', array( $this, 'admin_head' ) );
|
37 |
+
add_action( 'admin_init', array( $this, 'welcome' ), 9999 );
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Register the Dashboard Pages which are later hidden but these pages
|
42 |
+
* are used to render the Welcome and Credits pages.
|
43 |
+
*
|
44 |
+
* @access public
|
45 |
+
* @since 1.0
|
46 |
+
* @return void
|
47 |
+
*/
|
48 |
+
public function admin_menus() {
|
49 |
+
|
50 |
+
// What's New
|
51 |
+
add_dashboard_page(
|
52 |
+
__( 'What\'s new in Schema', 'schema-wp' ),
|
53 |
+
__( 'What\'s new in Schema', 'schema-wp' ),
|
54 |
+
$this->minimum_capability,
|
55 |
+
'schema-wp-what-is-new',
|
56 |
+
array( $this, 'whats_new_screen' )
|
57 |
+
);
|
58 |
+
|
59 |
+
// Getting Started Page
|
60 |
+
add_dashboard_page(
|
61 |
+
__( 'Getting started with Schema', 'schema-wp' ),
|
62 |
+
__( 'Getting started with Schema', 'schema-wp' ),
|
63 |
+
$this->minimum_capability,
|
64 |
+
'schema-wp-getting-started',
|
65 |
+
array( $this, 'getting_started_screen' )
|
66 |
+
);
|
67 |
+
|
68 |
+
// Credits Page
|
69 |
+
add_dashboard_page(
|
70 |
+
__( 'The people that build Schema', 'schema-wp' ),
|
71 |
+
__( 'The people that build Schema', 'schema-wp' ),
|
72 |
+
$this->minimum_capability,
|
73 |
+
'schema-wp-credits',
|
74 |
+
array( $this, 'credits_screen' )
|
75 |
+
);
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Hide Individual Dashboard Pages
|
80 |
+
*
|
81 |
+
* @access public
|
82 |
+
* @since 1.0
|
83 |
+
* @return void
|
84 |
+
*/
|
85 |
+
public function admin_head() {
|
86 |
+
remove_submenu_page( 'index.php', 'schema-wp-what-is-new' );
|
87 |
+
remove_submenu_page( 'index.php', 'schema-wp-getting-started' );
|
88 |
+
remove_submenu_page( 'index.php', 'schema-wp-credits' );
|
89 |
+
|
90 |
+
$page = isset( $_GET['page'] ) ? $_GET['page'] : false;
|
91 |
+
|
92 |
+
if ( 'schema-wp-what-is-new' != $page && 'schema-wp-getting-started' != $page && 'schema-wp-credits' != $page ) {
|
93 |
+
return;
|
94 |
+
}
|
95 |
+
|
96 |
+
// Badge for welcome page
|
97 |
+
$badge_url = SCHEMAWP_PLUGIN_URL . 'assets/images/schema-badge.png';
|
98 |
+
?>
|
99 |
+
<style type="text/css" media="screen">
|
100 |
+
/*<![CDATA[*/
|
101 |
+
.schema-wp-badge {
|
102 |
+
height: 128px;
|
103 |
+
width: 128px;
|
104 |
+
position: relative;
|
105 |
+
color: #777777;
|
106 |
+
font-weight: bold;
|
107 |
+
font-size: 14px;
|
108 |
+
text-align: center;
|
109 |
+
background: url('<?php echo esc_url( $badge_url ); ?>') no-repeat;
|
110 |
+
}
|
111 |
+
.schema-wp-badge span {
|
112 |
+
position: absolute;
|
113 |
+
bottom: -30px;
|
114 |
+
left: 0;
|
115 |
+
width: 100%;
|
116 |
+
}
|
117 |
+
.about-wrap .schema-wp-badge {
|
118 |
+
position: absolute;
|
119 |
+
top: 0;
|
120 |
+
right: 0;
|
121 |
+
}
|
122 |
+
.schema-wp-welcome-screenshots {
|
123 |
+
float: right;
|
124 |
+
margin-left: 60px !important;
|
125 |
+
}
|
126 |
+
.schema-wp-info-notice {
|
127 |
+
border-left: 4px solid #5b9dd9;
|
128 |
+
}
|
129 |
+
.schema-wp-info-notice i {
|
130 |
+
color: #5b9dd9;
|
131 |
+
}
|
132 |
+
@media (max-width: 800px) {
|
133 |
+
.schema-wp-welcome-screenshots {
|
134 |
+
float: none;
|
135 |
+
margin-left: 0px !important;
|
136 |
+
}
|
137 |
+
}
|
138 |
+
/*]]>*/
|
139 |
+
</style>
|
140 |
+
<?php
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Navigation tabs
|
145 |
+
*
|
146 |
+
* @access public
|
147 |
+
* @since 1.0
|
148 |
+
* @return void
|
149 |
+
*/
|
150 |
+
public function tabs() {
|
151 |
+
$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'schema-wp-getting-started';
|
152 |
+
?>
|
153 |
+
<h2 class="nav-tab-wrapper">
|
154 |
+
|
155 |
+
<a class="nav-tab <?php echo $selected == 'schema-wp-what-is-new' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'schema-wp-what-is-new' ), 'index.php' ) ) ); ?>">
|
156 |
+
<?php _e( "What's New", 'schema-wp' ); ?>
|
157 |
+
|
158 |
+
<a class="nav-tab <?php echo $selected == 'schema-wp-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'schema-wp-getting-started' ), 'index.php' ) ) ); ?>">
|
159 |
+
<?php _e( 'Getting Started', 'schema-wp' ); ?>
|
160 |
+
</a>
|
161 |
+
|
162 |
+
<a class="nav-tab <?php echo $selected == 'schema-wp-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'schema-wp-credits' ), 'index.php' ) ) ); ?>">
|
163 |
+
<?php _e( 'Credits', 'schema-wp' ); ?>
|
164 |
+
</a>
|
165 |
+
</h2>
|
166 |
+
<?php
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Render About Screen
|
171 |
+
*
|
172 |
+
* @access public
|
173 |
+
* @since 1.0
|
174 |
+
* @return void
|
175 |
+
*/
|
176 |
+
public function whats_new_screen() {
|
177 |
+
list( $display_version ) = explode( '-', SCHEMAWP_VERSION );
|
178 |
+
?>
|
179 |
+
<div class="wrap about-wrap">
|
180 |
+
<h1><?php printf( __( 'Welcome to Schema v%s', 'schema-wp' ), esc_html( $display_version ) ); ?></h1>
|
181 |
+
<div class="about-text"><?php echo __( 'Thank you for installing Schema. The best Schema.org plugin for WordPress.', 'schema-wp'); ?></div>
|
182 |
+
|
183 |
+
<div class="schema-wp-badge">
|
184 |
+
<span><?php printf( __( 'Version %s', 'schema-wp' ), esc_html( $display_version ) ); ?></span>
|
185 |
+
</div>
|
186 |
+
|
187 |
+
<?php $this->tabs(); ?>
|
188 |
+
|
189 |
+
<div class="changelog">
|
190 |
+
|
191 |
+
<div class="update-nag schema-wp-info-notice">
|
192 |
+
<h3><?php _e( 'Please update Schema Content settings!', 'schema-wp' );?></h3>
|
193 |
+
<p><?php _e( 'The Content settings has been updated with new features including support for \'WPHeader\', \'WPFooter\', and \'BreadcrumbList\', please configure the', 'schema-wp' );?> <a href="<?php echo esc_url( admin_url( 'admin.php?page=schema&tab=content' ) ); ?>"><?php _e( 'plugin settings', 'schema-wp' ); ?></a></p>
|
194 |
+
|
195 |
+
<p><i class="dashicons dashicons-warning"></i> <?php _e( 'If you are caching your site, make sure to clear cache for changes to take effect.', 'schema-wp' );?></p>
|
196 |
+
|
197 |
+
</div>
|
198 |
+
|
199 |
+
<div class="feature-section sub-section">
|
200 |
+
|
201 |
+
<h2><?php _e( 'Support More Schema Types', 'schema-wp' );?></h2>
|
202 |
+
<p><?php _e( 'Now, Schema plugin supports more schema.org types.', 'schema-wp' );?></p>
|
203 |
+
|
204 |
+
- <a href="https://schema.org/Article" target="_blank"></a><?php _e( 'Article', 'schema-wp' );?>
|
205 |
+
<ul>
|
206 |
+
<li><?php _e( 'General', 'schema-wp' );?></li>
|
207 |
+
<li><?php _e( 'BlogPosting', 'schema-wp' );?></li>
|
208 |
+
<li><?php _e( 'NewsArticle', 'schema-wp' );?></li>
|
209 |
+
<li><?php _e( 'Report', 'schema-wp' );?></li>
|
210 |
+
<li><?php _e( 'ScholarlyArticle', 'schema-wp' );?></li>
|
211 |
+
<li><?php _e( 'TechArticle', 'schema-wp' );?></li>
|
212 |
+
</ul>
|
213 |
+
|
214 |
+
<br>
|
215 |
+
|
216 |
+
- <?php _e( 'Blog', 'schema-wp' );?> (<?php _e( 'for Blog posts list page', 'schema-wp' );?>)
|
217 |
+
|
218 |
+
<br>
|
219 |
+
|
220 |
+
- <?php _e( 'WPHeader', 'schema-wp' );?> (<?php _e( 'for Web Page Header', 'schema-wp' );?>)
|
221 |
+
|
222 |
+
<br>
|
223 |
+
|
224 |
+
- <?php _e( 'WPFooter', 'schema-wp' );?> (<?php _e( 'for Web Page Footer', 'schema-wp' );?>)
|
225 |
+
|
226 |
+
<br>
|
227 |
+
|
228 |
+
- <?php _e( 'BreadcrumbList', 'schema-wp' );?> (<?php _e( 'for Breadcrumbs', 'schema-wp' );?>)
|
229 |
+
|
230 |
+
<br>
|
231 |
+
|
232 |
+
- <?php _e( 'CollectionPage', 'schema-wp' );?> (<?php _e( 'for Categories', 'schema-wp' );?>)
|
233 |
+
|
234 |
+
<br>
|
235 |
+
|
236 |
+
- <?php _e( 'CollectionPage', 'schema-wp' );?> (<?php _e( 'for Tags', 'schema-wp' );?>)
|
237 |
+
|
238 |
+
<br>
|
239 |
+
|
240 |
+
- <?php _e( 'AboutPage', 'schema-wp' );?> (<?php _e( 'for the about page', 'schema-wp' );?>)
|
241 |
+
|
242 |
+
<br>
|
243 |
+
|
244 |
+
- <?php _e( 'ContactPage', 'schema-wp' );?> (<?php _e( 'for the contact page', 'schema-wp' );?>)
|
245 |
+
|
246 |
+
<br>
|
247 |
+
|
248 |
+
- <?php _e( 'Person', 'schema-wp' );?> (<?php _e( 'author archive', 'schema-wp' );?>)
|
249 |
+
|
250 |
+
<br><br>
|
251 |
+
|
252 |
+
- <?php _e( 'New Schema Type?', 'schema-wp' );?>
|
253 |
+
<ul>
|
254 |
+
<li><?php _e( 'Maybe coming soon!', 'schema-wp' );?></li>
|
255 |
+
</ul>
|
256 |
+
|
257 |
+
<div class="return-to-dashboard">
|
258 |
+
<a href="<?php echo esc_url( admin_url( 'admin.php?page=schema' ) ); ?>"><i class="dashicons dashicons-admin-generic"></i><?php _e( 'Go To Schema Settings', 'schema-wp' ); ?></a>
|
259 |
+
</div>
|
260 |
+
|
261 |
+
|
262 |
+
<h2><?php _e( 'Integration with Themes and other Plugins', 'schema-wp' );?></h2>
|
263 |
+
<p><?php _e( 'Schema plays nicely and support themes mentioned below.', 'schema-wp' );?></p>
|
264 |
+
|
265 |
+
<h3><?php _e( 'Play nicely with Yoast SEO', 'schema-wp' );?></h3>
|
266 |
+
<p><?php _e( 'Now Schema plugin plays nicely with Yoast SEO plugin, you can have both plugins active with no conflicts.', 'schema-wp' );?></p>
|
267 |
+
|
268 |
+
<h3><?php _e( 'Hello AMP!', 'schema-wp' );?></h3>
|
269 |
+
<p><?php _e( 'If you are using the AMP plugin, Schema got you covered!', 'schema-wp' );?></p>
|
270 |
+
|
271 |
+
<h3><?php _e( 'WPRichSnippets plugin', 'schema-wp' );?></h3>
|
272 |
+
<p><?php _e( 'If you are using the WPRichSnippets plugin, Schema will behave!', 'schema-wp' );?></p>
|
273 |
+
|
274 |
+
<h3><?php _e( 'Correct Genesis Schema Markup', 'schema-wp' );?></h3>
|
275 |
+
<p><?php _e( 'Using Genesis Framework? The Schema plugin will automatically indicate that and correct Genesis Schema output.', 'schema-wp' );?></p>
|
276 |
+
<h3><?php _e( 'Uses Thesis Theme 2.x Post Image', 'schema-wp' );?></h3>
|
277 |
+
<p><?php _e( 'Using Thesis? The Schema plugin will automatically indicate and use Thesis Post Image is are presented.', 'schema-wp' );?></p>
|
278 |
+
|
279 |
+
<h3><?php _e( 'The SEO Framework plugin is active?', 'schema-wp' );?></h3>
|
280 |
+
<p><?php _e( 'No problem! The Schema plugin will automatically indicate that and show respect for SEO Framework.', 'schema-wp' );?></p>
|
281 |
+
|
282 |
+
<h3><?php _e( 'Is Divi your Theme?', 'schema-wp' );?></h3>
|
283 |
+
<p><?php _e( 'If Divi theme is active, Schema plugin will clear shortcodes to be able to output the content description.', 'schema-wp' );?></p>
|
284 |
+
|
285 |
+
</div>
|
286 |
+
|
287 |
+
<div class="schema-types-section sub-section">
|
288 |
+
|
289 |
+
<h2><?php _e( 'Schema Post Type', 'schema-wp' );?></h2>
|
290 |
+
<p><?php _e( 'Now, you can create new schema.org markup types and enable them on post type bases.', 'schema-wp' );?></p>
|
291 |
+
<p><?php _e( 'Also, you can set Schema to work on specific post categories.', 'schema-wp' );?></p>
|
292 |
+
|
293 |
+
<img src="<?php echo esc_url( SCHEMAWP_PLUGIN_URL . 'assets/images/screenshot-2.png' ); ?>" class="schema-wp-welcome-screenshots"/>
|
294 |
+
|
295 |
+
<h2><?php _e( 'Automatically add VideoObject to oEmbed', 'schema-wp' );?></h2>
|
296 |
+
<p><?php _e( 'Schema allow you to enable VideoObject markup automatically whenever oEmbed is called on your page.', 'schema-wp' );?></p>
|
297 |
+
<p><?php _e( 'Supported oEmbed videos: Dailymotion, TED, Vimeo, VideoPress, Vine, YouTube.', 'schema-wp' );?></p>
|
298 |
+
|
299 |
+
<h2><?php _e( 'Automatically add AudioObject to oEmbed', 'schema-wp' );?></h2>
|
300 |
+
<p><?php _e( 'Schema allow you to enable AudioObject markup automatically whenever oEmbed is called on your page.', 'schema-wp' );?></p>
|
301 |
+
<p><?php _e( 'Supported oEmbed audios: SoundCloud, and Mixcloud.', 'schema-wp' );?></p>
|
302 |
+
|
303 |
+
|
304 |
+
|
305 |
+
</div>
|
306 |
+
|
307 |
+
</div>
|
308 |
+
|
309 |
+
|
310 |
+
</div>
|
311 |
+
<?php
|
312 |
+
}
|
313 |
+
|
314 |
+
/**
|
315 |
+
* Render Getting Started Screen
|
316 |
+
*
|
317 |
+
* @access public
|
318 |
+
* @since 1.0
|
319 |
+
* @return void
|
320 |
+
*/
|
321 |
+
public function getting_started_screen() {
|
322 |
+
list( $display_version ) = explode( '-', SCHEMAWP_VERSION );
|
323 |
+
?>
|
324 |
+
<div class="wrap about-wrap">
|
325 |
+
<h1><?php printf( __( 'Welcome to Schema v%s', 'schema-wp' ), esc_html( $display_version ) ); ?></h1>
|
326 |
+
<div class="about-text"><?php echo __( 'Thank you for installing Schema. The best schema.org plugin for WordPress.', 'schema-wp' ); ?></div>
|
327 |
+
<div class="schema-wp-badge"><span><?php printf( __( 'Version %s', 'schema-wp' ), esc_html( $display_version ) ); ?></span></div>
|
328 |
+
|
329 |
+
<?php $this->tabs(); ?>
|
330 |
+
|
331 |
+
<p class="about-description"><?php _e( 'Hang on! We are going to add more schema integration and cool features to Schema plugin.', 'schema-wp' ); ?></p>
|
332 |
+
|
333 |
+
<div class="changelog">
|
334 |
+
<h3><?php _e( 'Overview', 'schema-wp' );?></h3>
|
335 |
+
|
336 |
+
<div class="feature-section">
|
337 |
+
<img src="<?php echo esc_url( SCHEMAWP_PLUGIN_URL . 'assets/images/serps.png' ); ?>" class="schema-wp-welcome-screenshots"/>
|
338 |
+
|
339 |
+
<h4><?php _e( 'What is Schema markup?', 'schema-wp' );?></h4>
|
340 |
+
<p><?php _e( 'Schema markup is code (semantic vocabulary) that you put on your website to help the search engines return more informative results for users. So, Schema is not just for SEO reasons, it’s also for the benefit of the searcher.' ,'schema-wp' ); ?></p>
|
341 |
+
|
342 |
+
<h4><?php _e( 'Why is Structured Data so Important?', 'schema-wp' );?></h4>
|
343 |
+
<p><?php _e( 'Structured Data can help you to send the right signals to search engines about your business and content.' ,'schema-wp' ); ?></p>
|
344 |
+
<p><?php _e('Structured Data helps search engines to understand what the content is specifically about. Moreover, structured data will allow users to see the value of a website before they visit, via rich snippets, which are rich data that are displayed in the SERP’s.', 'schema-wp') ?></p>
|
345 |
+
|
346 |
+
<div class="return-to-dashboard">
|
347 |
+
<a href="<?php echo esc_url( admin_url( 'admin.php?page=schema' ) ); ?>"><i class="dashicons dashicons-admin-generic"></i><?php _e( 'Go To Schema Settings', 'schema-wp' ); ?></a>
|
348 |
+
</div>
|
349 |
+
|
350 |
+
</div>
|
351 |
+
|
352 |
+
</div>
|
353 |
+
|
354 |
+
<div class="changelog">
|
355 |
+
<h3><?php _e( 'Need Help?', 'schema-wp' );?></h3>
|
356 |
+
|
357 |
+
<div class="feature-section">
|
358 |
+
<h4><?php _e( 'Documentation','schema-wp' );?></h4>
|
359 |
+
<p><?php _e( 'Docs are on its way! We will update <a href="http://schema.press/">schema.press</a> site with plugin documentation soon.', 'schema-wp' );?></p>
|
360 |
+
</div>
|
361 |
+
|
362 |
+
<div class="feature-section">
|
363 |
+
<h4><?php _e( 'Support','schema-wp' );?></h4>
|
364 |
+
<p><?php _e( 'We do our best to provide support we can. If you encounter a problem, report it to <a href="https://wordpress.org/support/plugin/schema">support</a>.', 'schema-wp' );?></p>
|
365 |
+
</div>
|
366 |
+
</div>
|
367 |
+
</div>
|
368 |
+
<?php
|
369 |
+
}
|
370 |
+
|
371 |
+
/**
|
372 |
+
* Render Credits Screen
|
373 |
+
*
|
374 |
+
* @access public
|
375 |
+
* @since 1.0
|
376 |
+
* @return void
|
377 |
+
*/
|
378 |
+
public function credits_screen() {
|
379 |
+
list( $display_version ) = explode( '-', SCHEMAWP_VERSION );
|
380 |
+
?>
|
381 |
+
<div class="wrap about-wrap">
|
382 |
+
<h1><?php printf( __( 'Welcome to Schema v%s', 'schema-wp' ), esc_html( $display_version ) ); ?></h1>
|
383 |
+
<div class="about-text"><?php _e( 'Thank you for updating to the latest version!', 'schema-wp' ); ?></div>
|
384 |
+
<div class="schema-wp-badge"><span><?php printf( __( 'Version %s', 'schema-wp' ), esc_html( $display_version ) ); ?></span></div>
|
385 |
+
|
386 |
+
<?php $this->tabs(); ?>
|
387 |
+
|
388 |
+
<p class="about-description"><?php _e( 'Here, we will be listing some of the faces that have helped build Schema.', 'schema-wp' ); ?></p>
|
389 |
+
|
390 |
+
<?php echo $this->contributors(); ?>
|
391 |
+
</div>
|
392 |
+
<?php
|
393 |
+
}
|
394 |
+
|
395 |
+
/**
|
396 |
+
* Render Contributors List
|
397 |
+
*
|
398 |
+
* @since 1.0
|
399 |
+
* @uses Schema_WP_Welcome::get_contributors()
|
400 |
+
* @return string $contributor_list HTML formatted list of all the contributors for Schema
|
401 |
+
*/
|
402 |
+
public function contributors() {
|
403 |
+
$contributors = $this->get_contributors();
|
404 |
+
|
405 |
+
if ( empty( $contributors ) ) {
|
406 |
+
return '';
|
407 |
+
}
|
408 |
+
|
409 |
+
$contributor_list = '<ul class="wp-people-group">';
|
410 |
+
|
411 |
+
foreach ( $contributors as $contributor ) {
|
412 |
+
$contributor_list .= '<li class="wp-person">';
|
413 |
+
$contributor_list .= sprintf( '<a href="%s" title="%s">',
|
414 |
+
esc_url( 'https://github.com/' . $contributor->login ),
|
415 |
+
esc_html( sprintf( __( 'View %s', 'schema-wp' ), $contributor->login ) )
|
416 |
+
);
|
417 |
+
$contributor_list .= sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) );
|
418 |
+
$contributor_list .= '</a>';
|
419 |
+
$contributor_list .= sprintf( '<a class="web" href="%s">%s</a>', esc_url( 'https://github.com/' . $contributor->login ), esc_html( $contributor->login ) );
|
420 |
+
$contributor_list .= '</a>';
|
421 |
+
$contributor_list .= '</li>';
|
422 |
+
}
|
423 |
+
|
424 |
+
$contributor_list .= '</ul>';
|
425 |
+
|
426 |
+
return $contributor_list;
|
427 |
+
}
|
428 |
+
|
429 |
+
/**
|
430 |
+
* Retreive list of contributors from GitHub.
|
431 |
+
*
|
432 |
+
* @access public
|
433 |
+
* @since 1.0
|
434 |
+
* @return array $contributors List of contributors
|
435 |
+
*/
|
436 |
+
public function get_contributors() {
|
437 |
+
|
438 |
+
//@ todo
|
439 |
+
return;
|
440 |
+
}
|
441 |
+
|
442 |
+
/**
|
443 |
+
* Sends user to the Welcome page on first activation of affwp as well as each
|
444 |
+
* time affwp is upgraded to a new version
|
445 |
+
*
|
446 |
+
* @access public
|
447 |
+
* @since 1.0
|
448 |
+
* @return void
|
449 |
+
*/
|
450 |
+
public function welcome() {
|
451 |
+
|
452 |
+
// Bail if no activation redirect
|
453 |
+
if ( ! get_transient( '_schema_wp_activation_redirect' ) ) {
|
454 |
+
return;
|
455 |
+
}
|
456 |
+
|
457 |
+
// Delete the redirect transient
|
458 |
+
delete_transient( '_schema_wp_activation_redirect' );
|
459 |
+
|
460 |
+
// Bail if activating from network, or bulk
|
461 |
+
if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
|
462 |
+
return;
|
463 |
+
}
|
464 |
+
|
465 |
+
$upgrade = get_option( 'schema_wp_version_upgraded_from' );
|
466 |
+
|
467 |
+
if ( ! $upgrade ) { // First time install
|
468 |
+
wp_safe_redirect( admin_url( 'index.php?page=schema-wp-getting-started' ) );
|
469 |
+
exit;
|
470 |
+
} else { // Update
|
471 |
+
wp_safe_redirect( admin_url( 'index.php?page=schema-wp-what-is-new' ) );
|
472 |
+
exit;
|
473 |
+
}
|
474 |
+
}
|
475 |
+
}
|
476 |
+
|
477 |
+
new Schema_WP_Welcome;
|
includes/admin/extensions.php
ADDED
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Admin Extensions
|
4 |
+
*
|
5 |
+
* @package Schema
|
6 |
+
* @subpackage Admin Functions/Extensions
|
7 |
+
* @copyright Copyright (c) 2017, Hesham Zebida
|
8 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
+
* @since 1.6.9.8
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Extensions Page
|
17 |
+
*
|
18 |
+
* Renders the extensions page content.
|
19 |
+
*
|
20 |
+
* @since 1.6.9.8
|
21 |
+
*
|
22 |
+
* @return void
|
23 |
+
*/
|
24 |
+
function schema_wp_admin_extensions_page() {
|
25 |
+
/**
|
26 |
+
* Filters the extensions tabs.
|
27 |
+
*
|
28 |
+
* @param array $tabs Extensions tabs.
|
29 |
+
*/
|
30 |
+
$add_ons_tabs = (array) apply_filters( 'schema_wp_extensions_tabs', array(
|
31 |
+
'pro' => __('Pro'),
|
32 |
+
'official-free' => __('Official Free')
|
33 |
+
) );
|
34 |
+
|
35 |
+
$active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $add_ons_tabs ) ? $_GET['tab'] : 'pro';
|
36 |
+
|
37 |
+
ob_start();
|
38 |
+
?>
|
39 |
+
<div class="wrap" id="schema-wp-extensions">
|
40 |
+
<h1>
|
41 |
+
<?php _e( 'Extensions for Schema', 'schema-wp' ); ?>
|
42 |
+
<span>
|
43 |
+
<a href="https://schema.press/downloads/?utm_source=plugin-extensions-page&utm_medium=plugin&utm_campaign=Schema%20Extensions%20Page&utm_content=All%20Extensions" class="button-primary" title="<?php _e( 'Browse all extensions', 'schema-wp' ); ?>" target="_blank"><?php _e( 'Browse all extensions', 'schema-wp' ); ?></a>
|
44 |
+
</span>
|
45 |
+
</h1>
|
46 |
+
<p><?php _e( 'These extensions <em><strong>add functionality</strong></em> to your Schema-powered site.', 'affiliate-wp' ); ?></p>
|
47 |
+
<h2 class="nav-tab-wrapper">
|
48 |
+
<?php schema_wp_admin_navigation_tabs( $add_ons_tabs, $active_tab, array( 'settings-updated' => false ) ); ?>
|
49 |
+
</h2>
|
50 |
+
<div id="tab_container">
|
51 |
+
|
52 |
+
<?php if ( 'pro' === $active_tab ) : ?>
|
53 |
+
<p><?php printf( __( 'Pro Extensions are only available with a Professional or Ultimate license. If you already have one of these licenses, simply <a href="%s">log in to your account</a> to download any of these extensions.', 'schema-wp' ), 'https://schema.press/account/?utm_source=plugin-extensions-page&utm_medium=plugin&utm_campaign=Schema%20Extensions%20Page&utm_content=Account' ); ?></p>
|
54 |
+
<p><?php printf( __( 'If you have a Personal or Plus license, you can easily upgrade from your account page to <a href="%s">get access to all of these extensions</a>!', 'schema-wp' ), 'https://schema.press/account/?utm_source=plugin-extensions-page&utm_medium=plugin&utm_campaign=Schema%20Extensions%20Page&utm_content=Account' ); ?></p>
|
55 |
+
<?php else : ?>
|
56 |
+
<p><?php _e( 'Our official free extensions are available to all license holders!', 'schema-wp' ); ?></p>
|
57 |
+
<?php endif; ?>
|
58 |
+
|
59 |
+
<?php echo schema_wp_extensions_get_rest( $active_tab ); ?>
|
60 |
+
<div class="schema-wp-extensions-footer">
|
61 |
+
<a href="https://schema.press/downloads/?utm_source=plugin-extensions-page&utm_medium=plugin&utm_campaign=Schema%20Extensions%20Page&utm_content=All%20Extensions" class="button-primary" title="<?php _e( 'Browse all extensions', 'schema-wp' ); ?>" target="_blank"><?php _e( 'Browse all extensions', 'schema-wp' ); ?></a>
|
62 |
+
</div>
|
63 |
+
</div>
|
64 |
+
</div>
|
65 |
+
<?php
|
66 |
+
echo ob_get_clean();
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Extensions Get Product with REST
|
71 |
+
*
|
72 |
+
* Gets the extensions "products" with REST API, and filter results by category.
|
73 |
+
*
|
74 |
+
* @since 1.6.9.8
|
75 |
+
*
|
76 |
+
* @return void
|
77 |
+
*/
|
78 |
+
function schema_wp_extensions_get_rest( $tab = 'pro' ) {
|
79 |
+
|
80 |
+
$cache = get_transient( 'schema_wp_extensions_feed_' . $tab );
|
81 |
+
|
82 |
+
// debug
|
83 |
+
//$cache = false;
|
84 |
+
|
85 |
+
if ( false === $cache ) {
|
86 |
+
|
87 |
+
$url = 'https://schema.press/downloads/';
|
88 |
+
$api_request = 'https://schema.press/edd-api/v2/products/';
|
89 |
+
$api_response = wp_remote_get( $api_request );
|
90 |
+
|
91 |
+
if ( ! is_wp_error( $api_response ) ) {
|
92 |
+
|
93 |
+
$extensions = json_decode( wp_remote_retrieve_body( $api_response ), true );
|
94 |
+
|
95 |
+
if ( $extensions && ! empty($extensions['products'] ) ) {
|
96 |
+
|
97 |
+
foreach ( $extensions['products'] as $key => $extension ) {
|
98 |
+
|
99 |
+
// get extension info
|
100 |
+
$info = $extension['info'];
|
101 |
+
|
102 |
+
// exclude Schema core plugin
|
103 |
+
if ($info['slug'] === 'schema' ) continue;
|
104 |
+
|
105 |
+
// exclude if not in this category
|
106 |
+
$category = isset($info['category'][0]['slug']) ? $info['category'][0]['slug'] : '';
|
107 |
+
if ( $category != $tab ) continue;
|
108 |
+
|
109 |
+
// prepare info
|
110 |
+
$ext_url = $url.$info['slug'].'/';
|
111 |
+
$excerpt = wp_trim_words( $info['excerpt'], 18, '...' );
|
112 |
+
|
113 |
+
// prepare our output
|
114 |
+
$cache .= '<div class="schema-wp-extension">';
|
115 |
+
$cache .= '<h3 class="schema-wp-extension-title">'.$info['title'].'</h3>';
|
116 |
+
$cache .= '<a href="'.$ext_url.'?utm_source=plugin-extensions-page&utm_medium=plugin&utm_campaign=SchemaExtentionsPage&utm_content='.$info['title'].'" title="Recurring Payments"><img width="880" height="440" src="'.$info['thumbnail'].'" class="attachment-showcase size-showcase wp-post-image" alt="" title="Recurring Payments"></a>';
|
117 |
+
$cache .= '<p>'.$excerpt.'</p>';
|
118 |
+
$cache .= '<a href="'.$ext_url.'?utm_source=plugin-extensions-page&utm_medium=plugin&utm_campaign=SchemaExtentionsPage&utm_content='.$info['title'].'" title="Recurring Payments" class="button-secondary">'.__('Get this Extension', 'schema-wp').'</a>';
|
119 |
+
$cache .= '</div>';
|
120 |
+
} //end foreach
|
121 |
+
|
122 |
+
if ( $cache ) {
|
123 |
+
set_transient( 'schema_wp_extensions_feed_' . $tab, $cache, HOUR_IN_SECONDS );
|
124 |
+
}
|
125 |
+
} //end if ( $extensions )
|
126 |
+
|
127 |
+
} else { //end if ( ! is_wp_error( $api_response ) )
|
128 |
+
|
129 |
+
$cache = '<div class="error"><p>' . __( 'There was an error retrieving the extensions list from the server. Please try again later.', 'schema-wp' ) . '</div>';
|
130 |
+
}
|
131 |
+
} //end if ( false === $cache )
|
132 |
+
|
133 |
+
return $cache;
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Outputs navigation tabs markup in core screens.
|
138 |
+
*
|
139 |
+
* @since 1.6.9.8
|
140 |
+
*
|
141 |
+
* @param array $tabs Navigation tabs.
|
142 |
+
* @param string $active_tab Active tab slug.
|
143 |
+
* @param array $query_args Optional. Query arguments used to build the tab URLs. Default empty array.
|
144 |
+
*/
|
145 |
+
function schema_wp_admin_navigation_tabs( $tabs, $active_tab, $query_args = array() ) {
|
146 |
+
$tabs = (array) $tabs;
|
147 |
+
|
148 |
+
if ( empty( $tabs ) ) {
|
149 |
+
return;
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Filters the navigation tabs immediately prior to output.
|
154 |
+
*
|
155 |
+
* @since 1.6.9.8
|
156 |
+
*
|
157 |
+
* @param array $tabs Tabs array.
|
158 |
+
* @param string $active_tab Active tab slug.
|
159 |
+
* @param array $query_args Query arguments used to build the tab URLs.
|
160 |
+
*/
|
161 |
+
$tabs = apply_filters( 'schema_wp_admin_navigation_tabs', $tabs, $active_tab, $query_args );
|
162 |
+
|
163 |
+
foreach ( $tabs as $tab_id => $tab_name ) {
|
164 |
+
$query_args = array_merge( $query_args, array( 'tab' => $tab_id ) );
|
165 |
+
$tab_url = add_query_arg( $query_args );
|
166 |
+
|
167 |
+
printf( '<a href="%1$s" alt="%2$s" class="%3$s">%4$s</a>',
|
168 |
+
esc_url( $tab_url ),
|
169 |
+
esc_attr( $tab_name ),
|
170 |
+
$active_tab == $tab_id ? 'nav-tab nav-tab-active' : 'nav-tab',
|
171 |
+
esc_html( $tab_name )
|
172 |
+
);
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Fires immediately after the navigation tabs output.
|
177 |
+
*
|
178 |
+
* @since 1.6.9.8
|
179 |
+
*
|
180 |
+
* @param array $tabs Tabs array.
|
181 |
+
* @param string $active_tab Active tab slug.
|
182 |
+
* @param array $query_args Query arguments used to build the tab URLs.
|
183 |
+
*/
|
184 |
+
do_action( 'schema_wp_admin_after_navigation_tabs', $tabs, $active_tab, $query_args );
|
185 |
+
}
|
includes/admin/meta-exclude.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Exclude post from Schema
|
4 |
+
*
|
5 |
+
* @package Schema
|
6 |
+
* @subpackage Schema Post Meta
|
7 |
+
* @copyright Copyright (c) 2016, Hesham Zebida
|
8 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
+
* @since 1.5.6
|
10 |
+
*/
|
11 |
+
|
12 |
+
|
13 |
+
// Exit if accessed directly
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
15 |
+
|
16 |
+
|
17 |
+
add_action( 'current_screen', 'schema_wp_exclude_post_meta' );
|
18 |
+
/**
|
19 |
+
* Add exclude post meta box
|
20 |
+
*
|
21 |
+
* @since 1.5.6
|
22 |
+
*/
|
23 |
+
function schema_wp_exclude_post_meta() {
|
24 |
+
|
25 |
+
if ( ! class_exists( 'Schema_WP' ) ) return;
|
26 |
+
|
27 |
+
global $post;
|
28 |
+
|
29 |
+
$prefix = '_schema_';
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Create meta box on active post types edit screens
|
33 |
+
*/
|
34 |
+
$fields = apply_filters( 'schema_wp_exclude', array(
|
35 |
+
array( // Single checkbox
|
36 |
+
'label' => __('Turn Schema OFF', 'schema-wp'), // <label>
|
37 |
+
'desc' => __('Tick this checkbox to turn off Schema output on this entry.', 'schema-wp'), // description
|
38 |
+
'id' => $prefix.'exclude', // field id and name
|
39 |
+
'type' => 'checkbox' // type of field
|
40 |
+
),
|
41 |
+
));
|
42 |
+
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Get enabled post types to create a meta box on
|
46 |
+
*/
|
47 |
+
$schemas_enabled = array();
|
48 |
+
|
49 |
+
// Get schame enabled array
|
50 |
+
$schemas_enabled = schema_wp_cpt_get_enabled();
|
51 |
+
|
52 |
+
if ( empty($schemas_enabled) ) return;
|
53 |
+
|
54 |
+
// Get post type from current screen
|
55 |
+
$current_screen = get_current_screen();
|
56 |
+
$post_type = $current_screen->post_type;
|
57 |
+
|
58 |
+
foreach( $schemas_enabled as $schema_enabled ) :
|
59 |
+
|
60 |
+
// debug
|
61 |
+
//echo '<pre>'; print_r($current_screen); echo '</pre>';
|
62 |
+
|
63 |
+
// Get Schema enabled post types array
|
64 |
+
$schema_cpt = $schema_enabled['post_type'];
|
65 |
+
|
66 |
+
if ( ! empty($schema_cpt) && in_array( $post_type, $schema_cpt, true ) ) {
|
67 |
+
|
68 |
+
|
69 |
+
$schema_wp_exclude = new Schema_Custom_Add_Meta_Box( 'schema_exclude', __('Schema Exclude','schema-wp'), $fields, $post_type, 'normal', 'low', true );
|
70 |
+
|
71 |
+
}
|
72 |
+
|
73 |
+
// debug
|
74 |
+
//print_r($schema_enabled);
|
75 |
+
|
76 |
+
endforeach;
|
77 |
+
}
|
includes/admin/meta-tax.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema Tax Meta
|
4 |
+
*
|
5 |
+
* @package Schema
|
6 |
+
* @subpackage Schema Tax Meta
|
7 |
+
* @copyright Copyright (c) 2016, Hesham Zebida
|
8 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
+
* @since 1.5.9.8
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
if (is_admin()){
|
16 |
+
/*
|
17 |
+
* prefix of meta keys, optional
|
18 |
+
*/
|
19 |
+
$prefix = 'schema_wp_';
|
20 |
+
/*
|
21 |
+
* configure your meta box
|
22 |
+
*/
|
23 |
+
$config = array(
|
24 |
+
'id' => 'schema_wp_meta_box', // meta box id, unique per meta box
|
25 |
+
'title' => __('Schema', 'schema-wp'), // meta box title
|
26 |
+
'pages' => array('category', 'post_tag'), // taxonomy name, accept categories, post_tag and custom taxonomies
|
27 |
+
'context' => 'normal', // where the meta box appear: normal (default), advanced, side; optional
|
28 |
+
'fields' => array(), // list of meta fields (can be added by field arrays)
|
29 |
+
'local_images' => false, // Use local or hosted images (meta box images for add/remove)
|
30 |
+
'use_with_theme' => false // change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).
|
31 |
+
);
|
32 |
+
|
33 |
+
|
34 |
+
/*
|
35 |
+
* Initiate your meta box
|
36 |
+
*/
|
37 |
+
$my_meta = new Schema_Custom_Add_Meta_Tax($config);
|
38 |
+
|
39 |
+
/*
|
40 |
+
* Add fields to your meta box
|
41 |
+
*/
|
42 |
+
|
43 |
+
//text field
|
44 |
+
$my_meta->addText( $prefix.'sameAs', array('name' => __('sameAs ','schema-wp'),'desc' => __("URL of a reference Web page that unambiguously indicates the item's identity. E.g. the URL of the item's Wikipedia page, Freebase page, or official website.", 'schema-wp') ));
|
45 |
+
|
46 |
+
/*
|
47 |
+
* Don't Forget to Close up the meta box decleration
|
48 |
+
*/
|
49 |
+
//Finish Meta Box Decleration
|
50 |
+
$my_meta->Finish();
|
51 |
+
}
|
includes/admin/meta-tax/README.md
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Tax Meta Class
|
2 |
+
=======================
|
3 |
+
Contributors: bainternet
|
4 |
+
Requires at least: 3.5
|
5 |
+
Tested up to: 4.0
|
6 |
+
[![Analytics](https://ga-beacon.appspot.com/UA-50573135-3/tax-meta-class/main)](https://github.com/bainternet/Tax-Meta-Class)
|
7 |
+
|
8 |
+
Description
|
9 |
+
-----------
|
10 |
+
The Tax Meta Class is used by including it in your plugin r theme files and using its methods to
|
11 |
+
Add meta fields for WordPress Taxonomies (categories,tags and custom taxonomies). It is meant to be very simple and
|
12 |
+
straightforward.
|
13 |
+
|
14 |
+
This class is derived from My-Meta-Box (https://github.com/bainternet/My-Meta-Box script) which is
|
15 |
+
a class for creating custom meta boxes for WordPress.
|
16 |
+
|
17 |
+
Usage
|
18 |
+
--------
|
19 |
+
Take a look at the `class-usage-demo.php` file which can also be tested as a WordPress Plugin.
|
20 |
+
Other options are available for each field which can be see in the 'Tax-meta-class.php' file,
|
21 |
+
|
22 |
+
Changelog
|
23 |
+
---------
|
24 |
+
2.1.0
|
25 |
+
Added support for WordPress 4.4 native term meta table
|
26 |
+
added migration class
|
27 |
+
|
28 |
+
2.0.2
|
29 |
+
Fixed jquery ui not loading theme and better jquery ui to WP version handling.
|
30 |
+
Added a filter hook to change jQuery ui theme `tmc_jquery_ui_theme`.
|
31 |
+
Better preBind jQuery plgin included.
|
32 |
+
|
33 |
+
2.0.1
|
34 |
+
Fixed #93.
|
35 |
+
|
36 |
+
2.0.0
|
37 |
+
Too many changes to list :)
|
38 |
+
major ones are around the image and file fields which no use `url` instead of `src` and allow multiple images/files that are stored in two fields of urls and ids split by a pipe `|`.
|
39 |
+
|
40 |
+
1.9.9
|
41 |
+
Fix references for the class for PHP 5.4 compatibility
|
42 |
+
|
43 |
+
1.9.8
|
44 |
+
fixed issue #49
|
45 |
+
|
46 |
+
1.9.7
|
47 |
+
see issue #44
|
48 |
+
|
49 |
+
1.9.6
|
50 |
+
Added WYSIWYG in repater support and most other fields which never worked in the repeate block, now should work. issue #42
|
51 |
+
|
52 |
+
1.9.5
|
53 |
+
Fixed Typo in validation call Props @Screenfeed.
|
54 |
+
|
55 |
+
1.9.4
|
56 |
+
Added textdomain for l18n #39
|
57 |
+
|
58 |
+
1.9.3
|
59 |
+
Fixed issue #38 props to Nicola Peluchetti for finding it and giving my an idea of how to fix it.
|
60 |
+
|
61 |
+
1.9.2
|
62 |
+
Pull #36
|
63 |
+
|
64 |
+
1.9.1
|
65 |
+
Fixed Upload field issues.
|
66 |
+
|
67 |
+
1.9.0
|
68 |
+
Added 'multiple' => false to all field types as defualt.
|
69 |
+
|
70 |
+
= 1.8.9 =
|
71 |
+
fixed issue #27 (again).
|
72 |
+
fixed issues #28, #29 , #30.
|
73 |
+
|
74 |
+
|
75 |
+
= 1.8.8 =
|
76 |
+
fixed issue #27.
|
77 |
+
|
78 |
+
= 1.8.7 =
|
79 |
+
fixed issue #26.
|
80 |
+
|
81 |
+
= 1.8.6 =
|
82 |
+
fixed issue #25.
|
83 |
+
|
84 |
+
= 1.8.5 =
|
85 |
+
fixed issue #21.
|
86 |
+
|
87 |
+
= 1.8.4 =
|
88 |
+
Renamed delete_taxonomy_metadata function to delete term meta on term deletion. pull #20.
|
89 |
+
|
90 |
+
= 1.8.3 =
|
91 |
+
Cleaned up Media uploader to simplify things. (parisholley)[https://github.com/parisholley]
|
92 |
+
Change the replacement of "INSERT TO POST" and is now done on client side.
|
93 |
+
|
94 |
+
= 1.8.2 =
|
95 |
+
Replaced get_stylesheet_directory_uri with get_template_directory_uri to work better with child themes.
|
96 |
+
Once again thanks to oobi. issue 17
|
97 |
+
|
98 |
+
= 1.8.1 =
|
99 |
+
added mete deletion on term deletion thanks to oobi
|
100 |
+
|
101 |
+
= 1.8 =
|
102 |
+
fixed issue 12
|
103 |
+
fixed issue 13
|
104 |
+
fixed issue 14
|
105 |
+
fixed issue 15
|
106 |
+
changed "insert into post" on media uploader.
|
107 |
+
|
108 |
+
= 1.7.4 =
|
109 |
+
Fixed bug caused by issue 2 fix.
|
110 |
+
|
111 |
+
= 1.7.3 =
|
112 |
+
Fixed issue #2.
|
113 |
+
|
114 |
+
= 1.7.2 =
|
115 |
+
Fixed issue #11.
|
116 |
+
|
117 |
+
= 1.7.1 =
|
118 |
+
Fixed typo.
|
119 |
+
|
120 |
+
= 1.7 =
|
121 |
+
Added strip slashes and get_tax_meta_strip function to avoid WordPress's native escape slashes.
|
122 |
+
|
123 |
+
= 1.6 =
|
124 |
+
Fixed file field issues.
|
125 |
+
|
126 |
+
= 1.5 =
|
127 |
+
Fixed repeater delete meta bug
|
128 |
+
|
129 |
+
= 1.4 =
|
130 |
+
updated addPosts in demo
|
131 |
+
and add_thickbox
|
132 |
+
|
133 |
+
= 1.3 =
|
134 |
+
Fixed WP debug errors
|
135 |
+
|
136 |
+
= 1.2=
|
137 |
+
Fixed debug Errors
|
138 |
+
|
139 |
+
= 1.0 =
|
140 |
+
* First Release
|
141 |
+
|
142 |
+
|
includes/admin/meta-tax/class-meta-tax.php
ADDED
@@ -0,0 +1,1819 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Tax Meta Class
|
4 |
+
*
|
5 |
+
* The Tax Meta Class is used by including it in your plugin r theme files and using its methods to
|
6 |
+
* Add meta fields for WordPress Taxonomies (categories,tags and custom taxonomies). It is meant to be very simple and
|
7 |
+
* straightforward.
|
8 |
+
*
|
9 |
+
* This class is derived from My-Meta-Box (https://github.com/bainternet/My-Meta-Box script) which is
|
10 |
+
* a class for creating custom meta boxes for WordPress.
|
11 |
+
*
|
12 |
+
* @version 2.1.0
|
13 |
+
* @copyright 2012-2015 Ohad Raz
|
14 |
+
* @author Ohad Raz (email: admin@bainternet.info)
|
15 |
+
* @link http://en.bainternet.info
|
16 |
+
*
|
17 |
+
* @license GNU General Public LIcense v3.0 - license.txt
|
18 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
21 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24 |
+
* THE SOFTWARE.
|
25 |
+
*
|
26 |
+
* @package Tax Meta Class
|
27 |
+
* @deprecated replace_insert_to_post_text() @since 1.8.3
|
28 |
+
*
|
29 |
+
*/
|
30 |
+
|
31 |
+
if ( ! class_exists( 'Schema_Custom_Add_Meta_Tax') ) :
|
32 |
+
|
33 |
+
/**
|
34 |
+
* All Types Meta Box class.
|
35 |
+
*
|
36 |
+
* @package All Types Meta Box
|
37 |
+
* @since 1.0
|
38 |
+
*
|
39 |
+
* @todo Nothing.
|
40 |
+
*/
|
41 |
+
class Schema_Custom_Add_Meta_Tax {
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Holds meta box object
|
45 |
+
*
|
46 |
+
* @var object
|
47 |
+
* @access protected
|
48 |
+
*/
|
49 |
+
protected $_meta_box;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Holds meta box fields.
|
53 |
+
*
|
54 |
+
* @var array
|
55 |
+
* @access protected
|
56 |
+
*/
|
57 |
+
protected $_prefix;
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Holds Prefix for meta box fields.
|
61 |
+
*
|
62 |
+
* @var array
|
63 |
+
* @access protected
|
64 |
+
*/
|
65 |
+
protected $_fields;
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Use local images.
|
69 |
+
*
|
70 |
+
* @var bool
|
71 |
+
* @access protected
|
72 |
+
*/
|
73 |
+
protected $_Local_images;
|
74 |
+
|
75 |
+
/**
|
76 |
+
* What form is this? edit or new term.
|
77 |
+
*
|
78 |
+
* @var string
|
79 |
+
* @access protected
|
80 |
+
* $since 1.0
|
81 |
+
*/
|
82 |
+
protected $_form_type;
|
83 |
+
/**
|
84 |
+
* SelfPath to allow themes as well as plugins.
|
85 |
+
*
|
86 |
+
* @var string
|
87 |
+
* @access protected
|
88 |
+
* $since 1.0
|
89 |
+
*/
|
90 |
+
protected $SelfPath;
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Constructor
|
94 |
+
*
|
95 |
+
* @since 1.0
|
96 |
+
* @access public
|
97 |
+
*
|
98 |
+
* @param array $meta_box
|
99 |
+
*/
|
100 |
+
public function __construct ( $meta_box ) {
|
101 |
+
|
102 |
+
// If we are not in admin area exit.
|
103 |
+
if ( ! is_admin() )
|
104 |
+
return;
|
105 |
+
|
106 |
+
// Assign meta box values to local variables and add it's missed values.
|
107 |
+
$this->_meta_box = $meta_box;
|
108 |
+
$this->_prefix = (isset($meta_box['prefix'])) ? $meta_box['prefix'] : '';
|
109 |
+
$this->_fields = $this->_meta_box['fields'];
|
110 |
+
$this->_Local_images = (isset($meta_box['local_images'])) ? true : false;
|
111 |
+
$this->add_missed_values();
|
112 |
+
if (isset($meta_box['use_with_theme'])){
|
113 |
+
if ($meta_box['use_with_theme'] === true){
|
114 |
+
$this->SelfPath = get_template_directory_uri() . '/meta-tax';
|
115 |
+
}elseif($meta_box['use_with_theme'] === false){
|
116 |
+
$this->SelfPath = plugins_url( 'meta-tax', plugin_basename( dirname( __FILE__ ) ) );
|
117 |
+
}else{
|
118 |
+
$this->SelfPath = $meta_box['use_with_theme'];
|
119 |
+
}
|
120 |
+
}else{
|
121 |
+
$this->SelfPath = plugins_url( 'meta-tax', plugin_basename( dirname( __FILE__ ) ) );
|
122 |
+
}
|
123 |
+
|
124 |
+
|
125 |
+
// Add Actions
|
126 |
+
add_action( 'admin_init', array( $this, 'add' ) );
|
127 |
+
|
128 |
+
// Load common js, css files
|
129 |
+
// Must enqueue for all pages as we need js for the media upload, too.
|
130 |
+
add_action( 'admin_print_styles', array( $this, 'load_scripts_styles' ) );
|
131 |
+
|
132 |
+
//overwrite insert into post button
|
133 |
+
|
134 |
+
//delete term meta on term deletion
|
135 |
+
add_action('delete_term', array($this,'delete_taxonomy_metadata'), 10,2);
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Load all Javascript and CSS
|
140 |
+
*
|
141 |
+
* @since 1.0
|
142 |
+
* @access public
|
143 |
+
*/
|
144 |
+
public function load_scripts_styles() {
|
145 |
+
|
146 |
+
// Get Plugin Path
|
147 |
+
$plugin_path = $this->SelfPath;
|
148 |
+
//only load styles and js when needed
|
149 |
+
/*
|
150 |
+
* since 1.0
|
151 |
+
*/
|
152 |
+
$taxnow = isset($_REQUEST['taxonomy'])? $_REQUEST['taxonomy'] : '';
|
153 |
+
if (in_array($taxnow,$this->_meta_box['pages'])){
|
154 |
+
// Check for special fields and add needed actions for them.
|
155 |
+
$this->check_field_upload();
|
156 |
+
$this->check_field_color();
|
157 |
+
$this->check_field_date();
|
158 |
+
$this->check_field_time();
|
159 |
+
// Enqueue Meta Box Style
|
160 |
+
wp_enqueue_style( 'tax-meta-clss', $plugin_path . '/css/tax-meta-class.css' );
|
161 |
+
// Enqueue Meta Box Scripts
|
162 |
+
wp_enqueue_script( 'tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array( 'jquery' ), null, true );
|
163 |
+
|
164 |
+
}
|
165 |
+
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Check the Field Upload, Add needed Actions
|
170 |
+
*
|
171 |
+
* @since 1.0
|
172 |
+
* @access public
|
173 |
+
*/
|
174 |
+
public function check_field_upload() {
|
175 |
+
|
176 |
+
// Check if the field is an image or file. If not, return.
|
177 |
+
if ( ! $this->has_field( 'image' ) && ! $this->has_field( 'file' ) )
|
178 |
+
return;
|
179 |
+
|
180 |
+
// Make upload feature work event when custom post type doesn't support 'editor'
|
181 |
+
wp_enqueue_script( 'jquery-ui-core' );
|
182 |
+
wp_enqueue_script( 'jquery-ui-sortable' );
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Check Field Color
|
187 |
+
*
|
188 |
+
* @since 1.0
|
189 |
+
* @access public
|
190 |
+
*/
|
191 |
+
public function check_field_color() {
|
192 |
+
|
193 |
+
if ( $this->has_field( 'color' ) && $this->is_edit_page() ) {
|
194 |
+
// Enqueu built-in script and style for color picker.
|
195 |
+
wp_enqueue_style( 'wp-color-picker' );
|
196 |
+
wp_enqueue_script( 'wp-color-picker' );
|
197 |
+
}
|
198 |
+
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Check Field Date
|
203 |
+
*
|
204 |
+
* @since 1.0
|
205 |
+
* @access public
|
206 |
+
*/
|
207 |
+
public function check_field_date() {
|
208 |
+
|
209 |
+
if ( $this->has_field( 'date' ) && $this->is_edit_page() ) {
|
210 |
+
// Enqueu JQuery UI, use proper version.
|
211 |
+
$this->enqueue_jqueryui();
|
212 |
+
}
|
213 |
+
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Check Field Time
|
218 |
+
*
|
219 |
+
* @since 1.0
|
220 |
+
* @access public
|
221 |
+
*/
|
222 |
+
public function check_field_time() {
|
223 |
+
|
224 |
+
if ( $this->has_field( 'time' ) && $this->is_edit_page() ) {
|
225 |
+
|
226 |
+
// Enqueu JQuery UI, use proper version.
|
227 |
+
$this->enqueue_jqueryui();
|
228 |
+
wp_enqueue_script( 'at-timepicker', '//cdnjs.cloudflare.com/ajax/libs/jquery-ui-timepicker-addon/1.4.5/jquery-ui-timepicker-addon.min.js', array( 'tmc-jquery-ui' ),false,true );
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Add Meta Box for multiple post types.
|
234 |
+
*
|
235 |
+
* @since 1.0
|
236 |
+
* @access public
|
237 |
+
*/
|
238 |
+
public function add() {
|
239 |
+
|
240 |
+
// Loop through array
|
241 |
+
foreach ( $this->_meta_box['pages'] as $page ) {
|
242 |
+
//add fields to edit form
|
243 |
+
add_action($page.'_edit_form_fields',array( $this, 'show_edit_form' ));
|
244 |
+
//add fields to add new form
|
245 |
+
add_action($page.'_add_form_fields',array( $this, 'show_new_form' ));
|
246 |
+
// this saves the edit fields
|
247 |
+
add_action( 'edited_'.$page, array( $this, 'save' ), 10, 2);
|
248 |
+
// this saves the add fields
|
249 |
+
add_action('created_'.$page,array( $this, 'save' ), 10, 2);
|
250 |
+
}
|
251 |
+
// Delete all attachments when delete custom post type.
|
252 |
+
add_action( 'wp_ajax_at_delete_file', array( $this, 'delete_file' ) );
|
253 |
+
add_action( 'wp_ajax_at_reorder_images', array( $this, 'reorder_images' ) );
|
254 |
+
// Delete file via Ajax
|
255 |
+
add_action( 'wp_ajax_at_delete_mupload', array( $this, 'wp_ajax_delete_image' ) );
|
256 |
+
|
257 |
+
}
|
258 |
+
|
259 |
+
/**
|
260 |
+
* Callback function to show fields on add new taxonomy term form.
|
261 |
+
*
|
262 |
+
* @since 1.0
|
263 |
+
* @access public
|
264 |
+
*/
|
265 |
+
public function show_new_form($term_id){
|
266 |
+
$this->_form_type = 'new';
|
267 |
+
add_action('admin_footer',array($this,'footer_js'));
|
268 |
+
$this->show($term_id);
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Callback function to show fields on term edit form.
|
273 |
+
*
|
274 |
+
* @since 1.0
|
275 |
+
* @access public
|
276 |
+
*/
|
277 |
+
public function show_edit_form($term_id){
|
278 |
+
$this->_form_type = 'edit';
|
279 |
+
$this->show($term_id);
|
280 |
+
}
|
281 |
+
|
282 |
+
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Callback function to show fields in meta box.
|
286 |
+
*
|
287 |
+
* @since 1.0
|
288 |
+
* @access public
|
289 |
+
*/
|
290 |
+
public function show($term_id) {
|
291 |
+
$term_id = is_object($term_id)? $term_id->term_id: $term_id;
|
292 |
+
wp_nonce_field( basename(__FILE__), 'tax_meta_class_nonce' );
|
293 |
+
|
294 |
+
foreach ( $this->_fields as $field ) {
|
295 |
+
$multiple = isset($field['multiple'])? $field['multiple'] : false;
|
296 |
+
$name = $field['id'];
|
297 |
+
//wordpress 4.4 term meta support
|
298 |
+
if ( function_exists('get_term_meta')){
|
299 |
+
$meta = get_term_meta($term_id, $name, !$multiple );
|
300 |
+
}else{
|
301 |
+
$meta = $this->get_tax_meta( $term_id, $name, !$multiple );
|
302 |
+
}
|
303 |
+
$meta = ( $meta !== '' ) ? $meta : (isset($field['std'])? $field['std'] : '');
|
304 |
+
if ('image' != $field['type'] && $field['type'] != 'repeater')
|
305 |
+
$meta = is_array( $meta ) ? array_map( 'esc_attr', $meta ) : esc_attr( $meta );
|
306 |
+
|
307 |
+
echo '<tr class="form-field">';
|
308 |
+
// Call Separated methods for displaying each type of field.
|
309 |
+
call_user_func ( array( $this, 'show_field_' . $field['type'] ), $field, is_array($meta)? $meta : stripslashes($meta) );
|
310 |
+
echo '</tr>';
|
311 |
+
}
|
312 |
+
echo '</table>';
|
313 |
+
}
|
314 |
+
|
315 |
+
/**
|
316 |
+
* Show Repeater Fields.
|
317 |
+
*
|
318 |
+
* @param string $field
|
319 |
+
* @param string $meta
|
320 |
+
* @since 1.0
|
321 |
+
* @access public
|
322 |
+
*/
|
323 |
+
public function show_field_repeater( $field, $meta ) {
|
324 |
+
// Get Plugin Path
|
325 |
+
$plugin_path = $this->SelfPath;
|
326 |
+
$this->show_field_begin( $field, $meta );
|
327 |
+
echo "<div class='at-repeat' id='{$field['id']}'>";
|
328 |
+
|
329 |
+
$c = 0;
|
330 |
+
|
331 |
+
if (count($meta) > 0 && is_array($meta) ){
|
332 |
+
foreach ($meta as $me){
|
333 |
+
//for labling toggles
|
334 |
+
$mmm = isset($me[$field['fields'][0]['id']])? $me[$field['fields'][0]['id']]: "";
|
335 |
+
echo '<div class="at-repater-block">'.$mmm.'<br/><table class="repeater-table" style="display: none;">';
|
336 |
+
if ($field['inline']){
|
337 |
+
echo '<tr class="at-inline" VALIGN="top">';
|
338 |
+
}
|
339 |
+
foreach ($field['fields'] as $f){
|
340 |
+
//reset var $id for repeater
|
341 |
+
$id = '';
|
342 |
+
$id = $field['id'].'['.$c.']['.$f['id'].']';
|
343 |
+
$m = isset($me[$f['id']])? $me[$f['id']]: '';
|
344 |
+
$m = ( $m !== '' ) ? $m : $f['std'];
|
345 |
+
if ('image' != $f['type'] && $f['type'] != 'repeater')
|
346 |
+
$m = is_array( $m) ? array_map( 'esc_attr', $m ) : esc_attr( $m);
|
347 |
+
|
348 |
+
//set new id for field in array format
|
349 |
+
$f['id'] = $id;
|
350 |
+
if (!$field['inline']){
|
351 |
+
echo '<tr>';
|
352 |
+
}
|
353 |
+
if ($f['type'] == 'wysiwyg')
|
354 |
+
call_user_func ( array( $this, 'show_field_' . $f['type'] ), $f, is_array($m)? $m : stripslashes($m),true);
|
355 |
+
else
|
356 |
+
call_user_func ( array( $this, 'show_field_' . $f['type'] ), $f, is_array($m)? $m : stripslashes($m));
|
357 |
+
|
358 |
+
if (!$field['inline']){
|
359 |
+
echo '</tr>';
|
360 |
+
}
|
361 |
+
}
|
362 |
+
if ($field['inline']){
|
363 |
+
echo '</tr>';
|
364 |
+
}
|
365 |
+
echo '</table>
|
366 |
+
<span class="at-re-toggle"><img src="';
|
367 |
+
if ($this->_Local_images){
|
368 |
+
echo $plugin_path.'/images/edit.png';
|
369 |
+
}else{
|
370 |
+
echo 'http://i.imgur.com/ka0E2.png';
|
371 |
+
}
|
372 |
+
echo '" alt="Edit" title="Edit"/></span>
|
373 |
+
<img src="';
|
374 |
+
if ($this->_Local_images){
|
375 |
+
echo $plugin_path.'/images/remove.png';
|
376 |
+
}else{
|
377 |
+
echo 'http://i.imgur.com/g8Duj.png';
|
378 |
+
}
|
379 |
+
echo '" alt="'.__('Remove','tax-meta').'" title="'.__('Remove','tax-meta').'" id="remove-'.$field['id'].'"></div>';
|
380 |
+
$c = $c + 1;
|
381 |
+
|
382 |
+
}
|
383 |
+
$this->show_field_end( $field, $meta );
|
384 |
+
}
|
385 |
+
|
386 |
+
echo '<img src="';
|
387 |
+
if ($this->_Local_images){
|
388 |
+
echo $plugin_path.'/images/add.png';
|
389 |
+
}else{
|
390 |
+
echo 'http://i.imgur.com/w5Tuc.png';
|
391 |
+
}
|
392 |
+
echo '" alt="'.__('Add','tax-meta').'" title="'.__('Add','tax-meta').'" id="add-'.$field['id'].'"><br/></div>';
|
393 |
+
|
394 |
+
//create all fields once more for js function and catch with object buffer
|
395 |
+
ob_start();
|
396 |
+
echo '<div class="at-repater-block"><table class="repeater-table">';
|
397 |
+
if ($field['inline']){
|
398 |
+
echo '<tr class="at-inline" VALIGN="top">';
|
399 |
+
}
|
400 |
+
foreach ($field['fields'] as $f){
|
401 |
+
//reset var $id for repeater
|
402 |
+
$id = '';
|
403 |
+
$id = $field['id'].'[CurrentCounter]['.$f['id'].']';
|
404 |
+
$f['id'] = $id;
|
405 |
+
if (!$field['inline']){
|
406 |
+
echo '<tr>';
|
407 |
+
}
|
408 |
+
if ($f['type'] == 'wysiwyg')
|
409 |
+
call_user_func ( array( $this, 'show_field_' . $f['type'] ), $f, '',true);
|
410 |
+
else
|
411 |
+
call_user_func ( array( $this, 'show_field_' . $f['type'] ), $f, '');
|
412 |
+
|
413 |
+
if (!$field['inline']){
|
414 |
+
echo '</tr>';
|
415 |
+
}
|
416 |
+
}
|
417 |
+
if ($field['inline']){
|
418 |
+
echo '</tr>';
|
419 |
+
}
|
420 |
+
echo '</table><img src="';
|
421 |
+
if ($this->_Local_images){
|
422 |
+
echo $plugin_path.'/images/remove.png';
|
423 |
+
}else{
|
424 |
+
echo 'http://i.imgur.com/g8Duj.png';
|
425 |
+
}
|
426 |
+
echo '" alt="'.__('Remove','tax-meta').'" title="'.__('Remove','tax-meta').'" id="remove-'.$field['id'].'"></div>';
|
427 |
+
$counter = 'countadd_'.$field['id'];
|
428 |
+
$js_code = ob_get_clean ();
|
429 |
+
$js_code = str_replace("\n","",$js_code);
|
430 |
+
$js_code = str_replace("\r","",$js_code);
|
431 |
+
$js_code = str_replace("'","\"",$js_code);
|
432 |
+
$js_code = str_replace("CurrentCounter","' + ".$counter." + '",$js_code);
|
433 |
+
echo '<script>
|
434 |
+
jQuery(document).ready(function() {
|
435 |
+
var '.$counter.' = '.$c.';
|
436 |
+
jQuery("#add-'.$field['id'].'").live(\'click\', function() {
|
437 |
+
'.$counter.' = '.$counter.' + 1;
|
438 |
+
jQuery(this).before(\''.$js_code.'\');
|
439 |
+
update_repeater_fields();
|
440 |
+
});
|
441 |
+
jQuery("#remove-'.$field['id'].'").live(\'click\', function() {
|
442 |
+
jQuery(this).parent().remove();
|
443 |
+
});
|
444 |
+
});
|
445 |
+
</script>';
|
446 |
+
echo '<br/><style>
|
447 |
+
.at-inline{line-height: 1 !important;}
|
448 |
+
.at-inline .at-field{border: 0px !important;}
|
449 |
+
.at-inline .at-label{margin: 0 0 1px !important;}
|
450 |
+
.at-inline .at-text{width: 70px;}
|
451 |
+
.at-inline .at-textarea{width: 100px; height: 75px;}
|
452 |
+
.at-repater-block{background-color: #FFFFFF;border: 1px solid;margin: 2px;}
|
453 |
+
</style>';
|
454 |
+
$this->show_field_end($field, $meta);
|
455 |
+
}
|
456 |
+
|
457 |
+
/**
|
458 |
+
* Begin Field.
|
459 |
+
*
|
460 |
+
* @param string $field
|
461 |
+
* @param string $meta
|
462 |
+
* @since 1.0
|
463 |
+
* @access public
|
464 |
+
*/
|
465 |
+
public function show_field_begin( $field, $meta) {
|
466 |
+
if (isset($field['group'])){
|
467 |
+
if ($field['group'] == "start"){
|
468 |
+
echo "<td class='at-field'>";
|
469 |
+
}
|
470 |
+
}else{
|
471 |
+
if ($this->_form_type == 'edit'){
|
472 |
+
echo '<th valign="top" scope="row">';
|
473 |
+
}else{
|
474 |
+
echo '<td><div class="form-field">';
|
475 |
+
}
|
476 |
+
}
|
477 |
+
if ( $field['name'] != '' || $field['name'] != FALSE ) {
|
478 |
+
//echo "<div class='at-label'>";
|
479 |
+
echo "<label for='{$field['id']}'>{$field['name']}</label>";
|
480 |
+
//echo "</div>";
|
481 |
+
}
|
482 |
+
if ($this->_form_type == 'edit'){
|
483 |
+
echo '</th><td>';
|
484 |
+
}
|
485 |
+
}
|
486 |
+
|
487 |
+
/**
|
488 |
+
* End Field.
|
489 |
+
*
|
490 |
+
* @param string $field
|
491 |
+
* @param string $meta
|
492 |
+
* @since 1.0
|
493 |
+
* @access public
|
494 |
+
*/
|
495 |
+
public function show_field_end( $field, $meta=NULL ,$group = false) {
|
496 |
+
if (isset($field['group'])){
|
497 |
+
if ($group == 'end'){
|
498 |
+
if ( isset($field['desc']) && $field['desc'] != '' ) {
|
499 |
+
echo "<p class='description'>{$field['desc']}</p></td>";
|
500 |
+
} else {
|
501 |
+
echo "</td>";
|
502 |
+
}
|
503 |
+
}else {
|
504 |
+
if ( isset($field['desc']) && $field['desc'] != '' ) {
|
505 |
+
echo "<p class='description'>{$field['desc']}</p><br/>";
|
506 |
+
}else{
|
507 |
+
echo '<br/>';
|
508 |
+
}
|
509 |
+
}
|
510 |
+
}else{
|
511 |
+
if ( isset($field['desc']) && $field['desc'] != '' ) {
|
512 |
+
echo "<p class='description'>{$field['desc']}</p>";
|
513 |
+
}
|
514 |
+
if ($this->_form_type == 'edit'){
|
515 |
+
echo '</td>';
|
516 |
+
}else{
|
517 |
+
echo '</td></div>';
|
518 |
+
}
|
519 |
+
}
|
520 |
+
}
|
521 |
+
|
522 |
+
/**
|
523 |
+
* Show Field Text.
|
524 |
+
*
|
525 |
+
* @param string $field
|
526 |
+
* @param string $meta
|
527 |
+
* @since 1.0
|
528 |
+
* @access public
|
529 |
+
*/
|
530 |
+
public function show_field_text( $field, $meta) {
|
531 |
+
$this->show_field_begin( $field, $meta );
|
532 |
+
echo "<input type='text' class='at-text' name='{$field['id']}' id='{$field['id']}' value='{$meta}' style='{$field['style']}' size='50' />";
|
533 |
+
$this->show_field_end( $field, $meta );
|
534 |
+
}
|
535 |
+
|
536 |
+
/**
|
537 |
+
* Show Field hidden.
|
538 |
+
*
|
539 |
+
* @param string $field
|
540 |
+
* @param string|mixed $meta
|
541 |
+
* @since 0.1.3
|
542 |
+
* @access public
|
543 |
+
*/
|
544 |
+
public function show_field_hidden( $field, $meta) {
|
545 |
+
//$this->show_field_begin( $field, $meta );
|
546 |
+
echo "<input type='hidden' class='at-text' name='{$field['id']}' id='{$field['id']}' value='{$meta}'/>";
|
547 |
+
//$this->show_field_end( $field, $meta );
|
548 |
+
}
|
549 |
+
|
550 |
+
/**
|
551 |
+
* Show Field Paragraph.
|
552 |
+
*
|
553 |
+
* @param string $field
|
554 |
+
* @since 0.1.3
|
555 |
+
* @access public
|
556 |
+
*/
|
557 |
+
public function show_field_paragraph( $field) {
|
558 |
+
//$this->show_field_begin( $field, $meta );
|
559 |
+
echo "<p style='{$field['style']}'>".$field['value']."</p>";
|
560 |
+
//$this->show_field_end( $field, $meta );
|
561 |
+
}
|
562 |
+
|
563 |
+
/**
|
564 |
+
* Show Field Textarea.
|
565 |
+
*
|
566 |
+
* @param string $field
|
567 |
+
* @param string $meta
|
568 |
+
* @since 1.0
|
569 |
+
* @access public
|
570 |
+
*/
|
571 |
+
public function show_field_textarea( $field, $meta ) {
|
572 |
+
$this->show_field_begin( $field, $meta );
|
573 |
+
echo "<textarea class='at-textarea large-text' style='{$field['style']}' name='{$field['id']}' id='{$field['id']}' cols='60' rows='10'>{$meta}</textarea>";
|
574 |
+
$this->show_field_end( $field, $meta );
|
575 |
+
}
|
576 |
+
|
577 |
+
/**
|
578 |
+
* Show Field Select.
|
579 |
+
*
|
580 |
+
* @param string $field
|
581 |
+
* @param string $meta
|
582 |
+
* @since 1.0
|
583 |
+
* @access public
|
584 |
+
*/
|
585 |
+
public function show_field_select( $field, $meta ) {
|
586 |
+
|
587 |
+
if ( ! is_array( $meta ) )
|
588 |
+
$meta = (array) $meta;
|
589 |
+
|
590 |
+
$this->show_field_begin( $field, $meta );
|
591 |
+
echo "<select class='at-select' style='{$field['style']}' name='{$field['id']}" . ( $field['multiple'] ? "[]' id='{$field['id']}' multiple='multiple'" : "'" ) . ">";
|
592 |
+
foreach ( $field['options'] as $key => $value ) {
|
593 |
+
echo "<option value='{$key}'" . selected( in_array( $key, $meta ), true, false ) . ">{$value}</option>";
|
594 |
+
}
|
595 |
+
echo "</select>";
|
596 |
+
$this->show_field_end( $field, $meta );
|
597 |
+
|
598 |
+
}
|
599 |
+
|
600 |
+
/**
|
601 |
+
* Show Radio Field.
|
602 |
+
*
|
603 |
+
* @param string $field
|
604 |
+
* @param string $meta
|
605 |
+
* @since 1.0
|
606 |
+
* @access public
|
607 |
+
*/
|
608 |
+
public function show_field_radio( $field, $meta ) {
|
609 |
+
|
610 |
+
if ( ! is_array( $meta ) )
|
611 |
+
$meta = (array) $meta;
|
612 |
+
|
613 |
+
$this->show_field_begin( $field, $meta );
|
614 |
+
foreach ( $field['options'] as $key => $value ) {
|
615 |
+
echo "<input style='{$field['style']}' type='radio' class='at-radio' name='{$field['id']}' value='{$key}'" . checked( in_array( $key, $meta ), true, false ) . " /> <span class='at-radio-label'>{$value}</span>";
|
616 |
+
}
|
617 |
+
$this->show_field_end( $field, $meta );
|
618 |
+
}
|
619 |
+
|
620 |
+
/**
|
621 |
+
* Show Checkbox Field.
|
622 |
+
*
|
623 |
+
* @param string $field
|
624 |
+
* @param string $meta
|
625 |
+
* @since 1.0
|
626 |
+
* @access public
|
627 |
+
*/
|
628 |
+
public function show_field_checkbox( $field, $meta ) {
|
629 |
+
|
630 |
+
$this->show_field_begin($field, $meta);
|
631 |
+
echo "<input type='checkbox' style='{$field['style']}' class='rw-checkbox' name='{$field['id']}' id='{$field['id']}'" . checked(!empty($meta), true, false) . " />";
|
632 |
+
$this->show_field_end( $field, $meta );
|
633 |
+
}
|
634 |
+
|
635 |
+
/**
|
636 |
+
* Show Wysiwig Field.
|
637 |
+
*
|
638 |
+
* @param string $field
|
639 |
+
* @param string $meta
|
640 |
+
* @since 1.0
|
641 |
+
* @access public
|
642 |
+
*/
|
643 |
+
public function show_field_wysiwyg( $field, $meta ,$in_repeater = false) {
|
644 |
+
$this->show_field_begin( $field, $meta );
|
645 |
+
// Add TinyMCE script for WP version < 3.3
|
646 |
+
global $wp_version;
|
647 |
+
|
648 |
+
if ( version_compare( $wp_version, '3.2.1' ) < 1 || $in_repeater) {
|
649 |
+
echo "<textarea style='{$field['style']}' class='at-wysiwyg theEditor large-text' name='{$field['id']}' id='{$field['id']}' cols='60' rows='10'>{$meta}</textarea>";
|
650 |
+
}else{
|
651 |
+
// Use new wp_editor() since WP 3.3
|
652 |
+
wp_editor( stripslashes(html_entity_decode($meta)), $field['id'], array( 'editor_class' => 'at-wysiwyg' ) );
|
653 |
+
}
|
654 |
+
$this->show_field_end( $field, $meta );
|
655 |
+
}
|
656 |
+
|
657 |
+
/**
|
658 |
+
* Show File Field.
|
659 |
+
*
|
660 |
+
* @param string $field
|
661 |
+
* @param string $meta
|
662 |
+
* @since 1.0
|
663 |
+
* @access public
|
664 |
+
*/
|
665 |
+
public function show_field_file( $field, $meta ) {
|
666 |
+
$this->show_field_begin( $field, $meta );
|
667 |
+
wp_enqueue_script('jquery-ui-sortable');
|
668 |
+
wp_enqueue_media();
|
669 |
+
$std = isset($field['std'])? $field['std'] : array('id' => '', 'url' => '');
|
670 |
+
$multiple = isset($field['multiple'])? $field['multiple'] : false;
|
671 |
+
$multiple = ($multiple)? "multiFile '" : "";
|
672 |
+
$name = esc_attr( $field['id'] );
|
673 |
+
$value = isset($meta['id']) ? $meta : $std;
|
674 |
+
$has_file = (empty($value['url']))? false : true;
|
675 |
+
$type = isset($field['mime_type'])? $field['mime_type'] : '';
|
676 |
+
$ext = isset($field['ext'])? $field['ext'] : '';
|
677 |
+
$type = (is_array($type)? implode("|",$type) : $type);
|
678 |
+
$ext = (is_array($ext)? implode("|",$ext) : $ext);
|
679 |
+
$id = $field['id'];
|
680 |
+
$li = ($has_file)? "<li><a href='{$value['url']}' target='_blank'>{$value['url']}</a></li>": "";
|
681 |
+
|
682 |
+
echo "<span class='simplePanelfilePreview'><ul>{$li}</ul></span>";
|
683 |
+
echo "<input type='hidden' name='{$name}[id]' value='{$value['id']}'/>";
|
684 |
+
echo "<input type='hidden' name='{$name}[url]' value='{$value['url']}'/>";
|
685 |
+
if ($has_file)
|
686 |
+
echo "<input type='button' class='{$multiple} button simplePanelfileUploadclear' id='{$id}' value='Remove File' data-mime_type='{$type}' data-ext='{$ext}'/>";
|
687 |
+
else
|
688 |
+
echo "<input type='button' class='{$multiple} button simplePanelfileUpload' id='{$id}' value='Upload File' data-mime_type='{$type}' data-ext='{$ext}'/>";
|
689 |
+
$this->show_field_end( $field, $meta );
|
690 |
+
}
|
691 |
+
|
692 |
+
/**
|
693 |
+
* Show Image Field.
|
694 |
+
*
|
695 |
+
* @param array $field
|
696 |
+
* @param array $meta
|
697 |
+
* @since 1.0
|
698 |
+
* @access public
|
699 |
+
*/
|
700 |
+
public function show_field_image( $field, $meta ) {
|
701 |
+
$this->show_field_begin( $field, $meta );
|
702 |
+
wp_enqueue_script('jquery-ui-sortable');
|
703 |
+
wp_enqueue_media();
|
704 |
+
$std = isset($field['std'])? $field['std'] : array('id' => '', 'url' => '');
|
705 |
+
$name = esc_attr( $field['id'] );
|
706 |
+
$value = isset($meta['id']) ? $meta : $std;
|
707 |
+
//backwords capability
|
708 |
+
if (!isset($value['url']))
|
709 |
+
$value['url'] = '';
|
710 |
+
if (!isset($value['id']))
|
711 |
+
$value['id'] = '';
|
712 |
+
$value['url'] = isset($value['src'])? $value['src']: $value['url'];
|
713 |
+
$has_image = empty($value['url'])? false : true;
|
714 |
+
$w = isset($field['width'])? $field['width'] : 'auto';
|
715 |
+
$h = isset($field['height'])? $field['height'] : 'auto';
|
716 |
+
$PreviewStyle = "style='width: $w; height: $h;". ( (!$has_image)? "display: none;'": "'");
|
717 |
+
$id = $field['id'];
|
718 |
+
$multiple = isset($field['multiple'])? $field['multiple'] : false;
|
719 |
+
$multiple = ($multiple)? "multiFile " : "";
|
720 |
+
|
721 |
+
echo "<span class='simplePanelImagePreview'><img {$PreviewStyle} src='{$value['url']}'><br/></span>";
|
722 |
+
echo "<input type='hidden' name='{$name}[id]' value='{$value['id']}'/>";
|
723 |
+
echo "<input type='hidden' name='{$name}[url]' value='{$value['url']}'/>";
|
724 |
+
if ($has_image)
|
725 |
+
echo "<input class='{$multiple} button simplePanelimageUploadclear' id='{$id}' value='".__('Remove Image')."' type='button'/>";
|
726 |
+
else
|
727 |
+
echo "<input class='{$multiple} button simplePanelimageUpload' id='{$id}' value='".__('Upload Image')."' type='button'/>";
|
728 |
+
$this->show_field_end( $field, $meta );
|
729 |
+
}
|
730 |
+
|
731 |
+
/**
|
732 |
+
* Show Color Field.
|
733 |
+
*
|
734 |
+
* @param string $field
|
735 |
+
* @param string $meta
|
736 |
+
* @since 1.0
|
737 |
+
* @access public
|
738 |
+
*/
|
739 |
+
public function show_field_color( $field, $meta ) {
|
740 |
+
|
741 |
+
if ( empty( $meta ) )
|
742 |
+
$meta = '#';
|
743 |
+
|
744 |
+
$this->show_field_begin( $field, $meta );
|
745 |
+
echo '<input class="at-color" type="text" name="'.$field['id'].'" value="'.esc_attr($meta).'"/>';
|
746 |
+
$this->show_field_end($field, $meta);
|
747 |
+
|
748 |
+
}
|
749 |
+
|
750 |
+
/**
|
751 |
+
* Show Checkbox List Field
|
752 |
+
*
|
753 |
+
* @param string $field
|
754 |
+
* @param string $meta
|
755 |
+
* @since 1.0
|
756 |
+
* @access public
|
757 |
+
*/
|
758 |
+
public function show_field_checkbox_list( $field, $meta ) {
|
759 |
+
|
760 |
+
if ( ! is_array( $meta ) )
|
761 |
+
$meta = (array) $meta;
|
762 |
+
|
763 |
+
$this->show_field_begin($field, $meta);
|
764 |
+
|
765 |
+
$html = array();
|
766 |
+
|
767 |
+
foreach ($field['options'] as $key => $value) {
|
768 |
+
$html[] = "<input style='{$field['style']}' type='checkbox' class='at-checkbox_list' name='{$field['id']}[]' value='{$key}'" . checked( in_array( $key, $meta ), true, false ) . " /> {$value}";
|
769 |
+
}
|
770 |
+
|
771 |
+
echo implode( '<br />' , $html );
|
772 |
+
|
773 |
+
$this->show_field_end($field, $meta);
|
774 |
+
|
775 |
+
}
|
776 |
+
|
777 |
+
/**
|
778 |
+
* Show Date Field.
|
779 |
+
*
|
780 |
+
* @param string $field
|
781 |
+
* @param string $meta
|
782 |
+
* @since 1.0
|
783 |
+
* @access public
|
784 |
+
*/
|
785 |
+
public function show_field_date( $field, $meta ) {
|
786 |
+
$this->show_field_begin( $field, $meta );
|
787 |
+
echo "<input style='{$field['style']}' type='text' class='at-date' name='{$field['id']}' id='{$field['id']}' rel='{$field['format']}' value='{$meta}' size='30' />";
|
788 |
+
$this->show_field_end( $field, $meta );
|
789 |
+
}
|
790 |
+
|
791 |
+
/**
|
792 |
+
* Show time field.
|
793 |
+
*
|
794 |
+
* @param string $field
|
795 |
+
* @param string $meta
|
796 |
+
* @since 1.0
|
797 |
+
* @access public
|
798 |
+
*/
|
799 |
+
public function show_field_time( $field, $meta ) {
|
800 |
+
$this->show_field_begin( $field, $meta );
|
801 |
+
echo "<input style='{$field['style']}' type='text' class='at-time' name='{$field['id']}' id='{$field['id']}' rel='{$field['format']}' value='{$meta}' size='30' />";
|
802 |
+
$this->show_field_end( $field, $meta );
|
803 |
+
}
|
804 |
+
|
805 |
+
/**
|
806 |
+
* Show Posts field.
|
807 |
+
* used creating a posts/pages/custom types checkboxlist or a select dropdown
|
808 |
+
* @param string $field
|
809 |
+
* @param string $meta
|
810 |
+
* @since 1.0
|
811 |
+
* @access public
|
812 |
+
*/
|
813 |
+
public function show_field_posts($field, $meta) {
|
814 |
+
global $post;
|
815 |
+
|
816 |
+
if (!is_array($meta)) $meta = (array) $meta;
|
817 |
+
$this->show_field_begin($field, $meta);
|
818 |
+
$options = $field['options'];
|
819 |
+
$posts = get_posts($options['args']);
|
820 |
+
|
821 |
+
// checkbox_list
|
822 |
+
if ('checkbox_list' == $options['type']) {
|
823 |
+
foreach ($posts as $p) {
|
824 |
+
echo "<input type='checkbox' name='{$field['id']}[]' value='$p->ID'" . checked(in_array($p->ID, $meta), true, false) . " /> $p->post_title<br/>";
|
825 |
+
}
|
826 |
+
}
|
827 |
+
// select
|
828 |
+
else {
|
829 |
+
echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
|
830 |
+
foreach ($posts as $p) {
|
831 |
+
echo "<option value='$p->ID'" . selected(in_array($p->ID, $meta), true, false) . ">$p->post_title</option>";
|
832 |
+
}
|
833 |
+
echo "</select>";
|
834 |
+
}
|
835 |
+
|
836 |
+
$this->show_field_end($field, $meta);
|
837 |
+
}
|
838 |
+
|
839 |
+
/**
|
840 |
+
* Show Taxonomy field.
|
841 |
+
* used creating a category/tags/custom taxonomy checkboxlist or a select dropdown
|
842 |
+
* @param string $field
|
843 |
+
* @param string $meta
|
844 |
+
* @since 1.0
|
845 |
+
* @access public
|
846 |
+
*
|
847 |
+
* @uses get_terms()
|
848 |
+
*/
|
849 |
+
public function show_field_taxonomy($field, $meta) {
|
850 |
+
global $post;
|
851 |
+
|
852 |
+
if (!is_array($meta)) $meta = (array) $meta;
|
853 |
+
$this->show_field_begin($field, $meta);
|
854 |
+
$options = $field['options'];
|
855 |
+
$terms = get_terms($options['taxonomy'], $options['args']);
|
856 |
+
|
857 |
+
// checkbox_list
|
858 |
+
if ('checkbox_list' == $options['type']) {
|
859 |
+
foreach ($terms as $term) {
|
860 |
+
echo "<input type='checkbox' name='{$field['id']}[]' value='$term->slug'" . checked(in_array($term->slug, $meta), true, false) . " /> $term->name<br/>";
|
861 |
+
}
|
862 |
+
}
|
863 |
+
// select
|
864 |
+
else {
|
865 |
+
echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
|
866 |
+
foreach ($terms as $term) {
|
867 |
+
echo "<option value='$term->slug'" . selected(in_array($term->slug, $meta), true, false) . ">$term->name</option>";
|
868 |
+
}
|
869 |
+
echo "</select>";
|
870 |
+
}
|
871 |
+
|
872 |
+
$this->show_field_end($field, $meta);
|
873 |
+
}
|
874 |
+
|
875 |
+
/**
|
876 |
+
* Save Data from Metabox
|
877 |
+
*
|
878 |
+
* @param string $term_id
|
879 |
+
* @since 1.0
|
880 |
+
* @access public
|
881 |
+
*/
|
882 |
+
public function save( $term_id ) {
|
883 |
+
|
884 |
+
// check if the we are coming from quick edit issue #38 props to Nicola Peluchetti.
|
885 |
+
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'inline-save-tax') {
|
886 |
+
return $term_id;
|
887 |
+
}
|
888 |
+
|
889 |
+
if ( ! isset( $term_id ) // Check Revision
|
890 |
+
|| ( ! isset( $_POST['taxonomy'] ) ) // Check if current taxonomy type is set.
|
891 |
+
|| ( ! in_array( $_POST['taxonomy'], $this->_meta_box['pages'] ) ) // Check if current taxonomy type is supported.
|
892 |
+
|| ( ! check_admin_referer( basename( __FILE__ ), 'tax_meta_class_nonce') ) // Check nonce - Security
|
893 |
+
|| ( ! current_user_can('manage_categories') ) ) // Check permission
|
894 |
+
{
|
895 |
+
return $term_id;
|
896 |
+
}
|
897 |
+
|
898 |
+
foreach ( $this->_fields as $field ) {
|
899 |
+
|
900 |
+
$name = $field['id'];
|
901 |
+
$type = $field['type'];
|
902 |
+
$multiple = isset($field['multiple'])? $field['multiple']: false;
|
903 |
+
//wordpress 4.4 term meta support
|
904 |
+
if ( function_exists('get_term_meta')){
|
905 |
+
$old = get_term_meta($term_id, $name, !$multiple );
|
906 |
+
}else{
|
907 |
+
$old = $this->get_tax_meta( $term_id, $name, !$multiple );
|
908 |
+
}
|
909 |
+
$new = ( isset( $_POST[$name] ) ) ? $_POST[$name] : ( ( $multiple ) ? array() : '' );
|
910 |
+
|
911 |
+
|
912 |
+
// Validate meta value
|
913 |
+
if ( class_exists( 'Tax_Meta_Validate' ) && method_exists( 'Tax_Meta_Validate', $field['validate_func'] ) ) {
|
914 |
+
$new = call_user_func( array( 'Tax_Meta_Validate', $field['validate_func'] ), $new );
|
915 |
+
}
|
916 |
+
|
917 |
+
//skip on Paragraph field
|
918 |
+
if ($type != "paragraph"){
|
919 |
+
|
920 |
+
// Call defined method to save meta value, if there's no methods, call common one.
|
921 |
+
$save_func = 'save_field_' . $type;
|
922 |
+
if ( method_exists( $this, $save_func ) ) {
|
923 |
+
call_user_func( array( $this, 'save_field_' . $type ), $term_id, $field, $old, $new );
|
924 |
+
} else {
|
925 |
+
$this->save_field( $term_id, $field, $old, $new );
|
926 |
+
}
|
927 |
+
}
|
928 |
+
|
929 |
+
} // End foreach
|
930 |
+
}
|
931 |
+
|
932 |
+
/**
|
933 |
+
* Common function for saving fields.
|
934 |
+
*
|
935 |
+
* @param string $term_id
|
936 |
+
* @param string $field
|
937 |
+
* @param string $old
|
938 |
+
* @param string|mixed $new
|
939 |
+
* @since 1.0
|
940 |
+
* @access public
|
941 |
+
*/
|
942 |
+
public function save_field( $term_id, $field, $old, $new ) {
|
943 |
+
$name = $field['id'];
|
944 |
+
//wordpress 4.4 term meta support
|
945 |
+
if ( function_exists('get_term_meta')){
|
946 |
+
delete_term_meta($term_id, $name);
|
947 |
+
}else{
|
948 |
+
$this->delete_tax_meta( $term_id, $name );
|
949 |
+
}
|
950 |
+
if ( $new === '' || $new === array() )
|
951 |
+
return;
|
952 |
+
|
953 |
+
if ( function_exists('update_term_meta')){
|
954 |
+
update_term_meta( $term_id, $name, $new );
|
955 |
+
}else{
|
956 |
+
$this->update_tax_meta( $term_id, $name, $new );
|
957 |
+
}
|
958 |
+
}
|
959 |
+
|
960 |
+
/**
|
961 |
+
* function for saving image field.
|
962 |
+
*
|
963 |
+
* @param string $term_id
|
964 |
+
* @param string $field
|
965 |
+
* @param string $old
|
966 |
+
* @param string|mixed $new
|
967 |
+
* @since 1.0
|
968 |
+
* @access public
|
969 |
+
*/
|
970 |
+
public function save_field_image( $term_id, $field, $old, $new ) {
|
971 |
+
$name = $field['id'];
|
972 |
+
if ( function_exists('delete_term_meta')){
|
973 |
+
delete_term_meta($term_id, $name);
|
974 |
+
}else{
|
975 |
+
$this->delete_tax_meta( $term_id, $name );
|
976 |
+
}
|
977 |
+
|
978 |
+
if ( $new === '' || $new === array() || $new['id'] == '' || $new['url'] == '')
|
979 |
+
return;
|
980 |
+
|
981 |
+
if ( function_exists('update_term_meta')){
|
982 |
+
update_term_meta( $term_id, $name, $new );
|
983 |
+
}else{
|
984 |
+
$this->update_tax_meta( $term_id, $name, $new );
|
985 |
+
}
|
986 |
+
}
|
987 |
+
|
988 |
+
/*
|
989 |
+
* Save Wysiwyg Field.
|
990 |
+
*
|
991 |
+
* @param string $term_id
|
992 |
+
* @param string $field
|
993 |
+
* @param string $old
|
994 |
+
* @param string $new
|
995 |
+
* @since 1.0
|
996 |
+
* @access public
|
997 |
+
*/
|
998 |
+
public function save_field_wysiwyg( $term_id, $field, $old, $new ) {
|
999 |
+
$this->save_field( $term_id, $field, $old, $new );
|
1000 |
+
}
|
1001 |
+
|
1002 |
+
/**
|
1003 |
+
* Save repeater Fields.
|
1004 |
+
*
|
1005 |
+
* @param string $term_id
|
1006 |
+
* @param string $field
|
1007 |
+
* @param string|mixed $old
|
1008 |
+
* @param string|mixed $new
|
1009 |
+
* @since 1.0
|
1010 |
+
* @access public
|
1011 |
+
*/
|
1012 |
+
public function save_field_repeater( $term_id, $field, $old, $new ) {
|
1013 |
+
if (is_array($new) && count($new) > 0){
|
1014 |
+
foreach ($new as $n){
|
1015 |
+
foreach ( $field['fields'] as $f ) {
|
1016 |
+
$type = $f['type'];
|
1017 |
+
switch($type) {
|
1018 |
+
case 'wysiwyg':
|
1019 |
+
$n[$f['id']] = wpautop( $n[$f['id']] );
|
1020 |
+
break;
|
1021 |
+
case 'file':
|
1022 |
+
$n[$f['id']] = $this->save_field_file_repeater($term_id,$f,'',$n[$f['id']]);
|
1023 |
+
break;
|
1024 |
+
default:
|
1025 |
+
break;
|
1026 |
+
}
|
1027 |
+
}
|
1028 |
+
if(!$this->is_array_empty($n))
|
1029 |
+
$temp[] = $n;
|
1030 |
+
}
|
1031 |
+
if (isset($temp) && count($temp) > 0 && !$this->is_array_empty($temp)){
|
1032 |
+
if ( function_exists('update_term_meta')){
|
1033 |
+
update_term_meta( $term_id,$field['id'],$temp );
|
1034 |
+
}else{
|
1035 |
+
$this->update_tax_meta( $term_id,$field['id'],$temp );
|
1036 |
+
}
|
1037 |
+
}else{
|
1038 |
+
// remove old meta if exists
|
1039 |
+
if ( function_exists('delete_term_meta')){
|
1040 |
+
delete_term_meta($term_id, $field['id']);
|
1041 |
+
}else{
|
1042 |
+
$this->delete_tax_meta($term_id,$field['id']);
|
1043 |
+
}
|
1044 |
+
}
|
1045 |
+
}else{
|
1046 |
+
// remove old meta if exists
|
1047 |
+
if ( function_exists('delete_term_meta')){
|
1048 |
+
delete_term_meta($term_id, $field['id']);
|
1049 |
+
}else{
|
1050 |
+
$this->delete_tax_meta($term_id,$field['id']);
|
1051 |
+
}
|
1052 |
+
}
|
1053 |
+
}
|
1054 |
+
|
1055 |
+
/**
|
1056 |
+
* Save File Field.
|
1057 |
+
*
|
1058 |
+
* @param string $term_id
|
1059 |
+
* @param string $field
|
1060 |
+
* @param string $old
|
1061 |
+
* @param string $new
|
1062 |
+
* @since 1.0
|
1063 |
+
* @access public
|
1064 |
+
*/
|
1065 |
+
public function save_field_file( $term_id, $field, $old, $new ) {
|
1066 |
+
|
1067 |
+
$name = $field['id'];
|
1068 |
+
if ( function_exists('delete_term_meta')){
|
1069 |
+
delete_term_meta($term_id, $name);
|
1070 |
+
}else{
|
1071 |
+
$this->delete_tax_meta($term_id,$name);
|
1072 |
+
}
|
1073 |
+
if ( $new === '' || $new === array() || $new['id'] == '' || $new['url'] == '')
|
1074 |
+
return;
|
1075 |
+
|
1076 |
+
if ( function_exists('update_term_meta')){
|
1077 |
+
update_term_meta( $term_id, $name, $new);
|
1078 |
+
}else{
|
1079 |
+
$this->update_tax_meta( $term_id, $name, $new );
|
1080 |
+
}
|
1081 |
+
}
|
1082 |
+
|
1083 |
+
|
1084 |
+
/**
|
1085 |
+
* Add missed values for meta box.
|
1086 |
+
*
|
1087 |
+
* @since 1.0
|
1088 |
+
* @access public
|
1089 |
+
*/
|
1090 |
+
public function add_missed_values() {
|
1091 |
+
|
1092 |
+
// Default values for meta box
|
1093 |
+
$this->_meta_box = array_merge( array( 'context' => 'normal', 'priority' => 'high', 'pages' => array( 'post' ) ),(array)$this->_meta_box );
|
1094 |
+
|
1095 |
+
// Default values for fields
|
1096 |
+
foreach ( (array)$this->_fields as $field ) {
|
1097 |
+
|
1098 |
+
$multiple = in_array( $field['type'], array( 'checkbox_list', 'file', 'image' ) );
|
1099 |
+
$std = $multiple ? array() : '';
|
1100 |
+
$format = 'date' == $field['type'] ? 'yy-mm-dd' : ( 'time' == $field['type'] ? 'hh:mm' : '' );
|
1101 |
+
|
1102 |
+
$field = array_merge( array( 'multiple' => $multiple, 'std' => $std, 'desc' => '', 'format' => $format, 'validate_func' => '' ), $field );
|
1103 |
+
|
1104 |
+
} // End foreach
|
1105 |
+
|
1106 |
+
}
|
1107 |
+
|
1108 |
+
/**
|
1109 |
+
* Check if field with $type exists.
|
1110 |
+
*
|
1111 |
+
* @param string $type
|
1112 |
+
* @since 1.0
|
1113 |
+
* @access public
|
1114 |
+
*/
|
1115 |
+
public function has_field( $type ) {
|
1116 |
+
foreach ( $this->_fields as $field ) {
|
1117 |
+
if ( $type == $field['type'] )
|
1118 |
+
return true;
|
1119 |
+
elseif('repeater' == $field['type'] ){
|
1120 |
+
foreach((array)$field["fields"] as $repeater_field) {
|
1121 |
+
if($type == $repeater_field["type"]) return true;
|
1122 |
+
}
|
1123 |
+
}
|
1124 |
+
}
|
1125 |
+
return false;
|
1126 |
+
}
|
1127 |
+
|
1128 |
+
/**
|
1129 |
+
* Check if current page is edit page.
|
1130 |
+
*
|
1131 |
+
* @since 1.0
|
1132 |
+
* @access public
|
1133 |
+
*/
|
1134 |
+
public function is_edit_page() {
|
1135 |
+
global $pagenow;
|
1136 |
+
return ( $pagenow == 'edit-tags.php' );
|
1137 |
+
}
|
1138 |
+
|
1139 |
+
/**
|
1140 |
+
* Fixes the odd indexing of multiple file uploads.
|
1141 |
+
*
|
1142 |
+
* Goes from the format:
|
1143 |
+
* $_FILES['field']['key']['index']
|
1144 |
+
* to
|
1145 |
+
* The More standard and appropriate:
|
1146 |
+
* $_FILES['field']['index']['key']
|
1147 |
+
*
|
1148 |
+
* @param string $files
|
1149 |
+
* @since 1.0
|
1150 |
+
* @access public
|
1151 |
+
*/
|
1152 |
+
public function fix_file_array( &$files ) {
|
1153 |
+
|
1154 |
+
$output = array();
|
1155 |
+
|
1156 |
+
foreach ( $files as $key => $list ) {
|
1157 |
+
foreach ( $list as $index => $value ) {
|
1158 |
+
$output[$index][$key] = $value;
|
1159 |
+
}
|
1160 |
+
}
|
1161 |
+
|
1162 |
+
return $files = $output;
|
1163 |
+
|
1164 |
+
}
|
1165 |
+
|
1166 |
+
/**
|
1167 |
+
* Get proper JQuery UI version.
|
1168 |
+
*
|
1169 |
+
* Used in order to not conflict with WP Admin Scripts.
|
1170 |
+
*
|
1171 |
+
* @since 1.0
|
1172 |
+
* @access public
|
1173 |
+
*/
|
1174 |
+
public function get_jqueryui_ver() {
|
1175 |
+
|
1176 |
+
global $wp_version;
|
1177 |
+
|
1178 |
+
if ( version_compare( $wp_version, '4.0', '>=') ) {
|
1179 |
+
return '1.11.2';
|
1180 |
+
}
|
1181 |
+
if ( version_compare( $wp_version, '3.9', '>=') ) {
|
1182 |
+
return '1.10.4';
|
1183 |
+
}
|
1184 |
+
if ( version_compare( $wp_version, '3.8', '>=') ) {
|
1185 |
+
return '1.10.3';
|
1186 |
+
}
|
1187 |
+
if ( version_compare( $wp_version, '3.5', '>=') ) {
|
1188 |
+
return '1.9.2';
|
1189 |
+
}
|
1190 |
+
if ( version_compare( $wp_version, '3.1', '>=') ) {
|
1191 |
+
return '1.8.10';
|
1192 |
+
}
|
1193 |
+
|
1194 |
+
return '1.7.3';
|
1195 |
+
}
|
1196 |
+
|
1197 |
+
/**
|
1198 |
+
* Enqueue JQuery UI version.
|
1199 |
+
*
|
1200 |
+
* @since 2.0.2
|
1201 |
+
* @access public
|
1202 |
+
*/
|
1203 |
+
public function enqueue_jqueryui(){
|
1204 |
+
wp_enqueue_style( 'tmc-jquery-ui-css', 'http://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/themes/'.apply_filters('tmc_jquery_ui_theme','smoothness').'/jquery-ui.css' );
|
1205 |
+
wp_enqueue_script( 'tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/jquery-ui.min.js', array( 'jquery' ) );
|
1206 |
+
}
|
1207 |
+
|
1208 |
+
/**
|
1209 |
+
* Add Field to meta box (generic function)
|
1210 |
+
* @author Ohad Raz
|
1211 |
+
* @since 1.0
|
1212 |
+
* @access public
|
1213 |
+
* @param $id string field id, i.e. the meta key
|
1214 |
+
* @param $args mixed|array
|
1215 |
+
*/
|
1216 |
+
public function addField($id,$args){
|
1217 |
+
$new_field = array('id'=> $id,'std' => '','desc' => '','style' =>'','multiple' => false);
|
1218 |
+
$new_field = array_merge($new_field, $args);
|
1219 |
+
$this->_fields[] = $new_field;
|
1220 |
+
}
|
1221 |
+
|
1222 |
+
/**
|
1223 |
+
* Add Text Field to meta box
|
1224 |
+
* @author Ohad Raz
|
1225 |
+
* @since 1.0
|
1226 |
+
* @access public
|
1227 |
+
* @param $id string field id, i.e. the meta key
|
1228 |
+
* @param $args mixed|array
|
1229 |
+
* 'name' => // field name/label string optional
|
1230 |
+
* 'desc' => // field description, string optional
|
1231 |
+
* 'std' => // default value, string optional
|
1232 |
+
* 'style' => // custom style for field, string optional
|
1233 |
+
* 'validate_func' => // validate function, string optional
|
1234 |
+
* @param $repeater bool is this a field inside a repeatr? true|false(default)
|
1235 |
+
*/
|
1236 |
+
public function addText($id,$args,$repeater=false){
|
1237 |
+
$new_field = array('type' => 'text','id'=> $id,'std' => '','desc' => '','style' =>'','name' => 'Text Field','multiple' => false);
|
1238 |
+
$new_field = array_merge($new_field, $args);
|
1239 |
+
if(false === $repeater){
|
1240 |
+
$this->_fields[] = $new_field;
|
1241 |
+
}else{
|
1242 |
+
return $new_field;
|
1243 |
+
}
|
1244 |
+
}
|
1245 |
+
/**
|
1246 |
+
* Add Hidden Field to meta box
|
1247 |
+
* @author Ohad Raz
|
1248 |
+
* @since 0.1.3
|
1249 |
+
* @access public
|
1250 |
+
* @param $id string field id, i.e. the meta key
|
1251 |
+
* @param $args mixed|array
|
1252 |
+
* 'name' => // field name/label string optional
|
1253 |
+
* 'desc' => // field description, string optional
|
1254 |
+
* 'std' => // default value, string optional
|
1255 |
+
* 'style' => // custom style for field, string optional
|
1256 |
+
* 'validate_func' => // validate function, string optional
|
1257 |
+
* @param $repeater bool is this a field inside a repeatr? true|false(default)
|
1258 |
+
*/
|
1259 |
+
public function addHidden($id,$args,$repeater=false){
|
1260 |
+
$new_field = array('type' => 'hidden','id'=> $id,'std' => '','desc' => '','style' =>'','name' => 'Text Field', 'multiple' => false);
|
1261 |
+
$new_field = array_merge($new_field, $args);
|
1262 |
+
if(false === $repeater){
|
1263 |
+
$this->_fields[] = $new_field;
|
1264 |
+
}else{
|
1265 |
+
return $new_field;
|
1266 |
+
}
|
1267 |
+
}
|
1268 |
+
|
1269 |
+
/**
|
1270 |
+
* Add Paragraph to meta box
|
1271 |
+
* @author Ohad Raz
|
1272 |
+
* @since 0.1.3
|
1273 |
+
* @access public
|
1274 |
+
* @param $id string field id, i.e. the meta key
|
1275 |
+
* @param $value paragraph html
|
1276 |
+
* @param $repeater bool is this a field inside a repeatr? true|false(default)
|
1277 |
+
*/
|
1278 |
+
public function addParagraph($id,$args,$repeater=false){
|
1279 |
+
$new_field = array('type' => 'paragraph','id'=> $id,'value' => '','style' =>'', 'std' => '', 'multiple' => false);
|
1280 |
+
$new_field = array_merge($new_field, $args);
|
1281 |
+
if(false === $repeater){
|
1282 |
+
$this->_fields[] = $new_field;
|
1283 |
+
}else{
|
1284 |
+
return $new_field;
|
1285 |
+
}
|
1286 |
+
}
|
1287 |
+
|
1288 |
+
/**
|
1289 |
+
* Add Checkbox Field to meta box
|
1290 |
+
* @author Ohad Raz
|
1291 |
+
* @since 1.0
|
1292 |
+
* @access public
|
1293 |
+
* @param $id string field id, i.e. the meta key
|
1294 |
+
* @param $args mixed|array
|
1295 |
+
* 'name' => // field name/label string optional
|
1296 |
+
* 'desc' => // field description, string optional
|
1297 |
+
* 'std' => // default value, string optional
|
1298 |
+
* 'validate_func' => // validate function, string optional
|
1299 |
+
* @param $repeater bool is this a field inside a repeatr? true|false(default)
|
1300 |
+
*/
|
1301 |
+
public function addCheckbox($id,$args,$repeater=false){
|
1302 |
+
$new_field = array('type' => 'checkbox','id'=> $id,'std' => '','desc' => '','style' =>'','name' => 'Checkbox Field','multiple' => false);
|
1303 |
+
$new_field = array_merge($new_field, $args);
|
1304 |
+
if(false === $repeater){
|
1305 |
+
$this->_fields[] = $new_field;
|
1306 |
+
}else{
|
1307 |
+
return $new_field;
|
1308 |
+
}
|
1309 |
+
}
|
1310 |
+
|
1311 |
+
/**
|
1312 |
+
* Add CheckboxList Field to meta box
|
1313 |
+
* @author Ohad Raz
|
1314 |
+
* @since 1.0
|
1315 |
+
* @access public
|
1316 |
+
* @param $id string field id, i.e. the meta key
|
1317 |
+
* @param $options (array) array of key => value pairs for select options
|
1318 |
+
* @param $args mixed|array
|
1319 |
+
* 'name' => // field name/label string optional
|
1320 |
+
* 'desc' => // field description, string optional
|
1321 |
+
* 'std' => // default value, string optional
|
1322 |
+
* 'validate_func' => // validate function, string optional
|
1323 |
+
* @param $repeater bool is this a field inside a repeatr? true|false(default)
|
1324 |
+
*
|
1325 |
+
* @return : remember to call: $checkbox_list = $this->get_tax_meta(get_the_ID(), 'meta_name', false);
|
1326 |
+
* which means the last param as false to get the values in an array
|
1327 |
+
*/
|
1328 |
+
public function addCheckboxList($id,$options,$args,$repeater=false){
|
1329 |
+
$new_field = array('type' => 'checkbox_list','id'=> $id,'std' => '','desc' => '','style' =>'','name' => 'Checkbox List Field', 'multiple' => false);
|
1330 |
+
$new_field = array_merge($new_field, $args);
|
1331 |
+
if(false === $repeater){
|
1332 |
+
$this->_fields[] = $new_field;
|
1333 |
+
}else{
|
1334 |
+
return $new_field;
|
1335 |
+
}
|
1336 |
+
}
|
1337 |
+
|
1338 |
+
/**
|
1339 |
+
* Add Textarea Field to meta box
|
1340 |
+
* @author Ohad Raz
|
1341 |
+
* @since 1.0
|
1342 |
+
* @access public
|
1343 |
+
* @param $id string field id, i.e. the meta key
|
1344 |
+
* @param $args mixed|array
|
1345 |
+
* 'name' => // field name/label string optional
|
1346 |
+
* 'desc' => // field description, string optional
|
1347 |
+
* 'std' => // default value, string optional
|
1348 |
+
* 'style' => // custom style for field, string optional
|
1349 |
+
* 'validate_func' => // validate function, string optional
|
1350 |
+
* @param $repeater bool is this a field inside a repeatr? true|false(default)
|
1351 |
+
*/
|
1352 |
+
public function addTextarea($id,$args,$repeater=false){
|
1353 |
+
$new_field = array('type' => 'textarea','id'=> $id,'std' => '','desc' => '','style' =>'','name' => 'Textarea Field','multiple' => false);
|
1354 |
+
$new_field = array_merge($new_field, $args);
|
1355 |
+
if(false === $repeater){
|
1356 |
+
$this->_fields[] = $new_field;
|
1357 |
+
}else{
|
1358 |
+
return $new_field;
|
1359 |
+
}
|
1360 |
+
}
|
1361 |
+
|
1362 |
+
/**
|
1363 |
+
* Add Select Field to meta box
|
1364 |
+
* @author Ohad Raz
|
1365 |
+
* @since 1.0
|
1366 |
+
* @access public
|
1367 |
+
* @param $id string field id, i.e. the meta key
|
1368 |
+
* @param $options (array) array of key => value pairs for select options
|
1369 |
+
* @param $args mixed|array
|
1370 |
+
* 'name' => // field name/label string optional
|
1371 |
+
* 'desc' => // field description, string optional
|
1372 |
+
* 'std' => // default value, (array) optional
|
1373 |
+
* 'multiple' => // select multiple values, optional. Default is false.
|
1374 |
+
* 'validate_func' => // validate function, string optional
|
1375 |
+
* @param $repeater bool is this a field inside a repeatr? true|false(default)
|
1376 |
+
*/
|
1377 |
+
public function addSelect($id,$options,$args,$repeater=false){
|
1378 |
+
$new_field = array('type' => 'select','id'=> $id,'std' => array(),'desc' => '','style' =>'','name' => 'Select Field','multiple' => false,'options' => $options);
|
1379 |
+
$new_field = array_merge($new_field, $args);
|
1380 |
+
if(false === $repeater){
|
1381 |
+
$this->_fields[] = $new_field;
|
1382 |
+
}else{
|
1383 |
+
return $new_field;
|
1384 |
+
}
|
1385 |
+
}
|
1386 |
+
|
1387 |
+
|
1388 |
+
/**
|
1389 |
+
* Add Radio Field to meta box
|
1390 |
+
* @author Ohad Raz
|
1391 |
+
* @since 1.0
|
1392 |
+
* @access public
|
1393 |
+
* @param $id string field id, i.e. the meta key
|
1394 |
+
* @param $options (array) array of key => value pairs for radio options
|
1395 |
+
* @param $args mixed|array
|
1396 |
+
* 'name' => // field name/label string optional
|
1397 |
+
* 'desc' => // field description, string optional
|
1398 |
+
* 'std' => // default value, string optional
|
1399 |
+
* 'validate_func' => // validate function, string optional
|
1400 |
+
* @param $repeater bool is this a field inside a repeatr? true|false(default)
|
1401 |
+
*/
|
1402 |
+
public function addRadio($id,$options,$args,$repeater=false){
|
1403 |
+
$new_field = array('type' => 'radio','id'=> $id,'std' => array(),'desc' => '','style' =>'','name' => 'Radio Field','options' => $options,'multiple' => false);
|
1404 |
+
$new_field = array_merge($new_field, $args);
|
1405 |
+
if(false === $repeater){
|
1406 |
+
$this->_fields[] = $new_field;
|
1407 |
+
}else{
|
1408 |
+
return $new_field;
|
1409 |
+
}
|
1410 |
+
}
|
1411 |
+
|
1412 |
+
/**
|
1413 |
+
* Add Date Field to meta box
|
1414 |
+
* @author Ohad Raz
|
1415 |
+
* @since 1.0
|
1416 |
+
* @access public
|
1417 |
+
* @param $id string field id, i.e. the meta key
|
1418 |
+
* @param $args mixed|array
|
1419 |
+
* 'name' => // field name/label string optional
|
1420 |
+
* 'desc' => // field description, string optional
|
1421 |
+
* 'std' => // default value, string optional
|
1422 |
+
* 'validate_func' => // validate function, string optional
|
1423 |
+
* 'format' => // date format, default yy-mm-dd. Optional. Default "'d MM, yy'" See more formats here: http://goo.gl/Wcwxn
|
1424 |
+
* @param $repeater bool is this a field inside a repeatr? true|false(default)
|
1425 |
+
*/
|
1426 |
+
public function addDate($id,$args,$repeater=false){
|
1427 |
+
$new_field = array('type' => 'date','id'=> $id,'style' =>'','std' => '','desc' => '','format'=>'d MM, yy','name' => 'Date Field','multiple' => false);
|
1428 |
+
$new_field = array_merge($new_field, $args);
|
1429 |
+
if(false === $repeater){
|
1430 |
+
$this->_fields[] = $new_field;
|
1431 |
+
}else{
|
1432 |
+
return $new_field;
|
1433 |
+
}
|
1434 |
+
}
|
1435 |
+
|
1436 |
+
/**
|
1437 |
+
* Add Time Field to meta box
|
1438 |
+
* @author Ohad Raz
|
1439 |
+
* @since 1.0
|
1440 |
+
* @access public
|
1441 |
+
* @param $id string- field id, i.e. the meta key
|
1442 |
+
* @param $args mixed|array
|
1443 |
+
* 'name' => // field name/label string optional
|
1444 |
+
* 'desc' => // field description, string optional
|
1445 |
+
* 'std' => // default value, string optional
|
1446 |
+
* 'validate_func' => // validate function, string optional
|
1447 |
+
* 'format' => // time format, default hh:mm. Optional. See more formats here: http://goo.gl/83woX
|
1448 |
+
* @param $repeater bool is this a field inside a repeatr? true|false(default)
|
1449 |
+
*/
|
1450 |
+
public function addTime($id,$args,$repeater=false){
|
1451 |
+
$new_field = array('type' => 'time','id'=> $id,'std' => '','style' =>'','desc' => '','format'=>'hh:mm','name' => 'Time Field','multiple' => false);
|
1452 |
+
$new_field = array_merge($new_field, $args);
|
1453 |
+
if(false === $repeater){
|
1454 |
+
$this->_fields[] = $new_field;
|
1455 |
+
}else{
|
1456 |
+
return $new_field;
|
1457 |
+
}
|
1458 |
+
}
|
1459 |
+
|
1460 |
+
/**
|
1461 |
+
* Add Color Field to meta box
|
1462 |
+
* @author Ohad Raz
|
1463 |
+
* @since 1.0
|
1464 |
+
* @access public
|
1465 |
+
* @param $id string field id, i.e. the meta key
|
1466 |
+
* @param $args mixed|array
|
1467 |
+
* 'name' => // field name/label string optional
|
1468 |
+
* 'desc' => // field description, string optional
|
1469 |
+
* 'std' => // default value, string optional
|
1470 |
+
* 'validate_func' => // validate function, string optional
|
1471 |
+
* @param $repeater bool is this a field inside a repeatr? true|false(default)
|
1472 |
+
*/
|
1473 |
+
public function addColor($id,$args,$repeater=false){
|
1474 |
+
$new_field = array('type' => 'color','id'=> $id,'std' => '','style' =>'','desc' => '','name' => 'ColorPicker Field','multiple' => false);
|
1475 |
+
$new_field = array_merge($new_field, $args);
|
1476 |
+
if(false === $repeater){
|
1477 |
+
$this->_fields[] = $new_field;
|
1478 |
+
}else{
|
1479 |
+
return $new_field;
|
1480 |
+
}
|
1481 |
+
}
|
1482 |
+
|
1483 |
+
/**
|
1484 |
+
* Add Image Field to meta box
|
1485 |
+
* @author Ohad Raz
|
1486 |
+
* @since 1.0
|
1487 |
+
* @access public
|
1488 |
+
* @param $id string field id, i.e. the meta key
|
1489 |
+
* @param $args mixed|array
|
1490 |
+
* 'name' => // field name/label string optional
|
1491 |
+
* 'desc' => // field description, string optional
|
1492 |
+
* 'validate_func' => // validate function, string optional
|
1493 |
+
* @param $repeater bool is this a field inside a repeatr? true|false(default)
|
1494 |
+
*/
|
1495 |
+
public function addImage($id,$args,$repeater=false){
|
1496 |
+
$new_field = array('type' => 'image','id'=> $id,'desc' => '','style' =>'','name' => 'Image Field', 'std' => '','multiple' => false);
|
1497 |
+
$new_field = array_merge($new_field, $args);
|
1498 |
+
if(false === $repeater){
|
1499 |
+
$this->_fields[] = $new_field;
|
1500 |
+
}else{
|
1501 |
+
return $new_field;
|
1502 |
+
}
|
1503 |
+
}
|
1504 |
+
|
1505 |
+
/**
|
1506 |
+
* Add File Field to meta box
|
1507 |
+
* @author Ohad Raz
|
1508 |
+
* @since 1.0
|
1509 |
+
* @access public
|
1510 |
+
* @param $id string field id, i.e. the meta key
|
1511 |
+
* @param $args mixed|array
|
1512 |
+
* 'name' => // field name/label string optional
|
1513 |
+
* 'desc' => // field description, string optional
|
1514 |
+
* 'validate_func' => // validate function, string optional
|
1515 |
+
* @param $repeater bool is this a field inside a repeatr? true|false(default)
|
1516 |
+
*/
|
1517 |
+
public function addFile($id,$args,$repeater=false){
|
1518 |
+
$new_field = array('type' => 'file','id'=> $id,'desc' => '','name' => 'File Field','multiple' => false);
|
1519 |
+
$new_field = array_merge($new_field, $args);
|
1520 |
+
if(false === $repeater){
|
1521 |
+
$this->_fields[] = $new_field;
|
1522 |
+
}else{
|
1523 |
+
return $new_field;
|
1524 |
+
}
|
1525 |
+
}
|
1526 |
+
|
1527 |
+
/**
|
1528 |
+
* Add WYSIWYG Field to meta box
|
1529 |
+
* @author Ohad Raz
|
1530 |
+
* @since 1.0
|
1531 |
+
* @access public
|
1532 |
+
* @param $id string field id, i.e. the meta key
|
1533 |
+
* @param $args mixed|array
|
1534 |
+
* 'name' => // field name/label string optional
|
1535 |
+
* 'desc' => // field description, string optional
|
1536 |
+
* 'std' => // default value, string optional
|
1537 |
+
* 'style' => // custom style for field, string optional Default 'width: 300px; height: 400px'
|
1538 |
+
* 'validate_func' => // validate function, string optional
|
1539 |
+
* @param $repeater bool is this a field inside a repeatr? true|false(default)
|
1540 |
+
*/
|
1541 |
+
public function addWysiwyg($id,$args,$repeater=false){
|
1542 |
+
$new_field = array('type' => 'wysiwyg','id'=> $id,'std' => '','desc' => '','style' =>'width: 300px; height: 400px','name' => 'WYSIWYG Editor Field','multiple' => false);
|
1543 |
+
$new_field = array_merge($new_field, $args);
|
1544 |
+
if(false === $repeater){
|
1545 |
+
$this->_fields[] = $new_field;
|
1546 |
+
}else{
|
1547 |
+
return $new_field;
|
1548 |
+
}
|
1549 |
+
}
|
1550 |
+
|
1551 |
+
/**
|
1552 |
+
* Add Taxonomy Field to meta box
|
1553 |
+
* @author Ohad Raz
|
1554 |
+
* @since 1.0
|
1555 |
+
* @access public
|
1556 |
+
* @param $id string field id, i.e. the meta key
|
1557 |
+
* @param $options mixed|array options of taxonomy field
|
1558 |
+
* 'taxonomy' => // taxonomy name can be category,post_tag or any custom taxonomy default is category
|
1559 |
+
* 'type' => // how to show taxonomy? 'select' (default) or 'checkbox_list'
|
1560 |
+
* 'args' => // arguments to query taxonomy, see http://goo.gl/uAANN default ('hide_empty' => false)
|
1561 |
+
* @param $args mixed|array
|
1562 |
+
* 'name' => // field name/label string optional
|
1563 |
+
* 'desc' => // field description, string optional
|
1564 |
+
* 'std' => // default value, string optional
|
1565 |
+
* 'validate_func' => // validate function, string optional
|
1566 |
+
* @param $repeater bool is this a field inside a repeatr? true|false(default)
|
1567 |
+
*/
|
1568 |
+
public function addTaxonomy($id,$options,$args,$repeater=false){
|
1569 |
+
$q = array('hide_empty' => 0);
|
1570 |
+
$tax = 'category';
|
1571 |
+
$type = 'select';
|
1572 |
+
$temp = array('taxonomy' => $tax,'type' => $type,'args' => $q);
|
1573 |
+
$options = array_merge($temp,$options);
|
1574 |
+
$new_field = array('type' => 'taxonomy','id'=> $id,'desc' => '','name' => 'Taxonomy Field','options'=> $options,'multiple' => false);
|
1575 |
+
$new_field = array_merge($new_field, $args);
|
1576 |
+
if(false === $repeater){
|
1577 |
+
$this->_fields[] = $new_field;
|
1578 |
+
}else{
|
1579 |
+
return $new_field;
|
1580 |
+
}
|
1581 |
+
}
|
1582 |
+
|
1583 |
+
/**
|
1584 |
+
* Add posts Field to meta box
|
1585 |
+
* @author Ohad Raz
|
1586 |
+
* @since 1.0
|
1587 |
+
* @access public
|
1588 |
+
* @param $id string field id, i.e. the meta key
|
1589 |
+
* @param $options mixed|array options of taxonomy field
|
1590 |
+
* 'type' => // how to show posts? 'select' (default) or 'checkbox_list'
|
1591 |
+
* 'args' => // arguments to query posts, see http://goo.gl/is0yK default ('posts_per_page' => -1, 'post_type' => 'post')
|
1592 |
+
* @param $args mixed|array
|
1593 |
+
* 'name' => // field name/label string optional
|
1594 |
+
* 'desc' => // field description, string optional
|
1595 |
+
* 'std' => // default value, string optional
|
1596 |
+
* 'validate_func' => // validate function, string optional
|
1597 |
+
* @param $repeater bool is this a field inside a repeatr? true|false(default)
|
1598 |
+
*/
|
1599 |
+
public function addPosts($id,$options,$args,$repeater=false){
|
1600 |
+
$temp = array('type'=>'select','args'=> array('posts_per_page' => -1, 'post_type' =>'post') );
|
1601 |
+
$options = array_merge($temp,$options);
|
1602 |
+
$new_field = array('type' => 'posts','id'=> $id,'desc' => '','name' => 'Posts Field','options'=> $options,'multiple' => false);
|
1603 |
+
$new_field = array_merge($new_field, $args);
|
1604 |
+
if(false === $repeater){
|
1605 |
+
$this->_fields[] = $new_field;
|
1606 |
+
}else{
|
1607 |
+
return $new_field;
|
1608 |
+
}
|
1609 |
+
}
|
1610 |
+
|
1611 |
+
/**
|
1612 |
+
* Add repeater Field Block to meta box
|
1613 |
+
* @author Ohad Raz
|
1614 |
+
* @since 1.0
|
1615 |
+
* @access public
|
1616 |
+
* @param $id string field id, i.e. the meta key
|
1617 |
+
* @param $args mixed|array
|
1618 |
+
* 'name' => // field name/label string optional
|
1619 |
+
* 'desc' => // field description, string optional
|
1620 |
+
* 'std' => // default value, string optional
|
1621 |
+
* 'style' => // custom style for field, string optional
|
1622 |
+
* 'validate_func' => // validate function, string optional
|
1623 |
+
* 'fields' => //fields to repeater
|
1624 |
+
*/
|
1625 |
+
public function addRepeaterBlock($id,$args){
|
1626 |
+
$new_field = array('type' => 'repeater','id'=> $id,'name' => 'Reapeater Field','fields' => array(),'inline'=> false);
|
1627 |
+
$new_field = array_merge($new_field, $args);
|
1628 |
+
$this->_fields[] = $new_field;
|
1629 |
+
}
|
1630 |
+
|
1631 |
+
|
1632 |
+
/**
|
1633 |
+
* Finish Declaration of Meta Box
|
1634 |
+
* @author Ohad Raz
|
1635 |
+
* @since 1.0
|
1636 |
+
* @access public
|
1637 |
+
*/
|
1638 |
+
public function Finish() {
|
1639 |
+
$this->add_missed_values();
|
1640 |
+
}
|
1641 |
+
|
1642 |
+
/**
|
1643 |
+
* Helper function to check for empty arrays
|
1644 |
+
* @author Ohad Raz
|
1645 |
+
* @since 1.0
|
1646 |
+
* @access public
|
1647 |
+
* @param $args mixed|array
|
1648 |
+
*/
|
1649 |
+
public function is_array_empty($array){
|
1650 |
+
if (!is_array($array))
|
1651 |
+
return true;
|
1652 |
+
|
1653 |
+
foreach ($array as $a){
|
1654 |
+
if (is_array($a)){
|
1655 |
+
foreach ($a as $sub_a){
|
1656 |
+
if (!empty($sub_a) && $sub_a != '')
|
1657 |
+
return false;
|
1658 |
+
}
|
1659 |
+
}else{
|
1660 |
+
if (!empty($a) && $a != '')
|
1661 |
+
return false;
|
1662 |
+
}
|
1663 |
+
}
|
1664 |
+
return true;
|
1665 |
+
}
|
1666 |
+
|
1667 |
+
|
1668 |
+
//get term meta field
|
1669 |
+
public function get_tax_meta($term_id,$key,$multi = false){
|
1670 |
+
$t_id = (is_object($term_id))? $term_id->term_id: $term_id;
|
1671 |
+
$m = get_option( 'tax_meta_'.$t_id);
|
1672 |
+
if (isset($m[$key])){
|
1673 |
+
return $m[$key];
|
1674 |
+
}else{
|
1675 |
+
return '';
|
1676 |
+
}
|
1677 |
+
}
|
1678 |
+
|
1679 |
+
//delete meta
|
1680 |
+
public function delete_tax_meta($term_id,$key){
|
1681 |
+
$m = get_option( 'tax_meta_'.$term_id);
|
1682 |
+
if (isset($m[$key])){
|
1683 |
+
unset($m[$key]);
|
1684 |
+
}
|
1685 |
+
update_option('tax_meta_'.$term_id,$m);
|
1686 |
+
}
|
1687 |
+
|
1688 |
+
//update meta
|
1689 |
+
public function update_tax_meta($term_id,$key,$value){
|
1690 |
+
$m = get_option( 'tax_meta_'.$term_id);
|
1691 |
+
$m[$key] = $value;
|
1692 |
+
update_option('tax_meta_'.$term_id,$m);
|
1693 |
+
}
|
1694 |
+
|
1695 |
+
|
1696 |
+
/**
|
1697 |
+
* delete_taxonomy_metadata
|
1698 |
+
*
|
1699 |
+
* delete meta on term deletion
|
1700 |
+
*
|
1701 |
+
* answers issue #16
|
1702 |
+
* @author Ohad Raz
|
1703 |
+
* @since 1.8.1
|
1704 |
+
* @access public
|
1705 |
+
* @return Void
|
1706 |
+
*/
|
1707 |
+
public function delete_taxonomy_metadata($term,$term_id) {
|
1708 |
+
delete_option( 'tax_meta_'.$term_id );
|
1709 |
+
if ( function_exists( 'delete_term_meta') ){
|
1710 |
+
delete_term_meta( $term, $term_id );
|
1711 |
+
}
|
1712 |
+
}
|
1713 |
+
|
1714 |
+
|
1715 |
+
/**
|
1716 |
+
* footer_js
|
1717 |
+
* fix issue #2
|
1718 |
+
* @author Ohad Raz
|
1719 |
+
* @since 1.7.4
|
1720 |
+
* @access public
|
1721 |
+
* @return Void
|
1722 |
+
*/
|
1723 |
+
public function footer_js(){
|
1724 |
+
?>
|
1725 |
+
<SCRIPT TYPE="text/javascript">
|
1726 |
+
//fix issue #2
|
1727 |
+
var numberOfRows = 0;
|
1728 |
+
jQuery(document).ready(function(){
|
1729 |
+
numberOfRows = jQuery("#the-list>tr").length;
|
1730 |
+
jQuery("#the-list").bind("DOMSubtreeModified", function() {
|
1731 |
+
if(jQuery("#the-list>tr").length !== numberOfRows){
|
1732 |
+
//update new count
|
1733 |
+
numberOfRows = jQuery("#the-list>tr").length;
|
1734 |
+
//clear form
|
1735 |
+
clear_form_meta();
|
1736 |
+
}
|
1737 |
+
});
|
1738 |
+
function clear_form_meta(){
|
1739 |
+
//remove image
|
1740 |
+
jQuery(".mupload_img_holder").find("img").remove();
|
1741 |
+
jQuery(".mupload_img_holder").next().next().next().removeClass('at-delete_image_button').addClass('at-upload_image_button');
|
1742 |
+
jQuery(".mupload_img_holder").next().next().next().val("Upload Image");
|
1743 |
+
jQuery(".mupload_img_holder").next().next().val('');
|
1744 |
+
jQuery(".mupload_img_holder").next().val('');
|
1745 |
+
|
1746 |
+
//clear selections
|
1747 |
+
jQuery("#addtag select option").removeProp('selected');
|
1748 |
+
//clear checkbox
|
1749 |
+
jQuery("#addtag input:checkbox").removeAttr('checked');
|
1750 |
+
//clear radio buttons
|
1751 |
+
jQuery("#addtag input:radio").prop('checked', false);
|
1752 |
+
//remove repeater blocks
|
1753 |
+
jQuery(".at-repater-block").remove();
|
1754 |
+
|
1755 |
+
}
|
1756 |
+
});
|
1757 |
+
</SCRIPT>
|
1758 |
+
<?php
|
1759 |
+
}
|
1760 |
+
|
1761 |
+
} // End Class
|
1762 |
+
|
1763 |
+
endif; // End Check Class Exists
|
1764 |
+
|
1765 |
+
/*
|
1766 |
+
* meta functions for easy access:
|
1767 |
+
*/
|
1768 |
+
//get term meta field
|
1769 |
+
if (!function_exists('get_tax_meta')){
|
1770 |
+
function get_tax_meta($term_id,$key,$multi = false){
|
1771 |
+
$t_id = (is_object($term_id))? $term_id->term_id: $term_id;
|
1772 |
+
$m = get_option( 'tax_meta_'.$t_id);
|
1773 |
+
if (isset($m[$key])){
|
1774 |
+
return $m[$key];
|
1775 |
+
}else{
|
1776 |
+
return '';
|
1777 |
+
}
|
1778 |
+
}
|
1779 |
+
}
|
1780 |
+
|
1781 |
+
//delete meta
|
1782 |
+
if (!function_exists('delete_tax_meta')){
|
1783 |
+
function delete_tax_meta($term_id,$key){
|
1784 |
+
$m = get_option( 'tax_meta_'.$term_id);
|
1785 |
+
if (isset($m[$key])){
|
1786 |
+
unset($m[$key]);
|
1787 |
+
}
|
1788 |
+
update_option('tax_meta_'.$term_id,$m);
|
1789 |
+
}
|
1790 |
+
}
|
1791 |
+
|
1792 |
+
//update meta
|
1793 |
+
if (!function_exists('update_tax_meta')){
|
1794 |
+
function update_tax_meta($term_id,$key,$value){
|
1795 |
+
$m = get_option( 'tax_meta_'.$term_id);
|
1796 |
+
$m[$key] = $value;
|
1797 |
+
update_option('tax_meta_'.$term_id,$m);
|
1798 |
+
}
|
1799 |
+
}
|
1800 |
+
|
1801 |
+
//get term meta field and strip slashes
|
1802 |
+
if (!function_exists('get_tax_meta_strip')){
|
1803 |
+
function get_tax_meta_strip($term_id,$key,$multi = false){
|
1804 |
+
$t_id = (is_object($term_id))? $term_id->term_id: $term_id;
|
1805 |
+
$m = get_option( 'tax_meta_'.$t_id);
|
1806 |
+
if (isset($m[$key])){
|
1807 |
+
return is_array($m[$key])? $m[$key] : stripslashes($m[$key]);
|
1808 |
+
}else{
|
1809 |
+
return '';
|
1810 |
+
}
|
1811 |
+
}
|
1812 |
+
}
|
1813 |
+
//get all meta fields of a term
|
1814 |
+
if (!function_exists('get_tax_meta_all')){
|
1815 |
+
function get_tax_meta_all( $term_id){
|
1816 |
+
$t_id = (is_object($term_id))? $term_id->term_id: $term_id;
|
1817 |
+
return get_option( 'tax_meta_'.$t_id,array());
|
1818 |
+
}
|
1819 |
+
}
|
includes/admin/meta-tax/class-usage-demo.php
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Demo Tax meta class
|
4 |
+
Plugin URI: https://en.bainternet.info
|
5 |
+
Description: Tax meta class usage demo
|
6 |
+
Version: 2.1.0
|
7 |
+
Author: Bainternet, Ohad Raz
|
8 |
+
Author URI: https://en.bainternet.info
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
//include the main class file
|
13 |
+
require_once("Tax-meta-class/Tax-meta-class.php");
|
14 |
+
if (is_admin()){
|
15 |
+
/*
|
16 |
+
* prefix of meta keys, optional
|
17 |
+
*/
|
18 |
+
$prefix = 'ba_';
|
19 |
+
/*
|
20 |
+
* configure your meta box
|
21 |
+
*/
|
22 |
+
$config = array(
|
23 |
+
'id' => 'demo_meta_box', // meta box id, unique per meta box
|
24 |
+
'title' => 'Demo Meta Box', // meta box title
|
25 |
+
'pages' => array('category'), // taxonomy name, accept categories, post_tag and custom taxonomies
|
26 |
+
'context' => 'normal', // where the meta box appear: normal (default), advanced, side; optional
|
27 |
+
'fields' => array(), // list of meta fields (can be added by field arrays)
|
28 |
+
'local_images' => false, // Use local or hosted images (meta box images for add/remove)
|
29 |
+
'use_with_theme' => false //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).
|
30 |
+
);
|
31 |
+
|
32 |
+
|
33 |
+
/*
|
34 |
+
* Initiate your meta box
|
35 |
+
*/
|
36 |
+
$my_meta = new Tax_Meta_Class($config);
|
37 |
+
|
38 |
+
/*
|
39 |
+
* Add fields to your meta box
|
40 |
+
*/
|
41 |
+
|
42 |
+
//text field
|
43 |
+
$my_meta->addText($prefix.'text_field_id',array('name'=> __('My Text ','tax-meta'),'desc' => 'this is a field desription'));
|
44 |
+
//textarea field
|
45 |
+
$my_meta->addTextarea($prefix.'textarea_field_id',array('name'=> __('My Textarea ','tax-meta')));
|
46 |
+
//checkbox field
|
47 |
+
$my_meta->addCheckbox($prefix.'checkbox_field_id',array('name'=> __('My Checkbox ','tax-meta')));
|
48 |
+
//select field
|
49 |
+
$my_meta->addSelect($prefix.'select_field_id',array('selectkey1'=>'Select Value1','selectkey2'=>'Select Value2'),array('name'=> __('My select ','tax-meta'), 'std'=> array('selectkey2')));
|
50 |
+
//radio field
|
51 |
+
$my_meta->addRadio($prefix.'radio_field_id',array('radiokey1'=>'Radio Value1','radiokey2'=>'Radio Value2'),array('name'=> __('My Radio Filed','tax-meta'), 'std'=> array('radionkey2')));
|
52 |
+
//date field
|
53 |
+
$my_meta->addDate($prefix.'date_field_id',array('name'=> __('My Date ','tax-meta')));
|
54 |
+
//Time field
|
55 |
+
$my_meta->addTime($prefix.'time_field_id',array('name'=> __('My Time ','tax-meta')));
|
56 |
+
//Color field
|
57 |
+
$my_meta->addColor($prefix.'color_field_id',array('name'=> __('My Color ','tax-meta')));
|
58 |
+
//Image field
|
59 |
+
$my_meta->addImage($prefix.'image_field_id',array('name'=> __('My Image ','tax-meta')));
|
60 |
+
//file upload field
|
61 |
+
$my_meta->addFile($prefix.'file_field_id',array('name'=> __('My File ','tax-meta')));
|
62 |
+
//wysiwyg field
|
63 |
+
$my_meta->addWysiwyg($prefix.'wysiwyg_field_id',array('name'=> __('My wysiwyg Editor ','tax-meta')));
|
64 |
+
//taxonomy field
|
65 |
+
$my_meta->addTaxonomy($prefix.'taxonomy_field_id',array('taxonomy' => 'category'),array('name'=> __('My Taxonomy ','tax-meta')));
|
66 |
+
//posts field
|
67 |
+
$my_meta->addPosts($prefix.'posts_field_id',array('args' => array('post_type' => 'page')),array('name'=> __('My Posts ','tax-meta')));
|
68 |
+
|
69 |
+
/*
|
70 |
+
* To Create a reapeater Block first create an array of fields
|
71 |
+
* use the same functions as above but add true as a last param
|
72 |
+
*/
|
73 |
+
|
74 |
+
$repeater_fields[] = $my_meta->addText($prefix.'re_text_field_id',array('name'=> __('My Text ','tax-meta')),true);
|
75 |
+
$repeater_fields[] = $my_meta->addTextarea($prefix.'re_textarea_field_id',array('name'=> __('My Textarea ','tax-meta')),true);
|
76 |
+
$repeater_fields[] = $my_meta->addCheckbox($prefix.'re_checkbox_field_id',array('name'=> __('My Checkbox ','tax-meta')),true);
|
77 |
+
$repeater_fields[] = $my_meta->addImage($prefix.'image_field_id',array('name'=> __('My Image ','tax-meta')),true);
|
78 |
+
|
79 |
+
/*
|
80 |
+
* Then just add the fields to the repeater block
|
81 |
+
*/
|
82 |
+
//repeater block
|
83 |
+
$my_meta->addRepeaterBlock($prefix.'re_',array('inline' => true, 'name' => __('This is a Repeater Block','tax-meta'),'fields' => $repeater_fields));
|
84 |
+
/*
|
85 |
+
* Don't Forget to Close up the meta box decleration
|
86 |
+
*/
|
87 |
+
//Finish Meta Box Decleration
|
88 |
+
$my_meta->Finish();
|
89 |
+
}
|
includes/admin/meta-tax/css/tax-meta-class.css
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* All Tax meta class
|
3 |
+
*
|
4 |
+
* JS used for the custom fields and other form items.
|
5 |
+
*
|
6 |
+
* Copyright 2012 Ohad Raz (admin@bainternet.info)
|
7 |
+
*/
|
8 |
+
|
9 |
+
/* =Common Rules for all fields.
|
10 |
+
----------------------------------------------- */
|
11 |
+
.form-table td.at-field{ border: 1px solid #DDD; padding: 10px 10px 20px; margin: 0px; font-family: "HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue", Helvetica, Arial, sans-serif; }
|
12 |
+
.at-label {
|
13 |
+
margin: 0 0 5px 0; padding: 5px 0 0 0;
|
14 |
+
font: 20px/31px "HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue", Helvetica, Arial, sans-serif;
|
15 |
+
text-shadow: rgba(255, 255, 255, 1) 0 1px 0;
|
16 |
+
width: auto;
|
17 |
+
}
|
18 |
+
.at-radio-label{ padding-right: 10px; }
|
19 |
+
.at-file-upload-label{ clear: both; margin: 5px 0px 5px 1px; }
|
20 |
+
|
21 |
+
|
22 |
+
/* =Form Fields
|
23 |
+
----------------------------------------------- */
|
24 |
+
/*.form-field input, .form-field textarea {width: 95%;}*/
|
25 |
+
.wp-editor-wrap{width: 500px;} textarea.at-wysiwyg{width: 498px !important;}
|
26 |
+
.rw-checkbox, .at-select, .at-text , .at-textarea{width: auto!important;}
|
27 |
+
.postbox .at-field input,
|
28 |
+
.postbox .at-field textarea { padding: 5px; line-height: 18px; }
|
29 |
+
.postbox .at-field input.at-radio{}
|
30 |
+
.postbox .at-field input.at-color{ border: 0px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; margin-right: 10px; min-width: 100px; }
|
31 |
+
.at-field input:focus,
|
32 |
+
.at-field textarea:focus { background: #fffff8; }
|
33 |
+
#wpcontent select.at-select { height: 30px !important; padding: 5px; display: block; min-width: 200px; }
|
34 |
+
.at-field .desc-field { color: #AAA; font-style: italic; margin: 5px 0 0 3px !important; font-size: 13px; }
|
35 |
+
.at-field .wp_themeSkin table.mceLayout{ border: 1px solid #DFDFDF; }
|
36 |
+
#post-body .at-field .wp_themeSkin .mceStatusbar a.mceResize{ top: -25px; }
|
37 |
+
|
38 |
+
/* =Uploaded Images
|
39 |
+
----------------------------------------------- */
|
40 |
+
.at-images li { margin: 5px 10px 0px 0; float: left; width: 150px; height: 150px; text-align: center; border: 3px solid #ccc; cursor: move; position: relative; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; }
|
41 |
+
.at-images img { width: 150px; height: 150px; }
|
42 |
+
.at-images a { position: absolute; top: -12px; right: -12px; color: #fff; font-weight: bold; padding: 5px; }
|
43 |
+
.at-images .at-delete-file img{ width: 16px; height: 16px; }
|
44 |
+
|
45 |
+
/* =Upload Button
|
46 |
+
----------------------------------------------- */
|
47 |
+
.at-upload-button { float: left; clear: both; margin-top: 10px; }
|
48 |
+
.at-add-file { float: left; clear: both; margin-top: 10px; }
|
49 |
+
|
50 |
+
/* =Time Picker
|
51 |
+
----------------------------------------------- */
|
52 |
+
.ui-timepicker-div { font-size: 0.9em; }
|
53 |
+
.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
|
54 |
+
.ui-timepicker-div dl { text-align: left; }
|
55 |
+
.ui-timepicker-div dl dt { height: 25px; }
|
56 |
+
.ui-timepicker-div dl dd { margin: -25px 0 10px 65px; }
|
57 |
+
.ui-timepicker-div td { font-size: 90%; }
|
58 |
+
|
59 |
+
/* =Repater Block
|
60 |
+
----------------------------------------------- */
|
61 |
+
/* inline */
|
62 |
+
.at-inline label{font-size: 12px !important;}
|
63 |
+
.at-inline textarea{height: 130px;width: 200px;}
|
includes/admin/meta-tax/images/add.png
ADDED
Binary file
|
includes/admin/meta-tax/images/delete-16.png
ADDED
Binary file
|
includes/admin/meta-tax/images/edit.png
ADDED
Binary file
|
includes/admin/meta-tax/images/remove.png
ADDED
Binary file
|
includes/admin/meta-tax/js/tax-meta-clss.js
ADDED
@@ -0,0 +1,493 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* All Tax meta class
|
3 |
+
*
|
4 |
+
* JS used for the custom fields and other form items.
|
5 |
+
*
|
6 |
+
* Copyright 2012 Ohad Raz (admin@bainternet.info)
|
7 |
+
* @since 1.0
|
8 |
+
*
|
9 |
+
* @package Tax Meta Class
|
10 |
+
*
|
11 |
+
*/
|
12 |
+
|
13 |
+
var $ =jQuery.noConflict();
|
14 |
+
function update_repeater_fields(){
|
15 |
+
|
16 |
+
/**
|
17 |
+
* WysiWyg editor
|
18 |
+
*
|
19 |
+
* @since 1.9.6
|
20 |
+
*/
|
21 |
+
$(".theEditor").each(function(){
|
22 |
+
if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) {
|
23 |
+
tinyMCE.execCommand("mceAddControl", false, $(this).attr('id'));
|
24 |
+
}
|
25 |
+
});
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Datepicker Field.
|
29 |
+
*
|
30 |
+
* @since 1.0
|
31 |
+
*/
|
32 |
+
$('.at-date').each( function() {
|
33 |
+
|
34 |
+
var $this = $(this),
|
35 |
+
format = $this.attr('rel');
|
36 |
+
|
37 |
+
$this.datepicker( { showButtonPanel: true, dateFormat: format } );
|
38 |
+
|
39 |
+
});
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Timepicker Field.
|
43 |
+
*
|
44 |
+
* @since 1.0
|
45 |
+
*/
|
46 |
+
$('.at-time').each( function() {
|
47 |
+
|
48 |
+
var $this = $(this),
|
49 |
+
format = $this.attr('rel');
|
50 |
+
|
51 |
+
$this.timepicker( { showSecond: true, timeFormat: format } );
|
52 |
+
|
53 |
+
});
|
54 |
+
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Select Color Field.
|
58 |
+
*
|
59 |
+
* uses: wpColorPicker
|
60 |
+
*
|
61 |
+
* @since 2.1.1
|
62 |
+
*/
|
63 |
+
// $('.at-color').wpColorPicker();
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Delete File.
|
67 |
+
*
|
68 |
+
* @since 1.0
|
69 |
+
*/
|
70 |
+
$('.at-upload').delegate( '.at-delete-file', 'click' , function() {
|
71 |
+
|
72 |
+
var $this = $(this),
|
73 |
+
$parent = $this.parent(),
|
74 |
+
data = $this.attr('rel');
|
75 |
+
|
76 |
+
$.post( ajaxurl, { action: 'at_delete_file', data: data }, function(response) {
|
77 |
+
response == '0' ? ( alert( 'File has been successfully deleted.' ), $parent.remove() ) : alert( 'You do NOT have permission to delete this file.' );
|
78 |
+
});
|
79 |
+
|
80 |
+
return false;
|
81 |
+
|
82 |
+
});
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Reorder Images.
|
86 |
+
*
|
87 |
+
* @since 1.0
|
88 |
+
*/
|
89 |
+
$('.at-images').each( function() {
|
90 |
+
|
91 |
+
var $this = $(this), order, data;
|
92 |
+
|
93 |
+
$this.sortable( {
|
94 |
+
placeholder: 'ui-state-highlight',
|
95 |
+
update: function (){
|
96 |
+
order = $this.sortable('serialize');
|
97 |
+
data = order + '|' + $this.siblings('.at-images-data').val();
|
98 |
+
|
99 |
+
$.post(ajaxurl, {action: 'at_reorder_images', data: data}, function(response){
|
100 |
+
response == '0' ? alert( 'Order saved!' ) : alert( "You don't have permission to reorder images." );
|
101 |
+
});
|
102 |
+
}
|
103 |
+
});
|
104 |
+
|
105 |
+
});
|
106 |
+
|
107 |
+
}
|
108 |
+
jQuery(document).ready(function($) {
|
109 |
+
|
110 |
+
/**
|
111 |
+
* repater Field
|
112 |
+
* @since 1.1
|
113 |
+
*/
|
114 |
+
/*$( ".at-repeater-item" ).live('click', function() {
|
115 |
+
var $this = $(this);
|
116 |
+
$this.siblings().toggle();
|
117 |
+
});
|
118 |
+
jQuery(".at-repater-block").click(function(){
|
119 |
+
jQuery(this).find('table').toggle();
|
120 |
+
});
|
121 |
+
|
122 |
+
*/
|
123 |
+
//edit
|
124 |
+
$(document).on('click','.at-re-toggle',function() {
|
125 |
+
$(this).prev().toggle('slow');
|
126 |
+
});
|
127 |
+
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Datepicker Field.
|
131 |
+
*
|
132 |
+
* @since 1.0
|
133 |
+
*/
|
134 |
+
$('.at-date').each( function() {
|
135 |
+
|
136 |
+
var $this = $(this),
|
137 |
+
format = $this.attr('rel');
|
138 |
+
|
139 |
+
$this.datepicker( { showButtonPanel: true, dateFormat: format } );
|
140 |
+
|
141 |
+
});
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Timepicker Field.
|
145 |
+
*
|
146 |
+
* @since 1.0
|
147 |
+
*/
|
148 |
+
$('.at-time').each( function() {
|
149 |
+
|
150 |
+
var $this = $(this),
|
151 |
+
format = $this.attr('rel');
|
152 |
+
|
153 |
+
$this.timepicker( { showSecond: true, timeFormat: format } );
|
154 |
+
|
155 |
+
});
|
156 |
+
|
157 |
+
// $('.at-color').wpColorPicker();
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Helper Function
|
161 |
+
*
|
162 |
+
* Get Query string value by name.
|
163 |
+
*
|
164 |
+
* @since 1.0
|
165 |
+
*/
|
166 |
+
function get_query_var( name ) {
|
167 |
+
var match = RegExp('[?&]' + name + '=([^&#]*)').exec(location.href);
|
168 |
+
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
|
169 |
+
}
|
170 |
+
|
171 |
+
//clear form after submit
|
172 |
+
$( document ).ajaxComplete(function( event, xhr, settings ) {
|
173 |
+
try{
|
174 |
+
$respo = $.parseXML(xhr.responseText);
|
175 |
+
|
176 |
+
//exit on error
|
177 |
+
if ($($respo).find('wp_error').length) return;
|
178 |
+
|
179 |
+
$($respo).find('response').each(function(i,e){
|
180 |
+
if ($(e).attr('action').indexOf("add-tag") > -1){
|
181 |
+
var tid = $(e).find('term_id');
|
182 |
+
if (tid){
|
183 |
+
clear_form($( "form[action='edit-tags.php']" ));
|
184 |
+
}
|
185 |
+
}
|
186 |
+
});
|
187 |
+
}catch(err) {}
|
188 |
+
});
|
189 |
+
function version_compare(a,b){
|
190 |
+
var c=a.split('.');
|
191 |
+
var d=b.split('.');
|
192 |
+
for(var i=0;i<c.length;++i){
|
193 |
+
if(d.length==i){
|
194 |
+
return"gt";
|
195 |
+
}
|
196 |
+
if(c[i]==d[i]){
|
197 |
+
continue;
|
198 |
+
}else if(c[i]>d[i]){
|
199 |
+
return"gt";
|
200 |
+
}else{
|
201 |
+
return"lt";
|
202 |
+
}
|
203 |
+
}
|
204 |
+
if(c.length!=d.length){
|
205 |
+
return"lt";
|
206 |
+
}
|
207 |
+
return"eq";
|
208 |
+
}
|
209 |
+
function clear_form(form){
|
210 |
+
$('input[type="text"]:visible, textarea:visible', form).val('');
|
211 |
+
//color field
|
212 |
+
$('.at-color', form).attr('style','');
|
213 |
+
//image upload
|
214 |
+
$('.simplePanelImagePreview img').remove();
|
215 |
+
$('simplePanelimageUploadclear').each(function(){
|
216 |
+
var $field = $(this);
|
217 |
+
//clear urls
|
218 |
+
$field.prev().val('');
|
219 |
+
//clear ids
|
220 |
+
$field.prev().prev().val('');
|
221 |
+
simplePanelupload.getInstance().replaceImageUploadClass($field);
|
222 |
+
});
|
223 |
+
//file upload
|
224 |
+
$('.simplePanelfilePreview ul li').remove();
|
225 |
+
$('simplePanelfileUploadclear').each(function(){
|
226 |
+
var $field = $(this);
|
227 |
+
//clear urls
|
228 |
+
$field.prev().val('');
|
229 |
+
//clear ids
|
230 |
+
$field.prev().prev().val('');
|
231 |
+
simplePanelupload.getInstance().replaceImageUploadClass($field);
|
232 |
+
});
|
233 |
+
//repeater
|
234 |
+
$(".at-repater-block").remove();
|
235 |
+
//select
|
236 |
+
$('select',form).val('');
|
237 |
+
//checkboxes
|
238 |
+
$( "input[type='checkbox']",form ).prop('checked',false);
|
239 |
+
//radio
|
240 |
+
$( "input[type='radio']",form ).prop('checked',false);
|
241 |
+
}
|
242 |
+
/** pre bind jquery function **/
|
243 |
+
$.fn.preBind = function (type, data, fn) {
|
244 |
+
this.each(function () {
|
245 |
+
var $this = $(this);
|
246 |
+
|
247 |
+
$this.bind(type, data, fn);
|
248 |
+
if (version_compare($.fn.jquery,'1.8') == 'lt')
|
249 |
+
var currentBindings = $this.data('events')[type];
|
250 |
+
else
|
251 |
+
var currentBindings = $._data(this, "events")[type];
|
252 |
+
if ($.isArray(currentBindings)) {
|
253 |
+
currentBindings.unshift(currentBindings.pop());
|
254 |
+
}
|
255 |
+
});
|
256 |
+
return this;
|
257 |
+
};
|
258 |
+
/** fix tinymce not saving on add screen*/
|
259 |
+
$('#submit').preBind('click', function() {
|
260 |
+
if(typeof tinymce !== "undefined" && $('input[name=action]').val() == 'add-tag'){
|
261 |
+
$.each(tinymce.editors,function(i,editor){
|
262 |
+
var tx = editor.targetElm;
|
263 |
+
$(tx).html(editor.getContent());
|
264 |
+
});
|
265 |
+
}
|
266 |
+
});
|
267 |
+
});
|
268 |
+
|
269 |
+
|
270 |
+
var simple_meta_box;
|
271 |
+
jQuery(document).ready(function($){
|
272 |
+
var simplePanelupload = (function(){
|
273 |
+
var inited;
|
274 |
+
var file_id;
|
275 |
+
var file_url;
|
276 |
+
var file_type;
|
277 |
+
function init (){
|
278 |
+
return {
|
279 |
+
image_frame: new Array(),
|
280 |
+
file_frame: new Array(),
|
281 |
+
hooks:function(){
|
282 |
+
$(document).on('click','.simplePanelimageUpload,.simplePanelfileUpload', function( event ){
|
283 |
+
event.preventDefault();
|
284 |
+
if ($(this).hasClass('simplePanelfileUpload'))
|
285 |
+
inited.upload($(this),'file');
|
286 |
+
else
|
287 |
+
inited.upload($(this),'image');
|
288 |
+
});
|
289 |
+
|
290 |
+
$(document).on('click','.simplePanelimageUploadclear,.simplePanelfileUploadclear', function( event ){
|
291 |
+
event.preventDefault();
|
292 |
+
inited.set_fields($(this));
|
293 |
+
$(inited.file_url).val("");
|
294 |
+
$(inited.file_id).val("");
|
295 |
+
if ($(this).hasClass('simplePanelimageUploadclear')){
|
296 |
+
inited.set_preview('image',false);
|
297 |
+
inited.replaceImageUploadClass($(this));
|
298 |
+
}else{
|
299 |
+
inited.set_preview('file',false);
|
300 |
+
inited.replaceFileUploadClass($(this));
|
301 |
+
}
|
302 |
+
});
|
303 |
+
},
|
304 |
+
set_fields: function (el){
|
305 |
+
inited.file_url = $(el).prev();
|
306 |
+
inited.file_id = $(inited.file_url).prev();
|
307 |
+
},
|
308 |
+
upload:function(el,utype){
|
309 |
+
inited.set_fields(el)
|
310 |
+
if (utype == 'image')
|
311 |
+
inited.upload_Image($(el));
|
312 |
+
else
|
313 |
+
inited.upload_File($(el));
|
314 |
+
},
|
315 |
+
upload_File: function(el){
|
316 |
+
// If the media frame already exists, reopen it.
|
317 |
+
var mime = $(el).attr('data-mime_type') || '';
|
318 |
+
var ext = $(el).attr("data-ext") || false;
|
319 |
+
var name = $(el).attr('id');
|
320 |
+
var multi = ($(el).hasClass("multiFile")? true: false);
|
321 |
+
|
322 |
+
if ( typeof inited.file_frame[name] !== "undefined") {
|
323 |
+
if (ext){
|
324 |
+
inited.file_frame[name].uploader.uploader.param( 'uploadeType', ext);
|
325 |
+
inited.file_frame[name].uploader.uploader.param( 'uploadeTypecaller', 'my_meta_box' );
|
326 |
+
}
|
327 |
+
inited.file_frame[name].open();
|
328 |
+
return;
|
329 |
+
}
|
330 |
+
// Create the media frame.
|
331 |
+
|
332 |
+
inited.file_frame[name] = wp.media({
|
333 |
+
library: {
|
334 |
+
type: mime
|
335 |
+
},
|
336 |
+
title: jQuery( this ).data( 'uploader_title' ),
|
337 |
+
button: {
|
338 |
+
text: jQuery( this ).data( 'uploader_button_text' ),
|
339 |
+
},
|
340 |
+
multiple: multi // Set to true to allow multiple files to be selected
|
341 |
+
});
|
342 |
+
|
343 |
+
|
344 |
+
// When an image is selected, run a callback.
|
345 |
+
inited.file_frame[name].on( 'select', function() {
|
346 |
+
// We set multiple to false so only get one image from the uploader
|
347 |
+
attachment = inited.file_frame[name].state().get('selection').first().toJSON();
|
348 |
+
// Do something with attachment.id and/or attachment.url here
|
349 |
+
$(inited.file_id).val(attachment.id);
|
350 |
+
$(inited.file_url).val(attachment.url);
|
351 |
+
inited.replaceFileUploadClass(el);
|
352 |
+
inited.set_preview('file',true);
|
353 |
+
});
|
354 |
+
// Finally, open the modal
|
355 |
+
|
356 |
+
inited.file_frame[name].open();
|
357 |
+
if (ext){
|
358 |
+
inited.file_frame[name].uploader.uploader.param( 'uploadeType', ext);
|
359 |
+
inited.file_frame[name].uploader.uploader.param( 'uploadeTypecaller', 'my_meta_box' );
|
360 |
+
}
|
361 |
+
},
|
362 |
+
upload_Image:function(el){
|
363 |
+
var name = $(el).attr('id');
|
364 |
+
var multi = ($(el).hasClass("multiFile")? true: false);
|
365 |
+
// If the media frame already exists, reopen it.
|
366 |
+
if ( typeof inited.image_frame[name] !== "undefined") {
|
367 |
+
inited.image_frame[name].open();
|
368 |
+
return;
|
369 |
+
}
|
370 |
+
// Create the media frame.
|
371 |
+
inited.image_frame[name] = wp.media({
|
372 |
+
library: {
|
373 |
+
type: 'image'
|
374 |
+
},
|
375 |
+
title: jQuery( this ).data( 'uploader_title' ),
|
376 |
+
button: {
|
377 |
+
text: jQuery( this ).data( 'uploader_button_text' ),
|
378 |
+
},
|
379 |
+
multiple: multi // Set to true to allow multiple files to be selected
|
380 |
+
});
|
381 |
+
//set pre selected images
|
382 |
+
inited.image_frame[name].on('open',function(){
|
383 |
+
var selection = inited.image_frame[name].state().get('selection');
|
384 |
+
var att_ids = $(inited.file_id).val().split("|");
|
385 |
+
$.each(att_ids,function(i,v){
|
386 |
+
if (v.length){
|
387 |
+
attachment = wp.media.attachment(v);
|
388 |
+
attachment.fetch();
|
389 |
+
selection.add( attachment ? [ attachment ] : [] );
|
390 |
+
}
|
391 |
+
});
|
392 |
+
});
|
393 |
+
// When an image is selected, run a callback.
|
394 |
+
inited.image_frame[name].on( 'select', function() {
|
395 |
+
if (!multi){
|
396 |
+
attachment = inited.image_frame[name].state().get('selection').first().toJSON();
|
397 |
+
// Do something with attachment.id and/or attachment.url here
|
398 |
+
$(inited.file_id).val(attachment.id);
|
399 |
+
$(inited.file_url).val(attachment.url);
|
400 |
+
inited.replaceImageUploadClass(el);
|
401 |
+
inited.set_preview('image',true);
|
402 |
+
}else{
|
403 |
+
var att_ids = '';
|
404 |
+
var att_urls = '';
|
405 |
+
inited.image_frame[name].state().get('selection').each(function(i){
|
406 |
+
att_ids += i.get('id') + '|';
|
407 |
+
att_urls += i.get('url') + '|';
|
408 |
+
});
|
409 |
+
att_ids = att_ids.substring(0, att_ids.length - 1);
|
410 |
+
att_urls = att_urls.substring(0, att_urls.length - 1);
|
411 |
+
$(inited.file_id).val(att_ids);
|
412 |
+
$(inited.file_url).val(att_urls);
|
413 |
+
inited.set_multiple_img_preview(true);
|
414 |
+
}
|
415 |
+
});
|
416 |
+
// Finally, open the modal
|
417 |
+
inited.image_frame[name].open();
|
418 |
+
},
|
419 |
+
replaceImageUploadClass: function(el){
|
420 |
+
if ($(el).hasClass("simplePanelimageUpload")){
|
421 |
+
$(el).removeClass("simplePanelimageUpload").addClass('simplePanelimageUploadclear').val('Remove Image');
|
422 |
+
}else{
|
423 |
+
$(el).removeClass("simplePanelimageUploadclear").addClass('simplePanelimageUpload').val('Upload Image');
|
424 |
+
}
|
425 |
+
},
|
426 |
+
replaceFileUploadClass: function(el){
|
427 |
+
if ($(el).hasClass("simplePanelfileUpload")){
|
428 |
+
$(el).removeClass("simplePanelfileUpload").addClass('simplePanelfileUploadclear').val('Remove File');
|
429 |
+
}else{
|
430 |
+
$(el).removeClass("simplePanelfileUploadclear").addClass('simplePanelfileUpload').val('Upload File');
|
431 |
+
}
|
432 |
+
},
|
433 |
+
set_preview: function(stype,ShowFlag){
|
434 |
+
ShowFlag = ShowFlag || false;
|
435 |
+
var fileuri = $(inited.file_url).val();
|
436 |
+
if (stype == 'image'){
|
437 |
+
if (ShowFlag)
|
438 |
+
$(inited.file_id).prev().find('img').attr('src',fileuri).show();
|
439 |
+
else
|
440 |
+
$(inited.file_id).prev().find('img').attr('src','').hide();
|
441 |
+
}else{
|
442 |
+
if (ShowFlag)
|
443 |
+
$(inited.file_id).prev().find('ul').append('<li><a href="' + fileuri + '" target="_blank">'+fileuri+'</a></li>');
|
444 |
+
else
|
445 |
+
$(inited.file_id).prev().find('ul').children().remove();
|
446 |
+
}
|
447 |
+
},
|
448 |
+
set_multiple_img_preview: function(ShowFlag){
|
449 |
+
ShowFlag = ShowFlag || false;
|
450 |
+
var fileuri = $(inited.file_url).val();
|
451 |
+
var fileids = $(inited.file_id).val();
|
452 |
+
if (fileuri == '') return;
|
453 |
+
fileuri = fileuri.split("|");
|
454 |
+
fileids = fileids.split("|");
|
455 |
+
if (ShowFlag){
|
456 |
+
$(inited.file_id).prev().find('ul').remove();
|
457 |
+
$(inited.file_id).prev().append('<ul class="imageSortable"></ul>')
|
458 |
+
$.each(fileuri,function(i,f){
|
459 |
+
$(inited.file_id).prev().find('.imageSortable').append('<li><img src="'+f+'"data-attid="'+fileids[i]+'" style="width: 80px; height: auto;"></li>');
|
460 |
+
});
|
461 |
+
$( ".imageSortable" ).sortable({
|
462 |
+
placeholder: "ui-state-highlight",
|
463 |
+
update: function( event, ui ) {
|
464 |
+
var $ul = $(ui.item[0]).parent();
|
465 |
+
var att_ids = '';
|
466 |
+
var att_urls = '';
|
467 |
+
$ul.find('img').each(function(i,v){
|
468 |
+
att_ids += $(v).attr('data-attid') + '|';
|
469 |
+
att_urls += $(v).attr('src') + '|';
|
470 |
+
});
|
471 |
+
att_ids = att_ids.substring(0, att_ids.length - 1);
|
472 |
+
att_urls = att_urls.substring(0, att_urls.length - 1);
|
473 |
+
$(inited.file_id).val(att_ids);
|
474 |
+
$(inited.file_url).val(att_urls);
|
475 |
+
}
|
476 |
+
});
|
477 |
+
}else{
|
478 |
+
$(inited.file_id).prev().find('ul').remove();
|
479 |
+
}
|
480 |
+
}
|
481 |
+
}
|
482 |
+
}
|
483 |
+
return {
|
484 |
+
getInstance :function(){
|
485 |
+
if (!inited){
|
486 |
+
inited = init();
|
487 |
+
}
|
488 |
+
return inited;
|
489 |
+
}
|
490 |
+
}
|
491 |
+
})()
|
492 |
+
simplePanelupload.getInstance().hooks();
|
493 |
+
});
|
includes/admin/meta-tax/lang/default.mo
ADDED
Binary file
|
includes/admin/meta-tax/lang/default.po
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Tax meta class\n"
|
4 |
+
"POT-Creation-Date: 2013-04-25 09:31+0100\n"
|
5 |
+
"PO-Revision-Date: 2013-04-25 09:31+0100\n"
|
6 |
+
"Last-Translator: David Thomas <anou@smol.org>\n"
|
7 |
+
"Language-Team: David THOMAS <anou@smol.org>\n"
|
8 |
+
"Language: fr_FR\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 1.5.5\n"
|
13 |
+
"X-Poedit-KeywordsList: _;__;_e;gettext;gettext_noop\n"
|
14 |
+
"X-Poedit-Basepath: .\n"
|
15 |
+
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
16 |
+
"X-Poedit-SearchPath-0: ../../Tax-meta-class\n"
|
17 |
+
|
18 |
+
#: ../../Tax-meta-class/Tax-meta-class.php:250
|
19 |
+
msgid "Delete this image"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: ../../Tax-meta-class/Tax-meta-class.php:250
|
23 |
+
#: ../../Tax-meta-class/Tax-meta-class.php:882
|
24 |
+
msgid "Delete"
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
#: ../../Tax-meta-class/Tax-meta-class.php:357
|
28 |
+
msgid "Cannot delete file. Something's wrong."
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: ../../Tax-meta-class/Tax-meta-class.php:582
|
32 |
+
#: ../../Tax-meta-class/Tax-meta-class.php:629
|
33 |
+
msgid "Remove"
|
34 |
+
msgstr ""
|
35 |
+
|
36 |
+
#: ../../Tax-meta-class/Tax-meta-class.php:595
|
37 |
+
msgid "Add"
|
38 |
+
msgstr ""
|
39 |
+
|
40 |
+
#: ../../Tax-meta-class/Tax-meta-class.php:878
|
41 |
+
msgid "Uploaded files"
|
42 |
+
msgstr ""
|
43 |
+
|
44 |
+
#: ../../Tax-meta-class/Tax-meta-class.php:889
|
45 |
+
msgid "Upload new files"
|
46 |
+
msgstr ""
|
47 |
+
|
48 |
+
#: ../../Tax-meta-class/Tax-meta-class.php:895
|
49 |
+
msgid "Add more files"
|
50 |
+
msgstr ""
|
51 |
+
|
52 |
+
#: ../../Tax-meta-class/Tax-meta-class.php:947
|
53 |
+
msgid "Select a color"
|
54 |
+
msgstr ""
|
includes/admin/meta-tax/lang/fr_FR.mo
ADDED
Binary file
|
includes/admin/meta-tax/lang/fr_FR.po
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Tax meta class\n"
|
4 |
+
"POT-Creation-Date: 2013-04-25 09:31+0100\n"
|
5 |
+
"PO-Revision-Date: 2013-04-25 09:34+0100\n"
|
6 |
+
"Last-Translator: David Thomas <anou@smol.org>\n"
|
7 |
+
"Language-Team: David THOMAS <anou@smol.org>\n"
|
8 |
+
"Language: fr_FR\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 1.5.5\n"
|
13 |
+
"X-Poedit-KeywordsList: _;__;_e;gettext;gettext_noop\n"
|
14 |
+
"X-Poedit-Basepath: .\n"
|
15 |
+
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
16 |
+
"X-Poedit-SearchPath-0: ../../Tax-meta-class\n"
|
17 |
+
|
18 |
+
#: ../../Tax-meta-class/Tax-meta-class.php:250
|
19 |
+
msgid "Delete this image"
|
20 |
+
msgstr "Supprimer cette image"
|
21 |
+
|
22 |
+
#: ../../Tax-meta-class/Tax-meta-class.php:250
|
23 |
+
#: ../../Tax-meta-class/Tax-meta-class.php:882
|
24 |
+
msgid "Delete"
|
25 |
+
msgstr "Supprimer"
|
26 |
+
|
27 |
+
#: ../../Tax-meta-class/Tax-meta-class.php:357
|
28 |
+
msgid "Cannot delete file. Something's wrong."
|
29 |
+
msgstr "Impossible de supprimer le fichier. Quelque chose cloche."
|
30 |
+
|
31 |
+
#: ../../Tax-meta-class/Tax-meta-class.php:582
|
32 |
+
#: ../../Tax-meta-class/Tax-meta-class.php:629
|
33 |
+
msgid "Remove"
|
34 |
+
msgstr "Enlever"
|
35 |
+
|
36 |
+
#: ../../Tax-meta-class/Tax-meta-class.php:595
|
37 |
+
msgid "Add"
|
38 |
+
msgstr "Ajouter"
|
39 |
+
|
40 |
+
#: ../../Tax-meta-class/Tax-meta-class.php:878
|
41 |
+
msgid "Uploaded files"
|
42 |
+
msgstr "Fichiers téléchargés"
|
43 |
+
|
44 |
+
#: ../../Tax-meta-class/Tax-meta-class.php:889
|
45 |
+
msgid "Upload new files"
|
46 |
+
msgstr "Télécharger de nouveaux fichiers"
|
47 |
+
|
48 |
+
#: ../../Tax-meta-class/Tax-meta-class.php:895
|
49 |
+
msgid "Add more files"
|
50 |
+
msgstr "Ajouter des fichiers"
|
51 |
+
|
52 |
+
#: ../../Tax-meta-class/Tax-meta-class.php:947
|
53 |
+
msgid "Select a color"
|
54 |
+
msgstr "Sélectionner une couleur"
|
includes/admin/meta-tax/license.txt
ADDED
@@ -0,0 +1,674 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 3, 29 June 2007
|
3 |
+
|
4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
6 |
+
of this license document, but changing it is not allowed.
|
7 |
+
|
8 |
+
Preamble
|
9 |
+
|
10 |
+
The GNU General Public License is a free, copyleft license for
|
11 |
+
software and other kinds of works.
|
12 |
+
|
13 |
+
The licenses for most software and other practical works are designed
|
14 |
+
to take away your freedom to share and change the works. By contrast,
|
15 |
+
the GNU General Public License is intended to guarantee your freedom to
|
16 |
+
share and change all versions of a program--to make sure it remains free
|
17 |
+
software for all its users. We, the Free Software Foundation, use the
|
18 |
+
GNU General Public License for most of our software; it applies also to
|
19 |
+
any other work released this way by its authors. You can apply it to
|
20 |
+
your programs, too.
|
21 |
+
|
22 |
+
When we speak of free software, we are referring to freedom, not
|
23 |
+
price. Our General Public Licenses are designed to make sure that you
|
24 |
+
have the freedom to distribute copies of free software (and charge for
|
25 |
+
them if you wish), that you receive source code or can get it if you
|
26 |
+
want it, that you can change the software or use pieces of it in new
|
27 |
+
free programs, and that you know you can do these things.
|
28 |
+
|
29 |
+
To protect your rights, we need to prevent others from denying you
|
30 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
31 |
+
certain responsibilities if you distribute copies of the software, or if
|
32 |
+
you modify it: responsibilities to respect the freedom of others.
|
33 |
+
|
34 |
+
For example, if you distribute copies of such a program, whether
|
35 |
+
gratis or for a fee, you must pass on to the recipients the same
|
36 |
+
freedoms that you received. You must make sure that they, too, receive
|
37 |
+
or can get the source code. And you must show them these terms so they
|
38 |
+
know their rights.
|
39 |
+
|
40 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
41 |
+
(1) assert copyright on the software, and (2) offer you this License
|
42 |
+
giving you legal permission to copy, distribute and/or modify it.
|
43 |
+
|
44 |
+
For the developers' and authors' protection, the GPL clearly explains
|
45 |
+
that there is no warranty for this free software. For both users' and
|
46 |
+
authors' sake, the GPL requires that modified versions be marked as
|
47 |
+
changed, so that their problems will not be attributed erroneously to
|
48 |
+
authors of previous versions.
|
49 |
+
|
50 |
+
Some devices are designed to deny users access to install or run
|
51 |
+
modified versions of the software inside them, although the manufacturer
|
52 |
+
can do so. This is fundamentally incompatible with the aim of
|
53 |
+
protecting users' freedom to change the software. The systematic
|
54 |
+
pattern of such abuse occurs in the area of products for individuals to
|
55 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
56 |
+
have designed this version of the GPL to prohibit the practice for those
|
57 |
+
products. If such problems arise substantially in other domains, we
|
58 |
+
stand ready to extend this provision to those domains in future versions
|
59 |
+
of the GPL, as needed to protect the freedom of users.
|
60 |
+
|
61 |
+
Finally, every program is threatened constantly by software patents.
|
62 |
+
States should not allow patents to restrict development and use of
|
63 |
+
software on general-purpose computers, but in those that do, we wish to
|
64 |
+
avoid the special danger that patents applied to a free program could
|
65 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
66 |
+
patents cannot be used to render the program non-free.
|
67 |
+
|
68 |
+
The precise terms and conditions for copying, distribution and
|
69 |
+
modification follow.
|
70 |
+
|
71 |
+
TERMS AND CONDITIONS
|
72 |
+
|
73 |
+
0. Definitions.
|
74 |
+
|
75 |
+
"This License" refers to version 3 of the GNU General Public License.
|
76 |
+
|
77 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
78 |
+
works, such as semiconductor masks.
|
79 |
+
|
80 |
+
"The Program" refers to any copyrightable work licensed under this
|
81 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
82 |
+
"recipients" may be individuals or organizations.
|
83 |
+
|
84 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
85 |
+
in a fashion requiring copyright permission, other than the making of an
|
86 |
+
exact copy. The resulting work is called a "modified version" of the
|
87 |
+
earlier work or a work "based on" the earlier work.
|
88 |
+
|
89 |
+
A "covered work" means either the unmodified Program or a work based
|
90 |
+
on the Program.
|
91 |
+
|
92 |
+
To "propagate" a work means to do anything with it that, without
|
93 |
+
permission, would make you directly or secondarily liable for
|
94 |
+
infringement under applicable copyright law, except executing it on a
|
95 |
+
computer or modifying a private copy. Propagation includes copying,
|
96 |
+
distribution (with or without modification), making available to the
|
97 |
+
public, and in some countries other activities as well.
|
98 |
+
|
99 |
+
To "convey" a work means any kind of propagation that enables other
|
100 |
+
parties to make or receive copies. Mere interaction with a user through
|
101 |
+
a computer network, with no transfer of a copy, is not conveying.
|
102 |
+
|
103 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
104 |
+
to the extent that it includes a convenient and prominently visible
|
105 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
106 |
+
tells the user that there is no warranty for the work (except to the
|
107 |
+
extent that warranties are provided), that licensees may convey the
|
108 |
+
work under this License, and how to view a copy of this License. If
|
109 |
+
the interface presents a list of user commands or options, such as a
|
110 |
+
menu, a prominent item in the list meets this criterion.
|
111 |
+
|
112 |
+
1. Source Code.
|
113 |
+
|
114 |
+
The "source code" for a work means the preferred form of the work
|
115 |
+
for making modifications to it. "Object code" means any non-source
|
116 |
+
form of a work.
|
117 |
+
|
118 |
+
A "Standard Interface" means an interface that either is an official
|
119 |
+
standard defined by a recognized standards body, or, in the case of
|
120 |
+
interfaces specified for a particular programming language, one that
|
121 |
+
is widely used among developers working in that language.
|
122 |
+
|
123 |
+
The "System Libraries" of an executable work include anything, other
|
124 |
+
than the work as a whole, that (a) is included in the normal form of
|
125 |
+
packaging a Major Component, but which is not part of that Major
|
126 |
+
Component, and (b) serves only to enable use of the work with that
|
127 |
+
Major Component, or to implement a Standard Interface for which an
|
128 |
+
implementation is available to the public in source code form. A
|
129 |
+
"Major Component", in this context, means a major essential component
|
130 |
+
(kernel, window system, and so on) of the specific operating system
|
131 |
+
(if any) on which the executable work runs, or a compiler used to
|
132 |
+
produce the work, or an object code interpreter used to run it.
|
133 |
+
|
134 |
+
The "Corresponding Source" for a work in object code form means all
|
135 |
+
the source code needed to generate, install, and (for an executable
|
136 |
+
work) run the object code and to modify the work, including scripts to
|
137 |
+
control those activities. However, it does not include the work's
|
138 |
+
System Libraries, or general-purpose tools or generally available free
|
139 |
+
programs which are used unmodified in performing those activities but
|
140 |
+
which are not part of the work. For example, Corresponding Source
|
141 |
+
includes interface definition files associated with source files for
|
142 |
+
the work, and the source code for shared libraries and dynamically
|
143 |
+
linked subprograms that the work is specifically designed to require,
|
144 |
+
such as by intimate data communication or control flow between those
|
145 |
+
subprograms and other parts of the work.
|
146 |
+
|
147 |
+
The Corresponding Source need not include anything that users
|
148 |
+
can regenerate automatically from other parts of the Corresponding
|
149 |
+
Source.
|
150 |
+
|
151 |
+
The Corresponding Source for a work in source code form is that
|
152 |
+
same work.
|
153 |
+
|
154 |
+
2. Basic Permissions.
|
155 |
+
|
156 |
+
All rights granted under this License are granted for the term of
|
157 |
+
copyright on the Program, and are irrevocable provided the stated
|
158 |
+
conditions are met. This License explicitly affirms your unlimited
|
159 |
+
permission to run the unmodified Program. The output from running a
|
160 |
+
covered work is covered by this License only if the output, given its
|
161 |
+
content, constitutes a covered work. This License acknowledges your
|
162 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
163 |
+
|
164 |
+
You may make, run and propagate covered works that you do not
|
165 |
+
convey, without conditions so long as your license otherwise remains
|
166 |
+
in force. You may convey covered works to others for the sole purpose
|
167 |
+
of having them make modifications exclusively for you, or provide you
|
168 |
+
with facilities for running those works, provided that you comply with
|
169 |
+
the terms of this License in conveying all material for which you do
|
170 |
+
not control copyright. Those thus making or running the covered works
|
171 |
+
for you must do so exclusively on your behalf, under your direction
|
172 |
+
and control, on terms that prohibit them from making any copies of
|
173 |
+
your copyrighted material outside their relationship with you.
|
174 |
+
|
175 |
+
Conveying under any other circumstances is permitted solely under
|
176 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
177 |
+
makes it unnecessary.
|
178 |
+
|
179 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
180 |
+
|
181 |
+
No covered work shall be deemed part of an effective technological
|
182 |
+
measure under any applicable law fulfilling obligations under article
|
183 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
184 |
+
similar laws prohibiting or restricting circumvention of such
|
185 |
+
measures.
|
186 |
+
|
187 |
+
When you convey a covered work, you waive any legal power to forbid
|
188 |
+
circumvention of technological measures to the extent such circumvention
|
189 |
+
is effected by exercising rights under this License with respect to
|
190 |
+
the covered work, and you disclaim any intention to limit operation or
|
191 |
+
modification of the work as a means of enforcing, against the work's
|
192 |
+
users, your or third parties' legal rights to forbid circumvention of
|
193 |
+
technological measures.
|
194 |
+
|
195 |
+
4. Conveying Verbatim Copies.
|
196 |
+
|
197 |
+
You may convey verbatim copies of the Program's source code as you
|
198 |
+
receive it, in any medium, provided that you conspicuously and
|
199 |
+
appropriately publish on each copy an appropriate copyright notice;
|
200 |
+
keep intact all notices stating that this License and any
|
201 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
202 |
+
keep intact all notices of the absence of any warranty; and give all
|
203 |
+
recipients a copy of this License along with the Program.
|
204 |
+
|
205 |
+
You may charge any price or no price for each copy that you convey,
|
206 |
+
and you may offer support or warranty protection for a fee.
|
207 |
+
|
208 |
+
5. Conveying Modified Source Versions.
|
209 |
+
|
210 |
+
You may convey a work based on the Program, or the modifications to
|
211 |
+
produce it from the Program, in the form of source code under the
|
212 |
+
terms of section 4, provided that you also meet all of these conditions:
|
213 |
+
|
214 |
+
a) The work must carry prominent notices stating that you modified
|
215 |
+
it, and giving a relevant date.
|
216 |
+
|
217 |
+
b) The work must carry prominent notices stating that it is
|
218 |
+
released under this License and any conditions added under section
|
219 |
+
7. This requirement modifies the requirement in section 4 to
|
220 |
+
"keep intact all notices".
|
221 |
+
|
222 |
+
c) You must license the entire work, as a whole, under this
|
223 |
+
License to anyone who comes into possession of a copy. This
|
224 |
+
License will therefore apply, along with any applicable section 7
|
225 |
+
additional terms, to the whole of the work, and all its parts,
|
226 |
+
regardless of how they are packaged. This License gives no
|
227 |
+
permission to license the work in any other way, but it does not
|
228 |
+
invalidate such permission if you have separately received it.
|
229 |
+
|
230 |
+
d) If the work has interactive user interfaces, each must display
|
231 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
232 |
+
interfaces that do not display Appropriate Legal Notices, your
|
233 |
+
work need not make them do so.
|
234 |
+
|
235 |
+
A compilation of a covered work with other separate and independent
|
236 |
+
works, which are not by their nature extensions of the covered work,
|
237 |
+
and which are not combined with it such as to form a larger program,
|
238 |
+
in or on a volume of a storage or distribution medium, is called an
|
239 |
+
"aggregate" if the compilation and its resulting copyright are not
|
240 |
+
used to limit the access or legal rights of the compilation's users
|
241 |
+
beyond what the individual works permit. Inclusion of a covered work
|
242 |
+
in an aggregate does not cause this License to apply to the other
|
243 |
+
parts of the aggregate.
|
244 |
+
|
245 |
+
6. Conveying Non-Source Forms.
|
246 |
+
|
247 |
+
You may convey a covered work in object code form under the terms
|
248 |
+
of sections 4 and 5, provided that you also convey the
|
249 |
+
machine-readable Corresponding Source under the terms of this License,
|
250 |
+
in one of these ways:
|
251 |
+
|
252 |
+
a) Convey the object code in, or embodied in, a physical product
|
253 |
+
(including a physical distribution medium), accompanied by the
|
254 |
+
Corresponding Source fixed on a durable physical medium
|
255 |
+
customarily used for software interchange.
|
256 |
+
|
257 |
+
b) Convey the object code in, or embodied in, a physical product
|
258 |
+
(including a physical distribution medium), accompanied by a
|
259 |
+
written offer, valid for at least three years and valid for as
|
260 |
+
long as you offer spare parts or customer support for that product
|
261 |
+
model, to give anyone who possesses the object code either (1) a
|
262 |
+
copy of the Corresponding Source for all the software in the
|
263 |
+
product that is covered by this License, on a durable physical
|
264 |
+
medium customarily used for software interchange, for a price no
|
265 |
+
more than your reasonable cost of physically performing this
|
266 |
+
conveying of source, or (2) access to copy the
|
267 |
+
Corresponding Source from a network server at no charge.
|
268 |
+
|
269 |
+
c) Convey individual copies of the object code with a copy of the
|
270 |
+
written offer to provide the Corresponding Source. This
|
271 |
+
alternative is allowed only occasionally and noncommercially, and
|
272 |
+
only if you received the object code with such an offer, in accord
|
273 |
+
with subsection 6b.
|
274 |
+
|
275 |
+
d) Convey the object code by offering access from a designated
|
276 |
+
place (gratis or for a charge), and offer equivalent access to the
|
277 |
+
Corresponding Source in the same way through the same place at no
|
278 |
+
further charge. You need not require recipients to copy the
|
279 |
+
Corresponding Source along with the object code. If the place to
|
280 |
+
copy the object code is a network server, the Corresponding Source
|
281 |
+
may be on a different server (operated by you or a third party)
|
282 |
+
that supports equivalent copying facilities, provided you maintain
|
283 |
+
clear directions next to the object code saying where to find the
|
284 |
+
Corresponding Source. Regardless of what server hosts the
|
285 |
+
Corresponding Source, you remain obligated to ensure that it is
|
286 |
+
available for as long as needed to satisfy these requirements.
|
287 |
+
|
288 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
289 |
+
you inform other peers where the object code and Corresponding
|
290 |
+
Source of the work are being offered to the general public at no
|
291 |
+
charge under subsection 6d.
|
292 |
+
|
293 |
+
A separable portion of the object code, whose source code is excluded
|
294 |
+
from the Corresponding Source as a System Library, need not be
|
295 |
+
included in conveying the object code work.
|
296 |
+
|
297 |
+
A "User Product" is either (1) a "consumer product", which means any
|
298 |
+
tangible personal property which is normally used for personal, family,
|
299 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
300 |
+
into a dwelling. In determining whether a product is a consumer product,
|
301 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
302 |
+
product received by a particular user, "normally used" refers to a
|
303 |
+
typical or common use of that class of product, regardless of the status
|
304 |
+
of the particular user or of the way in which the particular user
|
305 |
+
actually uses, or expects or is expected to use, the product. A product
|
306 |
+
is a consumer product regardless of whether the product has substantial
|
307 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
308 |
+
the only significant mode of use of the product.
|
309 |
+
|
310 |
+
"Installation Information" for a User Product means any methods,
|
311 |
+
procedures, authorization keys, or other information required to install
|
312 |
+
and execute modified versions of a covered work in that User Product from
|
313 |
+
a modified version of its Corresponding Source. The information must
|
314 |
+
suffice to ensure that the continued functioning of the modified object
|
315 |
+
code is in no case prevented or interfered with solely because
|
316 |
+
modification has been made.
|
317 |
+
|
318 |
+
If you convey an object code work under this section in, or with, or
|
319 |
+
specifically for use in, a User Product, and the conveying occurs as
|
320 |
+
part of a transaction in which the right of possession and use of the
|
321 |
+
User Product is transferred to the recipient in perpetuity or for a
|
322 |
+
fixed term (regardless of how the transaction is characterized), the
|
323 |
+
Corresponding Source conveyed under this section must be accompanied
|
324 |
+
by the Installation Information. But this requirement does not apply
|
325 |
+
if neither you nor any third party retains the ability to install
|
326 |
+
modified object code on the User Product (for example, the work has
|
327 |
+
been installed in ROM).
|
328 |
+
|
329 |
+
The requirement to provide Installation Information does not include a
|
330 |
+
requirement to continue to provide support service, warranty, or updates
|
331 |
+
for a work that has been modified or installed by the recipient, or for
|
332 |
+
the User Product in which it has been modified or installed. Access to a
|
333 |
+
network may be denied when the modification itself materially and
|
334 |
+
adversely affects the operation of the network or violates the rules and
|
335 |
+
protocols for communication across the network.
|
336 |
+
|
337 |
+
Corresponding Source conveyed, and Installation Information provided,
|
338 |
+
in accord with this section must be in a format that is publicly
|
339 |
+
documented (and with an implementation available to the public in
|
340 |
+
source code form), and must require no special password or key for
|
341 |
+
unpacking, reading or copying.
|
342 |
+
|
343 |
+
7. Additional Terms.
|
344 |
+
|
345 |
+
"Additional permissions" are terms that supplement the terms of this
|
346 |
+
License by making exceptions from one or more of its conditions.
|
347 |
+
Additional permissions that are applicable to the entire Program shall
|
348 |
+
be treated as though they were included in this License, to the extent
|
349 |
+
that they are valid under applicable law. If additional permissions
|
350 |
+
apply only to part of the Program, that part may be used separately
|
351 |
+
under those permissions, but the entire Program remains governed by
|
352 |
+
this License without regard to the additional permissions.
|
353 |
+
|
354 |
+
When you convey a copy of a covered work, you may at your option
|
355 |
+
remove any additional permissions from that copy, or from any part of
|
356 |
+
it. (Additional permissions may be written to require their own
|
357 |
+
removal in certain cases when you modify the work.) You may place
|
358 |
+
additional permissions on material, added by you to a covered work,
|
359 |
+
for which you have or can give appropriate copyright permission.
|
360 |
+
|
361 |
+
Notwithstanding any other provision of this License, for material you
|
362 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
363 |
+
that material) supplement the terms of this License with terms:
|
364 |
+
|
365 |
+
a) Disclaiming warranty or limiting liability differently from the
|
366 |
+
terms of sections 15 and 16 of this License; or
|
367 |
+
|
368 |
+
b) Requiring preservation of specified reasonable legal notices or
|
369 |
+
author attributions in that material or in the Appropriate Legal
|
370 |
+
Notices displayed by works containing it; or
|
371 |
+
|
372 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
373 |
+
requiring that modified versions of such material be marked in
|
374 |
+
reasonable ways as different from the original version; or
|
375 |
+
|
376 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
377 |
+
authors of the material; or
|
378 |
+
|
379 |
+
e) Declining to grant rights under trademark law for use of some
|
380 |
+
trade names, trademarks, or service marks; or
|
381 |
+
|
382 |
+
f) Requiring indemnification of licensors and authors of that
|
383 |
+
material by anyone who conveys the material (or modified versions of
|
384 |
+
it) with contractual assumptions of liability to the recipient, for
|
385 |
+
any liability that these contractual assumptions directly impose on
|
386 |
+
those licensors and authors.
|
387 |
+
|
388 |
+
All other non-permissive additional terms are considered "further
|
389 |
+
restrictions" within the meaning of section 10. If the Program as you
|
390 |
+
received it, or any part of it, contains a notice stating that it is
|
391 |
+
governed by this License along with a term that is a further
|
392 |
+
restriction, you may remove that term. If a license document contains
|
393 |
+
a further restriction but permits relicensing or conveying under this
|
394 |
+
License, you may add to a covered work material governed by the terms
|
395 |
+
of that license document, provided that the further restriction does
|
396 |
+
not survive such relicensing or conveying.
|
397 |
+
|
398 |
+
If you add terms to a covered work in accord with this section, you
|
399 |
+
must place, in the relevant source files, a statement of the
|
400 |
+
additional terms that apply to those files, or a notice indicating
|
401 |
+
where to find the applicable terms.
|
402 |
+
|
403 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
404 |
+
form of a separately written license, or stated as exceptions;
|
405 |
+
the above requirements apply either way.
|
406 |
+
|
407 |
+
8. Termination.
|
408 |
+
|
409 |
+
You may not propagate or modify a covered work except as expressly
|
410 |
+
provided under this License. Any attempt otherwise to propagate or
|
411 |
+
modify it is void, and will automatically terminate your rights under
|
412 |
+
this License (including any patent licenses granted under the third
|
413 |
+
paragraph of section 11).
|
414 |
+
|
415 |
+
However, if you cease all violation of this License, then your
|
416 |
+
license from a particular copyright holder is reinstated (a)
|
417 |
+
provisionally, unless and until the copyright holder explicitly and
|
418 |
+
finally terminates your license, and (b) permanently, if the copyright
|
419 |
+
holder fails to notify you of the violation by some reasonable means
|
420 |
+
prior to 60 days after the cessation.
|
421 |
+
|
422 |
+
Moreover, your license from a particular copyright holder is
|
423 |
+
reinstated permanently if the copyright holder notifies you of the
|
424 |
+
violation by some reasonable means, this is the first time you have
|
425 |
+
received notice of violation of this License (for any work) from that
|
426 |
+
copyright holder, and you cure the violation prior to 30 days after
|
427 |
+
your receipt of the notice.
|
428 |
+
|
429 |
+
Termination of your rights under this section does not terminate the
|
430 |
+
licenses of parties who have received copies or rights from you under
|
431 |
+
this License. If your rights have been terminated and not permanently
|
432 |
+
reinstated, you do not qualify to receive new licenses for the same
|
433 |
+
material under section 10.
|
434 |
+
|
435 |
+
9. Acceptance Not Required for Having Copies.
|
436 |
+
|
437 |
+
You are not required to accept this License in order to receive or
|
438 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
439 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
440 |
+
to receive a copy likewise does not require acceptance. However,
|
441 |
+
nothing other than this License grants you permission to propagate or
|
442 |
+
modify any covered work. These actions infringe copyright if you do
|
443 |
+
not accept this License. Therefore, by modifying or propagating a
|
444 |
+
covered work, you indicate your acceptance of this License to do so.
|
445 |
+
|
446 |
+
10. Automatic Licensing of Downstream Recipients.
|
447 |
+
|
448 |
+
Each time you convey a covered work, the recipient automatically
|
449 |
+
receives a license from the original licensors, to run, modify and
|
450 |
+
propagate that work, subject to this License. You are not responsible
|
451 |
+
for enforcing compliance by third parties with this License.
|
452 |
+
|
453 |
+
An "entity transaction" is a transaction transferring control of an
|
454 |
+
organization, or substantially all assets of one, or subdividing an
|
455 |
+
organization, or merging organizations. If propagation of a covered
|
456 |
+
work results from an entity transaction, each party to that
|
457 |
+
transaction who receives a copy of the work also receives whatever
|
458 |
+
licenses to the work the party's predecessor in interest had or could
|
459 |
+
give under the previous paragraph, plus a right to possession of the
|
460 |
+
Corresponding Source of the work from the predecessor in interest, if
|
461 |
+
the predecessor has it or can get it with reasonable efforts.
|
462 |
+
|
463 |
+
You may not impose any further restrictions on the exercise of the
|
464 |
+
rights granted or affirmed under this License. For example, you may
|
465 |
+
not impose a license fee, royalty, or other charge for exercise of
|
466 |
+
rights granted under this License, and you may not initiate litigation
|
467 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
468 |
+
any patent claim is infringed by making, using, selling, offering for
|
469 |
+
sale, or importing the Program or any portion of it.
|
470 |
+
|
471 |
+
11. Patents.
|
472 |
+
|
473 |
+
A "contributor" is a copyright holder who authorizes use under this
|
474 |
+
License of the Program or a work on which the Program is based. The
|
475 |
+
work thus licensed is called the contributor's "contributor version".
|
476 |
+
|
477 |
+
A contributor's "essential patent claims" are all patent claims
|
478 |
+
owned or controlled by the contributor, whether already acquired or
|
479 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
480 |
+
by this License, of making, using, or selling its contributor version,
|
481 |
+
but do not include claims that would be infringed only as a
|
482 |
+
consequence of further modification of the contributor version. For
|
483 |
+
purposes of this definition, "control" includes the right to grant
|
484 |
+
patent sublicenses in a manner consistent with the requirements of
|
485 |
+
this License.
|
486 |
+
|
487 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
488 |
+
patent license under the contributor's essential patent claims, to
|
489 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
490 |
+
propagate the contents of its contributor version.
|
491 |
+
|
492 |
+
In the following three paragraphs, a "patent license" is any express
|
493 |
+
agreement or commitment, however denominated, not to enforce a patent
|
494 |
+
(such as an express permission to practice a patent or covenant not to
|
495 |
+
sue for patent infringement). To "grant" such a patent license to a
|
496 |
+
party means to make such an agreement or commitment not to enforce a
|
497 |
+
patent against the party.
|
498 |
+
|
499 |
+
If you convey a covered work, knowingly relying on a patent license,
|
500 |
+
and the Corresponding Source of the work is not available for anyone
|
501 |
+
to copy, free of charge and under the terms of this License, through a
|
502 |
+
publicly available network server or other readily accessible means,
|
503 |
+
then you must either (1) cause the Corresponding Source to be so
|
504 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
505 |
+
patent license for this particular work, or (3) arrange, in a manner
|
506 |
+
consistent with the requirements of this License, to extend the patent
|
507 |
+
license to downstream recipients. "Knowingly relying" means you have
|
508 |
+
actual knowledge that, but for the patent license, your conveying the
|
509 |
+
covered work in a country, or your recipient's use of the covered work
|
510 |
+
in a country, would infringe one or more identifiable patents in that
|
511 |
+
country that you have reason to believe are valid.
|
512 |
+
|
513 |
+
If, pursuant to or in connection with a single transaction or
|
514 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
515 |
+
covered work, and grant a patent license to some of the parties
|
516 |
+
receiving the covered work authorizing them to use, propagate, modify
|
517 |
+
or convey a specific copy of the covered work, then the patent license
|
518 |
+
you grant is automatically extended to all recipients of the covered
|
519 |
+
work and works based on it.
|
520 |
+
|
521 |
+
A patent license is "discriminatory" if it does not include within
|
522 |
+
the scope of its coverage, prohibits the exercise of, or is
|
523 |
+
conditioned on the non-exercise of one or more of the rights that are
|
524 |
+
specifically granted under this License. You may not convey a covered
|
525 |
+
work if you are a party to an arrangement with a third party that is
|
526 |
+
in the business of distributing software, under which you make payment
|
527 |
+
to the third party based on the extent of your activity of conveying
|
528 |
+
the work, and under which the third party grants, to any of the
|
529 |
+
parties who would receive the covered work from you, a discriminatory
|
530 |
+
patent license (a) in connection with copies of the covered work
|
531 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
532 |
+
for and in connection with specific products or compilations that
|
533 |
+
contain the covered work, unless you entered into that arrangement,
|
534 |
+
or that patent license was granted, prior to 28 March 2007.
|
535 |
+
|
536 |
+
Nothing in this License shall be construed as excluding or limiting
|
537 |
+
any implied license or other defenses to infringement that may
|
538 |
+
otherwise be available to you under applicable patent law.
|
539 |
+
|
540 |
+
12. No Surrender of Others' Freedom.
|
541 |
+
|
542 |
+
If conditions are imposed on you (whether by court order, agreement or
|
543 |
+
otherwise) that contradict the conditions of this License, they do not
|
544 |
+
excuse you from the conditions of this License. If you cannot convey a
|
545 |
+
covered work so as to satisfy simultaneously your obligations under this
|
546 |
+
License and any other pertinent obligations, then as a consequence you may
|
547 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
548 |
+
to collect a royalty for further conveying from those to whom you convey
|
549 |
+
the Program, the only way you could satisfy both those terms and this
|
550 |
+
License would be to refrain entirely from conveying the Program.
|
551 |
+
|
552 |
+
13. Use with the GNU Affero General Public License.
|
553 |
+
|
554 |
+
Notwithstanding any other provision of this License, you have
|
555 |
+
permission to link or combine any covered work with a work licensed
|
556 |
+
under version 3 of the GNU Affero General Public License into a single
|
557 |
+
combined work, and to convey the resulting work. The terms of this
|
558 |
+
License will continue to apply to the part which is the covered work,
|
559 |
+
but the special requirements of the GNU Affero General Public License,
|
560 |
+
section 13, concerning interaction through a network will apply to the
|
561 |
+
combination as such.
|
562 |
+
|
563 |
+
14. Revised Versions of this License.
|
564 |
+
|
565 |
+
The Free Software Foundation may publish revised and/or new versions of
|
566 |
+
the GNU General Public License from time to time. Such new versions will
|
567 |
+
be similar in spirit to the present version, but may differ in detail to
|
568 |
+
address new problems or concerns.
|
569 |
+
|
570 |
+
Each version is given a distinguishing version number. If the
|
571 |
+
Program specifies that a certain numbered version of the GNU General
|
572 |
+
Public License "or any later version" applies to it, you have the
|
573 |
+
option of following the terms and conditions either of that numbered
|
574 |
+
version or of any later version published by the Free Software
|
575 |
+
Foundation. If the Program does not specify a version number of the
|
576 |
+
GNU General Public License, you may choose any version ever published
|
577 |
+
by the Free Software Foundation.
|
578 |
+
|
579 |
+
If the Program specifies that a proxy can decide which future
|
580 |
+
versions of the GNU General Public License can be used, that proxy's
|
581 |
+
public statement of acceptance of a version permanently authorizes you
|
582 |
+
to choose that version for the Program.
|
583 |
+
|
584 |
+
Later license versions may give you additional or different
|
585 |
+
permissions. However, no additional obligations are imposed on any
|
586 |
+
author or copyright holder as a result of your choosing to follow a
|
587 |
+
later version.
|
588 |
+
|
589 |
+
15. Disclaimer of Warranty.
|
590 |
+
|
591 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
592 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
593 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
594 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
595 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
596 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
597 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
598 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
599 |
+
|
600 |
+
16. Limitation of Liability.
|
601 |
+
|
602 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
603 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
604 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
605 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
606 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
607 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
608 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
609 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
610 |
+
SUCH DAMAGES.
|
611 |
+
|
612 |
+
17. Interpretation of Sections 15 and 16.
|
613 |
+
|
614 |
+
If the disclaimer of warranty and limitation of liability provided
|
615 |
+
above cannot be given local legal effect according to their terms,
|
616 |
+
reviewing courts shall apply local law that most closely approximates
|
617 |
+
an absolute waiver of all civil liability in connection with the
|
618 |
+
Program, unless a warranty or assumption of liability accompanies a
|
619 |
+
copy of the Program in return for a fee.
|
620 |
+
|
621 |
+
END OF TERMS AND CONDITIONS
|
622 |
+
|
623 |
+
How to Apply These Terms to Your New Programs
|
624 |
+
|
625 |
+
If you develop a new program, and you want it to be of the greatest
|
626 |
+
possible use to the public, the best way to achieve this is to make it
|
627 |
+
free software which everyone can redistribute and change under these terms.
|
628 |
+
|
629 |
+
To do so, attach the following notices to the program. It is safest
|
630 |
+
to attach them to the start of each source file to most effectively
|
631 |
+
state the exclusion of warranty; and each file should have at least
|
632 |
+
the "copyright" line and a pointer to where the full notice is found.
|
633 |
+
|
634 |
+
<one line to give the program's name and a brief idea of what it does.>
|
635 |
+
Copyright (C) <year> <name of author>
|
636 |
+
|
637 |
+
This program is free software: you can redistribute it and/or modify
|
638 |
+
it under the terms of the GNU General Public License as published by
|
639 |
+
the Free Software Foundation, either version 3 of the License, or
|
640 |
+
(at your option) any later version.
|
641 |
+
|
642 |
+
This program is distributed in the hope that it will be useful,
|
643 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
644 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
645 |
+
GNU General Public License for more details.
|
646 |
+
|
647 |
+
You should have received a copy of the GNU General Public License
|
648 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
649 |
+
|
650 |
+
Also add information on how to contact you by electronic and paper mail.
|
651 |
+
|
652 |
+
If the program does terminal interaction, make it output a short
|
653 |
+
notice like this when it starts in an interactive mode:
|
654 |
+
|
655 |
+
<program> Copyright (C) <year> <name of author>
|
656 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
657 |
+
This is free software, and you are welcome to redistribute it
|
658 |
+
under certain conditions; type `show c' for details.
|
659 |
+
|
660 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
661 |
+
parts of the General Public License. Of course, your program's commands
|
662 |
+
might be different; for a GUI interface, you would use an "about box".
|
663 |
+
|
664 |
+
You should also get your employer (if you work as a programmer) or school,
|
665 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
666 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
667 |
+
<http://www.gnu.org/licenses/>.
|
668 |
+
|
669 |
+
The GNU General Public License does not permit incorporating your program
|
670 |
+
into proprietary programs. If your program is a subroutine library, you
|
671 |
+
may consider it more useful to permit linking proprietary applications with
|
672 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
673 |
+
Public License instead of this License. But first, please read
|
674 |
+
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
includes/admin/meta-tax/migration/tax_to_term_meta.php
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* tax_to_term_meta
|
4 |
+
*
|
5 |
+
* used to migrate data from options table to
|
6 |
+
* WordPress 4.4 term meta table
|
7 |
+
*
|
8 |
+
* to use this migration class you must include it directly before
|
9 |
+
* including the tax meta class file mainly if you want to use the old
|
10 |
+
* 'get_tax_meta', 'delete_tax_meta', 'update_tax_meta',
|
11 |
+
* 'get_tax_meta_strip' and 'get_tax_meta_all' this file also contains the
|
12 |
+
* new definition of these functions to use the term meta api so you don't
|
13 |
+
* have to go look around your code and replace every thing.
|
14 |
+
*
|
15 |
+
* @usage:
|
16 |
+
*
|
17 |
+
* require_once("Tax-meta-class/migration/tax_to_term_meta.php");
|
18 |
+
* new tax_to_term_meta();
|
19 |
+
*
|
20 |
+
* @copyright 2012-2015 Ohad Raz
|
21 |
+
* @author Ohad Raz (email: admin@bainternet.info)
|
22 |
+
* @link https://en.bainternet.info
|
23 |
+
*
|
24 |
+
* @license GNU General Public LIcense v3.0 - license.txt
|
25 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
26 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
27 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
28 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
29 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
30 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
31 |
+
* THE SOFTWARE.
|
32 |
+
*
|
33 |
+
* @package Tax Meta Class
|
34 |
+
*/
|
35 |
+
class tax_to_term_meta{
|
36 |
+
/**
|
37 |
+
* delete data from options table
|
38 |
+
* after migraion?
|
39 |
+
* @var bool
|
40 |
+
*/
|
41 |
+
public $delete_options = false;
|
42 |
+
function __construct( $delete_options = false){
|
43 |
+
$this->delete_options = $delete_options;
|
44 |
+
$this->hooks();
|
45 |
+
}
|
46 |
+
|
47 |
+
function hooks(){
|
48 |
+
add_action('init',array($this, 'migrate_data_maybe') );
|
49 |
+
if ( $this->delete_options ){
|
50 |
+
add_action('shutdown',array( $this, 'delete_options') );
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
function migrate_data_maybe(){
|
55 |
+
//needs migration?
|
56 |
+
$do_migration = get_option('tax_meta_migrated', 'do_migration');
|
57 |
+
if ( 'do_migration' == $do_migration ){
|
58 |
+
$this->do_migration();
|
59 |
+
update_option( 'tax_meta_migrated', 'done' );
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
function do_migration(){
|
64 |
+
$options = $this->get_options();
|
65 |
+
foreach ($options as $option) {
|
66 |
+
$term_id = $this->term_id_from_option( $option );
|
67 |
+
$meta = get_option( $option );
|
68 |
+
$this->tax_to_term( $term_id, $meta );
|
69 |
+
if( $this->delete_options ){
|
70 |
+
delete_option( $option );
|
71 |
+
}
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
function tax_to_term( $term_id, $meta ){
|
76 |
+
foreach ((array)$meta as $meta_name => $meta_value) {
|
77 |
+
update_term_meta( $term_id, $meta_name, $meta_value );
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
function term_id_from_option( $option ){
|
82 |
+
return str_replace('tax_meta_', '', $option );
|
83 |
+
}
|
84 |
+
|
85 |
+
function get_options(){
|
86 |
+
global $wpdb;
|
87 |
+
$query = "SELECT option_name
|
88 |
+
FROM $wpdb->options
|
89 |
+
WHERE option_name LIKE 'tax_meta_%'
|
90 |
+
";
|
91 |
+
$options = $wpdb->get_col( $query );
|
92 |
+
return $options;
|
93 |
+
}
|
94 |
+
|
95 |
+
function delete_options(){
|
96 |
+
$options = $this->get_options();
|
97 |
+
foreach ($options as $option) {
|
98 |
+
delete_option( $option );
|
99 |
+
}
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
/*
|
104 |
+
* meta functions for easy access using term meta api
|
105 |
+
*/
|
106 |
+
//get term meta field
|
107 |
+
if (!function_exists('get_tax_meta')){
|
108 |
+
function get_tax_meta($term_id,$key,$multi = false){
|
109 |
+
$term_id = (is_object($term_id))? $term_id->term_id: $term_id;
|
110 |
+
return get_term_meta( $term_id, $key, $multi );
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
//delete meta
|
115 |
+
if (!function_exists('delete_tax_meta')){
|
116 |
+
function delete_tax_meta($term_id,$key){
|
117 |
+
$term_id = (is_object($term_id))? $term_id->term_id: $term_id;
|
118 |
+
return delete_term_meta( $term_id, $key );
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
//update meta
|
123 |
+
if (!function_exists('update_tax_meta')){
|
124 |
+
function update_tax_meta($term_id,$key,$value){
|
125 |
+
$term_id = (is_object($term_id))? $term_id->term_id: $term_id;
|
126 |
+
return update_term_meta( $term_id, $key, $value );
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
//get term meta field and strip slashes
|
131 |
+
if (!function_exists('get_tax_meta_strip')){
|
132 |
+
function get_tax_meta_strip($term_id,$key,$multi = false){
|
133 |
+
return stripslashes( get_term_meta( $term_id, $key, $multi ) );
|
134 |
+
}
|
135 |
+
}
|
136 |
+
//get all meta fields of a term
|
137 |
+
if (!function_exists('get_tax_meta_all')){
|
138 |
+
function get_tax_meta_all( $term_id){
|
139 |
+
$term_id = (is_object($term_id))? $term_id->term_id: $term_id;
|
140 |
+
return get_term_meta( $term_id );
|
141 |
+
}
|
142 |
+
}
|
includes/admin/meta.php
ADDED
@@ -0,0 +1,335 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema Post Meta Box
|
4 |
+
*
|
5 |
+
* @package Schema
|
6 |
+
* @subpackage Schema Post Meta
|
7 |
+
* @copyright Copyright (c) 2016, Hesham Zebida
|
8 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
+
* @since 1.4
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Schema post meta
|
18 |
+
*
|
19 |
+
* @since 1.4
|
20 |
+
*/
|
21 |
+
$prefix = '_schema_';
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Schema main post meta
|
25 |
+
*
|
26 |
+
* @since 1.4
|
27 |
+
*/
|
28 |
+
$fields_main = array( apply_filters( 'schema_wp_types_post_meta_fields',
|
29 |
+
|
30 |
+
array( // Select box
|
31 |
+
'label' => __('Schema Markup Type', 'schema-wp'), // <label>
|
32 |
+
'desc' => __('Select Schema type which describes your content best', 'schema-wp'), // description
|
33 |
+
'id' => $prefix.'type', // field id and name
|
34 |
+
'type' => 'select', // type of field
|
35 |
+
'options' => apply_filters( 'schema_wp_types', array ( // array of options
|
36 |
+
'Article' => array ( // array key needs to be the same as the option value
|
37 |
+
'label' => __('Article', 'schema-wp'), // text displayed as the option
|
38 |
+
'value' => __('Article', 'schema-wp'), // value stored for the option
|
39 |
+
)
|
40 |
+
)),
|
41 |
+
), // end of array
|
42 |
+
|
43 |
+
array(
|
44 |
+
'label' => __('Post meta', 'schema-wp'),
|
45 |
+
'tip' => __('Enable custom post meta box', 'schema-wp'),
|
46 |
+
'desc' => __('Enable post meta box?', 'schema-wp'),
|
47 |
+
'id' => $prefix.'post_meta_box_enabled',
|
48 |
+
'type' => 'checkbox'
|
49 |
+
)
|
50 |
+
)
|
51 |
+
);
|
52 |
+
|
53 |
+
$fields_main = apply_filters( 'schema_wp_types_post_meta_fields', array(
|
54 |
+
|
55 |
+
'schema_types' => array( // Select box
|
56 |
+
'label' => __('Schema Markup Type', 'schema-wp'), // <label>
|
57 |
+
'desc' => __('Select Schema type which describes your content best', 'schema-wp'), // description
|
58 |
+
'id' => $prefix.'type', // field id and name
|
59 |
+
'type' => 'select', // type of field
|
60 |
+
'options' => apply_filters( 'schema_wp_types', array ( // array of options
|
61 |
+
'Article' => array ( // array key needs to be the same as the option value
|
62 |
+
'label' => __('Article', 'schema-wp'), // text displayed as the option
|
63 |
+
'value' => __('Article', 'schema-wp'), // value stored for the option
|
64 |
+
)
|
65 |
+
)
|
66 |
+
)
|
67 |
+
), // end of array
|
68 |
+
|
69 |
+
'post_meta_box_enabled' => array(
|
70 |
+
'label' => __('Post meta', 'schema-wp'),
|
71 |
+
'tip' => __('Enable custom post meta box', 'schema-wp'),
|
72 |
+
'desc' => __('Enable post meta box?', 'schema-wp'),
|
73 |
+
'id' => $prefix.'post_meta_box_enabled',
|
74 |
+
'type' => 'checkbox'
|
75 |
+
)
|
76 |
+
));
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Schema Article post meta
|
80 |
+
*
|
81 |
+
* @since 1.4
|
82 |
+
*/
|
83 |
+
$fields_article = array(
|
84 |
+
|
85 |
+
array( // Select box
|
86 |
+
'label' => __('Article Type', 'schema-wp'), // <label>
|
87 |
+
'desc' => __('Select more specific article type', 'schema-wp'), // description
|
88 |
+
'tip' => __('It is recommended to set type BlogPosting for posts, and leave empty or set to General for page post type', 'schema-wp'),
|
89 |
+
'id' => $prefix.'article_type', // field id and name
|
90 |
+
'type' => 'select', // type of field
|
91 |
+
'options' => array ( // array of options
|
92 |
+
'General' => array ( // array key needs to be the same as the option value
|
93 |
+
'label' => 'General', // text displayed as the option
|
94 |
+
'value' => 'General' // value stored for the option
|
95 |
+
),
|
96 |
+
'BlogPosting' => array (
|
97 |
+
'label' => 'BlogPosting',
|
98 |
+
'value' => 'BlogPosting'
|
99 |
+
),
|
100 |
+
'NewsArticle' => array (
|
101 |
+
'label' => 'NewsArticle',
|
102 |
+
'value' => 'NewsArticle'
|
103 |
+
),
|
104 |
+
'Report' => array (
|
105 |
+
'label' => 'Report',
|
106 |
+
'value' => 'Report'
|
107 |
+
),
|
108 |
+
'ScholarlyArticle' => array (
|
109 |
+
'label' => 'ScholarlyArticle',
|
110 |
+
'value' => 'ScholarlyArticle'
|
111 |
+
),
|
112 |
+
'TechArticle' => array (
|
113 |
+
'label' => 'TechArticle',
|
114 |
+
'value' => 'TechArticle'
|
115 |
+
)
|
116 |
+
)
|
117 |
+
),
|
118 |
+
);
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Post Types
|
122 |
+
*
|
123 |
+
* @since 1.4
|
124 |
+
*/
|
125 |
+
$fields_post_types = array(
|
126 |
+
|
127 |
+
array( // Post Types Select box
|
128 |
+
'label' => '', // <label>
|
129 |
+
'desc' => __('Enabled on specific custom post types', 'schema-wp'), // description
|
130 |
+
'id' => $prefix.'post_types', // field id and name
|
131 |
+
'type' => 'cpt' // type of field
|
132 |
+
),
|
133 |
+
);
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Post Meta Keys to Filters - post meta
|
137 |
+
*
|
138 |
+
* @since 1.5.8
|
139 |
+
*/
|
140 |
+
$fields_post_meta_box = array (
|
141 |
+
|
142 |
+
'title' => array(
|
143 |
+
'label' => __('Title', 'schema-wp'),
|
144 |
+
'desc' => __('Post meta box title, default: Schema', 'schema-wp'),
|
145 |
+
'tip' => __('This field will allow you to override the Schema post meta box title, default: Schema', 'schema-wp'),
|
146 |
+
'id' => $prefix.'post_meta_box_title',
|
147 |
+
'type' => 'text',
|
148 |
+
'size' => 'midum',
|
149 |
+
'placeholder' => __('Schema', 'schema-wp'),
|
150 |
+
),
|
151 |
+
|
152 |
+
array( // Repeatable & Sortable Text inputs
|
153 |
+
'label' => __('Fields', 'schema-wp'), // <label>
|
154 |
+
'desc' => __('This is where you can define a source for schema.org markup fields to override its output. Select a filter name, then define post meta key name to pull data from, or tick the check box to automatically create a new custom post meta field to insert values manually when editing posts.', 'schema-wp'), // description
|
155 |
+
'tip' => __('This feature allow you to override the schema.org markups output generated by the Schema plugin.', 'schema-wp'),
|
156 |
+
'id' => $prefix.'post_meta_box', // field id and name
|
157 |
+
'type' => 'repeatable_row', // type of field
|
158 |
+
'sanitizer' => array( // array of sanitizers with matching kets to next array
|
159 |
+
'featured' => 'schema_wp_meta_box_santitize_boolean',
|
160 |
+
'title' => 'sanitize_text_field',
|
161 |
+
'desc' => 'wp_kses_data'
|
162 |
+
),
|
163 |
+
'repeatable_fields' => array ( // array of fields to be repeated
|
164 |
+
|
165 |
+
array( // Select box
|
166 |
+
'label' => __('Filter', 'schema-wp'), // <label>
|
167 |
+
'desc' => __('This is the filter name', 'schema-wp'), // description
|
168 |
+
'id' => 'filter', // field id and name
|
169 |
+
'type' => 'select', // type of field
|
170 |
+
'class' => 'schema_type_filter', // css class
|
171 |
+
'selectone' => __('Select Filter', 'schema-wp'), // type of field
|
172 |
+
'options' => apply_filters( 'schema_wp_post_meta', array ( // array of options
|
173 |
+
'author_name' => array ( // array key needs to be the same as the option value
|
174 |
+
'label' => __('Author Name', 'schema-wp'), // text displayed as the option
|
175 |
+
'value' => 'schema_wp_filter_author_name' // value stored for the option
|
176 |
+
),
|
177 |
+
'headline' => array (
|
178 |
+
'label' => __('Headline', 'schema-wp'),
|
179 |
+
'value' => 'schema_wp_filter_headline'
|
180 |
+
),
|
181 |
+
'description' => array (
|
182 |
+
'label' => __('Description', 'schema-wp'),
|
183 |
+
'value' => 'schema_wp_filter_description'
|
184 |
+
),
|
185 |
+
|
186 |
+
)),
|
187 |
+
), // end of array
|
188 |
+
|
189 |
+
'title' => array(
|
190 |
+
'label' => __('Key', 'schema-wp'),
|
191 |
+
'desc' => __('Add post meta key name as source', 'schema-wp'),
|
192 |
+
'id' => 'key',
|
193 |
+
'type' => 'text',
|
194 |
+
'size' => 'medium',
|
195 |
+
'placeholder' => __('Meta Key Name', 'schema-wp'),
|
196 |
+
),
|
197 |
+
|
198 |
+
'field' => array(
|
199 |
+
'label' => __('Create?', 'schema-wp'),
|
200 |
+
'tip' => __('Create custom post meta field?', 'schema-wp'),
|
201 |
+
'desc' => __('Create Field?', 'schema-wp'),
|
202 |
+
'id' => 'field',
|
203 |
+
'type' => 'checkbox'
|
204 |
+
),
|
205 |
+
|
206 |
+
'div_open' => array(
|
207 |
+
'id' => 'div_open',
|
208 |
+
'type' => 'div_open',
|
209 |
+
),
|
210 |
+
|
211 |
+
array(
|
212 |
+
'label' => __('Type', 'schema-wp'),
|
213 |
+
'desc' => __('Select field type', 'schema-wp'),
|
214 |
+
'id' => 'type',
|
215 |
+
'type' => 'select',
|
216 |
+
'selectone' => __('Select Type', 'schema-wp'),
|
217 |
+
'options' => apply_filters( 'schema_wp_post_meta_type', array (
|
218 |
+
'text' => array (
|
219 |
+
'label' => __('Text', 'schema-wp'),
|
220 |
+
'value' => 'text'
|
221 |
+
),
|
222 |
+
'textarea' => array (
|
223 |
+
'label' => __('Text Area', 'schema-wp'),
|
224 |
+
'value' => 'textarea'
|
225 |
+
),
|
226 |
+
'checkbox' => array (
|
227 |
+
'label' => __('Checkbox', 'schema-wp'),
|
228 |
+
'value' => 'checkbox'
|
229 |
+
),
|
230 |
+
|
231 |
+
)),
|
232 |
+
), // end of array
|
233 |
+
|
234 |
+
'label' => array(
|
235 |
+
'label' => __('Label', 'schema-wp'),
|
236 |
+
'desc' => __('Field label', 'schema-wp'),
|
237 |
+
'id' => 'label',
|
238 |
+
'type' => 'text',
|
239 |
+
'size' => 'medium',
|
240 |
+
'placeholder' => __('Label', 'schema-wp'),
|
241 |
+
),
|
242 |
+
|
243 |
+
'desc' => array(
|
244 |
+
'label' => __('Description', 'schema-wp'),
|
245 |
+
'desc' => __('Field description', 'schema-wp'),
|
246 |
+
'id' => 'desc',
|
247 |
+
'type' => 'textarea',
|
248 |
+
'placeholder' => __('Description for this field', 'schema-wp'),
|
249 |
+
),
|
250 |
+
|
251 |
+
'div_close' => array(
|
252 |
+
'id' => 'div_close',
|
253 |
+
'type' => 'div_close',
|
254 |
+
),
|
255 |
+
|
256 |
+
)
|
257 |
+
), // end of main array
|
258 |
+
|
259 |
+
);
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Instantiate the class with all variables to create a meta box
|
263 |
+
* var $id string meta box id
|
264 |
+
* var $title string title
|
265 |
+
* var $fields array fields
|
266 |
+
* var $page string|array post type to add meta box to
|
267 |
+
* var $context string context where to add meta box at (normal, side)
|
268 |
+
* var $priority string meta box priority (high, core, default, low)
|
269 |
+
* var $js bool including javascript or not
|
270 |
+
*/
|
271 |
+
$schema_box = new Schema_Custom_Add_Meta_Box( 'schema', __('Schema Settings', 'schema-wp'), $fields_main, 'schema', 'normal', 'high', true );
|
272 |
+
$schema_article_box = new Schema_Custom_Add_Meta_Box( 'schema_article', __('Article', 'schema-wp'), $fields_article, 'schema', 'normal', 'high', true );
|
273 |
+
$schema_cpt_box = new Schema_Custom_Add_Meta_Box( 'schema_cpt', __('Post Types', 'schema-wp'), $fields_post_types, 'schema', 'side', 'default', true );
|
274 |
+
$schema_post_meta_box = new Schema_Custom_Add_Meta_Box( 'schema_post_meta_box', __('Post Meta', 'schema-wp'), $fields_post_meta_box, 'schema', 'normal', 'default', true );
|
275 |
+
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Create post meta box
|
279 |
+
*
|
280 |
+
* Uses class Schema_Custom_Add_Meta_Box
|
281 |
+
*
|
282 |
+
* @todo this function is not used, make sure it's important before removing it!
|
283 |
+
*
|
284 |
+
* @since 1.5.7
|
285 |
+
* @return true
|
286 |
+
*/
|
287 |
+
function schema_wp_do_post_meta( $args ) {
|
288 |
+
|
289 |
+
if ( empty( $args ) ) return;
|
290 |
+
|
291 |
+
$id = $args['id'];
|
292 |
+
$title = $args['title'];
|
293 |
+
$schema_type = $args['type'];
|
294 |
+
$fields = $args['fields'];
|
295 |
+
|
296 |
+
if ( empty( $fields ) ) return;
|
297 |
+
|
298 |
+
/**
|
299 |
+
* Get enabled post types to create a meta box on
|
300 |
+
*/
|
301 |
+
$schemas_enabled = array();
|
302 |
+
|
303 |
+
// Get schame enabled array
|
304 |
+
$schemas_enabled = schema_wp_cpt_get_enabled();
|
305 |
+
|
306 |
+
if ( empty($schemas_enabled) ) return;
|
307 |
+
|
308 |
+
// Get post type from current screen
|
309 |
+
$current_screen = get_current_screen();
|
310 |
+
$post_type = $current_screen->post_type;
|
311 |
+
|
312 |
+
foreach( $schemas_enabled as $schema_enabled ) :
|
313 |
+
|
314 |
+
$type = $schema_enabled['type'];
|
315 |
+
|
316 |
+
if ( ! isset($type) || $type == '' ) return;
|
317 |
+
|
318 |
+
// Get Schema enabled post types array
|
319 |
+
$schema_cpt = $schema_enabled['post_type'];
|
320 |
+
|
321 |
+
if ( ! empty($schema_cpt) && in_array( $post_type, $schema_cpt, true ) ) {
|
322 |
+
|
323 |
+
if ( $type == $schema_type && $schema_enabled['post_type'][0] == $post_type ) {
|
324 |
+
$new_post_meta = new Schema_Custom_Add_Meta_Box( $id, $title, $fields, $post_type, 'normal', 'high', true );
|
325 |
+
}
|
326 |
+
|
327 |
+
}
|
328 |
+
|
329 |
+
// debug
|
330 |
+
//print_r($schema_enabled);
|
331 |
+
|
332 |
+
endforeach;
|
333 |
+
|
334 |
+
return true;
|
335 |
+
}
|
includes/admin/meta/class-meta.php
ADDED
@@ -0,0 +1,927 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Post Meta Boxes
|
4 |
+
*
|
5 |
+
* Used to create custom meta boxes
|
6 |
+
* @link: https://github.com/tammyhart/Reusable-Custom-WordPress-Meta-Boxes
|
7 |
+
* @since 1.3
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
11 |
+
|
12 |
+
// metaboxes directory constant
|
13 |
+
//define( 'SCHEMA_CUSTOM_METABOXES_DIR', get_template_directory_uri() . '/metaboxes' );
|
14 |
+
define( 'SCHEMA_CUSTOM_METABOXES_DIR', plugin_dir_url( __FILE__ ) );
|
15 |
+
|
16 |
+
/**
|
17 |
+
* recives data about a form field and spits out the proper html
|
18 |
+
*
|
19 |
+
* @param array $field array with various bits of information about the field
|
20 |
+
* @param string|int|bool|array $meta the saved data for this field
|
21 |
+
* @param array $repeatable if is this for a repeatable field, contains parant id and the current integar
|
22 |
+
*
|
23 |
+
* @return string html for the field
|
24 |
+
*/
|
25 |
+
function schema_wp_custom_meta_box_field( $field, $meta = null, $repeatable = null ) {
|
26 |
+
if ( ! ( $field || is_array( $field ) ) )
|
27 |
+
return;
|
28 |
+
|
29 |
+
// get field data
|
30 |
+
$type = isset( $field['type'] ) ? $field['type'] : null;
|
31 |
+
$label = isset( $field['label'] ) ? $field['label'] : null;
|
32 |
+
$desc = isset( $field['desc'] ) ? '<span class="description">' . $field['desc'] . '</span>' : null;
|
33 |
+
$tip = isset( $field['tip'] ) ? '<span data-tooltip="'.$field['tip'].'"><span class="dashicons dashicons-info"></span></span>' : null;
|
34 |
+
$placeholder = isset( $field['placeholder'] ) ? $field['placeholder'] : null;
|
35 |
+
$place = isset( $field['place'] ) ? $field['place'] : null;
|
36 |
+
$size = isset( $field['size'] ) ? $field['size'] : 'regular';
|
37 |
+
$class = isset( $field['class'] ) ? $field['class'] : '';
|
38 |
+
$post_type = isset( $field['post_type'] ) ? $field['post_type'] : null;
|
39 |
+
$options = isset( $field['options'] ) ? $field['options'] : null;
|
40 |
+
$settings = isset( $field['settings'] ) ? $field['settings'] : null;
|
41 |
+
$repeatable_fields = isset( $field['repeatable_fields'] ) ? $field['repeatable_fields'] : null;
|
42 |
+
$selectone = isset( $field['selectone'] ) ? $field['selectone'] : __('Select One', 'schema-wp');
|
43 |
+
$sanitizer = isset( $field['sanitizer'] ) ? $field['sanitizer'] : null;
|
44 |
+
$default = isset( $field['default'] ) ? $field['default'] : null;
|
45 |
+
$required = isset( $field['required'] ) ? $field['required'] : null;
|
46 |
+
$min = isset( $field['min'] ) ? $field['min'] : null;
|
47 |
+
$max = isset( $field['max'] ) ? $field['max'] : null;
|
48 |
+
$step = isset( $field['step'] ) ? $field['step'] : null;
|
49 |
+
$multiple = isset( $field['multiple'] ) ? $field['multiple'] : null;
|
50 |
+
|
51 |
+
// the id and name for each field
|
52 |
+
$id = $name = isset( $field['id'] ) ? $field['id'] : null;
|
53 |
+
if ( $repeatable ) {
|
54 |
+
$name = $repeatable[0] . '[' . $repeatable[1] . '][' . $id .']';
|
55 |
+
$id = $repeatable[0] . '_' . $repeatable[1] . '_' . $id;
|
56 |
+
}
|
57 |
+
switch( $type ) {
|
58 |
+
// separator
|
59 |
+
case 'separator':
|
60 |
+
echo '<div style="height:2px; border-bottom: 1px dashed #ccc;"></div>';
|
61 |
+
break;
|
62 |
+
// opening div
|
63 |
+
case 'div_open':
|
64 |
+
echo '<span id="' . esc_attr( $id ) . '" class="toggle">'.__('Advanced', 'schema-wp').' <span class="dashicons dashicons-arrow-down-alt2"></span></span>';
|
65 |
+
echo '</li></ul><span style="clear:both;display:block;"></span><div id="' . esc_attr( $id ) . '_wrap" class="toggle_div"><ul>';
|
66 |
+
break;
|
67 |
+
// closing div
|
68 |
+
case 'div_close':
|
69 |
+
echo '</li></ul></div>';
|
70 |
+
break;
|
71 |
+
// headline
|
72 |
+
case 'desc':
|
73 |
+
echo '<p>'.$desc.'</p>';
|
74 |
+
break;
|
75 |
+
// basic
|
76 |
+
case 'text':
|
77 |
+
case 'tel':
|
78 |
+
case 'email':
|
79 |
+
default:
|
80 |
+
if ( is_array($meta) ) continue; // if $meta has an array, continue to the next case, @since 1.6.9.4
|
81 |
+
echo '<input type="' . $type . '" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" value="' . esc_attr( $meta ) . '" class="'.$size.'-text '.$class.'" size="30" placeholder="' . $placeholder . '" />
|
82 |
+
<br />' . $desc;
|
83 |
+
break;
|
84 |
+
case 'url':
|
85 |
+
echo '<input type="' . $type . '" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" placeholder="' . $placeholder . '" value="' . esc_url( $meta ) . '" class="regular-text '.$class.'" size="30" />
|
86 |
+
<br />' . $desc;
|
87 |
+
break;
|
88 |
+
case 'number':
|
89 |
+
echo '<input type="' . $type . '" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" value="' . intval( $meta ) . '" class="'.$size.'-text '.$class.'" size="30" />
|
90 |
+
<br />' . $desc;
|
91 |
+
break;
|
92 |
+
// textarea
|
93 |
+
case 'textarea':
|
94 |
+
echo '<textarea name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" placeholder="' . $placeholder . '" cols="60" rows="4" class="'.$class.'">' . esc_textarea( $meta ) . '</textarea>
|
95 |
+
<br />' . $desc;
|
96 |
+
break;
|
97 |
+
// editor
|
98 |
+
case 'editor':
|
99 |
+
echo wp_editor( $meta, $id, $settings ) . '<br />' . $desc;
|
100 |
+
break;
|
101 |
+
// checkbox
|
102 |
+
case 'checkbox':
|
103 |
+
echo '<input type="checkbox" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" ' . checked( $meta, true, false ) . ' value="1" />
|
104 |
+
<label for="' . esc_attr( $id ) . '">' . $desc . '</label>';
|
105 |
+
break;
|
106 |
+
// select, chosen
|
107 |
+
case 'select':
|
108 |
+
case 'chosen':
|
109 |
+
|
110 |
+
if ( '' === $meta || array() === $meta ) {
|
111 |
+
$meta = isset($field['default']) ? $field['default'] : '';
|
112 |
+
}
|
113 |
+
|
114 |
+
echo '<select name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '"' , $type == 'chosen' ? ' class="'.$class.' chosen"' : ' class="'.$class.'"' , isset( $multiple ) && $multiple == true ? ' multiple="multiple"' : '' , '>
|
115 |
+
<option value="">' . $selectone . '</option>'; // Select One
|
116 |
+
foreach ( $options as $option )
|
117 |
+
echo '<option' . selected( $meta, $option['value'], false ) . ' value="' . $option['value'] . '">' . $option['label'] . '</option>';
|
118 |
+
echo '</select><br />' . $desc;
|
119 |
+
break;
|
120 |
+
// radio
|
121 |
+
case 'radio':
|
122 |
+
echo '<ul class="meta_box_items">';
|
123 |
+
foreach ( $options as $option )
|
124 |
+
echo '<li><input type="radio" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '-' . $option['value'] . '" value="' . $option['value'] . '" ' . checked( $meta, $option['value'], false ) . ' />
|
125 |
+
<label for="' . esc_attr( $id ) . '-' . $option['value'] . '">' . $option['label'] . '</label></li>';
|
126 |
+
echo '</ul><p>' . $desc . '</p>';
|
127 |
+
break;
|
128 |
+
// checkbox_group
|
129 |
+
case 'checkbox_group':
|
130 |
+
echo '<ul class="meta_box_items">';
|
131 |
+
foreach ( $options as $option )
|
132 |
+
echo '<li><input type="checkbox" value="' . $option['value'] . '" name="' . esc_attr( $name ) . '[]" id="' . esc_attr( $id ) . '-' . $option['value'] . '"' , is_array( $meta ) && in_array( $option['value'], $meta ) ? ' checked="checked"' : '' , ' />
|
133 |
+
<label for="' . esc_attr( $id ) . '-' . $option['value'] . '">' . $option['label'] . '</label></li>';
|
134 |
+
echo '</ul><p>' . $desc . '</p>';
|
135 |
+
break;
|
136 |
+
// checkbox_group
|
137 |
+
case 'checkbox_group_inline':
|
138 |
+
echo '<ul class="meta_box_items">';
|
139 |
+
foreach ( $options as $option )
|
140 |
+
echo '<input class="'.esc_attr( $option['value'] ).'" type="checkbox" value="' . $option['value'] . '" name="' . esc_attr( $name ) . '[]" id="' . esc_attr( $id ) . '-' . $option['value'] . '"' , is_array( $meta ) && in_array( $option['value'], $meta ) ? ' checked="checked"' : '' , ' />
|
141 |
+
<label for="' . esc_attr( $id ) . '-' . $option['value'] . '">' . $option['label'] . '</label><br>';
|
142 |
+
echo '<p>' . $desc . '</p>';
|
143 |
+
break;
|
144 |
+
// color
|
145 |
+
case 'color':
|
146 |
+
$meta = $meta ? $meta : '#';
|
147 |
+
echo '<input type="text" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" value="' . $meta . '" size="10" />
|
148 |
+
<br />' . $desc;
|
149 |
+
echo '<div id="colorpicker-' . esc_attr( $id ) . '"></div>
|
150 |
+
<script type="text/javascript">
|
151 |
+
jQuery(function(jQuery) {
|
152 |
+
jQuery("#colorpicker-' . esc_attr( $id ) . '").hide();
|
153 |
+
jQuery("#colorpicker-' . esc_attr( $id ) . '").farbtastic("#' . esc_attr( $id ) . '");
|
154 |
+
jQuery("#' . esc_attr( $id ) . '").bind("blur", function() { jQuery("#colorpicker-' . esc_attr( $id ) . '").slideToggle(); } );
|
155 |
+
jQuery("#' . esc_attr( $id ) . '").bind("focus", function() { jQuery("#colorpicker-' . esc_attr( $id ) . '").slideToggle(); } );
|
156 |
+
});
|
157 |
+
</script>';
|
158 |
+
break;
|
159 |
+
// post_select, post_chosen
|
160 |
+
case 'post_select':
|
161 |
+
case 'post_list':
|
162 |
+
case 'post_chosen':
|
163 |
+
echo '<select data-placeholder="Select One" name="' . esc_attr( $name ) . '[]" id="' . esc_attr( $id ) . '"' , $type == 'post_chosen' ? ' class="chosen"' : '' , isset( $multiple ) && $multiple == true ? ' multiple="multiple"' : '' , '>
|
164 |
+
<option value=""></option>'; // Select One
|
165 |
+
$posts = get_posts( array( 'post_type' => $post_type, 'posts_per_page' => -1, 'orderby' => 'name', 'order' => 'ASC' ) );
|
166 |
+
foreach ( $posts as $item )
|
167 |
+
echo '<option value="' . $item->ID . '"' . selected( is_array( $meta ) && in_array( $item->ID, $meta ), true, false ) . '>' . $item->post_title . '</option>';
|
168 |
+
$post_type_object = get_post_type_object( $post_type );
|
169 |
+
if(isset($post_type_object->label))
|
170 |
+
echo '</select> <span class="description"><a href="' . admin_url( 'edit.php?post_type=' . $post_type . '">Manage ' . $post_type_object->label ) . '</a></span><br />' . $desc;
|
171 |
+
break;
|
172 |
+
// post_checkboxes
|
173 |
+
case 'post_checkboxes':
|
174 |
+
$posts = get_posts( array( 'post_type' => $post_type, 'posts_per_page' => -1 ) );
|
175 |
+
echo '<ul class="meta_box_items">';
|
176 |
+
foreach ( $posts as $item )
|
177 |
+
echo '<li><input type="checkbox" value="' . $item->ID . '" name="' . esc_attr( $name ) . '[]" id="' . esc_attr( $id ) . '-' . $item->ID . '"' , is_array( $meta ) && in_array( $item->ID, $meta ) ? ' checked="checked"' : '' , ' />
|
178 |
+
<label for="' . esc_attr( $id ) . '-' . $item->ID . '">' . $item->post_title . '</label></li>';
|
179 |
+
$post_type_object = get_post_type_object( $post_type );
|
180 |
+
echo '</ul> ' . $desc , ' <span class="description"><a href="' . admin_url( 'edit.php?post_type=' . $post_type . '">Manage ' . $post_type_object->label ) . '</a></span>';
|
181 |
+
break;
|
182 |
+
// post_drop_sort
|
183 |
+
case 'post_drop_sort':
|
184 |
+
//areas
|
185 |
+
$post_type_object = get_post_type_object( $post_type );
|
186 |
+
echo '<p>' . $desc . ' <span class="description"><a href="' . admin_url( 'edit.php?post_type=' . $post_type . '">Manage ' . $post_type_object->label ) . '</a></span></p><div class="post_drop_sort_areas">';
|
187 |
+
foreach ( $areas as $area ) {
|
188 |
+
echo '<ul id="area-' . $area['id'] . '" class="sort_list">
|
189 |
+
<li class="post_drop_sort_area_name">' . $area['label'] . '</li>';
|
190 |
+
if ( is_array( $meta ) ) {
|
191 |
+
$items = explode( ',', $meta[$area['id']] );
|
192 |
+
foreach ( $items as $item ) {
|
193 |
+
$output = $display == 'thumbnail' ? get_the_post_thumbnail( $item, array( 204, 30 ) ) : wp_filter_nohtml_kses(get_the_title( $item ));
|
194 |
+
echo '<li id="' . $item . '">' . $output . '</li>';
|
195 |
+
}
|
196 |
+
}
|
197 |
+
echo '</ul>
|
198 |
+
<input type="hidden" name="' . esc_attr( $name ) . '[' . $area['id'] . ']"
|
199 |
+
class="store-area-' . $area['id'] . '"
|
200 |
+
value="' , $meta ? $meta[$area['id']] : '' , '" />';
|
201 |
+
}
|
202 |
+
echo '</div>';
|
203 |
+
// source
|
204 |
+
$exclude = null;
|
205 |
+
if ( !empty( $meta ) ) {
|
206 |
+
$exclude = implode( ',', $meta ); // because each ID is in a unique key
|
207 |
+
$exclude = explode( ',', $exclude ); // put all the ID's back into a single array
|
208 |
+
}
|
209 |
+
$posts = get_posts( array( 'post_type' => $post_type, 'posts_per_page' => -1, 'post__not_in' => $exclude ) );
|
210 |
+
echo '<ul class="post_drop_sort_source sort_list">
|
211 |
+
<li class="post_drop_sort_area_name">Available ' . $label . '</li>';
|
212 |
+
foreach ( $posts as $item ) {
|
213 |
+
$output = $display == 'thumbnail' ? get_the_post_thumbnail( $item->ID, array( 204, 30 ) ) : wp_filter_nohtml_kses(get_the_title( $item->ID ));
|
214 |
+
echo '<li id="' . $item->ID . '">' . $output . '</li>';
|
215 |
+
}
|
216 |
+
echo '</ul>';
|
217 |
+
break;
|
218 |
+
// tax_select
|
219 |
+
case 'tax_select':
|
220 |
+
echo '<select name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '">
|
221 |
+
<option value="">Select One</option>'; // Select One
|
222 |
+
$terms = get_terms( $id, 'get=all' );
|
223 |
+
$post_terms = wp_get_object_terms( get_the_ID(), $id );
|
224 |
+
$taxonomy = get_taxonomy( $id );
|
225 |
+
$selected = $post_terms ? $taxonomy->hierarchical ? $post_terms[0]->term_id : $post_terms[0]->slug : null;
|
226 |
+
foreach ( $terms as $term ) {
|
227 |
+
$term_value = $taxonomy->hierarchical ? $term->term_id : $term->slug;
|
228 |
+
echo '<option value="' . $term_value . '"' . selected( $selected, $term_value, false ) . '>' . $term->name . '</option>';
|
229 |
+
}
|
230 |
+
echo '</select> <span class="description"><a href="'.get_bloginfo( 'url' ) . '/wp-admin/edit-tags.php?taxonomy=' . $id . '">Manage ' . $taxonomy->label . '</a></span>
|
231 |
+
<br />' . $desc;
|
232 |
+
break;
|
233 |
+
// CPT, custom post types
|
234 |
+
case 'cpt':
|
235 |
+
$options = apply_filters('schema_wp_get_post_types_settings', schema_wp_get_post_types() );
|
236 |
+
echo $desc;
|
237 |
+
if (!empty($options)) {
|
238 |
+
echo '<ul class="meta_box_cpt_items">';
|
239 |
+
foreach ( $options as $option => $info )
|
240 |
+
echo '<li><input type="checkbox" value="' . $option . '" name="' . esc_attr( $name ) . '['.$option.']" id="' . esc_attr( $id ) . '-' . $option . '"' , is_array( $meta ) && in_array( $option, $meta, true ) ? ' checked="checked"' : '' , ' />
|
241 |
+
<label for="' . esc_attr( $id ) . '-' . $option. '">' . $info['label'] . '</label></li>';
|
242 |
+
echo '</ul>';
|
243 |
+
} else {
|
244 |
+
echo '';
|
245 |
+
}
|
246 |
+
break;
|
247 |
+
// tax_checkboxes
|
248 |
+
case 'tax_checkboxes':
|
249 |
+
$terms = get_terms( $id, 'get=all' );
|
250 |
+
$post_terms = wp_get_object_terms( get_the_ID(), $id );
|
251 |
+
$taxonomy = get_taxonomy( $id );
|
252 |
+
$checked = $post_terms ? $taxonomy->hierarchical ? $post_terms[0]->term_id : $post_terms[0]->slug : null;
|
253 |
+
foreach ( $terms as $term ) {
|
254 |
+
$term_value = $taxonomy->hierarchical ? $term->term_id : $term->slug;
|
255 |
+
echo '<input type="checkbox" value="' . $term_value . '" name="' . $id . '[]" id="term-' . $term_value . '"' . checked( $checked, $term_value, false ) . ' /> <label for="term-' . $term_value . '">' . $term->name . '</label><br />';
|
256 |
+
}
|
257 |
+
echo '<span class="description">' . $field['desc'] . ' <a href="'.get_bloginfo( 'url' ) . '/wp-admin/edit-tags.php?taxonomy=' . $id . '&post_type=' . $page . '">Manage ' . $taxonomy->label . '</a></span>';
|
258 |
+
break;
|
259 |
+
// date
|
260 |
+
case 'date':
|
261 |
+
echo '<input type="text" class="datepicker" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" value="' . $meta . '" size="30" />
|
262 |
+
<br />' . $desc;
|
263 |
+
break;
|
264 |
+
// slider
|
265 |
+
case 'slider':
|
266 |
+
$value = $meta != '' ? intval( $meta ) : '0';
|
267 |
+
echo '<div id="' . esc_attr( $id ) . '-slider"></div>
|
268 |
+
<br />
|
269 |
+
<input type="text" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" value="' . $value . '" size="5" /> ' . $desc;
|
270 |
+
break;
|
271 |
+
// rating slider
|
272 |
+
case 'sliderrating':
|
273 |
+
$post_id = isset($_GET['post']) ? $_GET['post'] : null;
|
274 |
+
$rating_type = schema_wp_review_get_rating_type( $post_id );
|
275 |
+
$rating_scale = schema_wp_review_get_rating_scale( $rating_type );
|
276 |
+
$value = $meta != '' ? intval( $meta ) : '0';
|
277 |
+
$value = schema_wp_review_adjust_rating( $value, $rating_scale );
|
278 |
+
|
279 |
+
//$value = $meta != '' ? intval( $meta ) : '0';
|
280 |
+
echo '<div id="' . esc_attr( $id ) . '-sliderrating"></div>
|
281 |
+
<br />
|
282 |
+
<input type="text" readonly="readonly" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $id ) . '" value="' . $value . '" size="5" />' . $desc;
|
283 |
+
break;
|
284 |
+
// image
|
285 |
+
case 'image':
|
286 |
+
$image = SCHEMA_CUSTOM_METABOXES_DIR . '/images/image.png';
|
287 |
+
echo '<div class="meta_box_image"><span class="meta_box_default_image" style="display:none">' . $image . '</span>';
|
288 |
+
if ( $meta ) {
|
289 |
+
$image = wp_get_attachment_image_src( intval( $meta ), 'medium' );
|
290 |
+
$image = $image[0];
|
291 |
+
}
|
292 |
+
echo '<input name="' . esc_attr( $name ) . '" type="hidden" class="meta_box_upload_image" value="' . intval( $meta ) . '" />
|
293 |
+
<img src="' . esc_attr( $image ) . '" class="meta_box_preview_image" alt="" />
|
294 |
+
<a href="#" class="meta_box_upload_image_button button" rel="' . get_the_ID() . '">Choose Image</a>
|
295 |
+
<small> <a href="#" class="meta_box_clear_image_button">Remove Image</a></small></div>
|
296 |
+
<br clear="all" />' . $desc;
|
297 |
+
break;
|
298 |
+
// file
|
299 |
+
case 'file':
|
300 |
+
$iconClass = 'meta_box_file';
|
301 |
+
if ( $meta ) $iconClass .= ' checked';
|
302 |
+
echo '<div class="meta_box_file_stuff"><input name="' . esc_attr( $name ) . '" type="hidden" class="meta_box_upload_file" value="' . esc_url( $meta ) . '" />
|
303 |
+
<span class="' . $iconClass . '"></span>
|
304 |
+
<span class="meta_box_filename">' . esc_url( $meta ) . '</span>
|
305 |
+
<a href="#" class="meta_box_upload_image_button button" rel="' . get_the_ID() . '">Choose File</a>
|
306 |
+
<small> <a href="#" class="meta_box_clear_file_button">Remove File</a></small></div>
|
307 |
+
<br clear="all" />' . $desc;
|
308 |
+
break;
|
309 |
+
// repeatable
|
310 |
+
case 'repeatable':
|
311 |
+
echo '<table id="' . esc_attr( $id ) . '-repeatable" class="meta_box_repeatable" cellspacing="0">
|
312 |
+
<thead>
|
313 |
+
<tr>
|
314 |
+
<th><span class="sort_label"><span class="dashicons dashicons-menu"></span></span></th>
|
315 |
+
<th>Fields</th>
|
316 |
+
<th><a class="meta_box_repeatable_add" href="#"><span class="dashicons dashicons-plus-alt"></span></a></th>
|
317 |
+
</tr>
|
318 |
+
</thead>
|
319 |
+
<tbody>';
|
320 |
+
$i = 0;
|
321 |
+
// create an empty array
|
322 |
+
if ( $meta == '' || $meta == array() ) {
|
323 |
+
$keys = wp_list_pluck( $repeatable_fields, 'id' );
|
324 |
+
$meta = array ( array_fill_keys( $keys, null ) );
|
325 |
+
}
|
326 |
+
$meta = array_values( $meta );
|
327 |
+
foreach( $meta as $row ) {
|
328 |
+
echo '<tr>
|
329 |
+
<td><span class="sort hndle"><span class="dashicons dashicons-menu"></span></span></td><td>';
|
330 |
+
foreach ( $repeatable_fields as $repeatable_field ) {
|
331 |
+
if ( ! array_key_exists( $repeatable_field['id'], $meta[$i] ) )
|
332 |
+
$meta[$i][$repeatable_field['id']] = null;
|
333 |
+
echo '<label>' . $repeatable_field['label'] . '</label><p>';
|
334 |
+
echo schema_wp_custom_meta_box_field( $repeatable_field, $meta[$i][$repeatable_field['id']], array( $id, $i ) );
|
335 |
+
echo '</p>';
|
336 |
+
} // end each field
|
337 |
+
echo '</td><td><a class="meta_box_repeatable_remove repeatable-remove" href="#"><span class="dashicons dashicons-dismiss"></span></a></td></tr>';
|
338 |
+
$i++;
|
339 |
+
} // end each row
|
340 |
+
echo '</tbody>';
|
341 |
+
echo '
|
342 |
+
<tfoot>
|
343 |
+
<tr>
|
344 |
+
<th><span class="sort_label"><span class="dashicons dashicons-menu"></span></span></th>
|
345 |
+
<th>' . __('Fields', 'schema-wp') . '</th>
|
346 |
+
<th><a class="meta_box_repeatable_add" href="#"><span class="dashicons dashicons-plus-alt"></span></a></th>
|
347 |
+
</tr>
|
348 |
+
</tfoot>';
|
349 |
+
echo '</table>
|
350 |
+
' . $desc;
|
351 |
+
break;
|
352 |
+
|
353 |
+
// repeatable row
|
354 |
+
case 'repeatable_row':
|
355 |
+
echo '<table id="' . esc_attr( $id ) . '-repeatable" class="meta_box_repeatable meta_box_repeatable_row" cellspacing="0">
|
356 |
+
<thead>
|
357 |
+
<tr>
|
358 |
+
<th><span class="sort_label"><span class="dashicons dashicons-menu"></span></span></th>
|
359 |
+
<th>Fields</th>
|
360 |
+
<th><a class="meta_box_repeatable_add" href="#"><span class="dashicons dashicons-plus-alt"></span></a></th>
|
361 |
+
</tr>
|
362 |
+
</thead>
|
363 |
+
<tbody>';
|
364 |
+
$i = 0;
|
365 |
+
// create an empty array
|
366 |
+
if ( $meta == '' || $meta == array() ) {
|
367 |
+
$keys = wp_list_pluck( $repeatable_fields, 'id' );
|
368 |
+
$meta = array ( array_fill_keys( $keys, null ) );
|
369 |
+
}
|
370 |
+
$meta = array_values( $meta );
|
371 |
+
//echo '<pre>'; print_r($meta); echo '</pre>';// exit;
|
372 |
+
foreach( $meta as $row ) {
|
373 |
+
echo '<tr>
|
374 |
+
<td><span class="sort hndle"><span class="dashicons dashicons-menu"></span></span></td><td><ul>';
|
375 |
+
foreach ( $repeatable_fields as $repeatable_field ) {
|
376 |
+
if ( ! array_key_exists( $repeatable_field['id'], $meta[$i] ) )
|
377 |
+
$meta[$i][$repeatable_field['id']] = null;
|
378 |
+
//echo '<li><label>' . $repeatable_field['label'] . '</label>';
|
379 |
+
echo '<li><label></label>';
|
380 |
+
//echo '<li>';
|
381 |
+
echo schema_wp_custom_meta_box_field( $repeatable_field, $meta[$i][$repeatable_field['id']], array( $id, $i ) );
|
382 |
+
echo '</li>';
|
383 |
+
} // end each field
|
384 |
+
echo '</td><td><a class="meta_box_repeatable_remove" href="#"><span class="dashicons dashicons-dismiss"></span></a></td></tr>';
|
385 |
+
$i++;
|
386 |
+
} // end each row
|
387 |
+
echo '</tbody>';
|
388 |
+
echo '
|
389 |
+
<tfoot>
|
390 |
+
<tr>
|
391 |
+
<th><span class="sort_label"><span class="dashicons dashicons-menu"></span></span></th>
|
392 |
+
<th>Fields</th>
|
393 |
+
<th><a class="meta_box_repeatable_add" href="#"><span class="dashicons dashicons-plus-alt"></span></a></th>
|
394 |
+
</tr>
|
395 |
+
</tfoot>';
|
396 |
+
echo '</table>
|
397 |
+
<p><br />' . $desc . '</p>';
|
398 |
+
break;
|
399 |
+
|
400 |
+
} //end switch
|
401 |
+
|
402 |
+
}
|
403 |
+
|
404 |
+
|
405 |
+
/**
|
406 |
+
* Finds any item in any level of an array
|
407 |
+
*
|
408 |
+
* @param string $needle field type to look for
|
409 |
+
* @param array $haystack an array to search the type in
|
410 |
+
*
|
411 |
+
* @return bool whether or not the type is in the provided array
|
412 |
+
* @since 1.0
|
413 |
+
*/
|
414 |
+
function schema_wp_meta_box_find_field_type($keySearch, $array) {
|
415 |
+
|
416 |
+
if ( ! is_array( $array) ) return;
|
417 |
+
|
418 |
+
foreach ($array as $key => $item) {
|
419 |
+
|
420 |
+
if ( isset( $key['type'] ) && $key['type'] == 'repeatable' )
|
421 |
+
return schema_wp_meta_box_find_field_type( $keySearch, $key['repeatable_fields'] );
|
422 |
+
elseif ( isset( $key['type'] ) && $key['type'] == 'repeatable_row' )
|
423 |
+
return schema_wp_meta_box_find_field_type( $keySearch, $h['repeatable_fields'] );
|
424 |
+
elseif ( ( isset( $key['type'] ) && $key['type'] == $keySearch ) || ( isset( $key['repeatable_type'] ) && $key['repeatable_type'] == $keySearch ) )
|
425 |
+
return true;
|
426 |
+
|
427 |
+
// additional check
|
428 |
+
// @since 1.6.9.1
|
429 |
+
if ($key == $keySearch) {
|
430 |
+
return true;
|
431 |
+
} else {
|
432 |
+
if (is_array($item) && schema_wp_meta_box_find_field_type($item, $keySearch)) {
|
433 |
+
return true;
|
434 |
+
}
|
435 |
+
}
|
436 |
+
}
|
437 |
+
|
438 |
+
return false;
|
439 |
+
}
|
440 |
+
|
441 |
+
|
442 |
+
/**
|
443 |
+
* Find repeatable
|
444 |
+
*
|
445 |
+
* This function does almost the same exact thing that the above function
|
446 |
+
* does, except we're exclusively looking for the repeatable field. The
|
447 |
+
* reason is that we need a way to look for other fields nested within a
|
448 |
+
* repeatable, but also need a way to stop at repeatable being true.
|
449 |
+
* Hopefully I'll find a better way to do this later.
|
450 |
+
*
|
451 |
+
* @param string $needle field type to look for
|
452 |
+
* @param array $haystack an array to search the type in
|
453 |
+
*
|
454 |
+
* @return bool whether or not the type is in the provided array
|
455 |
+
*/
|
456 |
+
function schema_wp_meta_box_find_repeatable( $needle = 'repeatable', $haystack ) {
|
457 |
+
foreach ( $haystack as $h )
|
458 |
+
if ( isset( $h['type'] ) && $h['type'] == $needle )
|
459 |
+
return true;
|
460 |
+
return false;
|
461 |
+
}
|
462 |
+
|
463 |
+
/**
|
464 |
+
* Find repeatable_row
|
465 |
+
*
|
466 |
+
* This function does almost the same exact thing that the above function
|
467 |
+
* does, except we're exclusively looking for the repeatable field. The
|
468 |
+
* reason is that we need a way to look for other fields nested within a
|
469 |
+
* repeatable, but also need a way to stop at repeatable being true.
|
470 |
+
* Hopefully I'll find a better way to do this later.
|
471 |
+
*
|
472 |
+
* @param string $needle field type to look for
|
473 |
+
* @param array $haystack an array to search the type in
|
474 |
+
*
|
475 |
+
* @return bool whether or not the type is in the provided array
|
476 |
+
*/
|
477 |
+
function schema_wp_meta_box_find_repeatable_row( $needle = 'repeatable_row', $haystack ) {
|
478 |
+
foreach ( $haystack as $h )
|
479 |
+
if ( isset( $h['type'] ) && $h['type'] == $needle )
|
480 |
+
return true;
|
481 |
+
return false;
|
482 |
+
}
|
483 |
+
|
484 |
+
/**
|
485 |
+
* sanitize boolean inputs
|
486 |
+
*/
|
487 |
+
function schema_wp_meta_box_santitize_boolean( $string ) {
|
488 |
+
if ( ! isset( $string ) || $string != 1 || $string != true )
|
489 |
+
return false;
|
490 |
+
else
|
491 |
+
return true;
|
492 |
+
}
|
493 |
+
|
494 |
+
/**
|
495 |
+
* outputs properly sanitized data
|
496 |
+
*
|
497 |
+
* @param string $string the string to run through a validation function
|
498 |
+
* @param string $function the validation function
|
499 |
+
*
|
500 |
+
* @return a validated string
|
501 |
+
*/
|
502 |
+
function schema_wp_meta_box_sanitize( $string, $function = 'sanitize_text_field' ) {
|
503 |
+
switch ( $function ) {
|
504 |
+
case 'intval':
|
505 |
+
return intval( $string );
|
506 |
+
case 'absint':
|
507 |
+
return absint( $string );
|
508 |
+
case 'wp_kses_post':
|
509 |
+
return wp_kses_post( $string );
|
510 |
+
case 'wp_kses_data':
|
511 |
+
return wp_kses_data( $string );
|
512 |
+
case 'esc_url_raw':
|
513 |
+
return esc_url_raw( $string );
|
514 |
+
case 'is_email':
|
515 |
+
return is_email( $string );
|
516 |
+
case 'sanitize_title':
|
517 |
+
return sanitize_title( $string );
|
518 |
+
case 'santitize_title_with_dashes':
|
519 |
+
return sanitize_title_with_dashes( $string );
|
520 |
+
case 'santitize_boolean':
|
521 |
+
return santitize_boolean( $string );
|
522 |
+
case 'sanitize_html_class':
|
523 |
+
return sanitize_html_class( $string );
|
524 |
+
case 'no_santitize':
|
525 |
+
return $string;
|
526 |
+
case 'sanitize_text_field':
|
527 |
+
default:
|
528 |
+
return sanitize_text_field( $string );
|
529 |
+
}
|
530 |
+
}
|
531 |
+
|
532 |
+
/**
|
533 |
+
* Map a multideminsional array
|
534 |
+
*
|
535 |
+
* @param string $func the function to map
|
536 |
+
* @param array $meta a multidimensional array
|
537 |
+
* @param array $sanitizer a matching multidimensional array of sanitizers
|
538 |
+
*
|
539 |
+
* @return array new array, fully mapped with the provided arrays
|
540 |
+
*/
|
541 |
+
function schema_wp_meta_box_array_map_r( $func, $meta, $sanitizer ) {
|
542 |
+
|
543 |
+
$newMeta = array();
|
544 |
+
$meta = array_values( $meta );
|
545 |
+
|
546 |
+
foreach( $meta as $key => $array ) {
|
547 |
+
if ( $array == '' )
|
548 |
+
continue;
|
549 |
+
/**
|
550 |
+
* some values are stored as array, we only want multidimensional ones
|
551 |
+
*/
|
552 |
+
if ( ! is_array( $array ) ) {
|
553 |
+
return array_map( $func, $meta, (array)$sanitizer );
|
554 |
+
break;
|
555 |
+
}
|
556 |
+
/**
|
557 |
+
* the sanitizer will have all of the fields, but the item may only
|
558 |
+
* have valeus for a few, remove the ones we don't have from the santizer
|
559 |
+
*/
|
560 |
+
$keys = array_keys( $array );
|
561 |
+
$newSanitizer = $sanitizer;
|
562 |
+
if ( is_array( $sanitizer ) ) {
|
563 |
+
foreach( $newSanitizer as $sanitizerKey => $value )
|
564 |
+
if ( ! in_array( $sanitizerKey, $keys ) )
|
565 |
+
unset( $newSanitizer[$sanitizerKey] );
|
566 |
+
}
|
567 |
+
/**
|
568 |
+
* run the function as deep as the array goes
|
569 |
+
*/
|
570 |
+
foreach( $array as $arrayKey => $arrayValue )
|
571 |
+
if ( is_array( $arrayValue ) )
|
572 |
+
$array[$arrayKey] = schema_wp_meta_box_array_map_r( $func, $arrayValue, $newSanitizer[$arrayKey] );
|
573 |
+
|
574 |
+
$array = array_map( $func, $array, $newSanitizer );
|
575 |
+
$newMeta[$key] = array_combine( $keys, array_values( $array ) );
|
576 |
+
}
|
577 |
+
return $newMeta;
|
578 |
+
}
|
579 |
+
|
580 |
+
/**
|
581 |
+
* takes in a few peices of data and creates a custom meta box
|
582 |
+
*
|
583 |
+
* @param string $id meta box id
|
584 |
+
* @param string $title title
|
585 |
+
* @param array $fields array of each field the box should include
|
586 |
+
* @param string|array $page post type to add meta box to
|
587 |
+
*/
|
588 |
+
class Schema_Custom_Add_Meta_Box {
|
589 |
+
|
590 |
+
var $id;
|
591 |
+
var $title;
|
592 |
+
var $fields;
|
593 |
+
var $page;
|
594 |
+
var $context;
|
595 |
+
var $priority;
|
596 |
+
|
597 |
+
public function __construct( $id, $title, $fields, $page, $context = 'advanced', $priority = 'high' ) {
|
598 |
+
$this->id = $id;
|
599 |
+
$this->title = $title;
|
600 |
+
$this->fields = $fields;
|
601 |
+
$this->page = $page;
|
602 |
+
$this->context = $context;
|
603 |
+
$this->priority = $priority;
|
604 |
+
|
605 |
+
if( ! is_array( $this->page ) )
|
606 |
+
$this->page = array( $this->page );
|
607 |
+
|
608 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
609 |
+
add_action( 'admin_head', array( $this, 'admin_head' ) );
|
610 |
+
add_action( 'add_meta_boxes', array( $this, 'add_box' ) );
|
611 |
+
add_action( 'save_post', array( $this, 'save_box' ));
|
612 |
+
}
|
613 |
+
|
614 |
+
/**
|
615 |
+
* enqueue necessary scripts and styles
|
616 |
+
*/
|
617 |
+
function admin_enqueue_scripts() {
|
618 |
+
global $pagenow;
|
619 |
+
if ( in_array( $pagenow, array( 'post-new.php', 'post.php' ) ) && in_array( get_post_type(), $this->page ) ) {
|
620 |
+
|
621 |
+
// debug
|
622 |
+
//echo'<pre>';print_r($this->fields);echo'</pre>';
|
623 |
+
|
624 |
+
// js
|
625 |
+
$deps = array( 'jquery' );
|
626 |
+
if ( schema_wp_meta_box_find_field_type( 'date', $this->fields ) )
|
627 |
+
$deps[] = 'jquery-ui-datepicker';
|
628 |
+
if ( in_array( true, array(
|
629 |
+
schema_wp_meta_box_find_field_type( 'slider', $this->fields ),
|
630 |
+
schema_wp_meta_box_find_field_type( 'sliderrating', $this->fields )
|
631 |
+
) ) ) {
|
632 |
+
$deps[] = 'jquery-ui-slider';
|
633 |
+
}
|
634 |
+
if ( schema_wp_meta_box_find_field_type( 'color', $this->fields ) )
|
635 |
+
$deps[] = 'farbtastic';
|
636 |
+
if ( in_array( true, array(
|
637 |
+
schema_wp_meta_box_find_field_type( 'chosen', $this->fields ),
|
638 |
+
schema_wp_meta_box_find_field_type( 'post_chosen', $this->fields )
|
639 |
+
) ) ) {
|
640 |
+
wp_register_script( 'chosen', SCHEMA_CUSTOM_METABOXES_DIR . 'js/chosen.js', array( 'jquery' ) );
|
641 |
+
$deps[] = 'chosen';
|
642 |
+
wp_enqueue_style( 'chosen', SCHEMA_CUSTOM_METABOXES_DIR . 'css/chosen.css' );
|
643 |
+
}
|
644 |
+
if ( in_array( true, array(
|
645 |
+
schema_wp_meta_box_find_field_type( 'date', $this->fields ),
|
646 |
+
schema_wp_meta_box_find_field_type( 'slider', $this->fields ),
|
647 |
+
schema_wp_meta_box_find_field_type( 'sliderrating', $this->fields ),
|
648 |
+
schema_wp_meta_box_find_field_type( 'color', $this->fields ),
|
649 |
+
schema_wp_meta_box_find_field_type( 'chosen', $this->fields ),
|
650 |
+
schema_wp_meta_box_find_field_type( 'post_chosen', $this->fields ),
|
651 |
+
schema_wp_meta_box_find_repeatable( 'repeatable', $this->fields ),
|
652 |
+
schema_wp_meta_box_find_repeatable( 'repeatable_row', $this->fields ),
|
653 |
+
schema_wp_meta_box_find_field_type( 'image', $this->fields ),
|
654 |
+
schema_wp_meta_box_find_field_type( 'file', $this->fields )
|
655 |
+
) ) )
|
656 |
+
wp_enqueue_script( 'meta_box', SCHEMA_CUSTOM_METABOXES_DIR . 'js/scripts.js', $deps );
|
657 |
+
|
658 |
+
if ( in_array( true, array(
|
659 |
+
schema_wp_meta_box_find_field_type( 'select', $this->fields )
|
660 |
+
) ) )
|
661 |
+
wp_enqueue_script( 'schema_meta_box', SCHEMA_CUSTOM_METABOXES_DIR . 'js/schema.js', $deps );
|
662 |
+
|
663 |
+
// Load media uploader required scripts
|
664 |
+
if ( in_array( true, array(
|
665 |
+
schema_wp_meta_box_find_field_type( 'image', $this->fields )
|
666 |
+
) ) ) {
|
667 |
+
if(function_exists('wp_enqueue_media')) {
|
668 |
+
wp_enqueue_media();
|
669 |
+
} else {
|
670 |
+
wp_enqueue_script('media-upload');
|
671 |
+
wp_enqueue_script('thickbox');
|
672 |
+
wp_enqueue_style('thickbox');
|
673 |
+
}
|
674 |
+
}
|
675 |
+
|
676 |
+
// css
|
677 |
+
$deps = array();
|
678 |
+
wp_register_style( 'jqueryui', SCHEMA_CUSTOM_METABOXES_DIR . 'css/jqueryui.css' );
|
679 |
+
if ( schema_wp_meta_box_find_field_type( 'date', $this->fields ) || schema_wp_meta_box_find_field_type( 'slider', $this->fields ) || schema_wp_meta_box_find_field_type( 'sliderrating', $this->fields ) )
|
680 |
+
$deps[] = 'jqueryui';
|
681 |
+
if ( schema_wp_meta_box_find_field_type( 'color', $this->fields ) )
|
682 |
+
$deps[] = 'farbtastic';
|
683 |
+
wp_enqueue_style( 'meta_box', SCHEMA_CUSTOM_METABOXES_DIR . 'css/meta_box.css', $deps );
|
684 |
+
}
|
685 |
+
}
|
686 |
+
|
687 |
+
/**
|
688 |
+
* adds scripts to the head for special fields with extra js requirements
|
689 |
+
*/
|
690 |
+
function admin_head() {
|
691 |
+
|
692 |
+
if ( in_array( get_post_type(), $this->page ) && ( schema_wp_meta_box_find_field_type( 'date', $this->fields )
|
693 |
+
|| schema_wp_meta_box_find_field_type( 'slider', $this->fields )
|
694 |
+
|| schema_wp_meta_box_find_field_type( 'sliderrating', $this->fields ) ) ) {
|
695 |
+
|
696 |
+
echo '<script type="text/javascript">
|
697 |
+
jQuery(function($) {';
|
698 |
+
|
699 |
+
foreach ( $this->fields as $field ) {
|
700 |
+
switch( $field['type'] ) {
|
701 |
+
// date
|
702 |
+
case 'date' :
|
703 |
+
echo '$("#' . $field['id'] . '").datepicker({
|
704 |
+
dateFormat: \'yy-mm-dd\'
|
705 |
+
});';
|
706 |
+
break;
|
707 |
+
// slider
|
708 |
+
case 'slider' :
|
709 |
+
$value = get_post_meta( get_the_ID(), $field['id'], true );
|
710 |
+
if ( $value == '' )
|
711 |
+
$value = $field['min'];
|
712 |
+
echo '
|
713 |
+
$( "#' . $field['id'] . '-slider" ).slider({
|
714 |
+
range : "min",
|
715 |
+
value: ' . $value . ',
|
716 |
+
min: ' . $field['min'] . ',
|
717 |
+
max: ' . $field['max'] . ',
|
718 |
+
step: ' . $field['step'] . ',
|
719 |
+
slide: function( event, ui ) {
|
720 |
+
$( "#' . $field['id'] . '" ).val( ui.value );
|
721 |
+
}
|
722 |
+
});';
|
723 |
+
break;
|
724 |
+
// slider rating: Used by the Schema Review extension
|
725 |
+
case 'sliderrating' :
|
726 |
+
$post_id = get_the_ID();
|
727 |
+
$value = get_post_meta( $post_id, $field['id'], true );
|
728 |
+
if ( $value == '' )
|
729 |
+
$value = $field['min'];
|
730 |
+
|
731 |
+
$_scale = schema_wp_get_option( 'schema_review_rating_scale', false );
|
732 |
+
$rating_type = schema_wp_review_get_rating_type( $post_id );
|
733 |
+
$rating_scale = schema_wp_review_get_rating_scale( $rating_type );
|
734 |
+
$value = schema_wp_review_adjust_rating( $value, $rating_scale );
|
735 |
+
|
736 |
+
echo '
|
737 |
+
$( "#' . $field['id'] . '-sliderrating" ).slider({
|
738 |
+
range : "min",
|
739 |
+
value: ' . $value . ',
|
740 |
+
min: ' . $rating_scale['min'] . ',
|
741 |
+
max: ' . $rating_scale['max'] . ',
|
742 |
+
step: ' . $rating_scale['step'] . ',
|
743 |
+
slide: function( event, ui ) {
|
744 |
+
$( "#' . $field['id'] . '" ).val( ui.value );
|
745 |
+
}
|
746 |
+
});
|
747 |
+
|
748 |
+
var RatingType = "";
|
749 |
+
var RatingScale = ' . json_encode($_scale) . ';
|
750 |
+
var newBegin = 0;
|
751 |
+
var newEnd = 0;
|
752 |
+
var newStep = 0;
|
753 |
+
|
754 |
+
$("#_schema_review_rating_type").on("change", function() {
|
755 |
+
|
756 |
+
var currentVal = parseInt($("#' . $field['id'] . '-sliderrating" ).slider("value")),
|
757 |
+
RatingType = $("#_schema_review_rating_type").val();
|
758 |
+
|
759 |
+
var newBegin = parseInt(RatingScale[RatingType]["min"]);
|
760 |
+
var newEnd = parseInt(RatingScale[RatingType]["max"]);
|
761 |
+
var newStep = parseFloat(RatingScale[RatingType]["step"]);
|
762 |
+
|
763 |
+
if ( currentVal > newEnd ) var currentVal = newEnd;
|
764 |
+
|
765 |
+
|
766 |
+
var $slide = $("#' . $field['id'] . '-sliderrating" ).slider({
|
767 |
+
range : "min",
|
768 |
+
value: currentVal,
|
769 |
+
min: newBegin,
|
770 |
+
max: newEnd,
|
771 |
+
step: newStep,
|
772 |
+
slide: function( event, ui ) {
|
773 |
+
$( "#' . $field['id'] . '" ).val( ui.value );
|
774 |
+
}
|
775 |
+
});
|
776 |
+
$slide.slider("value", $slide.slider("value"));
|
777 |
+
});
|
778 |
+
';
|
779 |
+
break;
|
780 |
+
}
|
781 |
+
}
|
782 |
+
|
783 |
+
echo '});
|
784 |
+
</script>';
|
785 |
+
}
|
786 |
+
}
|
787 |
+
|
788 |
+
/**
|
789 |
+
* adds the meta box for every post type in $page
|
790 |
+
*/
|
791 |
+
function add_box() {
|
792 |
+
foreach ( $this->page as $page ) {
|
793 |
+
add_meta_box( $this->id, $this->title, array( $this, 'meta_box_callback' ), $page, $this->context, $this->priority );
|
794 |
+
}
|
795 |
+
}
|
796 |
+
|
797 |
+
/**
|
798 |
+
* outputs the meta box
|
799 |
+
*/
|
800 |
+
function meta_box_callback() {
|
801 |
+
// Use nonce for verification
|
802 |
+
wp_nonce_field( 'custom_meta_box_nonce_action', 'custom_meta_box_nonce_field' );
|
803 |
+
|
804 |
+
// Begin the field table and loop
|
805 |
+
echo '<table class="form-table meta_box">';
|
806 |
+
foreach ( $this->fields as $field) {
|
807 |
+
|
808 |
+
if ( !isset($field['label']) )
|
809 |
+
$field['label'] = null;
|
810 |
+
|
811 |
+
// set tooltip
|
812 |
+
$tip = isset( $field['tip'] ) ? '<span data-tooltip="'.$field['tip'].'"><span class="dashicons dashicons-info"></span></span>' : null;
|
813 |
+
|
814 |
+
if ( $field['type'] == 'section' ) {
|
815 |
+
echo '<tr>
|
816 |
+
<td colspan="2">
|
817 |
+
<h2>' . $field['label'] . ' ' . $tip . '</h2>
|
818 |
+
</td>
|
819 |
+
</tr>';
|
820 |
+
}
|
821 |
+
else {
|
822 |
+
$label = isset($field['required']) ? $field['label'] . ' <span class="required">*</span>' : $field['label'];
|
823 |
+
echo '<tr>
|
824 |
+
<th style="width:20%"><label for="' . $field['id'] . '">' . $label . ' ' . $tip . '</label></th>
|
825 |
+
<td>';
|
826 |
+
|
827 |
+
$meta = get_post_meta( get_the_ID(), $field['id'], true);
|
828 |
+
echo schema_wp_custom_meta_box_field( $field, $meta );
|
829 |
+
|
830 |
+
echo '<td>
|
831 |
+
</tr>';
|
832 |
+
}
|
833 |
+
} // end foreach
|
834 |
+
echo '</table>'; // end table
|
835 |
+
}
|
836 |
+
|
837 |
+
/**
|
838 |
+
* saves the captured data
|
839 |
+
*/
|
840 |
+
function save_box( $post_id ) {
|
841 |
+
|
842 |
+
$post_type = get_post_type();
|
843 |
+
|
844 |
+
// verify nonce
|
845 |
+
if ( ! isset( $_POST['custom_meta_box_nonce_field'] ) )
|
846 |
+
return $post_id;
|
847 |
+
if ( ! ( in_array( $post_type, $this->page ) || wp_verify_nonce( $_POST['custom_meta_box_nonce_field'], 'custom_meta_box_nonce_action' ) ) )
|
848 |
+
return $post_id;
|
849 |
+
// check autosave
|
850 |
+
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
851 |
+
return $post_id;
|
852 |
+
// check permissions
|
853 |
+
//if ( ! current_user_can( 'edit_page', $post_id ) )
|
854 |
+
//return $post_id;
|
855 |
+
|
856 |
+
// debug
|
857 |
+
//if ( isset( $_POST['_schema_review_rating_type'] ) ) echo $_POST['_schema_review_rating_type'];
|
858 |
+
//echo '<pre>'; print_r($_POST);echo'</pre>';
|
859 |
+
|
860 |
+
// loop through fields and save the data
|
861 |
+
foreach ( $this->fields as $field ) {
|
862 |
+
if( $field['type'] == 'section' ) {
|
863 |
+
$sanitizer = null;
|
864 |
+
continue;
|
865 |
+
}
|
866 |
+
if( in_array( $field['type'], array( 'tax_select', 'tax_checkboxes' ) ) ) {
|
867 |
+
// save taxonomies
|
868 |
+
if ( isset( $_POST[$field['id']] ) ) {
|
869 |
+
$term = $_POST[$field['id']];
|
870 |
+
wp_set_object_terms( $post_id, $term, $field['id'] );
|
871 |
+
}
|
872 |
+
}
|
873 |
+
/*else {
|
874 |
+
// save the rest
|
875 |
+
$new = false;
|
876 |
+
$old = get_post_meta( $post_id, $field['id'], true );
|
877 |
+
if ( isset( $_POST[$field['id']] ) )
|
878 |
+
$new = $_POST[$field['id']];
|
879 |
+
if ( isset( $new ) && '' == $new && $old ) {
|
880 |
+
delete_post_meta( $post_id, $field['id'], $old );
|
881 |
+
} elseif ( isset( $new ) && $new != $old ) {
|
882 |
+
$sanitizer = isset( $field['sanitizer'] ) ? $field['sanitizer'] : 'sanitize_text_field';
|
883 |
+
if ( is_array( $new ) )
|
884 |
+
$new = schema_wp_meta_box_array_map_r( 'schema_wp_meta_box_sanitize', $new, $sanitizer );
|
885 |
+
else
|
886 |
+
$new = schema_wp_meta_box_sanitize( $new, $sanitizer );
|
887 |
+
update_post_meta( $post_id, $field['id'], $new );
|
888 |
+
}
|
889 |
+
}*/
|
890 |
+
|
891 |
+
else {
|
892 |
+
// save the rest
|
893 |
+
$new = false;
|
894 |
+
$old = get_post_meta( $post_id, $field['id'], true );
|
895 |
+
if ( isset( $_POST[$field['id']] ) )
|
896 |
+
$new = $_POST[$field['id']];
|
897 |
+
if($field['type'] == 'repeatable' || $field['type'] == 'repeatable_row' ) {
|
898 |
+
if (is_array($new)) $new = array_values($new);
|
899 |
+
}
|
900 |
+
if ( isset( $new ) && '' == $new && $old ) {
|
901 |
+
delete_post_meta( $post_id, $field['id'], $old );
|
902 |
+
} elseif ( isset( $new ) && $new != $old ) {
|
903 |
+
$sanitizer = isset( $field['sanitizer'] ) ? $field['sanitizer'] : 'sanitize_text_field';
|
904 |
+
if ( is_array( $new ) )
|
905 |
+
$new = schema_wp_meta_box_array_map_r( 'schema_wp_meta_box_sanitize', $new, $sanitizer );
|
906 |
+
else
|
907 |
+
$new = schema_wp_meta_box_sanitize( $new, $sanitizer );
|
908 |
+
|
909 |
+
if( $field['type'] == 'date') {
|
910 |
+
$new = strtotime($new);
|
911 |
+
}
|
912 |
+
if( $field['type'] == 'sliderrating') {
|
913 |
+
// adjust rating before saving values
|
914 |
+
if (function_exists('schema_wp_review_adjust_rating')) {
|
915 |
+
$rating_type = schema_wp_review_get_rating_type( $post_id );
|
916 |
+
$scale = schema_wp_review_get_rating_scale( $rating_type );
|
917 |
+
$new = schema_wp_review_adjust_rating( $new, $scale, true );
|
918 |
+
}
|
919 |
+
}
|
920 |
+
|
921 |
+
update_post_meta( $post_id, $field['id'], $new );
|
922 |
+
}
|
923 |
+
}
|
924 |
+
} // end foreach
|
925 |
+
}
|
926 |
+
|
927 |
+
}
|
includes/admin/meta/css/chosen-sprite.png
ADDED
Binary file
|
includes/admin/meta/css/chosen-sprite@2x.png
ADDED
Binary file
|
includes/admin/meta/css/chosen.css
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
Chosen, a Select Box Enhancer for jQuery and Prototype
|
3 |
+
by Patrick Filler for Harvest, http://getharvest.com
|
4 |
+
|
5 |
+
Version 1.8.5
|
6 |
+
Full source at https://github.com/harvesthq/chosen
|
7 |
+
Copyright (c) 2011-2018 Harvest http://getharvest.com
|
8 |
+
|
9 |
+
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
10 |
+
This file is generated by `grunt build`, do not edit it by hand.
|
11 |
+
*/.chosen-container{position:relative;display:inline-block;vertical-align:middle;font-size:13px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.chosen-container *{-webkit-box-sizing:border-box;box-sizing:border-box}.chosen-container .chosen-drop{position:absolute;top:100%;z-index:1010;width:100%;border:1px solid #aaa;border-top:0;background:#fff;-webkit-box-shadow:0 4px 5px rgba(0,0,0,.15);box-shadow:0 4px 5px rgba(0,0,0,.15);display:none}.chosen-container.chosen-with-drop .chosen-drop{display:block}.chosen-container a{cursor:pointer}.chosen-container .chosen-single .group-name,.chosen-container .search-choice .group-name{margin-right:4px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-weight:400;color:#999}.chosen-container .chosen-single .group-name:after,.chosen-container .search-choice .group-name:after{content:":";padding-left:2px;vertical-align:top}.chosen-container-single .chosen-single{position:relative;display:block;overflow:hidden;padding:0 0 0 8px;height:25px;border:1px solid #aaa;border-radius:5px;background-color:#fff;background:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#fff),color-stop(50%,#f6f6f6),color-stop(52%,#eee),to(#f4f4f4));background:linear-gradient(#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background-clip:padding-box;-webkit-box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);color:#444;text-decoration:none;white-space:nowrap;line-height:24px}.chosen-container-single .chosen-single input[type=text]{cursor:pointer;opacity:0;position:absolute;width:0}.chosen-container-single .chosen-default{color:#999}.chosen-container-single .chosen-single span{display:block;overflow:hidden;margin-right:26px;text-overflow:ellipsis;white-space:nowrap}.chosen-container-single .chosen-single-with-deselect span{margin-right:38px}.chosen-container-single .chosen-single abbr{position:absolute;top:6px;right:26px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-single .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single.chosen-disabled .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single .chosen-single div{position:absolute;top:0;right:0;display:block;width:18px;height:100%}.chosen-container-single .chosen-single div b{display:block;width:100%;height:100%;background:url(chosen-sprite.png) no-repeat 0 2px}.chosen-container-single .chosen-search{position:relative;z-index:1010;margin:0;padding:3px 4px;white-space:nowrap}.chosen-container-single .chosen-search input[type=text]{margin:1px 0;padding:4px 20px 4px 5px;width:100%;height:auto;outline:0;border:1px solid #aaa;background:url(chosen-sprite.png) no-repeat 100% -20px;font-size:1em;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-single .chosen-drop{margin-top:-1px;border-radius:0 0 4px 4px;background-clip:padding-box}.chosen-container-single.chosen-container-single-nosearch .chosen-search{position:absolute;opacity:0;pointer-events:none}.chosen-container .chosen-results{color:#444;position:relative;overflow-x:hidden;overflow-y:auto;margin:0 4px 4px 0;padding:0 0 0 4px;max-height:240px;-webkit-overflow-scrolling:touch}.chosen-container .chosen-results li{display:none;margin:0;padding:5px 6px;list-style:none;line-height:15px;word-wrap:break-word;-webkit-touch-callout:none}.chosen-container .chosen-results li.active-result{display:list-item;cursor:pointer}.chosen-container .chosen-results li.disabled-result{display:list-item;color:#ccc;cursor:default}.chosen-container .chosen-results li.highlighted{background-color:#3875d7;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#3875d7),color-stop(90%,#2a62bc));background-image:linear-gradient(#3875d7 20%,#2a62bc 90%);color:#fff}.chosen-container .chosen-results li.no-results{color:#777;display:list-item;background:#f4f4f4}.chosen-container .chosen-results li.group-result{display:list-item;font-weight:700;cursor:default}.chosen-container .chosen-results li.group-option{padding-left:15px}.chosen-container .chosen-results li em{font-style:normal;text-decoration:underline}.chosen-container-multi .chosen-choices{position:relative;overflow:hidden;margin:0;padding:0 5px;width:100%;height:auto;border:1px solid #aaa;background-color:#fff;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(1%,#eee),color-stop(15%,#fff));background-image:linear-gradient(#eee 1%,#fff 15%);cursor:text}.chosen-container-multi .chosen-choices li{float:left;list-style:none}.chosen-container-multi .chosen-choices li.search-field{margin:0;padding:0;white-space:nowrap}.chosen-container-multi .chosen-choices li.search-field input[type=text]{margin:1px 0;padding:0;height:25px;outline:0;border:0!important;background:0 0!important;-webkit-box-shadow:none;box-shadow:none;color:#999;font-size:100%;font-family:sans-serif;line-height:normal;border-radius:0;width:25px}.chosen-container-multi .chosen-choices li.search-choice{position:relative;margin:3px 5px 3px 0;padding:3px 20px 3px 5px;border:1px solid #aaa;max-width:100%;border-radius:3px;background-color:#eee;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),to(#eee));background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-size:100% 19px;background-repeat:repeat-x;background-clip:padding-box;-webkit-box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);color:#333;line-height:13px;cursor:default}.chosen-container-multi .chosen-choices li.search-choice span{word-wrap:break-word}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close{position:absolute;top:4px;right:3px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover{background-position:-42px -10px}.chosen-container-multi .chosen-choices li.search-choice-disabled{padding-right:5px;border:1px solid #ccc;background-color:#e4e4e4;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),to(#eee));background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);color:#666}.chosen-container-multi .chosen-choices li.search-choice-focus{background:#d4d4d4}.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close{background-position:-42px -10px}.chosen-container-multi .chosen-results{margin:0;padding:0}.chosen-container-multi .chosen-drop .result-selected{display:list-item;color:#ccc;cursor:default}.chosen-container-active .chosen-single{border:1px solid #5897fb;-webkit-box-shadow:0 0 5px rgba(0,0,0,.3);box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active.chosen-with-drop .chosen-single{border:1px solid #aaa;border-bottom-right-radius:0;border-bottom-left-radius:0;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#eee),color-stop(80%,#fff));background-image:linear-gradient(#eee 20%,#fff 80%);-webkit-box-shadow:0 1px 0 #fff inset;box-shadow:0 1px 0 #fff inset}.chosen-container-active.chosen-with-drop .chosen-single div{border-left:none;background:0 0}.chosen-container-active.chosen-with-drop .chosen-single div b{background-position:-18px 2px}.chosen-container-active .chosen-choices{border:1px solid #5897fb;-webkit-box-shadow:0 0 5px rgba(0,0,0,.3);box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active .chosen-choices li.search-field input[type=text]{color:#222!important}.chosen-disabled{opacity:.5!important;cursor:default}.chosen-disabled .chosen-single{cursor:default}.chosen-disabled .chosen-choices .search-choice .search-choice-close{cursor:default}.chosen-rtl{text-align:right}.chosen-rtl .chosen-single{overflow:visible;padding:0 8px 0 0}.chosen-rtl .chosen-single span{margin-right:0;margin-left:26px;direction:rtl}.chosen-rtl .chosen-single-with-deselect span{margin-left:38px}.chosen-rtl .chosen-single div{right:auto;left:3px}.chosen-rtl .chosen-single abbr{right:auto;left:26px}.chosen-rtl .chosen-choices li{float:right}.chosen-rtl .chosen-choices li.search-field input[type=text]{direction:rtl}.chosen-rtl .chosen-choices li.search-choice{margin:3px 5px 3px 0;padding:3px 5px 3px 19px}.chosen-rtl .chosen-choices li.search-choice .search-choice-close{right:auto;left:4px}.chosen-rtl.chosen-container-single .chosen-results{margin:0 0 4px 4px;padding:0 4px 0 0}.chosen-rtl .chosen-results li.group-option{padding-right:15px;padding-left:0}.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div{border-right:none}.chosen-rtl .chosen-search input[type=text]{padding:4px 5px 4px 20px;background:url(chosen-sprite.png) no-repeat -30px -20px;direction:rtl}.chosen-rtl.chosen-container-single .chosen-single div b{background-position:6px 2px}.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b{background-position:-12px 2px}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (min-resolution:144dpi),only screen and (min-resolution:1.5dppx){.chosen-container .chosen-results-scroll-down span,.chosen-container .chosen-results-scroll-up span,.chosen-container-multi .chosen-choices .search-choice .search-choice-close,.chosen-container-single .chosen-search input[type=text],.chosen-container-single .chosen-single abbr,.chosen-container-single .chosen-single div b,.chosen-rtl .chosen-search input[type=text]{background-image:url(chosen-sprite@2x.png)!important;background-size:52px 37px!important;background-repeat:no-repeat!important}}
|
includes/admin/meta/css/jqueryui.css
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* jQuery UI CSS Framework 1.8.14
|
3 |
+
*
|
4 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
5 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6 |
+
* http://jquery.org/license
|
7 |
+
*
|
8 |
+
* http://docs.jquery.com/UI/Theming/API
|
9 |
+
*/
|
10 |
+
|
11 |
+
/* Layout helpers
|
12 |
+
----------------------------------*/
|
13 |
+
.ui-helper-hidden { display: none; }
|
14 |
+
.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
|
15 |
+
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
|
16 |
+
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
|
17 |
+
.ui-helper-clearfix { display: inline-block; }
|
18 |
+
/* required comment for clearfix to work in Opera \*/
|
19 |
+
* html .ui-helper-clearfix { height:1%; }
|
20 |
+
.ui-helper-clearfix { display:block; }
|
21 |
+
/* end clearfix */
|
22 |
+
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
|
23 |
+
|
24 |
+
|
25 |
+
/* Interaction Cues
|
26 |
+
----------------------------------*/
|
27 |
+
.ui-state-disabled { cursor: default !important; }
|
28 |
+
|
29 |
+
|
30 |
+
/* Icons
|
31 |
+
----------------------------------*/
|
32 |
+
|
33 |
+
/* states and images */
|
34 |
+
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
|
35 |
+
|
36 |
+
|
37 |
+
/* Misc visuals
|
38 |
+
----------------------------------*/
|
39 |
+
|
40 |
+
/* Overlays */
|
41 |
+
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
|
42 |
+
|
43 |
+
|
44 |
+
/*
|
45 |
+
* jQuery UI Slider 1.8.14
|
46 |
+
*
|
47 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
48 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
49 |
+
* http://jquery.org/license
|
50 |
+
*
|
51 |
+
* http://docs.jquery.com/UI/Slider#theming
|
52 |
+
*/
|
53 |
+
.ui-slider { position: relative; text-align: left; background:#ccc; border-radius:3px; width:300px; display:inline-block; margin-right:10px; }
|
54 |
+
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; background:#fff; border:1px solid #aaa; border-radius:3px; cursor:pointer; box-shadow:0 1px 1px rgba(0,0,0,.2); }
|
55 |
+
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
|
56 |
+
|
57 |
+
.ui-slider-horizontal { height: .8em; }
|
58 |
+
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
|
59 |
+
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
|
60 |
+
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
|
61 |
+
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
|
62 |
+
|
63 |
+
.ui-slider-vertical { width: .8em; height: 100px; }
|
64 |
+
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
|
65 |
+
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
|
66 |
+
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
|
67 |
+
.ui-slider-vertical .ui-slider-range-max { top: 0; }
|
68 |
+
|
69 |
+
/*
|
70 |
+
* jQuery UI Datepicker 1.8.14
|
71 |
+
*
|
72 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
73 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
74 |
+
* http://jquery.org/license
|
75 |
+
*
|
76 |
+
* http://docs.jquery.com/UI/Datepicker#theming
|
77 |
+
*/
|
78 |
+
.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; background:#fff; border:1px solid #aaa; border-radius:3px; z-index:100 !important; box-shadow:0 1px 2px rgba(0,0,0,.2); }
|
79 |
+
.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
|
80 |
+
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 5px; width: 1.8em; height: 1.8em; cursor:pointer; }
|
81 |
+
.ui-datepicker .ui-datepicker-prev { left:5px; font-size: 0px; line-height: 0%; width: 0px; border-top: 7px solid #fff; border-right: 13px solid #ccc; border-bottom: 7px solid #fff; }
|
82 |
+
.ui-datepicker .ui-datepicker-next { right:5px; font-size: 0px; line-height: 0%; width: 0px; border-top: 7px solid #fff; border-left: 13px solid #ccc; border-bottom: 7px solid #fff; }
|
83 |
+
.ui-datepicker .ui-datepicker-prev-hover { border-right-color:#aaa; }
|
84 |
+
.ui-datepicker .ui-datepicker-next-hover { border-left-color:#aaa; }
|
85 |
+
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
|
86 |
+
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
|
87 |
+
.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
|
88 |
+
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
|
89 |
+
.ui-datepicker select.ui-datepicker-month,
|
90 |
+
.ui-datepicker select.ui-datepicker-year { width: 49%;}
|
91 |
+
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
|
92 |
+
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
|
93 |
+
.ui-datepicker td { border: 0; padding: 1px; text-align:center; }
|
94 |
+
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; text-align:center; }
|
95 |
+
.ui-datepicker td a.ui-state-highlight { outline:1px solid #aaa; }
|
96 |
+
.ui-datepicker td a.ui-state-active { background:#aaa; color:#fff; cursor:default; }
|
97 |
+
.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
|
98 |
+
.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
|
99 |
+
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
|
100 |
+
|
101 |
+
/* with multiple calendars */
|
102 |
+
.ui-datepicker.ui-datepicker-multi { width:auto; }
|
103 |
+
.ui-datepicker-multi .ui-datepicker-group { float:left; }
|
104 |
+
.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
|
105 |
+
.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
|
106 |
+
.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
|
107 |
+
.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
|
108 |
+
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
|
109 |
+
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
|
110 |
+
.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
|
111 |
+
.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
|
112 |
+
|
113 |
+
/* RTL support */
|
114 |
+
.ui-datepicker-rtl { direction: rtl; }
|
115 |
+
.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
|
116 |
+
.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
|
117 |
+
.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
|
118 |
+
.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
|
119 |
+
.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
|
120 |
+
.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
|
121 |
+
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
|
122 |
+
.ui-datepicker-rtl .ui-datepicker-group { float:right; }
|
123 |
+
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
|
124 |
+
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
|
125 |
+
|
126 |
+
/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
|
127 |
+
.ui-datepicker-cover {
|
128 |
+
display: none; /*sorry for IE5*/
|
129 |
+
display/**/: block; /*sorry for IE5*/
|
130 |
+
position: absolute; /*must have*/
|
131 |
+
z-index: -1; /*must have*/
|
132 |
+
filter: mask(); /*must have*/
|
133 |
+
top: -4px; /*must have*/
|
134 |
+
left: -4px; /*must have*/
|
135 |
+
width: 200px; /*must have*/
|
136 |
+
height: 200px; /*must have*/
|
137 |
+
}
|
includes/admin/meta/css/meta_box.css
ADDED
@@ -0,0 +1,565 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Meta box styles
|
3 |
+
*/
|
4 |
+
.form-table.meta_box h2 {
|
5 |
+
border-bottom:1px dashed #ccc;
|
6 |
+
}
|
7 |
+
|
8 |
+
.form-table.meta_box th label {
|
9 |
+
font-weight:bold;
|
10 |
+
}
|
11 |
+
|
12 |
+
.form-table.meta_box .description {
|
13 |
+
font-size:11px;
|
14 |
+
color:#777;
|
15 |
+
font-style:italic;
|
16 |
+
}
|
17 |
+
|
18 |
+
.form-table.meta_box .meta_box_items {
|
19 |
+
margin:0;
|
20 |
+
padding:0;
|
21 |
+
}
|
22 |
+
|
23 |
+
.form-table.meta_box .meta_box_items li {
|
24 |
+
display:inline-block;
|
25 |
+
width:20%;
|
26 |
+
min-width:100px;
|
27 |
+
}
|
28 |
+
|
29 |
+
/* repeatable */
|
30 |
+
.form-table.meta_box .meta_box_repeatable {
|
31 |
+
width:100%;
|
32 |
+
}
|
33 |
+
.form-table.meta_box .meta_box_repeatable th {
|
34 |
+
width:auto !important;
|
35 |
+
padding:5px 10px;
|
36 |
+
border-bottom:1px dashed #ccc;
|
37 |
+
text-transform:uppercase;
|
38 |
+
font-size:10px;
|
39 |
+
text-shadow:none;
|
40 |
+
color:#ccc;
|
41 |
+
}
|
42 |
+
|
43 |
+
.form-table.meta_box .meta_box_repeatable tfoot th {
|
44 |
+
border-bottom:none;
|
45 |
+
}
|
46 |
+
|
47 |
+
.form-table.meta_box .meta_box_repeatable td {
|
48 |
+
width:auto !important;
|
49 |
+
vertical-align:top;
|
50 |
+
padding:10px;
|
51 |
+
border-bottom:1px dashed #ccc;
|
52 |
+
background:#fbfbfb;
|
53 |
+
}
|
54 |
+
|
55 |
+
.form-table.meta_box .meta_box_repeatable tr:nth-child(even) td {
|
56 |
+
background:none;
|
57 |
+
}
|
58 |
+
|
59 |
+
.form-table.meta_box .meta_box_repeatable td * {
|
60 |
+
display:block;
|
61 |
+
margin-bottom:3px;
|
62 |
+
}
|
63 |
+
|
64 |
+
.form-table.meta_box .meta_box_repeatable td .meta_box_upload_image_button,
|
65 |
+
.form-table.meta_box .meta_box_repeatable td small,
|
66 |
+
.form-table.meta_box .meta_box_repeatable td small a {
|
67 |
+
display:inline-block;
|
68 |
+
}
|
69 |
+
|
70 |
+
.form-table.meta_box .meta_box_repeatable td label {
|
71 |
+
display:block;
|
72 |
+
float:left;
|
73 |
+
width:100px;
|
74 |
+
font-weight:bold;
|
75 |
+
line-height:30px;
|
76 |
+
clear:left;
|
77 |
+
}
|
78 |
+
|
79 |
+
.form-table.meta_box .meta_box_repeatable td p {
|
80 |
+
margin:0;
|
81 |
+
float:left;
|
82 |
+
padding-bottom:5px;
|
83 |
+
}
|
84 |
+
|
85 |
+
.form-table.meta_box .meta_box_repeatable td textarea {
|
86 |
+
width: 300px;
|
87 |
+
}
|
88 |
+
|
89 |
+
.form-table.meta_box .meta_box_repeatable .repeatable_id {
|
90 |
+
background:#ccc;
|
91 |
+
width:30px;
|
92 |
+
text-align:center;
|
93 |
+
}
|
94 |
+
|
95 |
+
.meta_box_repeatable .sort_label {
|
96 |
+
display:block;
|
97 |
+
width:20px;
|
98 |
+
height:17px;
|
99 |
+
/*background:url(../images/sprite.png) no-repeat -68px -100px;*/
|
100 |
+
}
|
101 |
+
|
102 |
+
.meta_box_repeatable .sort {
|
103 |
+
display:block;
|
104 |
+
width:20px;
|
105 |
+
height:15px;
|
106 |
+
/*background:url(../images/sprite.png) 0 -100px;*/
|
107 |
+
margin-top:6px;
|
108 |
+
cursor:move;
|
109 |
+
}
|
110 |
+
|
111 |
+
.meta_box_repeatable_add,
|
112 |
+
.meta_box_repeatable_remove {
|
113 |
+
display:block;
|
114 |
+
width:18px;
|
115 |
+
height:16px;
|
116 |
+
/*background:url(../images/sprite.png);*/
|
117 |
+
margin-top:5px;
|
118 |
+
text-decoration:none;
|
119 |
+
cursor: pointer !important;
|
120 |
+
}
|
121 |
+
|
122 |
+
.meta_box_repeatable_add {
|
123 |
+
background-position:-30px -100px;
|
124 |
+
}
|
125 |
+
|
126 |
+
.meta_box_repeatable_remove {
|
127 |
+
background-position:-50px -100px;
|
128 |
+
}
|
129 |
+
|
130 |
+
.meta_box_repeatable tr:first-child .meta_box_repeatable_remove,
|
131 |
+
.meta_box_repeatable tr:first-child > td > .sort {
|
132 |
+
display:none;
|
133 |
+
}
|
134 |
+
|
135 |
+
/* image */
|
136 |
+
.meta_box_preview_image {
|
137 |
+
max-width:200px;
|
138 |
+
max-height:200px;
|
139 |
+
display:block;
|
140 |
+
margin-bottom:3px;
|
141 |
+
}
|
142 |
+
|
143 |
+
/* file */
|
144 |
+
.meta_box_file {
|
145 |
+
display:block;
|
146 |
+
width:37px;
|
147 |
+
height:48px;
|
148 |
+
background:url(../images/sprite.png) 0 0;
|
149 |
+
float:left;
|
150 |
+
margin-right:15px;
|
151 |
+
}
|
152 |
+
|
153 |
+
.meta_box_file.checked {
|
154 |
+
background-position:-50px 0;
|
155 |
+
}
|
156 |
+
|
157 |
+
.meta_box_filename {
|
158 |
+
margin-bottom:5px;
|
159 |
+
display:block;
|
160 |
+
font-weight:bold;
|
161 |
+
}
|
162 |
+
|
163 |
+
/* Select */
|
164 |
+
.form-table select {
|
165 |
+
width:auto;
|
166 |
+
}
|
167 |
+
|
168 |
+
.chosen-container-multi {
|
169 |
+
width: 95% !important;
|
170 |
+
}
|
171 |
+
|
172 |
+
.widget-content .meta_box_repeatable select {
|
173 |
+
width:96%;
|
174 |
+
}
|
175 |
+
|
176 |
+
/* post_drop_sort */
|
177 |
+
.post_drop_sort_areas,
|
178 |
+
.post_drop_sort_source {
|
179 |
+
width:250px;
|
180 |
+
margin-right:20px;
|
181 |
+
float:left;
|
182 |
+
}
|
183 |
+
|
184 |
+
.post_drop_sort_areas ul,
|
185 |
+
.post_drop_sort_source {
|
186 |
+
border-radius:5px;
|
187 |
+
border:3px dashed #ccc;
|
188 |
+
margin:0 0 10px;
|
189 |
+
padding:5px 10px 10px;
|
190 |
+
}
|
191 |
+
|
192 |
+
.post_drop_sort_source {
|
193 |
+
width:224px;
|
194 |
+
background:#ccc;
|
195 |
+
border:none;
|
196 |
+
}
|
197 |
+
|
198 |
+
.sort_list li {
|
199 |
+
padding:5px 10px;
|
200 |
+
cursor:move;
|
201 |
+
background:#fff;
|
202 |
+
margin:5px 0 0;
|
203 |
+
text-align:center;
|
204 |
+
}
|
205 |
+
|
206 |
+
.sort_list li.post_drop_sort_area_name {
|
207 |
+
font-weight:bold;
|
208 |
+
border-bottom:1px dashed #ccc;
|
209 |
+
color:#999;
|
210 |
+
background:none;
|
211 |
+
margin:0 0 10px;
|
212 |
+
padding:5px 0;
|
213 |
+
}
|
214 |
+
|
215 |
+
.post_drop_sort_source.sort_list li.post_drop_sort_area_name {
|
216 |
+
color:#fff;
|
217 |
+
border-color:#fff;
|
218 |
+
}
|
219 |
+
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Repeatable Row Styles
|
223 |
+
*/
|
224 |
+
.meta_box_repeatable .meta_box_repeatable_row {
|
225 |
+
width:100%;
|
226 |
+
}
|
227 |
+
.form-table.meta_box .meta_box_repeatable_row td * {
|
228 |
+
display:inline;
|
229 |
+
}
|
230 |
+
.form-table.meta_box .meta_box_repeatable_row td {
|
231 |
+
background-color: #fbfbfb;
|
232 |
+
}
|
233 |
+
.form-table.meta_box .meta_box_repeatable_row li {
|
234 |
+
display:block;
|
235 |
+
float: left;
|
236 |
+
padding: 5px;
|
237 |
+
/*min-height: 60px;*/
|
238 |
+
}
|
239 |
+
.form-table.meta_box .meta_box_repeatable_row select/*,
|
240 |
+
.form-table.meta_box .meta_box_repeatable_row textarea */ {
|
241 |
+
max-width: 120px;
|
242 |
+
width:120px;
|
243 |
+
}/*
|
244 |
+
.form-table.meta_box .meta_box_repeatable_row .small-text{
|
245 |
+
max-width: 280px;
|
246 |
+
width: 280px;
|
247 |
+
height: 28px;
|
248 |
+
}*/
|
249 |
+
.form-table.meta_box .meta_box_repeatable_row input[type=radio],
|
250 |
+
.form-table.meta_box .meta_box_repeatable_row input[type=checkbox] {
|
251 |
+
float: left;
|
252 |
+
display: block;
|
253 |
+
margin-top: 7px;
|
254 |
+
}
|
255 |
+
.form-table.meta_box .meta_box_repeatable_row td label {
|
256 |
+
line-height:inherit;
|
257 |
+
float:none;
|
258 |
+
}
|
259 |
+
.meta_box_repeatable .description {
|
260 |
+
font-size:11px;
|
261 |
+
font-weight:300;
|
262 |
+
}
|
263 |
+
.meta_box_repeatable .meta_box_repeatable_remove,
|
264 |
+
.meta_box_repeatable .ui-sortable-handle {
|
265 |
+
border: none;
|
266 |
+
}
|
267 |
+
.meta_box_repeatable .meta_box_repeatable_remove:hover,
|
268 |
+
.meta_box_repeatable .ui-sortable-handle:hover {
|
269 |
+
cursor:move;
|
270 |
+
}
|
271 |
+
.meta_box_repeatable .meta_box_repeatable_remove{
|
272 |
+
color:#ccc;
|
273 |
+
}
|
274 |
+
.meta_box_repeatable .meta_box_repeatable_remove:hover {
|
275 |
+
color:#cc0000;
|
276 |
+
}
|
277 |
+
.meta_box_repeatable .ui-sortable-handle:hover {
|
278 |
+
color:#333;
|
279 |
+
}
|
280 |
+
.meta_box_repeatable .dashicons {
|
281 |
+
font-size:14px;
|
282 |
+
width: 14px;
|
283 |
+
height: 14px;
|
284 |
+
}
|
285 |
+
|
286 |
+
|
287 |
+
|
288 |
+
/**
|
289 |
+
* Tooltip Styles
|
290 |
+
*/
|
291 |
+
|
292 |
+
/* Base styles for the element that has a tooltip */
|
293 |
+
[data-tooltip],
|
294 |
+
.tooltip {
|
295 |
+
position: relative;
|
296 |
+
cursor: pointer;
|
297 |
+
}
|
298 |
+
|
299 |
+
.form-table.meta_box .dashicons-info {
|
300 |
+
width: 16px;
|
301 |
+
height: 16px;
|
302 |
+
font-size: 16px;
|
303 |
+
line-height: 20px;
|
304 |
+
display: inline-block;
|
305 |
+
}
|
306 |
+
|
307 |
+
.form-table .dashicons-info:before {
|
308 |
+
color:#ccc;
|
309 |
+
}
|
310 |
+
|
311 |
+
/* Base styles for the entire tooltip */
|
312 |
+
[data-tooltip]:before,
|
313 |
+
[data-tooltip]:after,
|
314 |
+
.tooltip:before,
|
315 |
+
.tooltip:after {
|
316 |
+
position: absolute;
|
317 |
+
visibility: hidden;
|
318 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
|
319 |
+
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
|
320 |
+
opacity: 0;
|
321 |
+
-webkit-transition:
|
322 |
+
opacity 0.2s ease-in-out,
|
323 |
+
visibility 0.2s ease-in-out,
|
324 |
+
-webkit-transform 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);
|
325 |
+
-moz-transition:
|
326 |
+
opacity 0.2s ease-in-out,
|
327 |
+
visibility 0.2s ease-in-out,
|
328 |
+
-moz-transform 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);
|
329 |
+
transition:
|
330 |
+
opacity 0.2s ease-in-out,
|
331 |
+
visibility 0.2s ease-in-out,
|
332 |
+
transform 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);
|
333 |
+
-webkit-transform: translate3d(0, 0, 0);
|
334 |
+
-moz-transform: translate3d(0, 0, 0);
|
335 |
+
transform: translate3d(0, 0, 0);
|
336 |
+
pointer-events: none;
|
337 |
+
}
|
338 |
+
|
339 |
+
/* Show the entire tooltip on hover and focus */
|
340 |
+
[data-tooltip]:hover:before,
|
341 |
+
[data-tooltip]:hover:after,
|
342 |
+
[data-tooltip]:focus:before,
|
343 |
+
[data-tooltip]:focus:after,
|
344 |
+
.tooltip:hover:before,
|
345 |
+
.tooltip:hover:after,
|
346 |
+
.tooltip:focus:before,
|
347 |
+
.tooltip:focus:after {
|
348 |
+
visibility: visible;
|
349 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
|
350 |
+
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
|
351 |
+
opacity: 1;
|
352 |
+
}
|
353 |
+
|
354 |
+
/* Base styles for the tooltip's directional arrow */
|
355 |
+
.tooltip:before,
|
356 |
+
[data-tooltip]:before {
|
357 |
+
z-index: 1001;
|
358 |
+
border: 6px solid transparent;
|
359 |
+
background: transparent;
|
360 |
+
content: "";
|
361 |
+
}
|
362 |
+
|
363 |
+
/* Base styles for the tooltip's content area */
|
364 |
+
.tooltip:after,
|
365 |
+
[data-tooltip]:after {
|
366 |
+
z-index: 1000;
|
367 |
+
padding: 16px;
|
368 |
+
width: 160px;
|
369 |
+
background-color: #000;
|
370 |
+
background-color: hsla(0, 0%, 20%, 0.9);
|
371 |
+
color: #fff;
|
372 |
+
content: attr(data-tooltip);
|
373 |
+
font-size: 14px;
|
374 |
+
font-weight: normal;
|
375 |
+
line-height: 1.2;
|
376 |
+
}
|
377 |
+
|
378 |
+
/* Directions */
|
379 |
+
|
380 |
+
/* Top (default) */
|
381 |
+
[data-tooltip]:before,
|
382 |
+
[data-tooltip]:after,
|
383 |
+
.tooltip:before,
|
384 |
+
.tooltip:after,
|
385 |
+
.tooltip-top:before,
|
386 |
+
.tooltip-top:after {
|
387 |
+
bottom: 100%;
|
388 |
+
left: 50%;
|
389 |
+
}
|
390 |
+
|
391 |
+
[data-tooltip]:before,
|
392 |
+
.tooltip:before,
|
393 |
+
.tooltip-top:before {
|
394 |
+
margin-left: -6px;
|
395 |
+
margin-bottom: -12px;
|
396 |
+
border-top-color: #000;
|
397 |
+
border-top-color: hsla(0, 0%, 20%, 0.9);
|
398 |
+
}
|
399 |
+
|
400 |
+
/* Horizontally align top/bottom tooltips */
|
401 |
+
[data-tooltip]:after,
|
402 |
+
.tooltip:after,
|
403 |
+
.tooltip-top:after {
|
404 |
+
margin-left: -80px;
|
405 |
+
}
|
406 |
+
|
407 |
+
[data-tooltip]:hover:before,
|
408 |
+
[data-tooltip]:hover:after,
|
409 |
+
[data-tooltip]:focus:before,
|
410 |
+
[data-tooltip]:focus:after,
|
411 |
+
.tooltip:hover:before,
|
412 |
+
.tooltip:hover:after,
|
413 |
+
.tooltip:focus:before,
|
414 |
+
.tooltip:focus:after,
|
415 |
+
.tooltip-top:hover:before,
|
416 |
+
.tooltip-top:hover:after,
|
417 |
+
.tooltip-top:focus:before,
|
418 |
+
.tooltip-top:focus:after {
|
419 |
+
-webkit-transform: translateY(-12px);
|
420 |
+
-moz-transform: translateY(-12px);
|
421 |
+
transform: translateY(-12px);
|
422 |
+
}
|
423 |
+
|
424 |
+
/* Left */
|
425 |
+
.tooltip-left:before,
|
426 |
+
.tooltip-left:after {
|
427 |
+
right: 100%;
|
428 |
+
bottom: 50%;
|
429 |
+
left: auto;
|
430 |
+
}
|
431 |
+
|
432 |
+
.tooltip-left:before {
|
433 |
+
margin-left: 0;
|
434 |
+
margin-right: -12px;
|
435 |
+
margin-bottom: 0;
|
436 |
+
border-top-color: transparent;
|
437 |
+
border-left-color: #000;
|
438 |
+
border-left-color: hsla(0, 0%, 20%, 0.9);
|
439 |
+
}
|
440 |
+
|
441 |
+
.tooltip-left:hover:before,
|
442 |
+
.tooltip-left:hover:after,
|
443 |
+
.tooltip-left:focus:before,
|
444 |
+
.tooltip-left:focus:after {
|
445 |
+
-webkit-transform: translateX(-12px);
|
446 |
+
-moz-transform: translateX(-12px);
|
447 |
+
transform: translateX(-12px);
|
448 |
+
}
|
449 |
+
|
450 |
+
/* Bottom */
|
451 |
+
.tooltip-bottom:before,
|
452 |
+
.tooltip-bottom:after {
|
453 |
+
top: 100%;
|
454 |
+
bottom: auto;
|
455 |
+
left: 50%;
|
456 |
+
}
|
457 |
+
|
458 |
+
.tooltip-bottom:before {
|
459 |
+
margin-top: -12px;
|
460 |
+
margin-bottom: 0;
|
461 |
+
border-top-color: transparent;
|
462 |
+
border-bottom-color: #000;
|
463 |
+
border-bottom-color: hsla(0, 0%, 20%, 0.9);
|
464 |
+
}
|
465 |
+
|
466 |
+
.tooltip-bottom:hover:before,
|
467 |
+
.tooltip-bottom:hover:after,
|
468 |
+
.tooltip-bottom:focus:before,
|
469 |
+
.tooltip-bottom:focus:after {
|
470 |
+
-webkit-transform: translateY(12px);
|
471 |
+
-moz-transform: translateY(12px);
|
472 |
+
transform: translateY(12px);
|
473 |
+
}
|
474 |
+
|
475 |
+
/* Right */
|
476 |
+
.tooltip-right:before,
|
477 |
+
.tooltip-right:after {
|
478 |
+
bottom: 50%;
|
479 |
+
left: 100%;
|
480 |
+
}
|
481 |
+
|
482 |
+
.tooltip-right:before {
|
483 |
+
margin-bottom: 0;
|
484 |
+
margin-left: -12px;
|
485 |
+
border-top-color: transparent;
|
486 |
+
border-right-color: #000;
|
487 |
+
border-right-color: hsla(0, 0%, 20%, 0.9);
|
488 |
+
}
|
489 |
+
|
490 |
+
.tooltip-right:hover:before,
|
491 |
+
.tooltip-right:hover:after,
|
492 |
+
.tooltip-right:focus:before,
|
493 |
+
.tooltip-right:focus:after {
|
494 |
+
-webkit-transform: translateX(12px);
|
495 |
+
-moz-transform: translateX(12px);
|
496 |
+
transform: translateX(12px);
|
497 |
+
}
|
498 |
+
|
499 |
+
/* Move directional arrows down a bit for left/right tooltips */
|
500 |
+
.tooltip-left:before,
|
501 |
+
.tooltip-right:before {
|
502 |
+
top: 3px;
|
503 |
+
}
|
504 |
+
|
505 |
+
/* Vertically center tooltip content for left/right tooltips */
|
506 |
+
.tooltip-left:after,
|
507 |
+
.tooltip-right:after {
|
508 |
+
margin-left: 0;
|
509 |
+
margin-bottom: -16px;
|
510 |
+
}
|
511 |
+
|
512 |
+
/* Criteria fields */
|
513 |
+
.criteria_fields {
|
514 |
+
float: left;
|
515 |
+
margin-right: 10px !important;
|
516 |
+
}
|
517 |
+
|
518 |
+
/* Custom */
|
519 |
+
#schema_article {
|
520 |
+
display: none;
|
521 |
+
}
|
522 |
+
#schema_cpt .form-table th {
|
523 |
+
width: 1% !important;
|
524 |
+
}
|
525 |
+
#schema_cpt .description {
|
526 |
+
margin-bottom: 20px;
|
527 |
+
display: block;
|
528 |
+
}
|
529 |
+
#_schema_review_pros-repeatable input,
|
530 |
+
#_schema_review_cons-repeatable input {
|
531 |
+
float:left;
|
532 |
+
}
|
533 |
+
.form-table.meta_box .meta_box_repeatable td * {
|
534 |
+
margin:0;
|
535 |
+
}
|
536 |
+
/* Remove "+ Add New Category" */
|
537 |
+
.post-type-schema .taxonomy-add-new {
|
538 |
+
display:none;
|
539 |
+
}
|
540 |
+
|
541 |
+
/* Input & Textarea placeholder */
|
542 |
+
#schema_post_meta_box input::-webkit-input-placeholder {
|
543 |
+
color: #ccc;
|
544 |
+
}
|
545 |
+
#schema_post_meta_box input:-moz-placeholder { /* older Firefox*/
|
546 |
+
color: #ccc;
|
547 |
+
}
|
548 |
+
#schema_post_meta_box input::-moz-placeholder { /* Firefox 19+ */
|
549 |
+
color: #ccc;
|
550 |
+
}
|
551 |
+
#schema_post_meta_box input:-ms-input-placeholder {
|
552 |
+
color: #ccc;
|
553 |
+
}
|
554 |
+
#schema_post_meta_box textarea::-webkit-input-placeholder {
|
555 |
+
color: #ccc;
|
556 |
+
}
|
557 |
+
#schema_post_meta_box textarea:-moz-placeholder { /* older Firefox*/
|
558 |
+
color: #ccc;
|
559 |
+
}
|
560 |
+
#schema_post_meta_box textarea::-moz-placeholder { /* Firefox 19+ */
|
561 |
+
color: #ccc;
|
562 |
+
}
|
563 |
+
#schema_post_meta_box textarea:-ms-input-placeholder {
|
564 |
+
color: #ccc;
|
565 |
+
}
|
includes/admin/meta/images/chosen-sprite.png
ADDED
Binary file
|
includes/admin/meta/images/image.png
ADDED
Binary file
|
includes/admin/meta/images/sprite.png
ADDED
Binary file
|
includes/admin/meta/js/chosen.js
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
/* Chosen v1.8.5 | (c) 2011-2018 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
|
2 |
+
|
3 |
+
(function(){var t,e,s,i,n=function(t,e){return function(){return t.apply(e,arguments)}},o=function(t,e){function s(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return s.prototype=e.prototype,t.prototype=new s,t.__super__=e.prototype,t},r={}.hasOwnProperty;(i=function(){function t(){this.options_index=0,this.parsed=[]}return t.prototype.add_node=function(t){return"OPTGROUP"===t.nodeName.toUpperCase()?this.add_group(t):this.add_option(t)},t.prototype.add_group=function(t){var e,s,i,n,o,r;for(e=this.parsed.length,this.parsed.push({array_index:e,group:!0,label:t.label,title:t.title?t.title:void 0,children:0,disabled:t.disabled,classes:t.className}),r=[],s=0,i=(o=t.childNodes).length;s<i;s++)n=o[s],r.push(this.add_option(n,e,t.disabled));return r},t.prototype.add_option=function(t,e,s){if("OPTION"===t.nodeName.toUpperCase())return""!==t.text?(null!=e&&(this.parsed[e].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:t.value,text:t.text,html:t.innerHTML,title:t.title?t.title:void 0,selected:t.selected,disabled:!0===s?s:t.disabled,group_array_index:e,group_label:null!=e?this.parsed[e].label:null,classes:t.className,style:t.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},t}()).select_to_array=function(t){var e,s,n,o,r;for(o=new i,s=0,n=(r=t.childNodes).length;s<n;s++)e=r[s],o.add_node(e);return o.parsed},e=function(){function t(e,s){this.form_field=e,this.options=null!=s?s:{},this.label_click_handler=n(this.label_click_handler,this),t.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return t.prototype.set_default_values=function(){return this.click_test_action=function(t){return function(e){return t.test_active_click(e)}}(this),this.activate_action=function(t){return function(e){return t.activate_field(e)}}(this),this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.is_rtl=this.options.rtl||/\bchosen-rtl\b/.test(this.form_field.className),this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text&&this.options.allow_single_deselect,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null==this.options.enable_split_word_search||this.options.enable_split_word_search,this.group_search=null==this.options.group_search||this.options.group_search,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null==this.options.single_backstroke_delete||this.options.single_backstroke_delete,this.max_selected_options=this.options.max_selected_options||Infinity,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null==this.options.display_selected_options||this.options.display_selected_options,this.display_disabled_options=null==this.options.display_disabled_options||this.options.display_disabled_options,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY,this.case_sensitive_search=this.options.case_sensitive_search||!1,this.hide_results_on_select=null==this.options.hide_results_on_select||this.options.hide_results_on_select},t.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||t.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||t.default_single_text,this.default_text=this.escape_html(this.default_text),this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||t.default_no_result_text},t.prototype.choice_label=function(t){return this.include_group_label_in_selected&&null!=t.group_label?"<b class='group-name'>"+t.group_label+"</b>"+t.html:t.html},t.prototype.mouse_enter=function(){return this.mouse_on_container=!0},t.prototype.mouse_leave=function(){return this.mouse_on_container=!1},t.prototype.input_focus=function(t){if(this.is_multiple){if(!this.active_field)return setTimeout(function(t){return function(){return t.container_mousedown()}}(this),50)}else if(!this.active_field)return this.activate_field()},t.prototype.input_blur=function(t){if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(t){return function(){return t.blur_test()}}(this),100)},t.prototype.label_click_handler=function(t){return this.is_multiple?this.container_mousedown(t):this.activate_field()},t.prototype.results_option_build=function(t){var e,s,i,n,o,r,h;for(e="",h=0,n=0,o=(r=this.results_data).length;n<o&&(s=r[n],i="",""!==(i=s.group?this.result_add_group(s):this.result_add_option(s))&&(h++,e+=i),(null!=t?t.first:void 0)&&(s.selected&&this.is_multiple?this.choice_build(s):s.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(s))),!(h>=this.max_shown_results));n++);return e},t.prototype.result_add_option=function(t){var e,s;return t.search_match&&this.include_option_in_results(t)?(e=[],t.disabled||t.selected&&this.is_multiple||e.push("active-result"),!t.disabled||t.selected&&this.is_multiple||e.push("disabled-result"),t.selected&&e.push("result-selected"),null!=t.group_array_index&&e.push("group-option"),""!==t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),t.style&&(s.style.cssText=t.style),s.setAttribute("data-option-array-index",t.array_index),s.innerHTML=t.highlighted_html||t.html,t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.result_add_group=function(t){var e,s;return(t.search_match||t.group_match)&&t.active_options>0?((e=[]).push("group-result"),t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),s.innerHTML=t.highlighted_html||this.escape_html(t.label),t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.results_update_field=function(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()},t.prototype.reset_single_select_options=function(){var t,e,s,i,n;for(n=[],t=0,e=(s=this.results_data).length;t<e;t++)(i=s[t]).selected?n.push(i.selected=!1):n.push(void 0);return n},t.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},t.prototype.results_search=function(t){return this.results_showing?this.winnow_results():this.results_show()},t.prototype.winnow_results=function(t){var e,s,i,n,o,r,h,l,c,_,a,u,d,f,p;for(this.no_results_clear(),_=0,e=(h=this.get_search_text()).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),c=this.get_search_regex(e),i=0,n=(l=this.results_data).length;i<n;i++)(o=l[i]).search_match=!1,a=null,u=null,o.highlighted_html="",this.include_option_in_results(o)&&(o.group&&(o.group_match=!1,o.active_options=0),null!=o.group_array_index&&this.results_data[o.group_array_index]&&(0===(a=this.results_data[o.group_array_index]).active_options&&a.search_match&&(_+=1),a.active_options+=1),p=o.group?o.label:o.text,o.group&&!this.group_search||(u=this.search_string_match(p,c),o.search_match=null!=u,o.search_match&&!o.group&&(_+=1),o.search_match?(h.length&&(d=u.index,r=p.slice(0,d),s=p.slice(d,d+h.length),f=p.slice(d+h.length),o.highlighted_html=this.escape_html(r)+"<em>"+this.escape_html(s)+"</em>"+this.escape_html(f)),null!=a&&(a.group_match=!0)):null!=o.group_array_index&&this.results_data[o.group_array_index].search_match&&(o.search_match=!0)));return this.result_clear_highlight(),_<1&&h.length?(this.update_results_content(""),this.no_results(h)):(this.update_results_content(this.results_option_build()),(null!=t?t.skip_highlight:void 0)?void 0:this.winnow_results_set_highlight())},t.prototype.get_search_regex=function(t){var e,s;return s=this.search_contains?t:"(^|\\s|\\b)"+t+"[^\\s]*",this.enable_split_word_search||this.search_contains||(s="^"+s),e=this.case_sensitive_search?"":"i",new RegExp(s,e)},t.prototype.search_string_match=function(t,e){var s;return s=e.exec(t),!this.search_contains&&(null!=s?s[1]:void 0)&&(s.index+=1),s},t.prototype.choices_count=function(){var t,e,s;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,t=0,e=(s=this.form_field.options).length;t<e;t++)s[t].selected&&(this.selected_option_count+=1);return this.selected_option_count},t.prototype.choices_click=function(t){if(t.preventDefault(),this.activate_field(),!this.results_showing&&!this.is_disabled)return this.results_show()},t.prototype.keydown_checker=function(t){var e,s;switch(s=null!=(e=t.which)?e:t.keyCode,this.search_field_scale(),8!==s&&this.pending_backstroke&&this.clear_backstroke(),s){case 8:this.backstroke_length=this.get_search_field_value().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(t),this.mouse_on_container=!1;break;case 13:case 27:this.results_showing&&t.preventDefault();break;case 32:this.disable_search&&t.preventDefault();break;case 38:t.preventDefault(),this.keyup_arrow();break;case 40:t.preventDefault(),this.keydown_arrow()}},t.prototype.keyup_checker=function(t){var e,s;switch(s=null!=(e=t.which)?e:t.keyCode,this.search_field_scale(),s){case 8:this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0?this.keydown_backstroke():this.pending_backstroke||(this.result_clear_highlight(),this.results_search());break;case 13:t.preventDefault(),this.results_showing&&this.result_select(t);break;case 27:this.results_showing&&this.results_hide();break;case 9:case 16:case 17:case 18:case 38:case 40:case 91:break;default:this.results_search()}},t.prototype.clipboard_event_checker=function(t){if(!this.is_disabled)return setTimeout(function(t){return function(){return t.results_search()}}(this),50)},t.prototype.container_width=function(){return null!=this.options.width?this.options.width:this.form_field.offsetWidth+"px"},t.prototype.include_option_in_results=function(t){return!(this.is_multiple&&!this.display_selected_options&&t.selected)&&(!(!this.display_disabled_options&&t.disabled)&&!t.empty)},t.prototype.search_results_touchstart=function(t){return this.touch_started=!0,this.search_results_mouseover(t)},t.prototype.search_results_touchmove=function(t){return this.touch_started=!1,this.search_results_mouseout(t)},t.prototype.search_results_touchend=function(t){if(this.touch_started)return this.search_results_mouseup(t)},t.prototype.outerHTML=function(t){var e;return t.outerHTML?t.outerHTML:((e=document.createElement("div")).appendChild(t),e.innerHTML)},t.prototype.get_single_html=function(){return'<a class="chosen-single chosen-default">\n <input class="chosen-focus-input" type="text" autocomplete="off" />\n <span>'+this.default_text+'</span>\n <div><b></b></div>\n</a>\n<div class="chosen-drop">\n <div class="chosen-search">\n <input class="chosen-search-input" type="text" autocomplete="off" />\n </div>\n <ul class="chosen-results"></ul>\n</div>'},t.prototype.get_multi_html=function(){return'<ul class="chosen-choices">\n <li class="search-field">\n <input class="chosen-search-input" type="text" autocomplete="off" value="'+this.default_text+'" />\n </li>\n</ul>\n<div class="chosen-drop">\n <ul class="chosen-results"></ul>\n</div>'},t.prototype.get_no_results_html=function(t){return'<li class="no-results">\n '+this.results_none_found+" <span>"+this.escape_html(t)+"</span>\n</li>"},t.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:!(/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent))},t.default_multiple_text="Select Some Options",t.default_single_text="Select an Option",t.default_no_result_text="No results match",t}(),(t=jQuery).fn.extend({chosen:function(i){return e.browser_is_supported()?this.each(function(e){var n,o;o=(n=t(this)).data("chosen"),"destroy"!==i?o instanceof s||n.data("chosen",new s(this,i)):o instanceof s&&o.destroy()}):this}}),s=function(s){function n(){return n.__super__.constructor.apply(this,arguments)}return o(n,e),n.prototype.setup=function(){return this.form_field_jq=t(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex},n.prototype.set_up_html=function(){var e,s;return(e=["chosen-container"]).push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&e.push(this.form_field.className),this.is_rtl&&e.push("chosen-rtl"),s={"class":e.join(" "),title:this.form_field.title},this.form_field.id.length&&(s.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=t("<div />",s),this.container.width(this.container_width()),this.is_multiple?this.container.html(this.get_multi_html()):this.container.html(this.get_single_html()),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input.chosen-search-input"),this.focus_field=this.container.find("input.chosen-focus-input"),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},n.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},n.prototype.register_observers=function(){var t;return this.container.on("touchstart.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("touchend.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mousedown.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("mouseup.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mouseenter.chosen",function(t){return function(e){t.mouse_enter(e)}}(this)),this.container.on("mouseleave.chosen",function(t){return function(e){t.mouse_leave(e)}}(this)),this.search_results.on("mouseup.chosen",function(t){return function(e){t.search_results_mouseup(e)}}(this)),this.search_results.on("mouseover.chosen",function(t){return function(e){t.search_results_mouseover(e)}}(this)),this.search_results.on("mouseout.chosen",function(t){return function(e){t.search_results_mouseout(e)}}(this)),this.search_results.on("mousewheel.chosen DOMMouseScroll.chosen",function(t){return function(e){t.search_results_mousewheel(e)}}(this)),this.search_results.on("touchstart.chosen",function(t){return function(e){t.search_results_touchstart(e)}}(this)),this.search_results.on("touchmove.chosen",function(t){return function(e){t.search_results_touchmove(e)}}(this)),this.search_results.on("touchend.chosen",function(t){return function(e){t.search_results_touchend(e)}}(this)),this.form_field_jq.on("chosen:updated.chosen",function(t){return function(e){t.results_update_field(e)}}(this)),this.form_field_jq.on("chosen:activate.chosen",function(t){return function(e){t.activate_field(e)}}(this)),this.form_field_jq.on("chosen:open.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.form_field_jq.on("chosen:close.chosen",function(t){return function(e){t.close_field(e)}}(this)),this.search_field.on("blur.chosen",function(t){return function(e){t.input_blur(e)}}(this)),this.search_field.on("keyup.chosen",function(t){return function(e){t.keyup_checker(e)}}(this)),this.search_field.on("keydown.chosen",function(t){return function(e){t.keydown_checker(e)}}(this)),this.search_field.on("focus.chosen",function(t){return function(e){t.input_focus(e)}}(this)),this.search_field.on("cut.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.search_field.on("paste.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.is_multiple?this.search_choices.on("click.chosen",function(t){return function(e){t.choices_click(e)}}(this)):(this.container.on("click.chosen",function(t){t.preventDefault()}),this.focus_field.on("blur.chosen",function(t){return function(e){t.input_blur(e)}}(this)),this.focus_field.on("focus.chosen",function(t){return function(e){t.input_focus(e)}}(this)),t=function(t){return function(){return t.search_field.val(t.focus_field.val()),t.focus_field.val("")}}(this),this.focus_field.on("keyup.chosen",function(e){return function(s){t(),e.keyup_checker(s)}}(this)),this.focus_field.on("keydown.chosen",function(e){return function(s){t(),e.keydown_checker(s)}}(this)),this.focus_field.on("cut.chosen",function(e){return function(s){setTimeout(t,0),e.clipboard_event_checker(s)}}(this)),this.focus_field.on("paste.chosen",function(e){return function(s){setTimeout(t,0),e.clipboard_event_checker(s)}}(this)))},n.prototype.destroy=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.form_field_label.length>0&&this.form_field_label.off("click.chosen"),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},n.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled||this.form_field_jq.parents("fieldset").is(":disabled"),this.container.toggleClass("chosen-disabled",this.is_disabled),this.search_field[0].disabled=this.is_disabled,this.is_multiple||this.selected_item.off("focus.chosen",this.activate_field),this.is_disabled?this.close_field():this.is_multiple?void 0:this.selected_item.on("focus.chosen",this.activate_field)},n.prototype.container_mousedown=function(e){var s;if(!this.is_disabled)return!e||"mousedown"!==(s=e.type)&&"touchstart"!==s||this.results_showing||e.preventDefault(),null!=e&&t(e.target).hasClass("search-choice-close")?void 0:(this.active_field?this.is_multiple||!e||t(e.target)[0]!==this.selected_item[0]&&!t(e.target).parents("a.chosen-single").length||(e.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),t(this.container[0].ownerDocument).on("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},n.prototype.container_mouseup=function(t){if("ABBR"===t.target.nodeName&&!this.is_disabled)return this.results_reset(t)},n.prototype.search_results_mousewheel=function(t){var e;if(t.originalEvent&&(e=t.originalEvent.deltaY||-t.originalEvent.wheelDelta||t.originalEvent.detail),null!=e)return t.preventDefault(),"DOMMouseScroll"===t.type&&(e*=40),this.search_results.scrollTop(e+this.search_results.scrollTop())},n.prototype.blur_test=function(t){if(!this.active_field&&this.container.hasClass("chosen-container-active"))return this.close_field()},n.prototype.close_field=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale(),this.search_field.blur()},n.prototype.activate_field=function(){if(!this.is_disabled)return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.focus()},n.prototype.test_active_click=function(e){var s;return(s=t(e.target).closest(".chosen-container")).length&&this.container[0]===s[0]?this.active_field=!0:this.close_field()},n.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=i.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.focus_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.focus_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},n.prototype.result_do_highlight=function(t){var e,s,i,n,o;if(t.length){if(this.result_clear_highlight(),this.result_highlight=t,this.result_highlight.addClass("highlighted"),i=parseInt(this.search_results.css("maxHeight"),10),o=this.search_results.scrollTop(),n=i+o,s=this.result_highlight.position().top+this.search_results.scrollTop(),(e=s+this.result_highlight.outerHeight())>=n)return this.search_results.scrollTop(e-i>0?e-i:0);if(s<o)return this.search_results.scrollTop(s)}},n.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},n.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.get_search_field_value()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},n.prototype.update_results_content=function(t){return this.search_results.html(t)},n.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),setTimeout(function(t){return function(){return t.focus_field.focus()}}(this),0),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},n.prototype.set_tab_index=function(t){var e,s;if(this.form_field.tabIndex)return s=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=s,null!=(e=this.focus_field[0])?e.tabIndex=s:void 0},n.prototype.set_label_behavior=function(){if(this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=t("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0)return this.form_field_label.on("click.chosen",this.label_click_handler)},n.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},n.prototype.search_results_mouseup=function(e){var s;if((s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first()).length)return this.result_highlight=s,this.result_select(e),this.search_field.focus()},n.prototype.search_results_mouseover=function(e){var s;if(s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first())return this.result_do_highlight(s)},n.prototype.search_results_mouseout=function(e){if(t(e.target).hasClass("active-result")||t(e.target).parents(".active-result").first())return this.result_clear_highlight()},n.prototype.choice_build=function(e){var s,i;return s=t("<li />",{"class":"search-choice"}).html("<span>"+this.choice_label(e)+"</span>"),e.disabled?s.addClass("search-choice-disabled"):((i=t("<a />",{"class":"search-choice-close","data-option-array-index":e.array_index})).on("click.chosen",function(t){return function(e){return t.choice_destroy_link_click(e)}}(this)),s.append(i)),this.search_container.before(s)},n.prototype.choice_destroy_link_click=function(e){if(e.preventDefault(),e.stopPropagation(),!this.is_disabled)return this.choice_destroy(t(e.target))},n.prototype.choice_destroy=function(t){if(this.result_deselect(t[0].getAttribute("data-option-array-index")))return this.active_field?this.search_field.focus():this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.get_search_field_value().length<1&&this.results_hide(),t.parents("li").first().remove(),this.search_field_scale()},n.prototype.results_reset=function(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.trigger_form_field_change(),this.active_field)return this.results_hide()},n.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},n.prototype.result_select=function(t){var e,s;if(this.result_highlight)return e=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?e.removeClass("active-result"):this.reset_single_select_options(),e.addClass("result-selected"),s=this.results_data[e[0].getAttribute("data-option-array-index")],s.selected=!0,this.form_field.options[s.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(s):this.single_set_selected_text(this.choice_label(s)),this.is_multiple&&(!this.hide_results_on_select||t.metaKey||t.ctrlKey)?t.metaKey||t.ctrlKey?this.winnow_results({skip_highlight:!0}):(this.search_field.val(""),this.winnow_results()):(this.results_hide(),this.show_search_field_default()),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.trigger_form_field_change({selected:this.form_field.options[s.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,t.preventDefault(),this.search_field_scale())},n.prototype.single_set_selected_text=function(t){return null==t&&(t=this.default_text),t===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(t)},n.prototype.result_deselect=function(t){var e;return e=this.results_data[t],!this.form_field.options[e.options_index].disabled&&(e.selected=!1,this.form_field.options[e.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.trigger_form_field_change({deselected:this.form_field.options[e.options_index].value}),this.search_field_scale(),!0)},n.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")},n.prototype.get_search_field_value=function(){return this.search_field.val()},n.prototype.get_search_text=function(){return t.trim(this.get_search_field_value())},n.prototype.escape_html=function(e){return t("<div/>").text(e).html()},n.prototype.winnow_results_set_highlight=function(){var t,e;if(e=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),null!=(t=e.length?e.first():this.search_results.find(".active-result").first()))return this.result_do_highlight(t)},n.prototype.no_results=function(t){var e;return e=this.get_no_results_html(t),this.search_results.append(e),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},n.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},n.prototype.keydown_arrow=function(){var t;return this.results_showing&&this.result_highlight?(t=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(t):void 0:this.results_show()},n.prototype.keyup_arrow=function(){var t;return this.results_showing||this.is_multiple?this.result_highlight?(t=this.result_highlight.prevAll("li.active-result")).length?this.result_do_highlight(t.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight()):void 0:this.results_show()},n.prototype.keydown_backstroke=function(){var t;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(t=this.search_container.siblings("li.search-choice").last()).length&&!t.hasClass("search-choice-disabled")?(this.pending_backstroke=t,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0},n.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},n.prototype.search_field_scale=function(){var e,s,i,n,o,r,h;if(this.is_multiple){for(o={position:"absolute",left:"-1000px",top:"-1000px",display:"none",whiteSpace:"pre"},s=0,i=(r=["fontSize","fontStyle","fontWeight","fontFamily","lineHeight","textTransform","letterSpacing"]).length;s<i;s++)o[n=r[s]]=this.search_field.css(n);return(e=t("<div />").css(o)).text(this.get_search_field_value()),t("body").append(e),h=e.width()+25,e.remove(),this.container.is(":visible")&&(h=Math.min(this.container.outerWidth()-10,h)),this.search_field.width(h)}},n.prototype.trigger_form_field_change=function(t){return this.form_field_jq.trigger("input",t),this.form_field_jq.trigger("change",t)},n}()}).call(this);
|
includes/admin/meta/js/schema.js
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(function($) {
|
2 |
+
|
3 |
+
// Reset
|
4 |
+
//$("#schema_article").hide();
|
5 |
+
|
6 |
+
var schema_type = $("#_schema_type").val();
|
7 |
+
|
8 |
+
if ( schema_type == 'Article')
|
9 |
+
$("#schema_article").show();
|
10 |
+
|
11 |
+
$('#_schema_type').on('change', function() {
|
12 |
+
if ( this.value == 'Article')
|
13 |
+
//.....................^.......
|
14 |
+
{
|
15 |
+
$("#schema_article").show();
|
16 |
+
}
|
17 |
+
else
|
18 |
+
{
|
19 |
+
$("#schema_article").hide();
|
20 |
+
}
|
21 |
+
});
|
22 |
+
|
23 |
+
|
24 |
+
// repeated post meta group / show hide main meta box
|
25 |
+
$('#schema_post_meta_box').hide();
|
26 |
+
|
27 |
+
var post_meta_enabled = $("#_schema_post_meta_box_enabled").attr('checked');
|
28 |
+
|
29 |
+
if (post_meta_enabled)
|
30 |
+
$('#schema_post_meta_box').show();
|
31 |
+
|
32 |
+
$('#_schema_post_meta_box_enabled').change(function(){
|
33 |
+
var checked = $(this).attr('checked');
|
34 |
+
if (checked) {
|
35 |
+
$('#schema_post_meta_box').show();
|
36 |
+
} else {
|
37 |
+
$('#schema_post_meta_box').hide();
|
38 |
+
}
|
39 |
+
});
|
40 |
+
|
41 |
+
// repeated post meta group fields
|
42 |
+
// first, hide all divs inside the repeatable row, which has the advanmced options
|
43 |
+
$('.meta_box_repeatable_row div').hide();
|
44 |
+
|
45 |
+
// do toggle
|
46 |
+
$('.meta_box_repeatable_row .toggle').toggle(function() {
|
47 |
+
$('#' + this.id + '_wrap').show();
|
48 |
+
$(this).html('Less <span class="dashicons dashicons-arrow-up-alt2"></span>'); // Less options
|
49 |
+
}, function() {
|
50 |
+
$('#' + this.id + '_wrap').hide();
|
51 |
+
$(this).html('Advanced <span class="dashicons dashicons-arrow-down-alt2"></span>'); // Advanced options
|
52 |
+
//$(this).html(this.id);
|
53 |
+
});
|
54 |
+
|
55 |
+
|
56 |
+
});
|
includes/admin/meta/js/scripts.js
ADDED
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(function($) {
|
2 |
+
|
3 |
+
// the upload image button, saves the id and outputs a preview of the image
|
4 |
+
var imageFrame;
|
5 |
+
|
6 |
+
$(document).on('click', '.meta_box_upload_image_button', function(e) {
|
7 |
+
event.preventDefault();
|
8 |
+
|
9 |
+
var options, attachment;
|
10 |
+
|
11 |
+
$self = $(event.target);
|
12 |
+
$div = $self.closest('div.meta_box_image');
|
13 |
+
|
14 |
+
// if the frame already exists, open it
|
15 |
+
if (imageFrame) {
|
16 |
+
imageFrame.open();
|
17 |
+
return;
|
18 |
+
}
|
19 |
+
|
20 |
+
// set our settings
|
21 |
+
imageFrame = wp.media({
|
22 |
+
title: 'Choose Image',
|
23 |
+
multiple: false,
|
24 |
+
library: {
|
25 |
+
type: 'image'
|
26 |
+
},
|
27 |
+
button: {
|
28 |
+
text: 'Use This Image'
|
29 |
+
}
|
30 |
+
});
|
31 |
+
|
32 |
+
// set up our select handler
|
33 |
+
imageFrame.on('select', function() {
|
34 |
+
selection = imageFrame.state().get('selection');
|
35 |
+
|
36 |
+
if (!selection)
|
37 |
+
return;
|
38 |
+
|
39 |
+
// loop through the selected files
|
40 |
+
selection.each(function(attachment) {
|
41 |
+
console.log(attachment);
|
42 |
+
var src = attachment.attributes.sizes.full.url;
|
43 |
+
var id = attachment.id;
|
44 |
+
|
45 |
+
$div.find('.meta_box_preview_image').attr('src', src);
|
46 |
+
$div.find('.meta_box_upload_image').val(id);
|
47 |
+
});
|
48 |
+
});
|
49 |
+
|
50 |
+
// open the frame
|
51 |
+
imageFrame.open();
|
52 |
+
});
|
53 |
+
|
54 |
+
// the remove image link, removes the image id from the hidden field and replaces the image preview
|
55 |
+
$(document).on('click', '.meta_box_clear_image_button', function(e) {
|
56 |
+
var defaultImage = $(this).parent().siblings('.meta_box_default_image').text();
|
57 |
+
$(this).parent().siblings('.meta_box_upload_image').val('');
|
58 |
+
$(this).parent().siblings('.meta_box_preview_image').attr('src', defaultImage);
|
59 |
+
return false;
|
60 |
+
});
|
61 |
+
|
62 |
+
// the file image button, saves the id and outputs the file name
|
63 |
+
var fileFrame;
|
64 |
+
|
65 |
+
$(document).on('click', '.meta_box_upload_file_button', function(e) {
|
66 |
+
e.preventDefault();
|
67 |
+
|
68 |
+
var options, attachment;
|
69 |
+
|
70 |
+
$self = $(event.target);
|
71 |
+
$div = $self.closest('div.meta_box_file_stuff');
|
72 |
+
|
73 |
+
// if the frame already exists, open it
|
74 |
+
if (fileFrame) {
|
75 |
+
fileFrame.open();
|
76 |
+
return;
|
77 |
+
}
|
78 |
+
|
79 |
+
// set our settings
|
80 |
+
fileFrame = wp.media({
|
81 |
+
title: 'Choose File',
|
82 |
+
multiple: false,
|
83 |
+
library: {
|
84 |
+
},
|
85 |
+
button: {
|
86 |
+
text: 'Use This File'
|
87 |
+
}
|
88 |
+
});
|
89 |
+
|
90 |
+
// set up our select handler
|
91 |
+
fileFrame.on('select', function() {
|
92 |
+
selection = fileFrame.state().get('selection');
|
93 |
+
|
94 |
+
if (!selection)
|
95 |
+
return;
|
96 |
+
|
97 |
+
// loop through the selected files
|
98 |
+
selection.each(function(attachment) {
|
99 |
+
console.log(attachment);
|
100 |
+
var src = attachment.attributes.url;
|
101 |
+
var id = attachment.id;
|
102 |
+
|
103 |
+
$div.find('.meta_box_filename').text(src);
|
104 |
+
$div.find('.meta_box_upload_file').val(src);
|
105 |
+
$div.find('.meta_box_file').addClass('checked');
|
106 |
+
});
|
107 |
+
});
|
108 |
+
|
109 |
+
// open the frame
|
110 |
+
fileFrame.open();
|
111 |
+
});
|
112 |
+
|
113 |
+
// the remove image link, removes the image id from the hidden field and replaces the image preview
|
114 |
+
$(document).on('click', '.meta_box_clear_file_button', function(e) {
|
115 |
+
$(this).parent().siblings('.meta_box_upload_file').val('');
|
116 |
+
$(this).parent().siblings('.meta_box_filename').text('');
|
117 |
+
$(this).parent().siblings('.meta_box_file').removeClass('checked');
|
118 |
+
return false;
|
119 |
+
});
|
120 |
+
|
121 |
+
// function to create an array of input values
|
122 |
+
function ids(inputs) {
|
123 |
+
var a = [];
|
124 |
+
for (var i = 0; i < inputs.length; i++) {
|
125 |
+
a.push(inputs[i].val);
|
126 |
+
}
|
127 |
+
//$("span").text(a.join(" "));
|
128 |
+
}
|
129 |
+
// repeatable fields
|
130 |
+
$(document).on('click', '.meta_box_repeatable_add', function(e) {
|
131 |
+
// clone
|
132 |
+
var row = $(this).closest('.meta_box_repeatable').find('tbody tr:last-child');
|
133 |
+
var clone = row.clone();
|
134 |
+
clone.find('select.chosen').removeAttr('style', '').removeAttr('id', '').removeClass('chzn-done').data('chosen', null).next().remove();
|
135 |
+
clone.find('input.regular-text, textarea, select').val('');
|
136 |
+
clone.find('input[type=checkbox], input[type=radio]').attr('checked', false);
|
137 |
+
clone.find('img.meta_box_preview_image').attr('src', '');
|
138 |
+
row.after(clone);
|
139 |
+
|
140 |
+
// increment name and id
|
141 |
+
clone.find('input, textarea, select')
|
142 |
+
.attr('name', function(index, name) {
|
143 |
+
return name.replace(/(\d+)/, function(fullMatch, n) {
|
144 |
+
return Number(n) + 1;
|
145 |
+
});
|
146 |
+
});
|
147 |
+
clone.find('.toggle, .toggle_div')
|
148 |
+
.attr('id', function(index, id) {
|
149 |
+
return id.replace(/(\d+)/, function(fullMatch, n) {
|
150 |
+
return Number(n) + 1;
|
151 |
+
});
|
152 |
+
});
|
153 |
+
var arr = [];
|
154 |
+
$('input.repeatable_id:text').each(function() {
|
155 |
+
arr.push($(this).val());
|
156 |
+
});
|
157 |
+
clone.find('input.repeatable_id')
|
158 |
+
.val(Number(Math.max.apply(Math, arr)) + 1);
|
159 |
+
if (!!$.prototype.chosen) {
|
160 |
+
clone.find('select.chosen')
|
161 |
+
.chosen({allow_single_deselect: true});
|
162 |
+
}
|
163 |
+
//
|
164 |
+
return false;
|
165 |
+
});
|
166 |
+
|
167 |
+
$(document).on('click', '.meta_box_repeatable_remove', function(e) {
|
168 |
+
if (!confirm('Are you sure you want to delete this field?')) return false;
|
169 |
+
$(this).closest('tr').remove();
|
170 |
+
return false;
|
171 |
+
});
|
172 |
+
|
173 |
+
$('.meta_box_repeatable tbody').sortable({
|
174 |
+
opacity: 0.6,
|
175 |
+
revert: true,
|
176 |
+
cursor: 'move',
|
177 |
+
handle: '.hndle'
|
178 |
+
});
|
179 |
+
|
180 |
+
// post_drop_sort
|
181 |
+
$('.sort_list').sortable({
|
182 |
+
connectWith: '.sort_list',
|
183 |
+
opacity: 0.6,
|
184 |
+
revert: true,
|
185 |
+
cursor: 'move',
|
186 |
+
cancel: '.post_drop_sort_area_name',
|
187 |
+
items: 'li:not(.post_drop_sort_area_name)',
|
188 |
+
update: function(event, ui) {
|
189 |
+
var result = $(this).sortable('toArray');
|
190 |
+
var thisID = $(this).attr('id');
|
191 |
+
$('.store-' + thisID).val(result);
|
192 |
+
}
|
193 |
+
});
|
194 |
+
|
195 |
+
$('.sort_list').disableSelection();
|
196 |
+
|
197 |
+
// turn select boxes into something magical
|
198 |
+
if (!!$.prototype.chosen)
|
199 |
+
$('.chosen').chosen({
|
200 |
+
//disable_search_threshold: 10,
|
201 |
+
//no_results_text: "Oops, nothing found!",
|
202 |
+
//width: "95%",
|
203 |
+
allow_single_deselect: true,
|
204 |
+
});
|
205 |
+
});
|
includes/admin/meta/sample.php
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?
|
2 |
+
|
3 |
+
$prefix = 'sample_';
|
4 |
+
|
5 |
+
$fields = array(
|
6 |
+
array( // Text Input
|
7 |
+
'label' => 'Text Input', // <label>
|
8 |
+
'desc' => 'A description for the field.', // description
|
9 |
+
'id' => $prefix.'text', // field id and name
|
10 |
+
'type' => 'text' // type of field
|
11 |
+
),
|
12 |
+
array( // Textarea
|
13 |
+
'label' => 'Textarea', // <label>
|
14 |
+
'desc' => 'A description for the field.', // description
|
15 |
+
'id' => $prefix.'textarea', // field id and name
|
16 |
+
'type' => 'textarea' // type of field
|
17 |
+
),
|
18 |
+
array( // Single checkbox
|
19 |
+
'label' => 'Checkbox Input', // <label>
|
20 |
+
'desc' => 'A description for the field.', // description
|
21 |
+
'id' => $prefix.'checkbox', // field id and name
|
22 |
+
'type' => 'checkbox' // type of field
|
23 |
+
),
|
24 |
+
array( // Select box
|
25 |
+
'label' => 'Select Box', // <label>
|
26 |
+
'desc' => 'A description for the field.', // description
|
27 |
+
'id' => $prefix.'select', // field id and name
|
28 |
+
'type' => 'select', // type of field
|
29 |
+
'options' => array ( // array of options
|
30 |
+
'one' => array ( // array key needs to be the same as the option value
|
31 |
+
'label' => 'Option One', // text displayed as the option
|
32 |
+
'value' => 'one' // value stored for the option
|
33 |
+
),
|
34 |
+
'two' => array (
|
35 |
+
'label' => 'Option Two',
|
36 |
+
'value' => 'two'
|
37 |
+
),
|
38 |
+
'three' => array (
|
39 |
+
'label' => 'Option Three',
|
40 |
+
'value' => 'three'
|
41 |
+
)
|
42 |
+
)
|
43 |
+
),
|
44 |
+
array ( // Radio group
|
45 |
+
'label' => 'Radio Group', // <label>
|
46 |
+
'desc' => 'A description for the field.', // description
|
47 |
+
'id' => $prefix.'radio', // field id and name
|
48 |
+
'type' => 'radio', // type of field
|
49 |
+
'options' => array ( // array of options
|
50 |
+
'one' => array ( // array key needs to be the same as the option value
|
51 |
+
'label' => 'Option One', // text displayed as the option
|
52 |
+
'value' => 'one' // value stored for the option
|
53 |
+
),
|
54 |
+
'two' => array (
|
55 |
+
'label' => 'Option Two',
|
56 |
+
'value' => 'two'
|
57 |
+
),
|
58 |
+
'three' => array (
|
59 |
+
'label' => 'Option Three',
|
60 |
+
'value' => 'three'
|
61 |
+
)
|
62 |
+
)
|
63 |
+
),
|
64 |
+
array ( // Checkbox group
|
65 |
+
'label' => 'Checkbox Group', // <label>
|
66 |
+
'desc' => 'A description for the field.', // description
|
67 |
+
'id' => $prefix.'checkbox_group', // field id and name
|
68 |
+
'type' => 'checkbox_group', // type of field
|
69 |
+
'options' => array ( // array of options
|
70 |
+
'one' => array ( // array key needs to be the same as the option value
|
71 |
+
'label' => 'Option One', // text displayed as the option
|
72 |
+
'value' => 'one' // value stored for the option
|
73 |
+
),
|
74 |
+
'two' => array (
|
75 |
+
'label' => 'Option Two',
|
76 |
+
'value' => 'two'
|
77 |
+
),
|
78 |
+
'three' => array (
|
79 |
+
'label' => 'Option Three',
|
80 |
+
'value' => 'three'
|
81 |
+
)
|
82 |
+
)
|
83 |
+
),
|
84 |
+
array( // Taxonomy Select box
|
85 |
+
'label' => 'Category', // <label>
|
86 |
+
// the description is created in the callback function with a link to Manage the taxonomy terms
|
87 |
+
'id' => 'category', // field id and name, needs to be the exact name of the taxonomy
|
88 |
+
'type' => 'tax_select' // type of field
|
89 |
+
),
|
90 |
+
array( // Post ID select box
|
91 |
+
'label' => 'Post List', // <label>
|
92 |
+
'desc' => 'A description for the field.', // description
|
93 |
+
'id' => $prefix.'post_id', // field id and name
|
94 |
+
'type' => 'post_select', // type of field
|
95 |
+
'post_type' => array('post','page') // post types to display, options are prefixed with their post type
|
96 |
+
),
|
97 |
+
array( // jQuery UI Date input
|
98 |
+
'label' => 'Date', // <label>
|
99 |
+
'desc' => 'A description for the field.', // description
|
100 |
+
'id' => $prefix.'date', // field id and name
|
101 |
+
'type' => 'date' // type of field
|
102 |
+
),
|
103 |
+
array( // jQuery UI Slider
|
104 |
+
'label' => 'Slider', // <label>
|
105 |
+
'desc' => 'A description for the field.', // description
|
106 |
+
'id' => $prefix.'slider', // field id and name
|
107 |
+
'type' => 'slider', // type of field
|
108 |
+
'min' => '0', // lowest possible number
|
109 |
+
'max' => '100', // highest possible number
|
110 |
+
'step' => '5' // how the slider steps as it is dragged
|
111 |
+
),
|
112 |
+
array( // Image ID field
|
113 |
+
'label' => 'Image', // <label>
|
114 |
+
'desc' => 'A description for the field.', // description
|
115 |
+
'id' => $prefix.'image', // field id and name
|
116 |
+
'type' => 'image' // type of field
|
117 |
+
),
|
118 |
+
array( // Repeatable & Sortable Text inputs
|
119 |
+
'label' => 'Repeatable', // <label>
|
120 |
+
'desc' => 'A description for the field.', // description
|
121 |
+
'id' => $prefix.'repeatable', // field id and name
|
122 |
+
'type' => 'repeatable', // type of field
|
123 |
+
'sanitizer' => array( // array of sanitizers with matching kets to next array
|
124 |
+
'featured' => 'schema_wp_meta_box_santitize_boolean',
|
125 |
+
'title' => 'sanitize_text_field',
|
126 |
+
'desc' => 'wp_kses_data'
|
127 |
+
),
|
128 |
+
'repeatable_fields' => array ( // array of fields to be repeated
|
129 |
+
'featured' => array(
|
130 |
+
'label' => 'Featured?',
|
131 |
+
'id' => 'featured',
|
132 |
+
'type' => 'checkbox'
|
133 |
+
),
|
134 |
+
array( // Image ID field
|
135 |
+
'label' => 'Image', // <label>
|
136 |
+
'id' => 'image', // field id and name
|
137 |
+
'type' => 'image' // type of field
|
138 |
+
),
|
139 |
+
'title' => array(
|
140 |
+
'label' => 'Title',
|
141 |
+
'id' => 'title',
|
142 |
+
'type' => 'text'
|
143 |
+
),
|
144 |
+
'desc' => array(
|
145 |
+
'label' => 'Description',
|
146 |
+
'id' => 'desc',
|
147 |
+
'type' => 'textarea'
|
148 |
+
)
|
149 |
+
)
|
150 |
+
)
|
151 |
+
);
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Instantiate the class with all variables to create a meta box
|
155 |
+
* var $id string meta box id
|
156 |
+
* var $title string title
|
157 |
+
* var $fields array fields
|
158 |
+
* var $page string|array post type to add meta box to
|
159 |
+
* var $js bool including javascript or not
|
160 |
+
*/
|
161 |
+
$sample_box = new custom_add_meta_box( 'sample_box', 'Sample Box', $fields, 'post', true );
|
includes/admin/post-type/class-columns.php
ADDED
@@ -0,0 +1,356 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Schema - Class Schema CPT Columns
|
4 |
+
* @category Core
|
5 |
+
* @author Hesham Zebida
|
6 |
+
* @version 1.6.7
|
7 |
+
*/
|
8 |
+
|
9 |
+
// Exit if accessed directly
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
+
|
12 |
+
if ( ! class_exists('Schema_WP_CPT_columns') ) {
|
13 |
+
/**
|
14 |
+
* CPT_columns
|
15 |
+
* Simple class to add remove and manage admin post columns
|
16 |
+
* @author Ohad Raz <admin@bainternet.info>
|
17 |
+
* @version 0.1
|
18 |
+
* @copyright 2013 Ohad Raz
|
19 |
+
*/
|
20 |
+
class Schema_WP_CPT_columns{
|
21 |
+
/**
|
22 |
+
* $cpt_columns
|
23 |
+
*
|
24 |
+
* holds columns
|
25 |
+
* @var array
|
26 |
+
*/
|
27 |
+
public $cpt_columns = array();
|
28 |
+
/**
|
29 |
+
* $cpt_remove_columns
|
30 |
+
*
|
31 |
+
* holds columns to be removed
|
32 |
+
* @var array
|
33 |
+
*/
|
34 |
+
public $cpt_remove_columns = array();
|
35 |
+
/**
|
36 |
+
* $cpt_sortable_columns
|
37 |
+
*
|
38 |
+
* holds sortable columns
|
39 |
+
* @var array
|
40 |
+
*/
|
41 |
+
public $cpt_sortable_columns = array();
|
42 |
+
/**
|
43 |
+
* $cpt_name
|
44 |
+
*
|
45 |
+
* Holds custom post type name
|
46 |
+
* @var string
|
47 |
+
*/
|
48 |
+
public $cpt_name = '';
|
49 |
+
/**
|
50 |
+
* $replace
|
51 |
+
*
|
52 |
+
* Should coulmns be replace (true) or added (false)
|
53 |
+
* @var boolean
|
54 |
+
*/
|
55 |
+
public $replace = false;
|
56 |
+
/**
|
57 |
+
* __construct
|
58 |
+
*
|
59 |
+
* @author Ohad Raz <admin@bainternet.info>
|
60 |
+
* @since 0.1
|
61 |
+
* @param string $cpt custom post type name
|
62 |
+
* @param boolean $replace (optional) replace or add
|
63 |
+
*/
|
64 |
+
function __construct($cpt = '', $replace = false){
|
65 |
+
$this->cpt_name = $cpt;
|
66 |
+
$this->replace = $replace;
|
67 |
+
//add columns
|
68 |
+
add_filter( "manage_{$cpt}_posts_columns", array($this,'_cpt_columns' ),50);
|
69 |
+
//remove columns
|
70 |
+
add_filter( "manage_{$cpt}_posts_columns", array($this,'_cpt_columns_remove' ),60);
|
71 |
+
//display columns
|
72 |
+
add_action("manage_{$cpt}_posts_custom_column", array($this,'_cpt_custom_column'), 50, 2);
|
73 |
+
//sortable columns
|
74 |
+
add_filter( "manage_edit-{$cpt}_sortable_columns", array($this,"_sortable_columns" ),50);
|
75 |
+
//sort order
|
76 |
+
add_filter( 'pre_get_posts',array($this, '_column_orderby' ),50);
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* _cpt_columns
|
81 |
+
*
|
82 |
+
* @author Ohad Raz <admin@bainternet.info>
|
83 |
+
* @since 0.1
|
84 |
+
* @param array $defaults
|
85 |
+
* @return array
|
86 |
+
*/
|
87 |
+
function _cpt_columns($defaults){
|
88 |
+
global $typenow;
|
89 |
+
if ($this->cpt_name == $typenow){
|
90 |
+
$tmp = array();
|
91 |
+
foreach ($this->cpt_columns as $key => $args) {
|
92 |
+
$tmp[$key] = $args['label'];
|
93 |
+
}
|
94 |
+
if ($this->replace)
|
95 |
+
return $tmp;
|
96 |
+
else
|
97 |
+
$defaults = array_merge($defaults,$tmp);
|
98 |
+
}
|
99 |
+
|
100 |
+
return $defaults;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* _cpt_columns_remove
|
105 |
+
*
|
106 |
+
* used to remove columns
|
107 |
+
* @author Ohad Raz <admin@bainternet.info>
|
108 |
+
* @since 0.1
|
109 |
+
* @param array $columns
|
110 |
+
* @return array
|
111 |
+
*/
|
112 |
+
function _cpt_columns_remove($columns){
|
113 |
+
foreach ($this->cpt_remove_columns as $key) {
|
114 |
+
if (isset($columns[$key]))
|
115 |
+
unset($columns[$key]);
|
116 |
+
}
|
117 |
+
return $columns;
|
118 |
+
}
|
119 |
+
/**
|
120 |
+
* _sortable_columns
|
121 |
+
*
|
122 |
+
* sets sortable columns
|
123 |
+
* @author Ohad Raz <admin@bainternet.info>
|
124 |
+
* @since 0.1
|
125 |
+
* @param array $columns
|
126 |
+
* @return array
|
127 |
+
*/
|
128 |
+
function _sortable_columns($columns){
|
129 |
+
global $typenow;
|
130 |
+
if ($this->cpt_name == $typenow){
|
131 |
+
foreach ($this->cpt_sortable_columns as $key => $args) {
|
132 |
+
$columns[$key] = $key;
|
133 |
+
}
|
134 |
+
}
|
135 |
+
return $columns;
|
136 |
+
}
|
137 |
+
/**
|
138 |
+
* _cpt_custom_column
|
139 |
+
*
|
140 |
+
* calls do_column() when the column is set
|
141 |
+
* @author Ohad Raz <admin@bainternet.info>
|
142 |
+
* @since 0.1
|
143 |
+
* @param string $column_name column name
|
144 |
+
* @param int $post_id post ID
|
145 |
+
* @return void
|
146 |
+
*/
|
147 |
+
function _cpt_custom_column($column_name, $post_id) {
|
148 |
+
if(isset($this->cpt_columns[$column_name]))
|
149 |
+
$this->do_column($post_id,$this->cpt_columns[$column_name],$column_name);
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* do_column
|
154 |
+
*
|
155 |
+
* used to display the column
|
156 |
+
* @author Ohad Raz <admin@bainternet.info>
|
157 |
+
* @since 0.1
|
158 |
+
* @param int $post_id post ID
|
159 |
+
* @param array $column column args
|
160 |
+
* @param string $column_name column name
|
161 |
+
* @return void
|
162 |
+
*/
|
163 |
+
function do_column($post_id,$column,$column_name){
|
164 |
+
if (in_array($column['type'],array('text','thumb','post_meta','custom_tax', 'post_meta_array','indicator', 'cpt_post_count','markup_source') ) )
|
165 |
+
echo $column['prefix'];
|
166 |
+
switch ($column['type']) {
|
167 |
+
case 'text':
|
168 |
+
echo apply_filters( 'cpt_columns_text_'.$column_name, $column['text'],$post_id,$column, $column_name);
|
169 |
+
break;
|
170 |
+
case 'thumb':
|
171 |
+
if (has_post_thumbnail( $post_id )){
|
172 |
+
the_post_thumbnail( $column['size'] );
|
173 |
+
}else{
|
174 |
+
echo 'N/A';
|
175 |
+
}
|
176 |
+
break;
|
177 |
+
case 'post_meta':
|
178 |
+
$tmp = get_post_meta($post_id,$column['meta_key'],true);
|
179 |
+
echo (!empty($tmp))? $tmp : $column['std'];
|
180 |
+
break;
|
181 |
+
case 'custom_tax':
|
182 |
+
$post_type = get_post_type($post_id);
|
183 |
+
$terms = get_the_terms($post_id, $column['taxonomy']);
|
184 |
+
if ( !empty($terms) ) {
|
185 |
+
foreach ( $terms as $term ){
|
186 |
+
$href = "edit.php?post_type={$post_type}&{$column['taxonomy']}={$term->slug}";
|
187 |
+
$name = esc_html(sanitize_term_field('name', $term->name, $term->term_id, $column['taxonomy'], 'edit'));
|
188 |
+
$post_terms[] = "<a href='{$href}'>{$name}</a>";
|
189 |
+
}
|
190 |
+
echo join( ', ', $post_terms );
|
191 |
+
}
|
192 |
+
else echo '';
|
193 |
+
break;
|
194 |
+
case 'post_meta_array':
|
195 |
+
$tmp = get_post_meta( $post_id, $column['meta_key'], true );
|
196 |
+
if ( is_array($tmp) || ! empty($tmp) ) {
|
197 |
+
foreach ($tmp as $key) {
|
198 |
+
$pt = ( isset($key) ) ? get_post_type_object( $key ) : '';
|
199 |
+
if ( isset($pt->label) ) {
|
200 |
+
$count = wp_count_posts($key);
|
201 |
+
//echo $pt->label . ' (' . $count->publish . ')';
|
202 |
+
echo $pt->label;
|
203 |
+
} else {echo (isset($column['std'])) ? $column['std'] : '';}
|
204 |
+
}
|
205 |
+
}
|
206 |
+
break;
|
207 |
+
case 'cpt_post_count':
|
208 |
+
$tmp = get_post_meta( $post_id, $column['meta_key'], true );
|
209 |
+
if ( is_array($tmp) || ! empty($tmp) ) {
|
210 |
+
foreach ($tmp as $key) {
|
211 |
+
$pt = ( isset($key) ) ? get_post_type_object( $key ) : '';
|
212 |
+
if ( isset($pt->label) ) {
|
213 |
+
$count = wp_count_posts($key);
|
214 |
+
echo $count->publish;
|
215 |
+
} else {echo (isset($column['std'])) ? $column['std'] : '';}
|
216 |
+
}
|
217 |
+
}
|
218 |
+
break;
|
219 |
+
case 'indicator':
|
220 |
+
$tmp = get_post_meta( $post_id, $column['meta_key'], true );
|
221 |
+
if ( isset($tmp) && $tmp) {
|
222 |
+
echo '<span class="dashicons dashicons-marker" style="color:green;"></span>';
|
223 |
+
} else {
|
224 |
+
echo '<span class="dashicons dashicons-marker" style="color:#ccc;"></span>';
|
225 |
+
}
|
226 |
+
break;
|
227 |
+
case 'markup_source':
|
228 |
+
$tmp = get_post_meta( $post_id, $column['meta_key'], true );
|
229 |
+
if ( isset($tmp) && $tmp) {
|
230 |
+
if ($tmp == 'editor')
|
231 |
+
echo '<span class="dashicons dashicons-admin-users">';
|
232 |
+
if ($tmp == 'user')
|
233 |
+
echo '<span class="dashicons dashicons-groups"></span>';
|
234 |
+
} else {
|
235 |
+
echo '<span class="dashicons dashicons-marker" style="color:#ccc;"></span>';
|
236 |
+
}
|
237 |
+
break;
|
238 |
+
}//end switch
|
239 |
+
if (in_array($column['type'],array('text','thumb','post_meta','custom_tax','post_meta_array','indicator', 'cpt_post_count','markup_source') ) )
|
240 |
+
echo $column['suffix'];
|
241 |
+
}//end do_column
|
242 |
+
|
243 |
+
/**
|
244 |
+
* _column_orderby
|
245 |
+
*
|
246 |
+
* used to roder by meta keys
|
247 |
+
* @author Ohad Raz <admin@bainternet.info>
|
248 |
+
* @since 0.1
|
249 |
+
* @param object $query
|
250 |
+
* @return void
|
251 |
+
*/
|
252 |
+
function _column_orderby( $query ) {
|
253 |
+
if( ! is_admin() )
|
254 |
+
return;
|
255 |
+
|
256 |
+
$orderby = $query->get( 'orderby');
|
257 |
+
$keys = array_keys((array)$this->cpt_sortable_columns);
|
258 |
+
if ( in_array($orderby,$keys) ) {
|
259 |
+
//order by meta
|
260 |
+
if ('post_meta' == $this->cpt_sortable_columns[$orderby]['type']){
|
261 |
+
$query->set('meta_key',$orderby);
|
262 |
+
$query->set('orderby',$this->cpt_sortable_columns[$orderby]['orderby']);
|
263 |
+
}
|
264 |
+
}
|
265 |
+
}//end _column_orderby
|
266 |
+
|
267 |
+
/**
|
268 |
+
* add_column
|
269 |
+
*
|
270 |
+
* used to add column
|
271 |
+
* @author Ohad Raz <admin@bainternet.info>
|
272 |
+
* @since 0.1
|
273 |
+
* @param string $key column id
|
274 |
+
* @param array $args column arguments
|
275 |
+
* @return void
|
276 |
+
*/
|
277 |
+
function add_column($key,$args){
|
278 |
+
$def = array(
|
279 |
+
'label' => 'column label',
|
280 |
+
'size' => array('80','80'),
|
281 |
+
'taxonomy' => '',
|
282 |
+
'meta_key' => '',
|
283 |
+
'sortable' => false,
|
284 |
+
'text' => '',
|
285 |
+
'type' => 'native', //'native','post_meta','custom_tax',text
|
286 |
+
'orderby' => 'meta_value',
|
287 |
+
'prefix' => '',
|
288 |
+
'suffix' => '',
|
289 |
+
'std' => '',
|
290 |
+
);
|
291 |
+
$this->cpt_columns[$key] = array_merge($def,$args);
|
292 |
+
|
293 |
+
if ($this->cpt_columns[$key]['sortable'])
|
294 |
+
$this->cpt_sortable_columns[$key] = $this->cpt_columns[$key];
|
295 |
+
}//end add_column
|
296 |
+
|
297 |
+
/**
|
298 |
+
* remove_column
|
299 |
+
*
|
300 |
+
* Used to remove columns
|
301 |
+
*
|
302 |
+
* @author Ohad Raz <admin@bainternet.info>
|
303 |
+
* @since 0.1
|
304 |
+
* @param string $key column key to be removed
|
305 |
+
* @return void
|
306 |
+
*/
|
307 |
+
function remove_column($key){
|
308 |
+
$this->cpt_remove_columns[] = $key;
|
309 |
+
}//end remove_column
|
310 |
+
|
311 |
+
}//end class
|
312 |
+
}//end if
|
313 |
+
|
314 |
+
/* usage:
|
315 |
+
//create an instance
|
316 |
+
$post_columns = new Schema_CPT_columns('post'); // if you want to replace and reorder columns then pass a second parameter as true
|
317 |
+
//add native column
|
318 |
+
$post_columns->add_column('title',
|
319 |
+
array(
|
320 |
+
'label' => __('Title'),
|
321 |
+
'type' => 'native',
|
322 |
+
'sortable' => true
|
323 |
+
)
|
324 |
+
);
|
325 |
+
//add thumbnail column
|
326 |
+
$post_columns->add_column('post_thumb',
|
327 |
+
array(
|
328 |
+
'label' => __('Thumb'),
|
329 |
+
'type' => 'thumb',
|
330 |
+
'size' => array('80,80') //size accepted by the_post_thumbnail as array or string
|
331 |
+
)
|
332 |
+
);
|
333 |
+
//add taxonomy
|
334 |
+
$post_columns->add_column('custom_tax_id',
|
335 |
+
array(
|
336 |
+
'label' => __('Custom Taxonomy'),
|
337 |
+
'type' => 'custom_tax',
|
338 |
+
'taxonomy' => 'category' //taxonomy name
|
339 |
+
)
|
340 |
+
);
|
341 |
+
//custom field column
|
342 |
+
$post_columns->add_column('price',
|
343 |
+
array(
|
344 |
+
'label' => __('Custom Field'),
|
345 |
+
'type' => 'post_meta',
|
346 |
+
'meta_key' => 'price', //meta_key
|
347 |
+
'orderby' => 'meta_value', //meta_value,meta_value_num
|
348 |
+
'sortable' => true,
|
349 |
+
'prefix' => "$",
|
350 |
+
'suffix' => "",
|
351 |
+
'def' => "", // default value in case post meta not found
|
352 |
+
)
|
353 |
+
);
|
354 |
+
//remove date column
|
355 |
+
$post_columns->remove_column('date');
|
356 |
+
*/
|
includes/admin/post-type/schema-columns.php
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Schema - Schema Post Type Columns
|
4 |
+
* @category Core
|
5 |
+
* @author Hesham Zebida
|
6 |
+
* @version 1.6.7
|
7 |
+
*/
|
8 |
+
|
9 |
+
// Exit if accessed directly
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
+
|
12 |
+
if ( ! class_exists('Schema_WP_CPT_columns') ) return;
|
13 |
+
|
14 |
+
$post_columns = new Schema_WP_CPT_columns('schema'); // if you want to replace and reorder columns then pass a second parameter as true
|
15 |
+
|
16 |
+
//add native column
|
17 |
+
$post_columns->add_column('title',
|
18 |
+
array(
|
19 |
+
'label' => __('Name', 'schema-wp'),
|
20 |
+
'type' => 'native',
|
21 |
+
'sortable' => true
|
22 |
+
)
|
23 |
+
);
|
24 |
+
//custom field column
|
25 |
+
$post_columns->add_column('schema_type',
|
26 |
+
array(
|
27 |
+
'label' => __('Schema Type', 'schema-wp'),
|
28 |
+
'type' => 'post_meta',
|
29 |
+
'meta_key' => '_schema_type', //meta_key
|
30 |
+
'orderby' => 'meta_value', //meta_value,meta_value_num
|
31 |
+
'sortable' => true,
|
32 |
+
'prefix' => "",
|
33 |
+
'suffix' => "",
|
34 |
+
'std' => __('Not set!'), // default value in case post meta not found
|
35 |
+
)
|
36 |
+
);
|
37 |
+
$post_columns->add_column('schema_post_types',
|
38 |
+
array(
|
39 |
+
'label' => __('Post Type', 'schema-wp'),
|
40 |
+
'type' => 'post_meta_array',
|
41 |
+
'meta_key' => '_schema_post_types', //meta_key
|
42 |
+
'orderby' => 'meta_value', //meta_value,meta_value_num
|
43 |
+
'sortable' => true,
|
44 |
+
'prefix' => "",
|
45 |
+
'suffix' => "",
|
46 |
+
'std' => __('-'), // default value in case post meta not found
|
47 |
+
)
|
48 |
+
);
|
49 |
+
$post_columns->add_column('schema_cpt_post_count',
|
50 |
+
array(
|
51 |
+
'label' => __('Content', 'schema-wp'),
|
52 |
+
'type' => 'cpt_post_count',
|
53 |
+
'meta_key' => '_schema_post_types', //meta_key
|
54 |
+
'orderby' => 'meta_value', //meta_value,meta_value_num
|
55 |
+
'sortable' => true,
|
56 |
+
'prefix' => "",
|
57 |
+
'suffix' => "",
|
58 |
+
'std' => __('-'), // default value in case post meta not found
|
59 |
+
)
|
60 |
+
);
|
61 |
+
|
62 |
+
//remove columns
|
63 |
+
$post_columns->remove_column('post_type');
|
64 |
+
$post_columns->remove_column('categories');
|
65 |
+
$post_columns->remove_column('date');
|
66 |
+
|
67 |
+
// remove columns appended by
|
68 |
+
$post_columns->remove_column('gadwp_stats');
|
69 |
+
$post_columns->remove_column('mashsb_shares');
|
70 |
+
|
71 |
+
|
72 |
+
|
73 |
+
add_filter( 'post_row_actions', 'remove_row_actions', 10, 1 );
|
74 |
+
/**
|
75 |
+
* Remove row actions: View.& Quick Edit links
|
76 |
+
*
|
77 |
+
* @since 1.6.7
|
78 |
+
*
|
79 |
+
* @param array $actions
|
80 |
+
*
|
81 |
+
* @return array
|
82 |
+
*/
|
83 |
+
function remove_row_actions( $actions ) {
|
84 |
+
if( get_post_type() === 'schema' ) {
|
85 |
+
unset( $actions['view'] );
|
86 |
+
unset( $actions['inline hide-if-no-js'] );
|
87 |
+
}
|
88 |
+
|
89 |
+
return $actions;
|
90 |
+
}
|
91 |
+
|
includes/admin/post-type/schema-post-type.php
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema Custom Post Type
|
4 |
+
*
|
5 |
+
* @package Schema
|
6 |
+
* @subpackage Schema Custom Post Type
|
7 |
+
* @copyright Copyright (c) 2016, Hesham Zebida
|
8 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
+
* @since 1.3
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
|
16 |
+
add_action( 'init', 'schema_wp_cpt_init' );
|
17 |
+
/**
|
18 |
+
* Register Schema post type.
|
19 |
+
*
|
20 |
+
* @link http://codex.wordpress.org/Function_Reference/register_post_type
|
21 |
+
* @since 1.3
|
22 |
+
*/
|
23 |
+
function schema_wp_cpt_init() {
|
24 |
+
$labels = array(
|
25 |
+
'name' => _x( 'Schema', 'post type general name', 'schema-wp' ),
|
26 |
+
'singular_name' => _x( 'Schema', 'post type singular name', 'schema-wp' ),
|
27 |
+
'menu_name' => _x( 'Schema', 'admin menu', 'schema-wp' ),
|
28 |
+
'name_admin_bar' => _x( 'Schema', 'add new on admin bar', 'schema-wp' ),
|
29 |
+
'add_new' => _x( 'Add New', 'schema', 'schema-wp' ),
|
30 |
+
'add_new_item' => __( 'Add New Schema', 'schema-wp' ),
|
31 |
+
'new_item' => __( 'New Schema', 'schema-wp' ),
|
32 |
+
'edit_item' => __( 'Edit Schema', 'schema-wp' ),
|
33 |
+
'view_item' => __( 'View Schema', 'schema-wp' ),
|
34 |
+
'all_items' => __( 'All Schemas', 'schema-wp' ),
|
35 |
+
'search_items' => __( 'Search Schemas', 'schema-wp' ),
|
36 |
+
'parent_item_colon' => __( 'Parent Schemas:', 'schema-wp' ),
|
37 |
+
'not_found' => __( 'No schema found.', 'schema-wp' ),
|
38 |
+
'not_found_in_trash' => __( 'No schema found in Trash.', 'schema-wp' )
|
39 |
+
);
|
40 |
+
|
41 |
+
$args = array(
|
42 |
+
'labels' => $labels,
|
43 |
+
'description' => __( 'Description.', 'schema-wp' ),
|
44 |
+
'public' => false,
|
45 |
+
'publicly_queryable' => true,
|
46 |
+
'show_ui' => true,
|
47 |
+
'show_in_menu' => false,
|
48 |
+
'show_in_nav_menus' => false,
|
49 |
+
'show_in_admin_bar' => false,
|
50 |
+
'query_var' => true,
|
51 |
+
//'rewrite' => array( 'slug' => 'schema' ),
|
52 |
+
'rewrite' => false,
|
53 |
+
'capability_type' => 'post',
|
54 |
+
'map_meta_cap' => true, // Set to false, if users are not allowed to edit/delete existing schema
|
55 |
+
'has_archive' => false,
|
56 |
+
'can_export' => true,
|
57 |
+
'hierarchical' => false,
|
58 |
+
'exclude_from_search' => true,
|
59 |
+
'menu_position' => null,
|
60 |
+
'taxonomies' => array( 'category' ),
|
61 |
+
'supports' => array( 'title' )
|
62 |
+
);
|
63 |
+
|
64 |
+
register_post_type( 'schema', $args );
|
65 |
+
}
|
66 |
+
|
67 |
+
|
68 |
+
add_filter( 'post_updated_messages', 'schema_wp_cpt_updated_messages' );
|
69 |
+
/**
|
70 |
+
* Book update messages.
|
71 |
+
*
|
72 |
+
* See /wp-admin/edit-form-advanced.php
|
73 |
+
*
|
74 |
+
* @param array $messages Existing post update messages.
|
75 |
+
*
|
76 |
+
* @return array Amended post update messages with new CPT update messages.
|
77 |
+
* @since 1.3
|
78 |
+
*/
|
79 |
+
function schema_wp_cpt_updated_messages( $messages ) {
|
80 |
+
|
81 |
+
global $current_screen;
|
82 |
+
|
83 |
+
if ( $current_screen->post_type != 'schema' ) return $messages;
|
84 |
+
|
85 |
+
$post = get_post();
|
86 |
+
$post_type = get_post_type( $post );
|
87 |
+
$post_type_object = get_post_type_object( $post_type );
|
88 |
+
|
89 |
+
$messages['schema'] = array(
|
90 |
+
0 => '', // Unused. Messages start at index 1.
|
91 |
+
1 => __( 'Schema updated.', 'schema-wp' ),
|
92 |
+
2 => __( 'Custom field updated.', 'schema-wp' ),
|
93 |
+
3 => __( 'Custom field deleted.', 'schema-wp' ),
|
94 |
+
4 => __( 'Schema saved.', 'schema-wp' ),
|
95 |
+
/* translators: %s: date and time of the revision */
|
96 |
+
5 => isset( $_GET['revision'] ) ? sprintf( __( 'Schema restored to revision from %s', 'schema-wp' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
|
97 |
+
6 => __( 'Schema created.', 'schema-wp' ),
|
98 |
+
7 => __( 'Schema saved.', 'schema-wp' ),
|
99 |
+
8 => __( 'Schema added.', 'schema-wp' ),
|
100 |
+
9 => sprintf(
|
101 |
+
__( 'Schema scheduled for: <strong>%1$s</strong>.', 'schema-wp' ),
|
102 |
+
// translators: Publish box date format, see http://php.net/date
|
103 |
+
date_i18n( __( 'M j, Y @ G:i', 'schema-wp' ), strtotime( $post->post_date ) )
|
104 |
+
),
|
105 |
+
10 => __( 'Schema draft updated.', 'schema-wp' )
|
106 |
+
);
|
107 |
+
|
108 |
+
if ( $post_type_object->publicly_queryable ) {
|
109 |
+
$permalink = get_permalink( $post->ID );
|
110 |
+
|
111 |
+
$view_link = sprintf( ' <a href="%s">%s</a>', esc_url( $permalink ), __( 'View schema', 'schema-wp' ) );
|
112 |
+
$view_link = '';
|
113 |
+
$messages[ $post_type ][1] .= $view_link;
|
114 |
+
$messages[ $post_type ][6] .= $view_link;
|
115 |
+
$messages[ $post_type ][9] .= $view_link;
|
116 |
+
|
117 |
+
$preview_permalink = add_query_arg( 'preview', 'true', $permalink );
|
118 |
+
$preview_link = sprintf( ' <a target="_blank" href="%s">%s</a>', esc_url( $preview_permalink ), __( 'Preview schema', 'schema-wp' ) );
|
119 |
+
$preview_link = '';
|
120 |
+
$messages[ $post_type ][8] .= $preview_link;
|
121 |
+
$messages[ $post_type ][10] .= $preview_link;
|
122 |
+
}
|
123 |
+
|
124 |
+
return $messages;
|
125 |
+
}
|
126 |
+
|
127 |
+
|
128 |
+
//add_filter( 'post_row_actions', 'schema_wp_cpt_remove_row_actions', 10, 2 );
|
129 |
+
/**
|
130 |
+
* Remove quick edit and preview links for custom post type schema
|
131 |
+
*
|
132 |
+
* @param array $actions and $post
|
133 |
+
*
|
134 |
+
* @return array
|
135 |
+
* @link https://wordpress.org/support/topic/remove-quick-edit-from-custom-post-type?replies=11#post-2253706
|
136 |
+
* @since 1.3
|
137 |
+
*/
|
138 |
+
function schema_wp_cpt_remove_row_actions( $actions, $post ) {
|
139 |
+
|
140 |
+
global $current_screen;
|
141 |
+
|
142 |
+
//if ( $current_screen->post_type != 'schema' ) return $actions;
|
143 |
+
|
144 |
+
if( get_post_type() === 'schema' ) {
|
145 |
+
|
146 |
+
//unset( $actions['edit'] );
|
147 |
+
unset( $actions['view'] );
|
148 |
+
//unset( $actions['trash'] );
|
149 |
+
unset( $actions['inline hide-if-no-js'] );
|
150 |
+
//$actions['inline hide-if-no-js'] .= __( 'Quick Edit' );
|
151 |
+
}
|
152 |
+
return $actions;
|
153 |
+
}
|
154 |
+
|
155 |
+
|
156 |
+
// Not used, found a better function: schema_wp_replace_submit_meta_box()
|
157 |
+
//add_filter( 'gettext', 'schema_wp_change_publish_button', 10, 2 );
|
158 |
+
/**
|
159 |
+
* Modify Publish button on Schema post type
|
160 |
+
*
|
161 |
+
* @param array $translation and $text
|
162 |
+
*
|
163 |
+
* @return string
|
164 |
+
* @link http://wordpress.stackexchange.com/questions/3578/change-the-text-on-the-publish-button
|
165 |
+
* @since 1.4.7
|
166 |
+
*/
|
167 |
+
function schema_wp_change_publish_button( $translation, $text ) {
|
168 |
+
|
169 |
+
if ( ! isset($_GET['post_type']) || $_GET['post_type'] != 'schema' ) return $translation;
|
170 |
+
|
171 |
+
if ( $text == 'Publish' )
|
172 |
+
return __('Create Schema', 'schema-wp');
|
173 |
+
|
174 |
+
return $translation;
|
175 |
+
}
|
176 |
+
|
177 |
+
// Not used, found a better option below...
|
178 |
+
add_action( 'transition_post_status', 'schema_wp_set_post_status_to_publish', 10, 3 );
|
179 |
+
/**
|
180 |
+
* Make sure that Schema post status is set to publish
|
181 |
+
*
|
182 |
+
* @since 1.4.8
|
183 |
+
*/
|
184 |
+
function schema_wp_set_post_status_to_publish( $new_status, $old_status, $post ) {
|
185 |
+
if ( $post->post_type == 'schema' && $new_status == 'draft' && $old_status != $new_status ) {
|
186 |
+
$post->post_status = 'publish';
|
187 |
+
wp_update_post( $post );
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
//add_filter( 'wp_insert_post_data', 'schema_wp_force_type_publish' );
|
192 |
+
/**
|
193 |
+
* Make sure that Schema post status is set to publish
|
194 |
+
*
|
195 |
+
* @since 1.4.8
|
196 |
+
*/
|
197 |
+
function schema_wp_force_type_publish($post) {
|
198 |
+
if ($post['post_type'] == 'schema')
|
199 |
+
$post['post_status'] = 'publish';
|
200 |
+
return $post;
|
201 |
+
}
|
includes/admin/post-type/schema-wp-ajax.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* AJAX to validate event before publishing
|
4 |
+
*
|
5 |
+
* @package Schema
|
6 |
+
* @subpackage Schema Custom Post Type
|
7 |
+
* @copyright Copyright (c) 2016, Hesham Zebida
|
8 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
+
* @since 1.4.7
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
|
16 |
+
add_action('admin_enqueue_scripts-post.php', 'schema_wp_load_post_edit_jquery_js');
|
17 |
+
add_action('admin_enqueue_scripts-post-new.php', 'schema_wp_load_post_edit_jquery_js');
|
18 |
+
/**
|
19 |
+
* Make sure that jQuery is loaded in the post edit page
|
20 |
+
*
|
21 |
+
* @link http://wordpress.stackexchange.com/questions/42013/prevent-post-from-being-published-if-custom-fields-not-filled?answertab=votes#tab-top
|
22 |
+
* @since 1.4.7
|
23 |
+
*/
|
24 |
+
function schema_wp_load_post_edit_jquery_js(){
|
25 |
+
global $post;
|
26 |
+
if ( $post->post_type == 'schema' ) {
|
27 |
+
wp_enqueue_script('jquery');
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
|
32 |
+
add_action('admin_head-post.php','schema_wp_publish_admin_hook');
|
33 |
+
add_action('admin_head-post-new.php','schema_wp_publish_admin_hook');
|
34 |
+
/**
|
35 |
+
* Print script to post edit
|
36 |
+
*
|
37 |
+
* @since 1.4.7
|
38 |
+
*/
|
39 |
+
function schema_wp_publish_admin_hook(){
|
40 |
+
|
41 |
+
global $post;
|
42 |
+
|
43 |
+
if ( is_admin() && $post->post_type == 'schema' ) {
|
44 |
+
|
45 |
+
?>
|
46 |
+
<script language="javascript" type="text/javascript">
|
47 |
+
jQuery(document).ready(function() {
|
48 |
+
jQuery('#publish').click(function() {
|
49 |
+
if(jQuery(this).data("valid")) {
|
50 |
+
return true;
|
51 |
+
}
|
52 |
+
var form_data = jQuery('#post').serializeArray();
|
53 |
+
var data = {
|
54 |
+
action: 'schema_wp_pre_submit_validation',
|
55 |
+
security: '<?php echo wp_create_nonce( 'schema_wp_pre_publish_validation' ); ?>',
|
56 |
+
form_data: jQuery.param(form_data),
|
57 |
+
};
|
58 |
+
jQuery.post(ajaxurl, data, function(response) {
|
59 |
+
if (response.indexOf('true') > -1 || response == true) {
|
60 |
+
jQuery("#post").data("valid", true).submit();
|
61 |
+
} else {
|
62 |
+
alert("Error: " + response);
|
63 |
+
jQuery("#post").data("valid", false);
|
64 |
+
|
65 |
+
}
|
66 |
+
//hide loading icon, return Publish button to normal
|
67 |
+
jQuery('#ajax-loading').hide();
|
68 |
+
jQuery('#publish').removeClass('button-primary-disabled');
|
69 |
+
jQuery('#save-post').removeClass('button-disabled');
|
70 |
+
});
|
71 |
+
return false;
|
72 |
+
});
|
73 |
+
});
|
74 |
+
</script>
|
75 |
+
<?php
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
|
80 |
+
add_action('wp_ajax_schema_wp_pre_submit_validation', 'schema_wp_pre_submit_validation');
|
81 |
+
/**
|
82 |
+
* Pre submit validation
|
83 |
+
*
|
84 |
+
* @since 1.4.7
|
85 |
+
*/
|
86 |
+
function schema_wp_pre_submit_validation() {
|
87 |
+
//simple Security check
|
88 |
+
check_ajax_referer( 'schema_wp_pre_publish_validation', 'security' );
|
89 |
+
|
90 |
+
//convert the string of data received to an array
|
91 |
+
//from http://wordpress.stackexchange.com/a/26536/10406
|
92 |
+
parse_str( $_POST['form_data'], $vars );
|
93 |
+
|
94 |
+
if ( empty( $vars['_schema_post_types'] ) ) {
|
95 |
+
_e('You must select at leat one post type!', 'schema-wp');
|
96 |
+
die();
|
97 |
+
}
|
98 |
+
|
99 |
+
//everything ok, allow submission
|
100 |
+
echo 'true';
|
101 |
+
die();
|
102 |
+
}
|
includes/admin/post-type/schema-wp-submit.php
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Replace default submit box on Schema post type
|
4 |
+
*
|
5 |
+
* @since 1.4.7
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Exit if accessed directly
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
|
12 |
+
/*=========================================
|
13 |
+
Custom Submit Box
|
14 |
+
==========================================*/
|
15 |
+
/**
|
16 |
+
* Loop throught custom post types and
|
17 |
+
* replace default submit box
|
18 |
+
*
|
19 |
+
* @link https://gist.github.com/zutigrm/226ca14074133d30320a
|
20 |
+
* @since 1.0
|
21 |
+
*
|
22 |
+
*/
|
23 |
+
function schema_wp_replace_submit_meta_box()
|
24 |
+
{
|
25 |
+
// create a multidimensional array that will hold
|
26 |
+
// each custom post_type as a key, and custom
|
27 |
+
// post_type name will be it's value.
|
28 |
+
$items = array(
|
29 |
+
'schema' => 'Schema'
|
30 |
+
);
|
31 |
+
|
32 |
+
// now loop through $items array and remove, then
|
33 |
+
// add submit meta box for each post type, by using
|
34 |
+
// values from array to complete this.
|
35 |
+
foreach( $items as $item => $value )
|
36 |
+
{
|
37 |
+
remove_meta_box('submitdiv', $item, 'core'); // $item represents post_type
|
38 |
+
add_meta_box('submitdiv', sprintf( __('%s'), $value ), 'schema_wp_submit_meta_box', $item, 'side', 'low'); // $value will be the output title in the box
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
add_action( 'admin_menu', 'schema_wp_replace_submit_meta_box' );
|
43 |
+
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Custom edit of default wordpress publish box callback
|
47 |
+
* loop through each custom post type and remove default
|
48 |
+
* submit box, replacing it with custom one that has
|
49 |
+
* only submit button with custom text on it (add/update)
|
50 |
+
*
|
51 |
+
* @global $action, $post
|
52 |
+
* @see wordpress/includes/metaboxes.php
|
53 |
+
* @since 1.0
|
54 |
+
*
|
55 |
+
*/
|
56 |
+
function schema_wp_submit_meta_box() {
|
57 |
+
global $action, $post;
|
58 |
+
|
59 |
+
$post_type = $post->post_type; // get current post_type
|
60 |
+
$post_type_object = get_post_type_object($post_type);
|
61 |
+
$can_publish = current_user_can($post_type_object->cap->publish_posts);
|
62 |
+
|
63 |
+
// again, use the same array. It is important
|
64 |
+
// to put it in same order, so that it can
|
65 |
+
// follow the right meta box
|
66 |
+
$items = array(
|
67 |
+
'schema' => 'Schema'
|
68 |
+
);
|
69 |
+
|
70 |
+
// now create var $item that will take only right
|
71 |
+
// post_type information for currently displayed
|
72 |
+
// post_type. Because $post_type var will store
|
73 |
+
// only current post_type, it will correspond to
|
74 |
+
// the appropriate 'key' from the $items array.
|
75 |
+
// This $item will hold only the string name of
|
76 |
+
// the post_type which will be used further in context
|
77 |
+
// on appropriate places.
|
78 |
+
$item = $items[$post_type];
|
79 |
+
|
80 |
+
?>
|
81 |
+
<div class="submitbox" id="submitpost">
|
82 |
+
<div id="major-publishing-actions">
|
83 |
+
<?php
|
84 |
+
do_action( 'post_submitbox_start' );
|
85 |
+
?>
|
86 |
+
<div id="delete-action">
|
87 |
+
<?php
|
88 |
+
if ( current_user_can( "delete_post", $post->ID ) ) {
|
89 |
+
if ( !EMPTY_TRASH_DAYS )
|
90 |
+
$delete_text = __('Delete Permanently');
|
91 |
+
else
|
92 |
+
$delete_text = __('Move to Trash');
|
93 |
+
?>
|
94 |
+
<a class="submitdelete deletion" href="<?php echo get_delete_post_link($post->ID); ?>"><?php echo $delete_text; ?></a><?php
|
95 |
+
} //if ?>
|
96 |
+
</div>
|
97 |
+
<div id="publishing-action">
|
98 |
+
<span class="spinner"></span>
|
99 |
+
<?php
|
100 |
+
if ( ! in_array( $post->post_status, array( 'publish', 'future', 'private') ) || 0 == $post->ID ) {
|
101 |
+
if ( $can_publish ) : ?>
|
102 |
+
|
103 |
+
<input name="original_publish" type="hidden" id="original_publish" accesskey="p" value="<?php esc_attr_e('Publish') ?>" />
|
104 |
+
<?php submit_button( __( 'Save' ), 'primary button-large', 'publish', false, array( 'accesskey' => 'p' ) ); ?>
|
105 |
+
<?php
|
106 |
+
endif;
|
107 |
+
|
108 |
+
|
109 |
+
} else { ?>
|
110 |
+
<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update ') . $item; ?>" />
|
111 |
+
<input name="save" type="submit" class="button button-primary button-large" id="publish" accesskey="p" value="<?php esc_attr_e('Save ') . $item; ?>" />
|
112 |
+
<?php
|
113 |
+
} //if ?>
|
114 |
+
</div>
|
115 |
+
<div class="clear"></div>
|
116 |
+
</div>
|
117 |
+
</div>
|
118 |
+
<?php
|
119 |
+
} //schema_wp_submit_meta_box()
|
includes/admin/ref.php
ADDED
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ref Functions
|
4 |
+
*
|
5 |
+
* @package Schema
|
6 |
+
* @subpackage Admin Ref
|
7 |
+
* @copyright Copyright (c) 2016, Hesham Zebida
|
8 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
+
* @since 1.5.9.7
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
|
16 |
+
add_action( 'save_post', 'schema_wp_save_ref', 10, 3 );
|
17 |
+
/**
|
18 |
+
* Save post metadata when a Schema Type is saved.
|
19 |
+
* Add schema reference Id
|
20 |
+
*
|
21 |
+
* @param int $post_id The post ID.
|
22 |
+
* @param post $post The post object.
|
23 |
+
* @param bool $update Whether this is an existing post being updated or not.
|
24 |
+
* @since 1.5.9.7
|
25 |
+
*/
|
26 |
+
function schema_wp_save_ref( $post_id, $post, $update ) {
|
27 |
+
|
28 |
+
if( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
29 |
+
|| ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )
|
30 |
+
return $post_id;
|
31 |
+
|
32 |
+
$slug = 'schema';
|
33 |
+
|
34 |
+
// If this isn't a 'schema' post, don't update it.
|
35 |
+
if ( $slug != $post->post_type ) {
|
36 |
+
return $post_id;
|
37 |
+
}
|
38 |
+
|
39 |
+
// If this is just a revision, don't save ref.
|
40 |
+
if ( wp_is_post_revision( $post_id ) )
|
41 |
+
return $post_id;
|
42 |
+
|
43 |
+
// - Update the post's metadata.
|
44 |
+
schema_wp_update_all_meta_ref( $post_id );
|
45 |
+
|
46 |
+
// Delete cached data in post meta
|
47 |
+
// @since 1.6.1
|
48 |
+
schema_wp_json_delete_cache();
|
49 |
+
|
50 |
+
// Debug
|
51 |
+
//$msg = 'Is this un update? ';
|
52 |
+
//$msg .= $update ? 'Yes.' : 'No.';
|
53 |
+
//wp_die( $msg );
|
54 |
+
|
55 |
+
return $post_id;
|
56 |
+
}
|
57 |
+
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Update post meta with a ref Schema Id for post types
|
61 |
+
*
|
62 |
+
* @param int $schema_id The schema post ID.
|
63 |
+
* @since 1.5.9.7
|
64 |
+
*/
|
65 |
+
function schema_wp_update_all_meta_ref( $schema_id ) {
|
66 |
+
|
67 |
+
global $wpdb;
|
68 |
+
|
69 |
+
if ( ! isset( $schema_id ) ) return;
|
70 |
+
|
71 |
+
// Get enabled post types array
|
72 |
+
$schema_type = get_post_meta( $schema_id, '_schema_post_types' , true );
|
73 |
+
|
74 |
+
// Debug
|
75 |
+
//echo '<pre>'; print_r($schema_type); echo '</pre>';exit;
|
76 |
+
|
77 |
+
if ( ! is_array( $schema_type ) || empty( $schema_type) ) return false;
|
78 |
+
|
79 |
+
$results = array();
|
80 |
+
|
81 |
+
foreach( $schema_type as $schema_enabled ) :
|
82 |
+
|
83 |
+
$query = $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = '%s'", $schema_enabled );
|
84 |
+
|
85 |
+
$post_ids = $wpdb->get_col( $query );
|
86 |
+
|
87 |
+
if ( count( $post_ids ) ) {
|
88 |
+
|
89 |
+
$results = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = %s
|
90 |
+
WHERE meta_key = '_schema_ref'
|
91 |
+
AND post_id
|
92 |
+
IN( " . implode( ',', $post_ids ) . " )", $schema_id )
|
93 |
+
);
|
94 |
+
}
|
95 |
+
|
96 |
+
endforeach;
|
97 |
+
|
98 |
+
return $results;
|
99 |
+
}
|
100 |
+
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Update post meta with a ref Schema Id
|
104 |
+
*
|
105 |
+
* Used by schema_wp_add_ref_on_page_view() & schema_wp_add_ref()
|
106 |
+
*
|
107 |
+
* @param int $post_id The post ID.
|
108 |
+
* @since 1.5.9.6
|
109 |
+
*/
|
110 |
+
function schema_wp_update_meta_ref( $post_id ) {
|
111 |
+
|
112 |
+
global $typenow;
|
113 |
+
|
114 |
+
$schemas_enabled = array();
|
115 |
+
|
116 |
+
// Get schame enabled array
|
117 |
+
$schemas_enabled = schema_wp_cpt_get_enabled();
|
118 |
+
|
119 |
+
if ( empty($schemas_enabled) ) return false;
|
120 |
+
|
121 |
+
// Get post type
|
122 |
+
if ( is_admin() ) {
|
123 |
+
// on back-end
|
124 |
+
if ( ! function_exists( 'get_current_screen' ) ) {
|
125 |
+
require_once( ABSPATH . 'wp-admin/includes/screen.php' );
|
126 |
+
}
|
127 |
+
// get the current screen
|
128 |
+
$current_screen = get_current_screen();
|
129 |
+
// check global variable $typenow, this to get post type when do a Quick Edit
|
130 |
+
if ( empty($current_screen) ) { $post_type = $typenow; } else { $post_type = $current_screen->post_type;}
|
131 |
+
|
132 |
+
} else {
|
133 |
+
// on front-end
|
134 |
+
$post_type = get_post_type($post_id);
|
135 |
+
}
|
136 |
+
|
137 |
+
foreach( $schemas_enabled as $schema_enabled ) :
|
138 |
+
|
139 |
+
// Debug
|
140 |
+
//echo '<pre>'; print_r($schema_enabled); echo '</pre>';exit;
|
141 |
+
|
142 |
+
// Get Schema enabled post types array
|
143 |
+
$schema_cpt = $schema_enabled['post_type'];
|
144 |
+
|
145 |
+
if ( ! empty($schema_cpt) && in_array( $post_type, $schema_cpt, true ) ) {
|
146 |
+
|
147 |
+
// Get schema post id
|
148 |
+
$schema_id = $schema_enabled['id'];
|
149 |
+
|
150 |
+
// Get old ref value
|
151 |
+
$old_ref = get_post_meta( $post_id, '_schema_ref', true );
|
152 |
+
|
153 |
+
// Compare values and update post meta according
|
154 |
+
if ( isset($old_ref) ) {
|
155 |
+
if ( $old_ref != $post_id ) {
|
156 |
+
update_post_meta( $post_id, '_schema_ref', $schema_id );
|
157 |
+
}
|
158 |
+
} else {
|
159 |
+
update_post_meta( $post_id, '_schema_ref', $schema_id );
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
endforeach;
|
164 |
+
|
165 |
+
return true;
|
166 |
+
}
|
167 |
+
|
168 |
+
|
169 |
+
add_action( 'wp_insert_post', 'schema_wp_add_ref', 10, 1 );
|
170 |
+
/**
|
171 |
+
* Add schema reference Id
|
172 |
+
*
|
173 |
+
* Save ref on new post creation
|
174 |
+
* To allow extentions to add their own meta boxes to a specific Schema type
|
175 |
+
*
|
176 |
+
* @since 1.4.4
|
177 |
+
* @return array of enabled post types, schema type
|
178 |
+
*/
|
179 |
+
function schema_wp_add_ref( $post_id ) {
|
180 |
+
|
181 |
+
if ( ! isset( $_POST['post_status'] ) ) return false;
|
182 |
+
|
183 |
+
$slug = 'schema';
|
184 |
+
|
185 |
+
// If this isn't a 'schema' post, don't update it.
|
186 |
+
if ( get_post_type( $post_id ) == $slug ) {
|
187 |
+
return $post_id;
|
188 |
+
}
|
189 |
+
|
190 |
+
$original_post_status = isset($_POST['original_post_status']) ? $_POST['original_post_status'] : '';
|
191 |
+
|
192 |
+
if( ( $_POST['post_status'] == 'publish' ) && ( $original_post_status != 'publish' ) ) {
|
193 |
+
|
194 |
+
schema_wp_update_meta_ref( $post_id );
|
195 |
+
}
|
196 |
+
|
197 |
+
return true;
|
198 |
+
}
|
199 |
+
|
200 |
+
|
201 |
+
add_action( 'future_post', 'schema_wp_add_ref_on_post_scheduled', 10, 2 );
|
202 |
+
/**
|
203 |
+
* Add schema reference for scheduled posts
|
204 |
+
*
|
205 |
+
* @since 1.6
|
206 |
+
*/
|
207 |
+
function schema_wp_add_ref_on_post_scheduled( $ID, $post ) {
|
208 |
+
// A function to perform actions when a post is scheduled to be published.
|
209 |
+
schema_wp_update_meta_ref( $ID );
|
210 |
+
}
|
includes/admin/scripts.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Load the admin scripts
|
5 |
+
*
|
6 |
+
* @since 1.0
|
7 |
+
* @return void
|
8 |
+
*/
|
9 |
+
function schema_wp_admin_scripts() {
|
10 |
+
|
11 |
+
if( ! schema_wp_is_admin_page() ) {
|
12 |
+
return;
|
13 |
+
}
|
14 |
+
|
15 |
+
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
|
16 |
+
|
17 |
+
wp_enqueue_script( 'schema-wp-admin', SCHEMAWP_PLUGIN_URL . 'assets/js/admin' . $suffix . '.js', array( 'jquery' ), SCHEMAWP_VERSION );
|
18 |
+
|
19 |
+
wp_localize_script( 'schema-wp-admin', 'schema_wp_vars', array(
|
20 |
+
'post_id' => isset( $post->ID ) ? $post->ID : null,
|
21 |
+
'schema_wp_version' => SCHEMAWP_VERSION,
|
22 |
+
'use_this_file' => __( 'Use This File', 'schema-wp' ),
|
23 |
+
'remove_text' => __( 'Remove', 'schema-wp' ),
|
24 |
+
'new_media_ui' => apply_filters( 'schema_wp_use_35_media_ui', 1 ),
|
25 |
+
'unsupported_browser' => __( 'We are sorry but your browser is not compatible with this kind of file upload. Please upgrade your browser.', 'schema-wp' ),
|
26 |
+
));
|
27 |
+
|
28 |
+
wp_enqueue_style( 'wp-color-picker' );
|
29 |
+
wp_enqueue_script( 'wp-color-picker' );
|
30 |
+
|
31 |
+
// For media uploader
|
32 |
+
wp_enqueue_media();
|
33 |
+
|
34 |
+
wp_enqueue_script( 'jquery-ui-datepicker' );
|
35 |
+
wp_enqueue_script( 'jquery-ui-dialog' );
|
36 |
+
wp_enqueue_script( 'jquery-ui-tooltip' );
|
37 |
+
|
38 |
+
wp_enqueue_script( 'media-upload' );
|
39 |
+
wp_enqueue_script( 'thickbox' );
|
40 |
+
wp_enqueue_style( 'thickbox' );
|
41 |
+
|
42 |
+
}
|
43 |
+
add_action( 'admin_enqueue_scripts', 'schema_wp_admin_scripts' );
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Load the admin styles
|
47 |
+
*
|
48 |
+
* @since 1.0
|
49 |
+
* @return void
|
50 |
+
*/
|
51 |
+
function schema_wp_admin_styles() {
|
52 |
+
|
53 |
+
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
|
54 |
+
|
55 |
+
// Dashicons and our main admin CSS need to be on all pages for the menu icon
|
56 |
+
wp_enqueue_style( 'dashicons' );
|
57 |
+
wp_enqueue_style( 'schema-wp-admin', SCHEMAWP_PLUGIN_URL . 'assets/css/admin' . $suffix . '.css', SCHEMAWP_VERSION );
|
58 |
+
|
59 |
+
if( ! schema_wp_is_admin_page() ) {
|
60 |
+
return;
|
61 |
+
}
|
62 |
+
|
63 |
+
// jQuery UI styles are loaded on our admin pages only
|
64 |
+
$ui_style = ( 'classic' == get_user_option( 'admin_color' ) ) ? 'classic' : 'fresh';
|
65 |
+
wp_enqueue_style( 'jquery-ui-css', SCHEMAWP_PLUGIN_URL . 'assets/css/jquery-ui-' . $ui_style . '.min.css' );
|
66 |
+
}
|
67 |
+
add_action( 'admin_enqueue_scripts', 'schema_wp_admin_styles' );
|
includes/admin/settings/contextual-help.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Contextual Help
|
4 |
+
*
|
5 |
+
* @package Schema
|
6 |
+
* @subpackage Admin/Settings
|
7 |
+
* @copyright Copyright (c) 2016, Hesham Zebida
|
8 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
+
* @since 1.5.9.3
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Settings contextual help.
|
17 |
+
*
|
18 |
+
* @since 1.5.9.3
|
19 |
+
* @return void
|
20 |
+
*/
|
21 |
+
function schema_wp_settings_contextual_help() {
|
22 |
+
|
23 |
+
$screen = get_current_screen();
|
24 |
+
|
25 |
+
$screen->set_help_sidebar(
|
26 |
+
'<p><strong>' . sprintf( __( 'For more information:', 'schema-wp' ) . '</strong></p>' .
|
27 |
+
'<p>' . sprintf( __( 'Visit the <a href="%s">documentation</a> on the schema.press website.', 'schema-wp' ), esc_url( 'https://schema.press/docs/' ) ) ) . '</p>' .
|
28 |
+
'<p>' . sprintf(
|
29 |
+
__( '<a href="%s">Post an issue</a> on <a href="%s">GitHub</a>. View <a href="%s">extensions</a>', 'schema-wp' ),
|
30 |
+
esc_url( 'https://github.com/schemapress/Schema/issues' ),
|
31 |
+
esc_url( 'https://github.com/schemapress/Schema' ),
|
32 |
+
esc_url( 'https://schema.press/docs/?utm_source=plugin-settings-page&utm_medium=contextual-help-sidebar&utm_term=extensions&utm_campaign=ContextualHelp' )
|
33 |
+
) . '</p>'
|
34 |
+
);
|
35 |
+
|
36 |
+
$screen->add_help_tab( array(
|
37 |
+
'id' => 'schema-wp-settings-general',
|
38 |
+
'title' => __( 'General', 'schema-wp' ),
|
39 |
+
'content' => '<p>' . __( 'This screen provides the most basic settings for configuring Schema plugin on your site. You can set Schema for About and Contact pages, and turn automatic <em>Feature image</em> on and off...etc', 'schema-wp' ) . '</p>'
|
40 |
+
) );
|
41 |
+
|
42 |
+
$screen->add_help_tab( array(
|
43 |
+
'id' => 'schema-wp-settings-knowledge-graph',
|
44 |
+
'title' => __( 'Knowledge Graph', 'schema-wp' ),
|
45 |
+
'content' => '<p>' . __( 'This screen provides settings for configuring the Knowledge Graph. You can set Organization Info and Corporate Contacts.', 'schema-wp' ) . '</p>'
|
46 |
+
) );
|
47 |
+
|
48 |
+
$screen->add_help_tab( array(
|
49 |
+
'id' => 'schema-wp-settings-search-results',
|
50 |
+
'title' => __( 'Search Results', 'schema-wp' ),
|
51 |
+
'content' => '<p>' . __( 'This screen provides settings for configuring Search Results. You can set Sitelinks Search Box and Site Name.', 'schema-wp' ) . '</p>'
|
52 |
+
) );
|
53 |
+
|
54 |
+
$screen->add_help_tab( array(
|
55 |
+
'id' => 'schema-wp-settings-extensions',
|
56 |
+
'title' => __( 'Extensions', 'schema-wp' ),
|
57 |
+
'content' => '<p>' . __( 'This screen provides access to settings added by most Schema extensions.', 'schema-wp' ) . '</p>'
|
58 |
+
) );
|
59 |
+
|
60 |
+
$screen->add_help_tab( array(
|
61 |
+
'id' => 'schema-wp-settings-misc',
|
62 |
+
'title' => __( 'Miscellaneous', 'schema-wp' ),
|
63 |
+
'content' =>
|
64 |
+
'<p>' . __( 'This screen provides other miscellaneous options such as deleting plugin data on uninstall.', 'schema-wp' ) . '</p>' .
|
65 |
+
'<p>' . __( 'A description of all the options are provided beside their input boxes.', 'schema-wp' ) . '</p>'
|
66 |
+
) );
|
67 |
+
|
68 |
+
do_action( 'schema_wp_settings_contextual_help', apply_filters( 'schema_wp_contextual_help', $screen ) );
|
69 |
+
}
|
includes/admin/settings/display-settings.php
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Admin Options Page
|
4 |
+
*
|
5 |
+
* @package EDD
|
6 |
+
* @subpackage Admin/Settings
|
7 |
+
* @copyright Copyright (c) 2015, Pippin Williamson
|
8 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
+
* @since 1.0
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Options Page
|
17 |
+
*
|
18 |
+
* Renders the options page contents.
|
19 |
+
*
|
20 |
+
* @since 1.0
|
21 |
+
* @return void
|
22 |
+
*/
|
23 |
+
function schema_wp_options_page() {
|
24 |
+
|
25 |
+
$settings_tabs = schema_wp_get_settings_tabs();
|
26 |
+
$settings_tabs = empty($settings_tabs) ? array() : $settings_tabs;
|
27 |
+
$active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $settings_tabs ) ? $_GET['tab'] : 'general';
|
28 |
+
$sections = schema_wp_get_settings_tab_sections( $active_tab );
|
29 |
+
$key = 'main';
|
30 |
+
|
31 |
+
if ( is_array( $sections ) ) {
|
32 |
+
$key = key( $sections );
|
33 |
+
}
|
34 |
+
|
35 |
+
$registered_sections = schema_wp_get_settings_tab_sections( $active_tab );
|
36 |
+
$section = isset( $_GET['section'] ) && ! empty( $registered_sections ) && array_key_exists( $_GET['section'], $registered_sections ) ? $_GET['section'] : $key;
|
37 |
+
|
38 |
+
// Unset 'main' if it's empty and default to the first non-empty if it's the chosen section
|
39 |
+
$all_settings = schema_wp_get_registered_settings();
|
40 |
+
|
41 |
+
// Let's verify we have a 'main' section to show
|
42 |
+
ob_start();
|
43 |
+
do_settings_sections( 'schema_wp_settings_' . $active_tab . '_main' );
|
44 |
+
$has_main_settings = strlen( ob_get_contents() ) > 0;
|
45 |
+
ob_end_clean();
|
46 |
+
|
47 |
+
$override = false;
|
48 |
+
if ( false === $has_main_settings ) {
|
49 |
+
unset( $sections['main'] );
|
50 |
+
|
51 |
+
if ( 'main' === $section ) {
|
52 |
+
foreach ( $sections as $section_key => $section_title ) {
|
53 |
+
if ( ! empty( $all_settings[ $active_tab ][ $section_key ] ) ) {
|
54 |
+
$section = $section_key;
|
55 |
+
$override = true;
|
56 |
+
break;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
ob_start();
|
63 |
+
?>
|
64 |
+
<div class="wrap <?php echo 'wrap-' . $active_tab; ?>">
|
65 |
+
<h1 class="nav-tab-wrapper">
|
66 |
+
<?php
|
67 |
+
foreach( schema_wp_get_settings_tabs() as $tab_id => $tab_name ) {
|
68 |
+
|
69 |
+
$tab_url = add_query_arg( array(
|
70 |
+
'settings-updated' => false,
|
71 |
+
'tab' => $tab_id,
|
72 |
+
) );
|
73 |
+
|
74 |
+
// Remove the section from the tabs so we always end up at the main section
|
75 |
+
$tab_url = remove_query_arg( 'section', $tab_url );
|
76 |
+
|
77 |
+
$active = $active_tab == $tab_id ? ' nav-tab-active' : '';
|
78 |
+
|
79 |
+
echo '<a href="' . esc_url( $tab_url ) . '" class="nav-tab' . $active . '">';
|
80 |
+
echo esc_html( $tab_name );
|
81 |
+
echo '</a>';
|
82 |
+
}
|
83 |
+
?>
|
84 |
+
</h1>
|
85 |
+
<?php
|
86 |
+
|
87 |
+
$number_of_sections = count( $sections );
|
88 |
+
$number = 0;
|
89 |
+
if ( $number_of_sections > 1 ) {
|
90 |
+
echo '<div><ul class="subsubsub">';
|
91 |
+
foreach( $sections as $section_id => $section_name ) {
|
92 |
+
echo '<li>';
|
93 |
+
$number++;
|
94 |
+
$tab_url = add_query_arg( array(
|
95 |
+
'settings-updated' => false,
|
96 |
+
'tab' => $active_tab,
|
97 |
+
'section' => $section_id
|
98 |
+
) );
|
99 |
+
$class = '';
|
100 |
+
if ( $section == $section_id ) {
|
101 |
+
$class = 'current';
|
102 |
+
}
|
103 |
+
echo '<a class="' . $class . '" href="' . esc_url( $tab_url ) . '">' . $section_name . '</a>';
|
104 |
+
|
105 |
+
if ( $number != $number_of_sections ) {
|
106 |
+
echo ' | ';
|
107 |
+
}
|
108 |
+
echo '</li>';
|
109 |
+
}
|
110 |
+
echo '</ul></div>';
|
111 |
+
}
|
112 |
+
?>
|
113 |
+
<div id="tab_container">
|
114 |
+
<form method="post" action="options.php">
|
115 |
+
<table class="form-table">
|
116 |
+
<?php
|
117 |
+
|
118 |
+
settings_fields( 'schema_wp_settings' );
|
119 |
+
|
120 |
+
if ( 'main' === $section ) {
|
121 |
+
do_action( 'schema_wp_settings_tab_top', $active_tab );
|
122 |
+
}
|
123 |
+
|
124 |
+
do_action( 'schema_wp_settings_tab_top_' . $active_tab . '_' . $section );
|
125 |
+
|
126 |
+
do_settings_sections( 'schema_wp_settings_' . $active_tab . '_' . $section );
|
127 |
+
|
128 |
+
do_action( 'schema_wp_settings_tab_bottom_' . $active_tab . '_' . $section );
|
129 |
+
|
130 |
+
// For backwards compatibility
|
131 |
+
if ( 'main' === $section ) {
|
132 |
+
do_action( 'schema_wp_settings_tab_bottom', $active_tab );
|
133 |
+
}
|
134 |
+
|
135 |
+
// If the main section was empty and we overrode the view with the next subsection, prepare the section for saving
|
136 |
+
if ( true === $override ) {
|
137 |
+
?><input type="hidden" name="schema_wp_section_override" value="<?php echo $section; ?>" /><?php
|
138 |
+
}
|
139 |
+
?>
|
140 |
+
</table>
|
141 |
+
<?php submit_button(); ?>
|
142 |
+
</form>
|
143 |
+
</div><!-- #tab_container-->
|
144 |
+
</div><!-- .wrap -->
|
145 |
+
<?php
|
146 |
+
echo ob_get_clean();
|
147 |
+
}
|
includes/admin/settings/register-settings.php
ADDED
@@ -0,0 +1,1530 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Register Settings
|
4 |
+
*
|
5 |
+
* @package Schema
|
6 |
+
* @subpackage Admin/Settings
|
7 |
+
* @copyright Copyright (c) 2016, Hesham Zebida
|
8 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
+
* @since 1.0
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Get an option
|
18 |
+
*
|
19 |
+
* Looks to see if the specified setting exists, returns default if not
|
20 |
+
*
|
21 |
+
* @since 1.8.4
|
22 |
+
* @global $schema_wp_options Array of all the Schema Options
|
23 |
+
* @return mixed
|
24 |
+
*/
|
25 |
+
function schema_wp_get_option( $key = '', $default = false ) {
|
26 |
+
global $schema_wp_options;
|
27 |
+
$value = ! empty( $schema_wp_options[ $key ] ) ? $schema_wp_options[ $key ] : $default;
|
28 |
+
$value = apply_filters( 'schema_wp_get_option', $value, $key, $default );
|
29 |
+
return apply_filters( 'schema_wp_get_option_' . $key, $value, $key, $default );
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Update an option
|
34 |
+
*
|
35 |
+
* Updates an edd setting value in both the db and the global variable.
|
36 |
+
* Warning: Passing in an empty, false or null string value will remove
|
37 |
+
* the key from the schema_wp_options array.
|
38 |
+
*
|
39 |
+
* @since 2.3
|
40 |
+
* @param string $key The Key to update
|
41 |
+
* @param string|bool|int $value The value to set the key to
|
42 |
+
* @global $schema_wp_options Array of all the Schema Options
|
43 |
+
* @return boolean True if updated, false if not.
|
44 |
+
*/
|
45 |
+
function schema_wp_update_option( $key = '', $value = false ) {
|
46 |
+
|
47 |
+
// If no key, exit
|
48 |
+
if ( empty( $key ) ){
|
49 |
+
return false;
|
50 |
+
}
|
51 |
+
|
52 |
+
if ( empty( $value ) ) {
|
53 |
+
$remove_option = schema_wp_delete_option( $key );
|
54 |
+
return $remove_option;
|
55 |
+
}
|
56 |
+
|
57 |
+
// First let's grab the current settings
|
58 |
+
$options = get_option( 'schema_wp_settings' );
|
59 |
+
|
60 |
+
// Let's let devs alter that value coming in
|
61 |
+
$value = apply_filters( 'schema_wp_update_option', $value, $key );
|
62 |
+
|
63 |
+
// Next let's try to update the value
|
64 |
+
$options[ $key ] = $value;
|
65 |
+
$did_update = update_option( 'schema_wp_settings', $options );
|
66 |
+
|
67 |
+
// If it updated, let's update the global variable
|
68 |
+
if ( $did_update ){
|
69 |
+
global $schema_wp_options;
|
70 |
+
$schema_wp_options[ $key ] = $value;
|
71 |
+
}
|
72 |
+
|
73 |
+
return $did_update;
|
74 |
+
}
|
75 |
+
|
76 |
+
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Remove an option
|
80 |
+
*
|
81 |
+
* Removes an edd setting value in both the db and the global variable.
|
82 |
+
*
|
83 |
+
* @since 2.3
|
84 |
+
* @param string $key The Key to delete
|
85 |
+
* @global $schema_wp_options Array of all the Schema Options
|
86 |
+
* @return boolean True if removed, false if not.
|
87 |
+
*/
|
88 |
+
function schema_wp_delete_option( $key = '' ) {
|
89 |
+
|
90 |
+
// If no key, exit
|
91 |
+
if ( empty( $key ) ){
|
92 |
+
return false;
|
93 |
+
}
|
94 |
+
|
95 |
+
// First let's grab the current settings
|
96 |
+
$options = get_option( 'schema_wp_settings' );
|
97 |
+
|
98 |
+
// Next let's try to update the value
|
99 |
+
if( isset( $options[ $key ] ) ) {
|
100 |
+
|
101 |
+
unset( $options[ $key ] );
|
102 |
+
|
103 |
+
}
|
104 |
+
|
105 |
+
$did_update = update_option( 'schema_wp_settings', $options );
|
106 |
+
|
107 |
+
// If it updated, let's update the global variable
|
108 |
+
if ( $did_update ){
|
109 |
+
global $schema_wp_options;
|
110 |
+
$schema_wp_options = $options;
|
111 |
+
}
|
112 |
+
|
113 |
+
return $did_update;
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Get Settings
|
118 |
+
*
|
119 |
+
* Retrieves all plugin settings
|
120 |
+
*
|
121 |
+
* @since 1.0
|
122 |
+
* @return array Schema settings
|
123 |
+
*/
|
124 |
+
function schema_wp_get_settings() {
|
125 |
+
|
126 |
+
$settings = get_option( 'schema_wp_settings' );
|
127 |
+
|
128 |
+
if( empty( $settings ) ) {
|
129 |
+
|
130 |
+
// Update old settings with new single option
|
131 |
+
|
132 |
+
$general_settings = is_array( get_option( 'schema_wp_settings_general' ) ) ? get_option( 'schema_wp_settings_general' ) : array();
|
133 |
+
$knowledge_graph_settings = is_array( get_option( 'schema_wp_settings_knowledge_graph' ) ) ? get_option( 'schema_wp_settings_knowledge_graph' ) : array();
|
134 |
+
$search_results_settings = is_array( get_option( 'schema_wp_settings_search_results' ) ) ? get_option( 'schema_wp_settings_search_results' ) : array();
|
135 |
+
$ext_settings = is_array( get_option( 'schema_wp_settings_extensions' ) ) ? get_option( 'schema_wp_settings_extensions' ) : array();
|
136 |
+
$license_settings = is_array( get_option( 'schema_wp_settings_licenses' ) ) ? get_option( 'schema_wp_settings_licenses' ) : array();
|
137 |
+
$misc_settings = is_array( get_option( 'schema_wp_settings_misc' ) ) ? get_option( 'schema_wp_settings_misc' ) : array();
|
138 |
+
|
139 |
+
$settings = array_merge( $general_settings, $knowledge_graph_settings, $search_results_settings, $ext_settings, $license_settings, $misc_settings );
|
140 |
+
|
141 |
+
update_option( 'schema_wp_settings', $settings );
|
142 |
+
|
143 |
+
}
|
144 |
+
return apply_filters( 'schema_wp_get_settings', $settings );
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Add all settings sections and fields
|
149 |
+
*
|
150 |
+
* @since 1.0
|
151 |
+
* @return void
|
152 |
+
*/
|
153 |
+
function schema_wp_register_settings() {
|
154 |
+
|
155 |
+
if ( false == get_option( 'schema_wp_settings' ) ) {
|
156 |
+
add_option( 'schema_wp_settings' );
|
157 |
+
}
|
158 |
+
|
159 |
+
foreach ( schema_wp_get_registered_settings() as $tab => $sections ) {
|
160 |
+
foreach ( $sections as $section => $settings) {
|
161 |
+
|
162 |
+
// Check for backwards compatibility
|
163 |
+
$section_tabs = schema_wp_get_settings_tab_sections( $tab );
|
164 |
+
if ( ! is_array( $section_tabs ) || ! array_key_exists( $section, $section_tabs ) ) {
|
165 |
+
$section = 'main';
|
166 |
+
$settings = $sections;
|
167 |
+
}
|
168 |
+
|
169 |
+
add_settings_section(
|
170 |
+
'schema_wp_settings_' . $tab . '_' . $section,
|
171 |
+
__return_null(),
|
172 |
+
'__return_false',
|
173 |
+
'schema_wp_settings_' . $tab . '_' . $section
|
174 |
+
);
|
175 |
+
|
176 |
+
foreach ( $settings as $option ) {
|
177 |
+
// For backwards compatibility
|
178 |
+
if ( empty( $option['id'] ) ) {
|
179 |
+
continue;
|
180 |
+
}
|
181 |
+
|
182 |
+
$name = isset( $option['name'] ) ? $option['name'] : '';
|
183 |
+
|
184 |
+
add_settings_field(
|
185 |
+
'schema_wp_settings[' . $option['id'] . ']',
|
186 |
+
$name,
|
187 |
+
function_exists( 'schema_wp_' . $option['type'] . '_callback' ) ? 'schema_wp_' . $option['type'] . '_callback' : 'schema_wp_missing_callback',
|
188 |
+
'schema_wp_settings_' . $tab . '_' . $section,
|
189 |
+
'schema_wp_settings_' . $tab . '_' . $section,
|
190 |
+
array(
|
191 |
+
'section' => $section,
|
192 |
+
'id' => isset( $option['id'] ) ? $option['id'] : null,
|
193 |
+
'desc' => ! empty( $option['desc'] ) ? $option['desc'] : '',
|
194 |
+
'name' => isset( $option['name'] ) ? $option['name'] : null,
|
195 |
+
'size' => isset( $option['size'] ) ? $option['size'] : null,
|
196 |
+
'options' => isset( $option['options'] ) ? $option['options'] : '',
|
197 |
+
'std' => isset( $option['std'] ) ? $option['std'] : '',
|
198 |
+
'min' => isset( $option['min'] ) ? $option['min'] : null,
|
199 |
+
'max' => isset( $option['max'] ) ? $option['max'] : null,
|
200 |
+
'step' => isset( $option['step'] ) ? $option['step'] : null,
|
201 |
+
'chosen' => isset( $option['chosen'] ) ? $option['chosen'] : null,
|
202 |
+
'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : null,
|
203 |
+
'allow_blank' => isset( $option['allow_blank'] ) ? $option['allow_blank'] : true,
|
204 |
+
'readonly' => isset( $option['readonly'] ) ? $option['readonly'] : false,
|
205 |
+
'faux' => isset( $option['faux'] ) ? $option['faux'] : false,
|
206 |
+
'tooltip_title' => isset( $option['tooltip_title'] ) ? $option['tooltip_title'] : false,
|
207 |
+
'tooltip_desc' => isset( $option['tooltip_desc'] ) ? $option['tooltip_desc'] : false,
|
208 |
+
'post_type' => isset( $option['post_type'] ) ? $option['post_type'] : false,
|
209 |
+
)
|
210 |
+
);
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
}
|
215 |
+
|
216 |
+
// Creates our settings in the options table
|
217 |
+
register_setting( 'schema_wp_settings', 'schema_wp_settings', 'schema_wp_settings_sanitize' );
|
218 |
+
|
219 |
+
}
|
220 |
+
add_action( 'admin_init', 'schema_wp_register_settings' );
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Retrieve the array of plugin settings
|
224 |
+
*
|
225 |
+
* @since 1.8
|
226 |
+
* @return array
|
227 |
+
*/
|
228 |
+
function schema_wp_get_registered_settings() {
|
229 |
+
|
230 |
+
/**
|
231 |
+
* 'Whitelisted' Schema settings, filters are provided for each settings
|
232 |
+
* section to allow extensions and other plugins to add their own settings
|
233 |
+
*/
|
234 |
+
$schema_wp_settings = array(
|
235 |
+
/** General Settings */
|
236 |
+
'general' => apply_filters( 'schema_wp_settings_general',
|
237 |
+
array(
|
238 |
+
'main' => array(
|
239 |
+
'about_page' => array(
|
240 |
+
'id' => 'about_page',
|
241 |
+
'name' => __( 'About Page', 'schema-wp' ),
|
242 |
+
'desc' => __( 'Select the about page', 'schema-wp' ),
|
243 |
+
'type' => 'post_select',
|
244 |
+
'post_type' => 'page'
|
245 |
+
),
|
246 |
+
'contact_page' => array(
|
247 |
+
'id' => 'contact_page',
|
248 |
+
'name' => __( 'Contact Page', 'schema-wp' ),
|
249 |
+
'desc' => __( 'Select the contact page', 'schema-wp' ),
|
250 |
+
'type' => 'post_select',
|
251 |
+
'post_type' => 'page'
|
252 |
+
),
|
253 |
+
/*'auto_featured_img' => array(
|
254 |
+
'id' => 'auto_featured_img',
|
255 |
+
'name' => __( 'Set Featured image automatically?', 'schema-wp' ),
|
256 |
+
'desc' => __( 'Check this box if you would like Schema to try setting Featured image while you create or edit the post.', 'schema-wp' ),
|
257 |
+
'type' => 'checkbox'
|
258 |
+
),*/
|
259 |
+
'publisher_logo' => array(
|
260 |
+
'id' => 'publisher_logo',
|
261 |
+
'name' => __( 'Publisher Logo', 'schema-wp' ),
|
262 |
+
'desc' => __( 'Publisher Logo should have a wide aspect ratio, not a square icon, it should be no wider than 600px, and no taller than 60px.', 'schema-wp' ) . ' <a href="https://developers.google.com/search/docs/data-types/articles#logo-guidelines" target="_blank">'.__('Logo guidelines', 'schema-wp').'</a>',
|
263 |
+
'type' => 'image_upload',
|
264 |
+
'std' => ''
|
265 |
+
)
|
266 |
+
)
|
267 |
+
)
|
268 |
+
),
|
269 |
+
|
270 |
+
'content' => apply_filters( 'schema_wp_settings_content',
|
271 |
+
array(
|
272 |
+
'web_page_element' => array(
|
273 |
+
'id' => 'web_page_element_enable',
|
274 |
+
'name' => __( 'WPHeader and WPFooter', 'schema-wp' ),
|
275 |
+
'desc' => __( 'enable?', 'schema-wp' ),
|
276 |
+
'type' => 'checkbox'
|
277 |
+
),
|
278 |
+
'breadcrumbs' => array(
|
279 |
+
'id' => 'breadcrumbs_enable',
|
280 |
+
'name' => __( 'Breadcrumbs', 'schema-wp' ),
|
281 |
+
'desc' => __( 'enable?', 'schema-wp' ),
|
282 |
+
'type' => 'checkbox'
|
283 |
+
),
|
284 |
+
'comments' => array(
|
285 |
+
'id' => 'comments_enable',
|
286 |
+
'name' => __( 'Comments', 'schema-wp' ),
|
287 |
+
'desc' => __( 'enable?', 'schema-wp' ),
|
288 |
+
'type' => 'checkbox'
|
289 |
+
),
|
290 |
+
'video' => array(
|
291 |
+
'id' => 'video_object_enable',
|
292 |
+
'name' => __( 'VideoObject', 'schema-wp' ),
|
293 |
+
'desc' => __( 'enable?', 'schema-wp' ),
|
294 |
+
'type' => 'checkbox'
|
295 |
+
),
|
296 |
+
'audio' => array(
|
297 |
+
'id' => 'audio_object_enable',
|
298 |
+
'name' => __( 'AudioObject', 'schema-wp' ),
|
299 |
+
'desc' => __( 'enable?', 'schema-wp' ),
|
300 |
+
'type' => 'checkbox'
|
301 |
+
)
|
302 |
+
)
|
303 |
+
),
|
304 |
+
|
305 |
+
/** Knowledge Graph Settings */
|
306 |
+
'knowledge_graph' => apply_filters('schema_wp_settings_knowledge_graph',
|
307 |
+
array(
|
308 |
+
'organization' => array( // section
|
309 |
+
'organization_or_person' => array(
|
310 |
+
'id' => 'organization_or_person',
|
311 |
+
'name' => __( 'Organization or Person?', 'schema-wp' ),
|
312 |
+
'desc' => '',
|
313 |
+
'type' => 'select',
|
314 |
+
'options' => array(
|
315 |
+
'' => __('Select Type', 'schema-wp'),
|
316 |
+
'organization' => 'Organization',
|
317 |
+
'person' => 'Person'
|
318 |
+
),
|
319 |
+
'std' => ''
|
320 |
+
),
|
321 |
+
'name' => array(
|
322 |
+
'id' => 'name',
|
323 |
+
'name' => __( 'Name', 'schema-wp' ),
|
324 |
+
'desc' => __( 'Organization or Person name.', 'schema-wp' ),
|
325 |
+
'type' => 'text',
|
326 |
+
'placeholder' => get_bloginfo( 'name' ),
|
327 |
+
'std' => ''
|
328 |
+
),
|
329 |
+
'url' => array(
|
330 |
+
'id' => 'url',
|
331 |
+
'name' => __( 'Website', 'schema-wp' ),
|
332 |
+
'desc' => __( 'Organization or Person website URL.', 'schema-wp' ),
|
333 |
+
'type' => 'text',
|
334 |
+
'placeholder' => 'http://',
|
335 |
+
'std' => ''
|
336 |
+
),
|
337 |
+
'logo' => array(
|
338 |
+
'id' => 'logo',
|
339 |
+
'name' => __( 'Logo', 'schema-wp' ),
|
340 |
+
'desc' => __( 'Organization logo.', 'schema-wp' ) . ' <a href="https://developers.google.com/search/docs/data-types/logo" target="_blank">'.__('Logo guidelines', 'schema-wp').'</a>',
|
341 |
+
'type' => 'image_upload',
|
342 |
+
'std' => ''
|
343 |
+
)
|
344 |
+
),
|
345 |
+
|
346 |
+
/** Corporate Contacts Settings */
|
347 |
+
'corporate_contacts' => array( // section
|
348 |
+
|
349 |
+
'corporate_contacts_contact_type' => array(
|
350 |
+
'id' => 'corporate_contacts_contact_type',
|
351 |
+
'name' => __( 'Contact Type', 'schema-wp' ),
|
352 |
+
'desc' => '',
|
353 |
+
'type' => 'select',
|
354 |
+
'options' => schema_wp_get_corporate_contacts_types()
|
355 |
+
),
|
356 |
+
|
357 |
+
'corporate_contacts_telephone' => array(
|
358 |
+
'id' => 'corporate_contacts_telephone',
|
359 |
+
'name' => __( 'Telephone', 'schema-wp' ),
|
360 |
+
'desc' => '<br>' . __('Recommended. An internationalized version of the phone number, starting with the "+" symbol and country code (+1 in the US and Canada).', 'schema-wp'),
|
361 |
+
'type' => 'text',
|
362 |
+
'std' => ''
|
363 |
+
),
|
364 |
+
|
365 |
+
'corporate_contacts_url' => array(
|
366 |
+
'id' => 'corporate_contacts_url',
|
367 |
+
'name' => __( 'URL', 'schema-wp' ),
|
368 |
+
'desc' => '<br>' . __('Recommended. The URL of contact page.', 'schema-wp'),
|
369 |
+
'type' => 'text',
|
370 |
+
'placeholder' => 'http://',
|
371 |
+
'std' => ''
|
372 |
+
),
|
373 |
+
|
374 |
+
// Social Profiles
|
375 |
+
'social_profiles_settings' => array(
|
376 |
+
'id' => 'social_profiles_settings',
|
377 |
+
'name' => '<strong>' . __( 'Social Profiles', 'schema-wp' ) . '</strong>',
|
378 |
+
'desc' => __( 'Use structured data markup embedded in your public website to specify your preferred social profiles.', 'schema-wp' ),
|
379 |
+
'type' => 'header'
|
380 |
+
),
|
381 |
+
'facebook' => array(
|
382 |
+
'id' => 'facebook',
|
383 |
+
'name' => __( 'Facebook', 'schema-wp' ),
|
384 |
+
'desc' => '',
|
385 |
+
'type' => 'text',
|
386 |
+
'placeholder' => 'http://',
|
387 |
+
'std' => ''
|
388 |
+
),
|
389 |
+
'twitter' => array(
|
390 |
+
'id' => 'twitter',
|
391 |
+
'name' => __( 'Twitter', 'schema-wp' ),
|
392 |
+
'desc' => '',
|
393 |
+
'type' => 'text',
|
394 |
+
'placeholder' => 'http://',
|
395 |
+
'std' => ''
|
396 |
+
),
|
397 |
+
'google' => array(
|
398 |
+
'id' => 'google',
|
399 |
+
'name' => __( 'Google+', 'schema-wp' ),
|
400 |
+
'desc' => '',
|
401 |
+
'type' => 'text',
|
402 |
+
'placeholder' => 'http://',
|
403 |
+
'std' => ''
|
404 |
+
),
|
405 |
+
'instagram' => array(
|
406 |
+
'id' => 'instagram',
|
407 |
+
'name' => __( 'Instagram', 'schema-wp' ),
|
408 |
+
'desc' => '',
|
409 |
+
'type' => 'text',
|
410 |
+
'placeholder' => 'http://',
|
411 |
+
'std' => ''
|
412 |
+
),
|
413 |
+
'youtube' => array(
|
414 |
+
'id' => 'youtube',
|
415 |
+
'name' => __( 'YouTube', 'schema-wp' ),
|
416 |
+
'desc' => '',
|
417 |
+
'type' => 'text',
|
418 |
+
'placeholder' => 'http://',
|
419 |
+
'std' => ''
|
420 |
+
),
|
421 |
+
'linkedin' => array(
|
422 |
+
'id' => 'linkedin',
|
423 |
+
'name' => __( 'LinkedIn', 'schema-wp' ),
|
424 |
+
'desc' => '',
|
425 |
+
'type' => 'text',
|
426 |
+
'placeholder' => 'http://',
|
427 |
+
'std' => ''
|
428 |
+
),
|
429 |
+
'myspace' => array(
|
430 |
+
'name' => __( 'myspace', 'schema-wp' ),
|
431 |
+
'desc' => '',
|
432 |
+
'type' => 'text',
|
433 |
+
'placeholder' => 'http://',
|
434 |
+
'std' => ''
|
435 |
+
),
|
436 |
+
'pinterest' => array(
|
437 |
+
'id' => 'pinterest',
|
438 |
+
'name' => __( 'Pinterest', 'schema-wp' ),
|
439 |
+
'desc' => '',
|
440 |
+
'type' => 'text',
|
441 |
+
'placeholder' => 'http://',
|
442 |
+
'std' => ''
|
443 |
+
),
|
444 |
+
'soundcloud' => array(
|
445 |
+
'id' => 'soundcloud',
|
446 |
+
'name' => __( 'SoundCloud', 'schema-wp' ),
|
447 |
+
'desc' => '',
|
448 |
+
'type' => 'text',
|
449 |
+
'placeholder' => 'http://',
|
450 |
+
'std' => ''
|
451 |
+
),
|
452 |
+
'tumblr' => array(
|
453 |
+
'id' => 'tumblr',
|
454 |
+
'name' => __( 'Tumblr', 'schema-wp' ),
|
455 |
+
'desc' => '',
|
456 |
+
'type' => 'text',
|
457 |
+
'placeholder' => 'http://',
|
458 |
+
'std' => ''
|
459 |
+
)
|
460 |
+
)
|
461 |
+
)
|
462 |
+
),
|
463 |
+
|
464 |
+
/** Search Results Settings */
|
465 |
+
'search_results' => apply_filters('schema_wp_settings_search_results',
|
466 |
+
array(
|
467 |
+
'sitelinks' => array( // section
|
468 |
+
'sitelinks_search_box' => array(
|
469 |
+
'id' => 'sitelinks_search_box',
|
470 |
+
'name' => __( 'Enable Sitelinks Search Box?', 'schema-wp' ),
|
471 |
+
'desc' => __( 'Tell Google to show a Sitelinks search box.', 'schema-wp' ),
|
472 |
+
'type' => 'checkbox'
|
473 |
+
)
|
474 |
+
),
|
475 |
+
'sitename' => array( // section
|
476 |
+
'site_name_enable' => array(
|
477 |
+
'id' => 'site_name_enable',
|
478 |
+
'name' => __( 'Enable Site Name?', 'schema-wp' ),
|
479 |
+
'desc' => __( 'Tell Google to show your site name in search results.', 'schema-wp' ),
|
480 |
+
'type' => 'checkbox'
|
481 |
+
),
|
482 |
+
'site_name' => array(
|
483 |
+
'id' => 'site_name',
|
484 |
+
'name' => __( 'Site Name', 'schema-wp' ),
|
485 |
+
'desc' => '',
|
486 |
+
'type' => 'text',
|
487 |
+
'std' => get_bloginfo ('name'),
|
488 |
+
),
|
489 |
+
'site_alternate_name' => array(
|
490 |
+
'id' => 'site_alternate_name',
|
491 |
+
'name' => __( 'Site Alternate Name', 'schema-wp' ),
|
492 |
+
'desc' => '',
|
493 |
+
'type' => 'text',
|
494 |
+
'std' => ''
|
495 |
+
)
|
496 |
+
),
|
497 |
+
)
|
498 |
+
),
|
499 |
+
|
500 |
+
|
501 |
+
/** Extension Settings */
|
502 |
+
'extensions' => apply_filters('schema_wp_settings_extensions',
|
503 |
+
array()
|
504 |
+
),
|
505 |
+
'licenses' => apply_filters('schema_wp_settings_licenses',
|
506 |
+
array()
|
507 |
+
),
|
508 |
+
|
509 |
+
/** Misc Settings */
|
510 |
+
'misc' => apply_filters('schema_wp_settings_misc',
|
511 |
+
array(
|
512 |
+
'main' => array(
|
513 |
+
'uninstall_on_delete' => array(
|
514 |
+
'id' => 'uninstall_on_delete',
|
515 |
+
'name' => __( 'Delete Data on Uninstall?', 'schema-wp' ),
|
516 |
+
'desc' => __( 'Check this box if you would like Schema to completely remove all of its data when uninstalling via Plugins > Delete.', 'schema-wp' ),
|
517 |
+
'type' => 'checkbox'
|
518 |
+
)
|
519 |
+
)
|
520 |
+
)
|
521 |
+
)
|
522 |
+
);
|
523 |
+
|
524 |
+
return apply_filters( 'schema_wp_registered_settings', $schema_wp_settings );
|
525 |
+
}
|
526 |
+
|
527 |
+
/**
|
528 |
+
* Settings Sanitization
|
529 |
+
*
|
530 |
+
* Adds a settings error (for the updated message)
|
531 |
+
* At some point this will validate input
|
532 |
+
*
|
533 |
+
* @since 1.0.8.2
|
534 |
+
*
|
535 |
+
* @param array $input The value inputted in the field
|
536 |
+
* @global $schema_wp_options Array of all the Schema Options
|
537 |
+
*
|
538 |
+
* @return string $input Sanitizied value
|
539 |
+
*/
|
540 |
+
function schema_wp_settings_sanitize( $input = array() ) {
|
541 |
+
global $schema_wp_options;
|
542 |
+
|
543 |
+
$doing_section = false;
|
544 |
+
if ( ! empty( $_POST['_wp_http_referer'] ) ) {
|
545 |
+
$doing_section = true;
|
546 |
+
}
|
547 |
+
|
548 |
+
$setting_types = schema_wp_get_registered_settings_types();
|
549 |
+
$input = $input ? $input : array();
|
550 |
+
|
551 |
+
if ( $doing_section ) {
|
552 |
+
|
553 |
+
parse_str( $_POST['_wp_http_referer'], $referrer ); // Pull out the tab and section
|
554 |
+
$tab = isset( $referrer['tab'] ) ? $referrer['tab'] : 'general';
|
555 |
+
$section = isset( $referrer['section'] ) ? $referrer['section'] : 'main';
|
556 |
+
|
557 |
+
// Run a general sanitization for the tab for special fields (like taxes)
|
558 |
+
$input = apply_filters( 'schema_wp_settings_' . $tab . '_sanitize', $input );
|
559 |
+
|
560 |
+
// Run a general sanitization for the section so custom tabs with sub-sections can save special data
|
561 |
+
$input = apply_filters( 'schema_wp_settings_' . $tab . '-' . $section . '_sanitize', $input );
|
562 |
+
|
563 |
+
}
|
564 |
+
|
565 |
+
// Merge our new settings with the existing
|
566 |
+
$output = array_merge( $schema_wp_options, $input );
|
567 |
+
|
568 |
+
foreach ( $setting_types as $key => $type ) {
|
569 |
+
|
570 |
+
if ( empty( $type ) ) {
|
571 |
+
continue;
|
572 |
+
}
|
573 |
+
|
574 |
+
// Some setting types are not actually settings, just keep moving along here
|
575 |
+
$non_setting_types = apply_filters( 'schema_wp_non_setting_types', array(
|
576 |
+
'header', 'descriptive_text', 'hook',
|
577 |
+
) );
|
578 |
+
|
579 |
+
if ( in_array( $type, $non_setting_types ) ) {
|
580 |
+
continue;
|
581 |
+
}
|
582 |
+
|
583 |
+
if ( array_key_exists( $key, $output ) ) {
|
584 |
+
$output[ $key ] = apply_filters( 'schema_wp_settings_sanitize_' . $type, $output[ $key ], $key );
|
585 |
+
$output[ $key ] = apply_filters( 'schema_wp_settings_sanitize', $output[ $key ], $key );
|
586 |
+
}
|
587 |
+
|
588 |
+
if ( $doing_section ) {
|
589 |
+
switch( $type ) {
|
590 |
+
case 'checkbox':
|
591 |
+
if ( array_key_exists( $key, $input ) && $output[ $key ] === '-1' ) {
|
592 |
+
unset( $output[ $key ] );
|
593 |
+
}
|
594 |
+
break;
|
595 |
+
default:
|
596 |
+
if ( array_key_exists( $key, $input ) && empty( $input[ $key ] ) ) {
|
597 |
+
unset( $output[ $key ] );
|
598 |
+
}
|
599 |
+
break;
|
600 |
+
}
|
601 |
+
} else {
|
602 |
+
if ( empty( $input[ $key ] ) ) {
|
603 |
+
unset( $output[ $key ] );
|
604 |
+
}
|
605 |
+
}
|
606 |
+
|
607 |
+
}
|
608 |
+
|
609 |
+
if ( $doing_section ) {
|
610 |
+
add_settings_error( 'schema-wp-notices', '', __( 'Settings updated.', 'wp-schema' ), 'updated' );
|
611 |
+
}
|
612 |
+
|
613 |
+
return $output;
|
614 |
+
}
|
615 |
+
|
616 |
+
/**
|
617 |
+
* Flattens the set of registered settings and their type so we can easily sanitize all the settings
|
618 |
+
* in a much cleaner set of logic in schema_wp_settings_sanitize
|
619 |
+
*
|
620 |
+
* @since 2.6.5
|
621 |
+
* @return array Key is the setting ID, value is the type of setting it is registered as
|
622 |
+
*/
|
623 |
+
function schema_wp_get_registered_settings_types() {
|
624 |
+
$settings = schema_wp_get_registered_settings();
|
625 |
+
$setting_types = array();
|
626 |
+
|
627 |
+
// debug
|
628 |
+
//echo'<pre>';print_r($settings);echo'</pre>';exit;
|
629 |
+
|
630 |
+
foreach ( $settings as $tab ) {
|
631 |
+
|
632 |
+
foreach ( $tab as $section_or_setting ) {
|
633 |
+
|
634 |
+
// See if we have a setting registered at the tab level for backwards compatibility
|
635 |
+
if ( is_array( $section_or_setting ) && array_key_exists( 'type', $section_or_setting ) ) {
|
636 |
+
$setting_types[ $section_or_setting['id'] ] = $section_or_setting['type'];
|
637 |
+
continue;
|
638 |
+
}
|
639 |
+
|
640 |
+
foreach ( $section_or_setting as $section => $section_settings ) {
|
641 |
+
if(isset($section_settings['id'])) $setting_types[ $section_settings['id'] ] = $section_settings['type'];
|
642 |
+
}
|
643 |
+
}
|
644 |
+
|
645 |
+
}
|
646 |
+
|
647 |
+
return $setting_types;
|
648 |
+
}
|
649 |
+
|
650 |
+
|
651 |
+
/**
|
652 |
+
* Sanitize text fields
|
653 |
+
*
|
654 |
+
* @since 1.8
|
655 |
+
* @param array $input The field value
|
656 |
+
* @return string $input Sanitizied value
|
657 |
+
*/
|
658 |
+
function schema_wp_sanitize_text_field( $input ) {
|
659 |
+
$tags = array(
|
660 |
+
'p' => array(
|
661 |
+
'class' => array(),
|
662 |
+
'id' => array(),
|
663 |
+
),
|
664 |
+
'span' => array(
|
665 |
+
'class' => array(),
|
666 |
+
'id' => array(),
|
667 |
+
),
|
668 |
+
'a' => array(
|
669 |
+
'href' => array(),
|
670 |
+
'title' => array(),
|
671 |
+
'class' => array(),
|
672 |
+
'title' => array(),
|
673 |
+
'id' => array(),
|
674 |
+
),
|
675 |
+
'strong' => array(),
|
676 |
+
'em' => array(),
|
677 |
+
'br' => array(),
|
678 |
+
'img' => array(
|
679 |
+
'src' => array(),
|
680 |
+
'title' => array(),
|
681 |
+
'alt' => array(),
|
682 |
+
'id' => array(),
|
683 |
+
),
|
684 |
+
'div' => array(
|
685 |
+
'class' => array(),
|
686 |
+
'id' => array(),
|
687 |
+
),
|
688 |
+
'ul' => array(
|
689 |
+
'class' => array(),
|
690 |
+
'id' => array(),
|
691 |
+
),
|
692 |
+
'li' => array(
|
693 |
+
'class' => array(),
|
694 |
+
'id' => array(),
|
695 |
+
)
|
696 |
+
);
|
697 |
+
|
698 |
+
$allowed_tags = apply_filters( 'schema_wp_allowed_html_tags', $tags );
|
699 |
+
|
700 |
+
return trim( wp_kses( $input, $allowed_tags ) );
|
701 |
+
}
|
702 |
+
add_filter( 'schema_wp_settings_sanitize_text', 'schema_wp_sanitize_text_field' );
|
703 |
+
|
704 |
+
/**
|
705 |
+
* Retrieve settings tabs
|
706 |
+
*
|
707 |
+
* @since 1.8
|
708 |
+
* @return array $tabs
|
709 |
+
*/
|
710 |
+
function schema_wp_get_settings_tabs() {
|
711 |
+
|
712 |
+
$settings = schema_wp_get_registered_settings();
|
713 |
+
|
714 |
+
$tabs = array();
|
715 |
+
$tabs['general'] = __( 'General', 'schema-wp' );
|
716 |
+
$tabs['content'] = __( 'Content', 'schema-wp' );
|
717 |
+
$tabs['knowledge_graph'] = __( 'Knowledge Graph', 'schema-wp' );
|
718 |
+
$tabs['search_results'] = __( 'Search Results', 'schema-wp' );
|
719 |
+
|
720 |
+
if( ! empty( $settings['extensions'] ) ) {
|
721 |
+
$tabs['extensions'] = __( 'Extensions', 'wp-schema' );
|
722 |
+
}
|
723 |
+
if( ! empty( $settings['licenses'] ) ) {
|
724 |
+
$tabs['licenses'] = __( 'Licenses', 'wp-schema' );
|
725 |
+
}
|
726 |
+
|
727 |
+
$tabs['misc'] = __( 'Misc', 'wp-schema' );
|
728 |
+
|
729 |
+
//if( schema_wp()->settings->get( 'debug_mode', false ) ) {
|
730 |
+
// $tabs['schema_wp_debug'] = __( 'Debug Assistant', 'schema-wp' );
|
731 |
+
//}
|
732 |
+
|
733 |
+
return apply_filters( 'schema_wp_settings_tabs', $tabs );
|
734 |
+
}
|
735 |
+
|
736 |
+
/**
|
737 |
+
* Retrieve settings tabs
|
738 |
+
*
|
739 |
+
* @since 2.5
|
740 |
+
* @return array $section
|
741 |
+
*/
|
742 |
+
function schema_wp_get_settings_tab_sections( $tab = false ) {
|
743 |
+
|
744 |
+
$tabs = false;
|
745 |
+
$sections = schema_wp_get_registered_settings_sections();
|
746 |
+
|
747 |
+
if( $tab && ! empty( $sections[ $tab ] ) ) {
|
748 |
+
$tabs = $sections[ $tab ];
|
749 |
+
} else if ( $tab ) {
|
750 |
+
$tabs = false;
|
751 |
+
}
|
752 |
+
|
753 |
+
return $tabs;
|
754 |
+
}
|
755 |
+
|
756 |
+
/**
|
757 |
+
* Get the settings sections for each tab
|
758 |
+
* Uses a static to avoid running the filters on every request to this function
|
759 |
+
*
|
760 |
+
* @since 2.5
|
761 |
+
* @return array Array of tabs and sections
|
762 |
+
*/
|
763 |
+
function schema_wp_get_registered_settings_sections() {
|
764 |
+
|
765 |
+
static $sections = false;
|
766 |
+
|
767 |
+
if ( false !== $sections ) {
|
768 |
+
return $sections;
|
769 |
+
}
|
770 |
+
|
771 |
+
$sections = array(
|
772 |
+
'general' => apply_filters( 'schema_wp_settings_sections_general', array(
|
773 |
+
'main' => '',
|
774 |
+
) ),
|
775 |
+
'content' => apply_filters( 'schema_wp_settings_sections_content', array(
|
776 |
+
'main' => '',
|
777 |
+
) ),
|
778 |
+
'knowledge_graph' => apply_filters( 'schema_wp_settings_sections_knowledge_graph', array(
|
779 |
+
'organization' => __( 'Organization Info', 'wp-schema' ),
|
780 |
+
'corporate_contacts' => __( 'Corporate Contacts', 'wp-schema' ),
|
781 |
+
) ),
|
782 |
+
'search_results' => apply_filters( 'schema_wp_settings_sections_search_results', array(
|
783 |
+
'sitelinks' => __( 'Sitelinks Search Box', 'wp-schema' ),
|
784 |
+
'sitename' => __( 'Site Name', 'wp-schema' ),
|
785 |
+
) ),
|
786 |
+
'extensions' => apply_filters( 'schema_wp_settings_sections_extensions', array(
|
787 |
+
'main' => __( 'Main', 'wp-schema' ),
|
788 |
+
) ),
|
789 |
+
'licenses' => apply_filters( 'schema_wp_settings_sections_licenses', array() ),
|
790 |
+
'misc' => apply_filters( 'schema_wp_settings_sections_misc', array(
|
791 |
+
'main' => '',
|
792 |
+
) ),
|
793 |
+
);
|
794 |
+
|
795 |
+
$sections = apply_filters( 'schema_wp_settings_sections', $sections );
|
796 |
+
|
797 |
+
return $sections;
|
798 |
+
}
|
799 |
+
|
800 |
+
/**
|
801 |
+
* Retrieve a list of all published pages
|
802 |
+
*
|
803 |
+
* On large sites this can be expensive, so only load if on the settings page or $force is set to true
|
804 |
+
*
|
805 |
+
* @since 1.9.5
|
806 |
+
* @param bool $force Force the pages to be loaded even if not on settings
|
807 |
+
* @return array $pages_options An array of the pages
|
808 |
+
*/
|
809 |
+
function schema_wp_get_pages( $force = false ) {
|
810 |
+
|
811 |
+
$pages_options = array( '' => '' ); // Blank option
|
812 |
+
|
813 |
+
if( ( ! isset( $_GET['page'] ) || 'schema' != $_GET['page'] ) && ! $force ) {
|
814 |
+
return $pages_options;
|
815 |
+
}
|
816 |
+
|
817 |
+
$pages = get_pages();
|
818 |
+
if ( $pages ) {
|
819 |
+
foreach ( $pages as $page ) {
|
820 |
+
$pages_options[ $page->ID ] = $page->post_title;
|
821 |
+
}
|
822 |
+
}
|
823 |
+
|
824 |
+
return $pages_options;
|
825 |
+
}
|
826 |
+
|
827 |
+
/**
|
828 |
+
* Header Callback
|
829 |
+
*
|
830 |
+
* Renders the header.
|
831 |
+
*
|
832 |
+
* @since 1.0
|
833 |
+
* @param array $args Arguments passed by the setting
|
834 |
+
* @return void
|
835 |
+
*/
|
836 |
+
function schema_wp_header_callback( $args ) {
|
837 |
+
echo apply_filters( 'schema_wp_after_setting_output', '', $args );
|
838 |
+
}
|
839 |
+
|
840 |
+
/**
|
841 |
+
* Checkbox Callback
|
842 |
+
*
|
843 |
+
* Renders checkboxes.
|
844 |
+
*
|
845 |
+
* @since 1.0
|
846 |
+
* @param array $args Arguments passed by the setting
|
847 |
+
*
|
848 |
+
* @return void
|
849 |
+
*/
|
850 |
+
function schema_wp_checkbox_callback( $args ) {
|
851 |
+
$schema_wp_option = schema_wp_get_option( $args['id'] );
|
852 |
+
|
853 |
+
if ( isset( $args['faux'] ) && true === $args['faux'] ) {
|
854 |
+
$name = '';
|
855 |
+
} else {
|
856 |
+
$name = 'name="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']"';
|
857 |
+
}
|
858 |
+
|
859 |
+
$checked = ! empty( $schema_wp_option ) ? checked( 1, $schema_wp_option, false ) : '';
|
860 |
+
$html = '<input type="hidden"' . $name . ' value="-1" />';
|
861 |
+
$html .= '<input type="checkbox" id="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']"' . $name . ' value="1" ' . $checked . '/>';
|
862 |
+
$html .= '<label for="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
|
863 |
+
|
864 |
+
echo apply_filters( 'schema_wp_after_setting_output', $html, $args );
|
865 |
+
}
|
866 |
+
|
867 |
+
/**
|
868 |
+
* Multicheck Callback
|
869 |
+
*
|
870 |
+
* Renders multiple checkboxes.
|
871 |
+
*
|
872 |
+
* @since 1.0
|
873 |
+
* @param array $args Arguments passed by the setting
|
874 |
+
*
|
875 |
+
* @return void
|
876 |
+
*/
|
877 |
+
function schema_wp_multicheck_callback( $args ) {
|
878 |
+
$schema_wp_option = schema_wp_get_option( $args['id'] );
|
879 |
+
|
880 |
+
$html = '';
|
881 |
+
if ( ! empty( $args['options'] ) ) {
|
882 |
+
foreach( $args['options'] as $key => $option ):
|
883 |
+
if( isset( $schema_wp_option[ $key ] ) ) { $enabled = $option; } else { $enabled = NULL; }
|
884 |
+
$html .= '<input name="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . '][' . schema_wp_sanitize_key( $key ) . ']" id="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . '][' . schema_wp_sanitize_key( $key ) . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked($option, $enabled, false) . '/> ';
|
885 |
+
$html .= '<label for="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . '][' . schema_wp_sanitize_key( $key ) . ']">' . wp_kses_post( $option ) . '</label><br/>';
|
886 |
+
endforeach;
|
887 |
+
$html .= '<p class="description">' . $args['desc'] . '</p>';
|
888 |
+
}
|
889 |
+
|
890 |
+
echo apply_filters( 'schema_wp_after_setting_output', $html, $args );
|
891 |
+
}
|
892 |
+
|
893 |
+
|
894 |
+
/**
|
895 |
+
* Radio Callback
|
896 |
+
*
|
897 |
+
* Renders radio boxes.
|
898 |
+
*
|
899 |
+
* @since 1.3.3
|
900 |
+
* @param array $args Arguments passed by the setting
|
901 |
+
*
|
902 |
+
* @return void
|
903 |
+
*/
|
904 |
+
function schema_wp_radio_callback( $args ) {
|
905 |
+
$schema_wp_options = schema_wp_get_option( $args['id'] );
|
906 |
+
|
907 |
+
$html = '';
|
908 |
+
|
909 |
+
foreach ( $args['options'] as $key => $option ) :
|
910 |
+
$checked = false;
|
911 |
+
|
912 |
+
if ( $schema_wp_options && $schema_wp_options == $key )
|
913 |
+
$checked = true;
|
914 |
+
elseif( isset( $args['std'] ) && $args['std'] == $key && ! $schema_wp_options )
|
915 |
+
$checked = true;
|
916 |
+
|
917 |
+
$html .= '<input name="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']" id="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . '][' . schema_wp_sanitize_key( $key ) . ']" type="radio" value="' . schema_wp_sanitize_key( $key ) . '" ' . checked(true, $checked, false) . '/> ';
|
918 |
+
$html .= '<label for="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . '][' . schema_wp_sanitize_key( $key ) . ']">' . esc_html( $option ) . '</label><br/>';
|
919 |
+
endforeach;
|
920 |
+
|
921 |
+
$html .= '<p class="description">' . apply_filters( 'schema_wp_after_setting_output', wp_kses_post( $args['desc'] ), $args ) . '</p>';
|
922 |
+
|
923 |
+
echo $html;
|
924 |
+
}
|
925 |
+
|
926 |
+
|
927 |
+
/**
|
928 |
+
* Text Callback
|
929 |
+
*
|
930 |
+
* Renders text fields.
|
931 |
+
*
|
932 |
+
* @since 1.0
|
933 |
+
* @param array $args Arguments passed by the setting
|
934 |
+
*
|
935 |
+
* @return void
|
936 |
+
*/
|
937 |
+
function schema_wp_text_callback( $args ) {
|
938 |
+
$schema_wp_option = schema_wp_get_option( $args['id'] );
|
939 |
+
|
940 |
+
if ( $schema_wp_option ) {
|
941 |
+
$value = $schema_wp_option;
|
942 |
+
} else {
|
943 |
+
$value = isset( $args['std'] ) ? $args['std'] : '';
|
944 |
+
}
|
945 |
+
|
946 |
+
if ( isset( $args['faux'] ) && true === $args['faux'] ) {
|
947 |
+
$args['readonly'] = true;
|
948 |
+
$value = isset( $args['std'] ) ? $args['std'] : '';
|
949 |
+
$name = '';
|
950 |
+
} else {
|
951 |
+
$name = 'name="schema_wp_settings[' . esc_attr( $args['id'] ) . ']"';
|
952 |
+
}
|
953 |
+
|
954 |
+
$readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
|
955 |
+
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
956 |
+
$html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" placeholder="' . $args['placeholder'] . '" ' . $readonly . '/>';
|
957 |
+
$html .= '<label for="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
|
958 |
+
|
959 |
+
echo apply_filters( 'schema_wp_after_setting_output', $html, $args );
|
960 |
+
}
|
961 |
+
|
962 |
+
/**
|
963 |
+
* Number Callback
|
964 |
+
*
|
965 |
+
* Renders number fields.
|
966 |
+
*
|
967 |
+
* @since 1.9
|
968 |
+
* @param array $args Arguments passed by the setting
|
969 |
+
*
|
970 |
+
* @return void
|
971 |
+
*/
|
972 |
+
function schema_wp_number_callback( $args ) {
|
973 |
+
$schema_wp_option = schema_wp_get_option( $args['id'] );
|
974 |
+
|
975 |
+
if ( $schema_wp_option ) {
|
976 |
+
$value = $schema_wp_option;
|
977 |
+
} else {
|
978 |
+
$value = isset( $args['std'] ) ? $args['std'] : '';
|
979 |
+
}
|
980 |
+
|
981 |
+
if ( isset( $args['faux'] ) && true === $args['faux'] ) {
|
982 |
+
$args['readonly'] = true;
|
983 |
+
$value = isset( $args['std'] ) ? $args['std'] : '';
|
984 |
+
$name = '';
|
985 |
+
} else {
|
986 |
+
$name = 'name="schema_wp_settings[' . esc_attr( $args['id'] ) . ']"';
|
987 |
+
}
|
988 |
+
|
989 |
+
$max = isset( $args['max'] ) ? $args['max'] : 999999;
|
990 |
+
$min = isset( $args['min'] ) ? $args['min'] : 0;
|
991 |
+
$step = isset( $args['step'] ) ? $args['step'] : 1;
|
992 |
+
|
993 |
+
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
994 |
+
$html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . sanitize_html_class( $size ) . '-text" id="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"/>';
|
995 |
+
$html .= '<label for="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
|
996 |
+
|
997 |
+
echo apply_filters( 'schema_wp_after_setting_output', $html, $args );
|
998 |
+
}
|
999 |
+
|
1000 |
+
/**
|
1001 |
+
* Textarea Callback
|
1002 |
+
*
|
1003 |
+
* Renders textarea fields.
|
1004 |
+
*
|
1005 |
+
* @since 1.0
|
1006 |
+
* @param array $args Arguments passed by the setting
|
1007 |
+
*
|
1008 |
+
* @return void
|
1009 |
+
*/
|
1010 |
+
function schema_wp_textarea_callback( $args ) {
|
1011 |
+
$schema_wp_option = schema_wp_get_option( $args['id'] );
|
1012 |
+
|
1013 |
+
if ( $schema_wp_option ) {
|
1014 |
+
$value = $schema_wp_option;
|
1015 |
+
} else {
|
1016 |
+
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1017 |
+
}
|
1018 |
+
|
1019 |
+
$html = '<textarea class="large-text" cols="50" rows="5" id="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']" name="schema_wp_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . ' placeholder="' . $args['placeholder'] .'"</textarea>';
|
1020 |
+
$html .= '<label for="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
|
1021 |
+
|
1022 |
+
echo apply_filters( 'schema_wp_after_setting_output', $html, $args );
|
1023 |
+
}
|
1024 |
+
|
1025 |
+
/**
|
1026 |
+
* Password Callback
|
1027 |
+
*
|
1028 |
+
* Renders password fields.
|
1029 |
+
*
|
1030 |
+
* @since 1.3
|
1031 |
+
* @param array $args Arguments passed by the setting
|
1032 |
+
*
|
1033 |
+
* @return void
|
1034 |
+
*/
|
1035 |
+
function schema_wp_password_callback( $args ) {
|
1036 |
+
$schema_wp_options = schema_wp_get_option( $args['id'] );
|
1037 |
+
|
1038 |
+
if ( $schema_wp_options ) {
|
1039 |
+
$value = $schema_wp_options;
|
1040 |
+
} else {
|
1041 |
+
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1042 |
+
}
|
1043 |
+
|
1044 |
+
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
1045 |
+
$html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']" name="schema_wp_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>';
|
1046 |
+
$html .= '<label for="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
|
1047 |
+
|
1048 |
+
echo apply_filters( 'schema_wp_after_setting_output', $html, $args );
|
1049 |
+
}
|
1050 |
+
|
1051 |
+
/**
|
1052 |
+
* Missing Callback
|
1053 |
+
*
|
1054 |
+
* If a function is missing for settings callbacks alert the user.
|
1055 |
+
*
|
1056 |
+
* @since 1.3.1
|
1057 |
+
* @param array $args Arguments passed by the setting
|
1058 |
+
* @return void
|
1059 |
+
*/
|
1060 |
+
function schema_wp_missing_callback($args) {
|
1061 |
+
printf(
|
1062 |
+
__( 'The callback function used for the %s setting is missing.', 'wp-schema' ),
|
1063 |
+
'<strong>' . $args['id'] . '</strong>'
|
1064 |
+
);
|
1065 |
+
}
|
1066 |
+
|
1067 |
+
/**
|
1068 |
+
* Select Callback
|
1069 |
+
*
|
1070 |
+
* Renders select fields.
|
1071 |
+
*
|
1072 |
+
* @since 1.0
|
1073 |
+
* @param array $args Arguments passed by the setting
|
1074 |
+
*
|
1075 |
+
* @return void
|
1076 |
+
*/
|
1077 |
+
function schema_wp_select_callback($args) {
|
1078 |
+
$schema_wp_option = schema_wp_get_option( $args['id'] );
|
1079 |
+
|
1080 |
+
if ( $schema_wp_option ) {
|
1081 |
+
$value = $schema_wp_option;
|
1082 |
+
} else {
|
1083 |
+
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1084 |
+
}
|
1085 |
+
|
1086 |
+
if ( isset( $args['placeholder'] ) ) {
|
1087 |
+
$placeholder = $args['placeholder'];
|
1088 |
+
} else {
|
1089 |
+
$placeholder = '';
|
1090 |
+
}
|
1091 |
+
|
1092 |
+
if ( isset( $args['chosen'] ) ) {
|
1093 |
+
$chosen = 'class="schema-wp-chosen"';
|
1094 |
+
} else {
|
1095 |
+
$chosen = '';
|
1096 |
+
}
|
1097 |
+
|
1098 |
+
$html = '<select id="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']" name="schema_wp_settings[' . esc_attr( $args['id'] ) . ']" ' . $chosen . 'data-placeholder="' . esc_html( $placeholder ) . '" />';
|
1099 |
+
|
1100 |
+
foreach ( $args['options'] as $option => $name ) {
|
1101 |
+
$selected = selected( $option, $value, false );
|
1102 |
+
$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
|
1103 |
+
}
|
1104 |
+
|
1105 |
+
$html .= '</select>';
|
1106 |
+
$html .= '<label for="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
|
1107 |
+
|
1108 |
+
echo apply_filters( 'schema_wp_after_setting_output', $html, $args );
|
1109 |
+
}
|
1110 |
+
|
1111 |
+
/**
|
1112 |
+
* Color select Callback
|
1113 |
+
*
|
1114 |
+
* Renders color select fields.
|
1115 |
+
*
|
1116 |
+
* @since 1.8
|
1117 |
+
* @param array $args Arguments passed by the setting
|
1118 |
+
*
|
1119 |
+
* @return void
|
1120 |
+
*/
|
1121 |
+
function schema_wp_color_select_callback( $args ) {
|
1122 |
+
$schema_wp_option = schema_wp_get_option( $args['id'] );
|
1123 |
+
|
1124 |
+
if ( $schema_wp_option ) {
|
1125 |
+
$value = $schema_wp_option;
|
1126 |
+
} else {
|
1127 |
+
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1128 |
+
}
|
1129 |
+
|
1130 |
+
$html = '<select id="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']" name="schema_wp_settings[' . esc_attr( $args['id'] ) . ']"/>';
|
1131 |
+
|
1132 |
+
foreach ( $args['options'] as $option => $color ) {
|
1133 |
+
$selected = selected( $option, $value, false );
|
1134 |
+
$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
|
1135 |
+
}
|
1136 |
+
|
1137 |
+
$html .= '</select>';
|
1138 |
+
$html .= '<label for="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
|
1139 |
+
|
1140 |
+
echo apply_filters( 'schema_wp_after_setting_output', $html, $args );
|
1141 |
+
}
|
1142 |
+
|
1143 |
+
/**
|
1144 |
+
* Rich Editor Callback
|
1145 |
+
*
|
1146 |
+
* Renders rich editor fields.
|
1147 |
+
*
|
1148 |
+
* @since 1.0
|
1149 |
+
* @param array $args Arguments passed by the setting
|
1150 |
+
*/
|
1151 |
+
function schema_wp_rich_editor_callback( $args ) {
|
1152 |
+
$schema_wp_option = schema_wp_get_option( $args['id'] );
|
1153 |
+
|
1154 |
+
if ( $schema_wp_option ) {
|
1155 |
+
$value = $schema_wp_option;
|
1156 |
+
|
1157 |
+
if( empty( $args['allow_blank'] ) && empty( $value ) ) {
|
1158 |
+
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1159 |
+
}
|
1160 |
+
} else {
|
1161 |
+
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1162 |
+
}
|
1163 |
+
|
1164 |
+
$rows = isset( $args['size'] ) ? $args['size'] : 20;
|
1165 |
+
|
1166 |
+
|
1167 |
+
ob_start();
|
1168 |
+
wp_editor( stripslashes( $value ), 'schema_wp_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'schema_wp_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ) ) );
|
1169 |
+
$html = ob_get_clean();
|
1170 |
+
|
1171 |
+
$html .= '<br/><label for="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
|
1172 |
+
|
1173 |
+
echo apply_filters( 'schema_wp_after_setting_output', $html, $args );
|
1174 |
+
}
|
1175 |
+
|
1176 |
+
/**
|
1177 |
+
* Upload Callback
|
1178 |
+
*
|
1179 |
+
* Renders upload fields.
|
1180 |
+
*
|
1181 |
+
* @since 1.0
|
1182 |
+
* @param array $args Arguments passed by the setting
|
1183 |
+
*
|
1184 |
+
* @return void
|
1185 |
+
*/
|
1186 |
+
function schema_wp_upload_callback( $args ) {
|
1187 |
+
$schema_wp_option = schema_wp_get_option( $args['id'] );
|
1188 |
+
|
1189 |
+
if ( $schema_wp_option ) {
|
1190 |
+
$value = $schema_wp_option;
|
1191 |
+
} else {
|
1192 |
+
$value = isset($args['std']) ? $args['std'] : '';
|
1193 |
+
}
|
1194 |
+
|
1195 |
+
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
1196 |
+
$html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']" name="schema_wp_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
|
1197 |
+
$html .= '<span> <input type="button" class="schema_wp_settings_upload_button button-secondary" value="' . __( 'Upload File', 'wp-schema' ) . '"/></span>';
|
1198 |
+
$html .= '<label for="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
|
1199 |
+
|
1200 |
+
echo apply_filters( 'schema_wp_after_setting_output', $html, $args );
|
1201 |
+
}
|
1202 |
+
|
1203 |
+
/**
|
1204 |
+
* Image Upload Callback
|
1205 |
+
*
|
1206 |
+
* Renders file upload fields.
|
1207 |
+
*
|
1208 |
+
* @since 1.0
|
1209 |
+
* @param array $args Arguements passed by the setting
|
1210 |
+
*/
|
1211 |
+
function schema_wp_image_upload_callback( $args ) {
|
1212 |
+
$schema_wp_option = schema_wp_get_option( $args['id'] );
|
1213 |
+
|
1214 |
+
if( $schema_wp_option )
|
1215 |
+
$value = $schema_wp_option;
|
1216 |
+
else
|
1217 |
+
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1218 |
+
|
1219 |
+
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
1220 |
+
$html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']" name="schema_wp_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
|
1221 |
+
$html .= '<span> <input type="button" class="schema_wp_settings_upload_button button-secondary" value="' . __( 'Upload File', 'wp-schema' ) . '"/></span>';
|
1222 |
+
|
1223 |
+
$html .= '<p>' . wp_kses_post( $args['desc'] ) . '</p>';
|
1224 |
+
|
1225 |
+
if ( ! empty( $value ) ) {
|
1226 |
+
$html .= '<div id="preview_image">';
|
1227 |
+
$html .= '<img src="'.esc_attr( stripslashes( $value ) ).'" />';
|
1228 |
+
$html .= '</div>';
|
1229 |
+
} else {
|
1230 |
+
$html .= '<div id="preview_image" style="display: none;"></div>';
|
1231 |
+
}
|
1232 |
+
|
1233 |
+
echo apply_filters( 'schema_wp_after_setting_output', $html, $args );
|
1234 |
+
}
|
1235 |
+
|
1236 |
+
/**
|
1237 |
+
* Color picker Callback
|
1238 |
+
*
|
1239 |
+
* Renders color picker fields.
|
1240 |
+
*
|
1241 |
+
* @since 1.6
|
1242 |
+
* @param array $args Arguments passed by the setting
|
1243 |
+
*
|
1244 |
+
* @return void
|
1245 |
+
*/
|
1246 |
+
function schema_wp_color_callback( $args ) {
|
1247 |
+
$schema_wp_option = schema_wp_get_option( $args['id'] );
|
1248 |
+
|
1249 |
+
if ( $schema_wp_option ) {
|
1250 |
+
$value = $schema_wp_option;
|
1251 |
+
} else {
|
1252 |
+
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1253 |
+
}
|
1254 |
+
|
1255 |
+
$default = isset( $args['std'] ) ? $args['std'] : '';
|
1256 |
+
|
1257 |
+
$html = '<input type="text" class="schema-wp-color-picker" id="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']" name="schema_wp_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $default ) . '" />';
|
1258 |
+
$html .= '<label for="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
|
1259 |
+
|
1260 |
+
echo apply_filters( 'schema_wp_after_setting_output', $html, $args );
|
1261 |
+
}
|
1262 |
+
|
1263 |
+
/**
|
1264 |
+
* Descriptive text callback.
|
1265 |
+
*
|
1266 |
+
* Renders descriptive text onto the settings field.
|
1267 |
+
*
|
1268 |
+
* @since 2.1.3
|
1269 |
+
* @param array $args Arguments passed by the setting
|
1270 |
+
* @return void
|
1271 |
+
*/
|
1272 |
+
function schema_wp_descriptive_text_callback( $args ) {
|
1273 |
+
$html = wp_kses_post( $args['desc'] );
|
1274 |
+
|
1275 |
+
echo apply_filters( 'schema_wp_after_setting_output', $html, $args );
|
1276 |
+
}
|
1277 |
+
|
1278 |
+
|
1279 |
+
/**
|
1280 |
+
* Post Select Callback
|
1281 |
+
*
|
1282 |
+
* Renders file upload fields.
|
1283 |
+
*
|
1284 |
+
* @since 1.5.2
|
1285 |
+
* @param array $args Arguements passed by the setting
|
1286 |
+
*/
|
1287 |
+
function schema_wp_post_select_callback( $args ) {
|
1288 |
+
|
1289 |
+
$schema_wp_option = schema_wp_get_option( $args['id'] );
|
1290 |
+
|
1291 |
+
if ( $schema_wp_option ) {
|
1292 |
+
$value = $schema_wp_option;
|
1293 |
+
} else {
|
1294 |
+
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1295 |
+
}
|
1296 |
+
|
1297 |
+
$html = '<select id="schema_wp_settings[' . $args['id'] . ']" name="schema_wp_settings[' . $args['id'] . ']"/>';
|
1298 |
+
$html .= '<option value=""> - '.__('Select One', 'schema-wp').' - </option>'; // Select One
|
1299 |
+
$posts = get_posts( array( 'post_type' => $args['post_type'], 'posts_per_page' => -1, 'orderby' => 'name', 'order' => 'ASC' ) );
|
1300 |
+
foreach ( $posts as $item ) :
|
1301 |
+
$selected = selected( $item->ID , $value, false );
|
1302 |
+
$html .= '<option value="' . $item->ID . '"' . $selected . '>' . $item->post_title . '</option>';
|
1303 |
+
$post_type_object = get_post_type_object( $args['post_type'] );
|
1304 |
+
endforeach;
|
1305 |
+
$html .= '</select>';
|
1306 |
+
$html .= '<p class="description">' . $args['desc'] . '</p>';
|
1307 |
+
|
1308 |
+
echo $html;
|
1309 |
+
}
|
1310 |
+
|
1311 |
+
|
1312 |
+
|
1313 |
+
/**
|
1314 |
+
* Registers the license field callback for Software Licensing
|
1315 |
+
*
|
1316 |
+
* @since 1.5
|
1317 |
+
* @param array $args Arguments passed by the setting
|
1318 |
+
*
|
1319 |
+
* @return void
|
1320 |
+
*/
|
1321 |
+
if ( ! function_exists( 'schema_wp_license_key_callback' ) ) {
|
1322 |
+
function schema_wp_license_key_callback( $args ) {
|
1323 |
+
$schema_wp_option = schema_wp_get_option( $args['id'] );
|
1324 |
+
|
1325 |
+
$messages = array();
|
1326 |
+
$license = get_option( $args['options']['is_valid_license_option'] );
|
1327 |
+
|
1328 |
+
if ( $schema_wp_option ) {
|
1329 |
+
$value = $schema_wp_option;
|
1330 |
+
} else {
|
1331 |
+
$value = isset( $args['std'] ) ? $args['std'] : '';
|
1332 |
+
}
|
1333 |
+
|
1334 |
+
if( ! empty( $license ) && is_object( $license ) ) {
|
1335 |
+
|
1336 |
+
// activate_license 'invalid' on anything other than valid, so if there was an error capture it
|
1337 |
+
if ( false === $license->success ) {
|
1338 |
+
|
1339 |
+
switch( $license->error ) {
|
1340 |
+
|
1341 |
+
case 'expired' :
|
1342 |
+
|
1343 |
+
$class = 'expired';
|
1344 |
+
$messages[] = sprintf(
|
1345 |
+
__( 'Your license key expired on %s. Please <a href="%s" target="_blank">renew your license key</a>.', 'wp-schema' ),
|
1346 |
+
date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
|
1347 |
+
'https://easydigitaldownloads.com/checkout/?schema_wp_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
|
1348 |
+
);
|
1349 |
+
|
1350 |
+
$license_status = 'license-' . $class . '-notice';
|
1351 |
+
|
1352 |
+
break;
|
1353 |
+
|
1354 |
+
case 'revoked' :
|
1355 |
+
|
1356 |
+
$class = 'error';
|
1357 |
+
$messages[] = sprintf(
|
1358 |
+
__( 'Your license key has been disabled. Please <a href="%s" target="_blank">contact support</a> for more information.', 'wp-schema' ),
|
1359 |
+
'https://easydigitaldownloads.com/support?utm_campaign=admin&utm_source=licenses&utm_medium=revoked'
|
1360 |
+
);
|
1361 |
+
|
1362 |
+
$license_status = 'license-' . $class . '-notice';
|
1363 |
+
|
1364 |
+
break;
|
1365 |
+
|
1366 |
+
case 'missing' :
|
1367 |
+
|
1368 |
+
$class = 'error';
|
1369 |
+
$messages[] = sprintf(
|
1370 |
+
__( 'Invalid license. Please <a href="%s" target="_blank">visit your account page</a> and verify it.', 'wp-schema' ),
|
1371 |
+
'https://easydigitaldownloads.com/your-account?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
|
1372 |
+
);
|
1373 |
+
|
1374 |
+
$license_status = 'license-' . $class . '-notice';
|
1375 |
+
|
1376 |
+
break;
|
1377 |
+
|
1378 |
+
case 'invalid' :
|
1379 |
+
case 'site_inactive' :
|
1380 |
+
|
1381 |
+
$class = 'error';
|
1382 |
+
$messages[] = sprintf(
|
1383 |
+
__( 'Your %s is not active for this URL. Please <a href="%s" target="_blank">visit your account page</a> to manage your license key URLs.', 'wp-schema' ),
|
1384 |
+
$args['name'],
|
1385 |
+
'https://easydigitaldownloads.com/your-account?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
|
1386 |
+
);
|
1387 |
+
|
1388 |
+
$license_status = 'license-' . $class . '-notice';
|
1389 |
+
|
1390 |
+
break;
|
1391 |
+
|
1392 |
+
case 'item_name_mismatch' :
|
1393 |
+
|
1394 |
+
$class = 'error';
|
1395 |
+
$messages[] = sprintf( __( 'This appears to be an invalid license key for %s.', 'wp-schema' ), $args['name'] );
|
1396 |
+
|
1397 |
+
$license_status = 'license-' . $class . '-notice';
|
1398 |
+
|
1399 |
+
break;
|
1400 |
+
|
1401 |
+
case 'no_activations_left':
|
1402 |
+
|
1403 |
+
$class = 'error';
|
1404 |
+
$messages[] = sprintf( __( 'Your license key has reached its activation limit. <a href="%s">View possible upgrades</a> now.', 'wp-schema' ), 'https://easydigitaldownloads.com/your-account/' );
|
1405 |
+
|
1406 |
+
$license_status = 'license-' . $class . '-notice';
|
1407 |
+
|
1408 |
+
break;
|
1409 |
+
|
1410 |
+
default :
|
1411 |
+
|
1412 |
+
$messages[] = print_r( $license, true );
|
1413 |
+
break;
|
1414 |
+
}
|
1415 |
+
|
1416 |
+
} else {
|
1417 |
+
|
1418 |
+
switch( $license->license ) {
|
1419 |
+
|
1420 |
+
case 'valid' :
|
1421 |
+
default:
|
1422 |
+
|
1423 |
+
$class = 'valid';
|
1424 |
+
|
1425 |
+
$now = current_time( 'timestamp' );
|
1426 |
+
$expiration = strtotime( $license->expires, current_time( 'timestamp' ) );
|
1427 |
+
|
1428 |
+
if( 'lifetime' === $license->expires ) {
|
1429 |
+
|
1430 |
+
$messages[] = __( 'License key never expires.', 'wp-schema' );
|
1431 |
+
|
1432 |
+
$license_status = 'license-lifetime-notice';
|
1433 |
+
|
1434 |
+
} elseif( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) {
|
1435 |
+
|
1436 |
+
$messages[] = sprintf(
|
1437 |
+
__( 'Your license key expires soon! It expires on %s. <a href="%s" target="_blank">Renew your license key</a>.', 'wp-schema' ),
|
1438 |
+
date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
|
1439 |
+
'https://easydigitaldownloads.com/checkout/?schema_wp_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
|
1440 |
+
);
|
1441 |
+
|
1442 |
+
$license_status = 'license-expires-soon-notice';
|
1443 |
+
|
1444 |
+
} else {
|
1445 |
+
|
1446 |
+
$messages[] = sprintf(
|
1447 |
+
__( 'Your license key expires on %s.', 'wp-schema' ),
|
1448 |
+
date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) )
|
1449 |
+
);
|
1450 |
+
|
1451 |
+
$license_status = 'license-expiration-date-notice';
|
1452 |
+
|
1453 |
+
}
|
1454 |
+
|
1455 |
+
break;
|
1456 |
+
|
1457 |
+
}
|
1458 |
+
|
1459 |
+
}
|
1460 |
+
|
1461 |
+
} else {
|
1462 |
+
$class = 'empty';
|
1463 |
+
|
1464 |
+
$messages[] = sprintf(
|
1465 |
+
__( 'To receive updates, please enter your valid %s license key.', 'wp-schema' ),
|
1466 |
+
$args['name']
|
1467 |
+
);
|
1468 |
+
|
1469 |
+
$license_status = null;
|
1470 |
+
}
|
1471 |
+
|
1472 |
+
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
|
1473 |
+
$html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']" name="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>';
|
1474 |
+
|
1475 |
+
if ( ( is_object( $license ) && 'valid' == $license->license ) || 'valid' == $license ) {
|
1476 |
+
$html .= '<input type="submit" class="button-secondary" name="' . $args['id'] . '_deactivate" value="' . __( 'Deactivate License', 'wp-schema' ) . '"/>';
|
1477 |
+
}
|
1478 |
+
|
1479 |
+
$html .= '<label for="schema_wp_settings[' . schema_wp_sanitize_key( $args['id'] ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
|
1480 |
+
|
1481 |
+
if ( ! empty( $messages ) ) {
|
1482 |
+
foreach( $messages as $message ) {
|
1483 |
+
|
1484 |
+
$html .= '<div class="schema-wp-license-data schema-wp-license-' . $class . ' ' . $license_status . '">';
|
1485 |
+
$html .= '<p>' . $message . '</p>';
|
1486 |
+
$html .= '</div>';
|
1487 |
+
|
1488 |
+
}
|
1489 |
+
}
|
1490 |
+
|
1491 |
+
wp_nonce_field( schema_wp_sanitize_key( $args['id'] ) . '-nonce', schema_wp_sanitize_key( $args['id'] ) . '-nonce' );
|
1492 |
+
|
1493 |
+
echo $html;
|
1494 |
+
}
|
1495 |
+
}
|
1496 |
+
|
1497 |
+
/**
|
1498 |
+
* Hook Callback
|
1499 |
+
*
|
1500 |
+
* Adds a do_action() hook in place of the field
|
1501 |
+
*
|
1502 |
+
* @since 1.0.8.2
|
1503 |
+
* @param array $args Arguments passed by the setting
|
1504 |
+
* @return void
|
1505 |
+
*/
|
1506 |
+
function schema_wp_hook_callback( $args ) {
|
1507 |
+
do_action( 'schema_wp_' . $args['id'], $args );
|
1508 |
+
}
|
1509 |
+
|
1510 |
+
/**
|
1511 |
+
* Set manage_schema_options as the cap required to save Schema settings pages
|
1512 |
+
*
|
1513 |
+
* @since 1.9
|
1514 |
+
* @return string capability required
|
1515 |
+
*/
|
1516 |
+
function schema_wp_set_settings_cap() {
|
1517 |
+
return 'manage_schema_options';
|
1518 |
+
}
|
1519 |
+
add_filter( 'option_page_capability_schema_wp_settings', 'schema_wp_set_settings_cap' );
|
1520 |
+
|
1521 |
+
function schema_wp_add_setting_tooltip( $html, $args ) {
|
1522 |
+
|
1523 |
+
if ( ! empty( $args['tooltip_title'] ) && ! empty( $args['tooltip_desc'] ) ) {
|
1524 |
+
$tooltip = '<span alt="f223" class="schema-wp-help-tip dashicons dashicons-editor-help" title="<strong>' . $args['tooltip_title'] . '</strong>: ' . $args['tooltip_desc'] . '"></span>';
|
1525 |
+
$html .= $tooltip;
|
1526 |
+
}
|
1527 |
+
|
1528 |
+
return $html;
|
1529 |
+
}
|
1530 |
+
add_filter( 'schema_wp_after_setting_output', 'schema_wp_add_setting_tooltip', 10, 2 );
|
includes/admin/updater/class-license-handler.php
ADDED
@@ -0,0 +1,482 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* License handler for Easy Digital Downloads
|
4 |
+
*
|
5 |
+
* This class should simplify the process of adding license information
|
6 |
+
* to new EDD extensions.
|
7 |
+
*
|
8 |
+
* @version 1.1
|
9 |
+
*/
|
10 |
+
|
11 |
+
// Exit if accessed directly
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
13 |
+
|
14 |
+
if ( ! class_exists( 'Schema_WP_License' ) ) :
|
15 |
+
|
16 |
+
/**
|
17 |
+
* EDD_License Class
|
18 |
+
*/
|
19 |
+
class Schema_WP_License {
|
20 |
+
private $file;
|
21 |
+
private $license;
|
22 |
+
private $item_name;
|
23 |
+
private $item_id;
|
24 |
+
private $item_shortname;
|
25 |
+
private $version;
|
26 |
+
private $author;
|
27 |
+
//private $api_url = 'https://schema.press/edd-sl-api/';
|
28 |
+
private $api_url = 'https://schema.press/';
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Class constructor
|
32 |
+
*
|
33 |
+
* @param string $_file
|
34 |
+
* @param string $_item
|
35 |
+
* @param string $_version
|
36 |
+
* @param string $_author
|
37 |
+
* @param string $_optname
|
38 |
+
* @param string $_api_url
|
39 |
+
*/
|
40 |
+
function __construct( $_file, $_item, $_version, $_author, $_optname = null, $_api_url = null ) {
|
41 |
+
|
42 |
+
$this->file = $_file;
|
43 |
+
|
44 |
+
if( is_numeric( $_item ) ) {
|
45 |
+
$this->item_id = absint( $_item );
|
46 |
+
} else {
|
47 |
+
$this->item_name = $_item;
|
48 |
+
}
|
49 |
+
|
50 |
+
$this->item_shortname = preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $this->item_name ) ) );
|
51 |
+
$this->version = $_version;
|
52 |
+
$this->license = trim( schema_wp_get_option( $this->item_shortname . '_license_key', '' ) );
|
53 |
+
$this->author = $_author;
|
54 |
+
$this->api_url = is_null( $_api_url ) ? $this->api_url : $_api_url;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Allows for backwards compatibility with old license options,
|
58 |
+
* i.e. if the plugins had license key fields previously, the license
|
59 |
+
* handler will automatically pick these up and use those in lieu of the
|
60 |
+
* user having to reactive their license.
|
61 |
+
*/
|
62 |
+
if ( ! empty( $_optname ) ) {
|
63 |
+
$opt = schema_wp_get_option( $_optname, false );
|
64 |
+
|
65 |
+
if( isset( $opt ) && empty( $this->license ) ) {
|
66 |
+
$this->license = trim( $opt );
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
// Setup hooks
|
71 |
+
$this->includes();
|
72 |
+
$this->hooks();
|
73 |
+
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Include the updater class
|
78 |
+
*
|
79 |
+
* @access private
|
80 |
+
* @return void
|
81 |
+
*/
|
82 |
+
private function includes() {
|
83 |
+
if ( ! class_exists( 'Schema_WP_SL_Plugin_Updater' ) ) {
|
84 |
+
require_once 'class-updater.php';
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Setup hooks
|
90 |
+
*
|
91 |
+
* @access private
|
92 |
+
* @return void
|
93 |
+
*/
|
94 |
+
private function hooks() {
|
95 |
+
|
96 |
+
// Register settings
|
97 |
+
add_filter( 'schema_wp_settings_licenses', array( $this, 'settings' ), 1 );
|
98 |
+
|
99 |
+
// Display help text at the top of the Licenses tab
|
100 |
+
add_action( 'schema_wp_settings_tab_top', array( $this, 'license_help_text' ) );
|
101 |
+
|
102 |
+
// Activate license key on settings save
|
103 |
+
add_action( 'admin_init', array( $this, 'activate_license' ) );
|
104 |
+
|
105 |
+
// Deactivate license key
|
106 |
+
add_action( 'admin_init', array( $this, 'deactivate_license' ) );
|
107 |
+
|
108 |
+
// Check that license is valid once per week
|
109 |
+
add_action( 'schema_wp_weekly_scheduled_events', array( $this, 'weekly_license_check' ) );
|
110 |
+
|
111 |
+
// For testing license notices, uncomment this line to force checks on every page load
|
112 |
+
//add_action( 'admin_init', array( $this, 'weekly_license_check' ) );
|
113 |
+
|
114 |
+
// Updater
|
115 |
+
add_action( 'admin_init', array( $this, 'auto_updater' ), 0 );
|
116 |
+
|
117 |
+
// Display notices to admins
|
118 |
+
add_action( 'admin_notices', array( $this, 'notices' ) );
|
119 |
+
|
120 |
+
add_action( 'in_plugin_update_message-' . plugin_basename( $this->file ), array( $this, 'plugin_row_license_missing' ), 10, 2 );
|
121 |
+
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Auto updater
|
126 |
+
*
|
127 |
+
* @access private
|
128 |
+
* @return void
|
129 |
+
*/
|
130 |
+
public function auto_updater() {
|
131 |
+
|
132 |
+
$args = array(
|
133 |
+
'version' => $this->version,
|
134 |
+
'license' => $this->license,
|
135 |
+
'author' => $this->author
|
136 |
+
);
|
137 |
+
|
138 |
+
if( ! empty( $this->item_id ) ) {
|
139 |
+
$args['item_id'] = $this->item_id;
|
140 |
+
} else {
|
141 |
+
$args['item_name'] = $this->item_name;
|
142 |
+
}
|
143 |
+
|
144 |
+
// Setup the updater
|
145 |
+
$edd_updater = new Schema_WP_SL_Plugin_Updater(
|
146 |
+
$this->api_url,
|
147 |
+
$this->file,
|
148 |
+
$args
|
149 |
+
);
|
150 |
+
|
151 |
+
// debug
|
152 |
+
//echo'<pre>';print_r($edd_updater);echo'</pre>';exit;
|
153 |
+
}
|
154 |
+
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Add license field to settings
|
158 |
+
*
|
159 |
+
* @access public
|
160 |
+
* @param array $settings
|
161 |
+
* @return array
|
162 |
+
*/
|
163 |
+
public function settings( $settings ) {
|
164 |
+
|
165 |
+
$edd_license_settings = array(
|
166 |
+
array(
|
167 |
+
'id' => $this->item_shortname . '_license_key',
|
168 |
+
'name' => sprintf( __( '%1$s', 'schema-wp' ), $this->item_name ),
|
169 |
+
'desc' => '',
|
170 |
+
'type' => 'license_key',
|
171 |
+
'options' => array( 'is_valid_license_option' => $this->item_shortname . '_license_active' ),
|
172 |
+
'size' => 'regular'
|
173 |
+
)
|
174 |
+
);
|
175 |
+
|
176 |
+
// debug
|
177 |
+
//echo'<pre>';print_r($edd_license_settings);echo'</pre>';exit;
|
178 |
+
|
179 |
+
return array_merge( $settings, $edd_license_settings );
|
180 |
+
}
|
181 |
+
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Display help text at the top of the Licenses tag
|
185 |
+
*
|
186 |
+
* @access public
|
187 |
+
* @since 2.5
|
188 |
+
* @param string $active_tab
|
189 |
+
* @return void
|
190 |
+
*/
|
191 |
+
public function license_help_text( $active_tab = '' ) {
|
192 |
+
|
193 |
+
static $has_ran;
|
194 |
+
|
195 |
+
if( 'licenses' !== $active_tab ) {
|
196 |
+
return;
|
197 |
+
}
|
198 |
+
|
199 |
+
if( ! empty( $has_ran ) ) {
|
200 |
+
return;
|
201 |
+
}
|
202 |
+
|
203 |
+
echo '<p>' . sprintf(
|
204 |
+
__( 'Enter your extension license keys here to receive updates for purchased extensions. If your license key has expired, please <a href="%s" target="_blank">renew your license</a>.', 'schema-wp' ),
|
205 |
+
'https://schema.press/'
|
206 |
+
) . '</p>';
|
207 |
+
|
208 |
+
$has_ran = true;
|
209 |
+
|
210 |
+
}
|
211 |
+
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Activate the license key
|
215 |
+
*
|
216 |
+
* @access public
|
217 |
+
* @return void
|
218 |
+
*/
|
219 |
+
public function activate_license() {
|
220 |
+
|
221 |
+
// debug
|
222 |
+
//echo'<pre>';print_r($_POST);echo'</pre>';exit;
|
223 |
+
|
224 |
+
if ( ! isset( $_POST['schema_wp_settings'] ) ) {
|
225 |
+
return;
|
226 |
+
}
|
227 |
+
|
228 |
+
|
229 |
+
if ( ! isset( $_REQUEST[ $this->item_shortname . '_license_key-nonce'] ) || ! wp_verify_nonce( $_REQUEST[ $this->item_shortname . '_license_key-nonce'], $this->item_shortname . '_license_key-nonce' ) ) {
|
230 |
+
|
231 |
+
return;
|
232 |
+
|
233 |
+
}
|
234 |
+
|
235 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
236 |
+
return;
|
237 |
+
}
|
238 |
+
|
239 |
+
if ( empty( $_POST['schema_wp_settings'][ $this->item_shortname . '_license_key'] ) ) {
|
240 |
+
|
241 |
+
delete_option( $this->item_shortname . '_license_active' );
|
242 |
+
|
243 |
+
return;
|
244 |
+
|
245 |
+
}
|
246 |
+
|
247 |
+
foreach ( $_POST as $key => $value ) {
|
248 |
+
if( false !== strpos( $key, 'license_key_deactivate' ) ) {
|
249 |
+
// Don't activate a key when deactivating a different key
|
250 |
+
return;
|
251 |
+
}
|
252 |
+
}
|
253 |
+
|
254 |
+
$details = get_option( $this->item_shortname . '_license_active' );
|
255 |
+
|
256 |
+
if ( is_object( $details ) && 'valid' === $details->license ) {
|
257 |
+
return;
|
258 |
+
}
|
259 |
+
|
260 |
+
$license = sanitize_text_field( $_POST['schema_wp_settings'][ $this->item_shortname . '_license_key'] );
|
261 |
+
|
262 |
+
if( empty( $license ) ) {
|
263 |
+
return;
|
264 |
+
}
|
265 |
+
|
266 |
+
// Data to send to the API
|
267 |
+
$api_params = array(
|
268 |
+
'edd_action' => 'activate_license',
|
269 |
+
'license' => $license,
|
270 |
+
'item_name' => urlencode( $this->item_name ),
|
271 |
+
'url' => home_url()
|
272 |
+
);
|
273 |
+
|
274 |
+
// Call the API
|
275 |
+
$response = wp_remote_post(
|
276 |
+
$this->api_url,
|
277 |
+
array(
|
278 |
+
'timeout' => 15,
|
279 |
+
'sslverify' => false,
|
280 |
+
'body' => $api_params
|
281 |
+
)
|
282 |
+
);
|
283 |
+
|
284 |
+
// debug
|
285 |
+
//echo'<pre>';print_r($response);echo'</pre>';exit;
|
286 |
+
|
287 |
+
// Make sure there are no errors
|
288 |
+
if ( is_wp_error( $response ) ) {
|
289 |
+
return;
|
290 |
+
}
|
291 |
+
|
292 |
+
// Tell WordPress to look for updates
|
293 |
+
set_site_transient( 'update_plugins', null );
|
294 |
+
|
295 |
+
// Decode license data
|
296 |
+
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
|
297 |
+
|
298 |
+
update_option( $this->item_shortname . '_license_active', $license_data );
|
299 |
+
|
300 |
+
}
|
301 |
+
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Deactivate the license key
|
305 |
+
*
|
306 |
+
* @access public
|
307 |
+
* @return void
|
308 |
+
*/
|
309 |
+
public function deactivate_license() {
|
310 |
+
|
311 |
+
if ( ! isset( $_POST['schema_wp_settings'] ) )
|
312 |
+
return;
|
313 |
+
|
314 |
+
if ( ! isset( $_POST['schema_wp_settings'][ $this->item_shortname . '_license_key'] ) )
|
315 |
+
return;
|
316 |
+
|
317 |
+
if( ! wp_verify_nonce( $_REQUEST[ $this->item_shortname . '_license_key-nonce'], $this->item_shortname . '_license_key-nonce' ) ) {
|
318 |
+
|
319 |
+
wp_die( __( 'Nonce verification failed', 'schema-wp' ), __( 'Error', 'schema-wp' ), array( 'response' => 403 ) );
|
320 |
+
|
321 |
+
}
|
322 |
+
|
323 |
+
if( ! current_user_can( 'manage_options' ) ) {
|
324 |
+
return;
|
325 |
+
}
|
326 |
+
|
327 |
+
// Run on deactivate button press
|
328 |
+
if ( isset( $_POST[ $this->item_shortname . '_license_key_deactivate'] ) ) {
|
329 |
+
|
330 |
+
// Data to send to the API
|
331 |
+
$api_params = array(
|
332 |
+
'edd_action' => 'deactivate_license',
|
333 |
+
'license' => $this->license,
|
334 |
+
'item_name' => urlencode( $this->item_name ),
|
335 |
+
'url' => home_url()
|
336 |
+
);
|
337 |
+
|
338 |
+
// Call the API
|
339 |
+
$response = wp_remote_post(
|
340 |
+
$this->api_url,
|
341 |
+
array(
|
342 |
+
'timeout' => 15,
|
343 |
+
'sslverify' => false,
|
344 |
+
'body' => $api_params
|
345 |
+
)
|
346 |
+
);
|
347 |
+
|
348 |
+
// Make sure there are no errors
|
349 |
+
if ( is_wp_error( $response ) ) {
|
350 |
+
return;
|
351 |
+
}
|
352 |
+
|
353 |
+
// Decode the license data
|
354 |
+
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
|
355 |
+
|
356 |
+
delete_option( $this->item_shortname . '_license_active' );
|
357 |
+
|
358 |
+
}
|
359 |
+
}
|
360 |
+
|
361 |
+
|
362 |
+
/**
|
363 |
+
* Check if license key is valid once per week
|
364 |
+
*
|
365 |
+
* @access public
|
366 |
+
* @since 2.5
|
367 |
+
* @return void
|
368 |
+
*/
|
369 |
+
public function weekly_license_check() {
|
370 |
+
|
371 |
+
if( ! empty( $_POST['schema_wp_settings'] ) ) {
|
372 |
+
return; // Don't fire when saving settings
|
373 |
+
}
|
374 |
+
|
375 |
+
if( empty( $this->license ) ) {
|
376 |
+
return;
|
377 |
+
}
|
378 |
+
|
379 |
+
// data to send in our API request
|
380 |
+
$api_params = array(
|
381 |
+
'edd_action'=> 'check_license',
|
382 |
+
'license' => $this->license,
|
383 |
+
'item_name' => urlencode( $this->item_name ),
|
384 |
+
'url' => home_url()
|
385 |
+
);
|
386 |
+
|
387 |
+
// Call the API
|
388 |
+
$response = wp_remote_post(
|
389 |
+
$this->api_url,
|
390 |
+
array(
|
391 |
+
'timeout' => 15,
|
392 |
+
'sslverify' => false,
|
393 |
+
'body' => $api_params
|
394 |
+
)
|
395 |
+
);
|
396 |
+
|
397 |
+
// make sure the response came back okay
|
398 |
+
if ( is_wp_error( $response ) ) {
|
399 |
+
return false;
|
400 |
+
}
|
401 |
+
|
402 |
+
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
|
403 |
+
|
404 |
+
update_option( $this->item_shortname . '_license_active', $license_data );
|
405 |
+
|
406 |
+
}
|
407 |
+
|
408 |
+
|
409 |
+
/**
|
410 |
+
* Admin notices for errors
|
411 |
+
*
|
412 |
+
* @access public
|
413 |
+
* @return void
|
414 |
+
*/
|
415 |
+
public function notices() {
|
416 |
+
|
417 |
+
static $showed_invalid_message;
|
418 |
+
|
419 |
+
if( empty( $this->license ) ) {
|
420 |
+
return;
|
421 |
+
}
|
422 |
+
|
423 |
+
if( ! current_user_can( 'manage_options' ) ) {
|
424 |
+
return;
|
425 |
+
}
|
426 |
+
|
427 |
+
$messages = array();
|
428 |
+
|
429 |
+
$license = get_option( $this->item_shortname . '_license_active' );
|
430 |
+
|
431 |
+
if( is_object( $license ) && 'valid' !== $license->license && empty( $showed_invalid_message ) ) {
|
432 |
+
|
433 |
+
if( empty( $_GET['tab'] ) || 'licenses' !== $_GET['tab'] ) {
|
434 |
+
|
435 |
+
$messages[] = sprintf(
|
436 |
+
__( 'You have invalid or expired license keys for Schema. Please go to the <a href="%s">Licenses page</a> to correct this issue.', 'schema-wp' ),
|
437 |
+
admin_url( 'admin.php?page=schema&tab=licenses' )
|
438 |
+
);
|
439 |
+
|
440 |
+
$showed_invalid_message = true;
|
441 |
+
|
442 |
+
}
|
443 |
+
|
444 |
+
}
|
445 |
+
|
446 |
+
if( ! empty( $messages ) ) {
|
447 |
+
|
448 |
+
foreach( $messages as $message ) {
|
449 |
+
|
450 |
+
echo '<div class="error">';
|
451 |
+
echo '<p>' . $message . '</p>';
|
452 |
+
echo '</div>';
|
453 |
+
|
454 |
+
}
|
455 |
+
|
456 |
+
}
|
457 |
+
|
458 |
+
}
|
459 |
+
|
460 |
+
/**
|
461 |
+
* Displays message inline on plugin row that the license key is missing
|
462 |
+
*
|
463 |
+
* @access public
|
464 |
+
* @since 2.5
|
465 |
+
* @return void
|
466 |
+
*/
|
467 |
+
public function plugin_row_license_missing( $plugin_data, $version_info ) {
|
468 |
+
|
469 |
+
static $showed_imissing_key_message;
|
470 |
+
|
471 |
+
$license = get_option( $this->item_shortname . '_license_active' );
|
472 |
+
|
473 |
+
if( ( ! is_object( $license ) || 'valid' !== $license->license ) && empty( $showed_imissing_key_message[ $this->item_shortname ] ) ) {
|
474 |
+
|
475 |
+
echo ' <strong><a href="' . esc_url( admin_url( 'admin.php?page=schema&tab=licenses' ) ) . '">' . __( 'Enter valid license key for automatic updates.', 'schema-wp' ) . '</a></strong>';
|
476 |
+
$showed_imissing_key_message[ $this->item_shortname ] = true;
|
477 |
+
}
|
478 |
+
|
479 |
+
}
|
480 |
+
}
|
481 |
+
|
482 |
+
endif; // end class_exists check
|
includes/admin/updater/class-updater.php
ADDED
@@ -0,0 +1,494 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// uncomment this line for testing
|
4 |
+
//set_site_transient( 'update_plugins', null );
|
5 |
+
|
6 |
+
// Exit if accessed directly
|
7 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Allows plugins to use their own update API.
|
11 |
+
*
|
12 |
+
* @author Easy Digital Downloads
|
13 |
+
* @version 1.6.14
|
14 |
+
*/
|
15 |
+
class Schema_WP_SL_Plugin_Updater {
|
16 |
+
|
17 |
+
private $api_url = '';
|
18 |
+
private $api_data = array();
|
19 |
+
private $name = '';
|
20 |
+
private $slug = '';
|
21 |
+
private $version = '';
|
22 |
+
private $wp_override = false;
|
23 |
+
private $cache_key = '';
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Class constructor.
|
27 |
+
*
|
28 |
+
* @uses plugin_basename()
|
29 |
+
* @uses hook()
|
30 |
+
*
|
31 |
+
* @param string $_api_url The URL pointing to the custom API endpoint.
|
32 |
+
* @param string $_plugin_file Path to the plugin file.
|
33 |
+
* @param array $_api_data Optional data to send with API calls.
|
34 |
+
*/
|
35 |
+
public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
|
36 |
+
|
37 |
+
global $edd_plugin_data;
|
38 |
+
|
39 |
+
$this->api_url = trailingslashit( $_api_url );
|
40 |
+
$this->api_data = $_api_data;
|
41 |
+
$this->name = plugin_basename( $_plugin_file );
|
42 |
+
$this->slug = basename( $_plugin_file, '.php' );
|
43 |
+
$this->version = $_api_data['version'];
|
44 |
+
$this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
|
45 |
+
$this->beta = ! empty( $this->api_data['beta'] ) ? true : false;
|
46 |
+
$this->cache_key = md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
|
47 |
+
|
48 |
+
$edd_plugin_data[ $this->slug ] = $this->api_data;
|
49 |
+
|
50 |
+
// Set up hooks.
|
51 |
+
$this->init();
|
52 |
+
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Set up WordPress filters to hook into WP's update process.
|
57 |
+
*
|
58 |
+
* @uses add_filter()
|
59 |
+
*
|
60 |
+
* @return void
|
61 |
+
*/
|
62 |
+
public function init() {
|
63 |
+
|
64 |
+
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
|
65 |
+
add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
|
66 |
+
remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 );
|
67 |
+
add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
|
68 |
+
add_action( 'admin_init', array( $this, 'show_changelog' ) );
|
69 |
+
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Check for Updates at the defined API endpoint and modify the update array.
|
74 |
+
*
|
75 |
+
* This function dives into the update API just when WordPress creates its update array,
|
76 |
+
* then adds a custom API call and injects the custom plugin data retrieved from the API.
|
77 |
+
* It is reassembled from parts of the native WordPress plugin update code.
|
78 |
+
* See wp-includes/update.php line 121 for the original wp_update_plugins() function.
|
79 |
+
*
|
80 |
+
* @uses api_request()
|
81 |
+
*
|
82 |
+
* @param array $_transient_data Update array build by WordPress.
|
83 |
+
* @return array Modified update array with custom plugin data.
|
84 |
+
*/
|
85 |
+
public function check_update( $_transient_data ) {
|
86 |
+
|
87 |
+
global $pagenow;
|
88 |
+
|
89 |
+
if ( ! is_object( $_transient_data ) ) {
|
90 |
+
$_transient_data = new stdClass;
|
91 |
+
}
|
92 |
+
|
93 |
+
if ( 'plugins.php' == $pagenow && is_multisite() ) {
|
94 |
+
return $_transient_data;
|
95 |
+
}
|
96 |
+
|
97 |
+
if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) {
|
98 |
+
return $_transient_data;
|
99 |
+
}
|
100 |
+
|
101 |
+
$version_info = $this->get_cached_version_info();
|
102 |
+
|
103 |
+
if ( false === $version_info ) {
|
104 |
+
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
|
105 |
+
|
106 |
+
$this->set_version_info_cache( $version_info );
|
107 |
+
|
108 |
+
}
|
109 |
+
|
110 |
+
if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
|
111 |
+
|
112 |
+
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
113 |
+
|
114 |
+
$_transient_data->response[ $this->name ] = $version_info;
|
115 |
+
|
116 |
+
}
|
117 |
+
|
118 |
+
$_transient_data->last_checked = current_time( 'timestamp' );
|
119 |
+
$_transient_data->checked[ $this->name ] = $this->version;
|
120 |
+
|
121 |
+
}
|
122 |
+
|
123 |
+
return $_transient_data;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
|
128 |
+
*
|
129 |
+
* @param string $file
|
130 |
+
* @param array $plugin
|
131 |
+
*/
|
132 |
+
public function show_update_notification( $file, $plugin ) {
|
133 |
+
|
134 |
+
if ( is_network_admin() ) {
|
135 |
+
return;
|
136 |
+
}
|
137 |
+
|
138 |
+
if( ! current_user_can( 'update_plugins' ) ) {
|
139 |
+
return;
|
140 |
+
}
|
141 |
+
|
142 |
+
if( ! is_multisite() ) {
|
143 |
+
return;
|
144 |
+
}
|
145 |
+
|
146 |
+
if ( $this->name != $file ) {
|
147 |
+
return;
|
148 |
+
}
|
149 |
+
|
150 |
+
// Remove our filter on the site transient
|
151 |
+
remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
|
152 |
+
|
153 |
+
$update_cache = get_site_transient( 'update_plugins' );
|
154 |
+
|
155 |
+
$update_cache = is_object( $update_cache ) ? $update_cache : new stdClass();
|
156 |
+
|
157 |
+
if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
|
158 |
+
|
159 |
+
$version_info = $this->get_cached_version_info();
|
160 |
+
|
161 |
+
if ( false === $version_info ) {
|
162 |
+
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
|
163 |
+
|
164 |
+
$this->set_version_info_cache( $version_info );
|
165 |
+
}
|
166 |
+
|
167 |
+
if ( ! is_object( $version_info ) ) {
|
168 |
+
return;
|
169 |
+
}
|
170 |
+
|
171 |
+
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
172 |
+
|
173 |
+
$update_cache->response[ $this->name ] = $version_info;
|
174 |
+
|
175 |
+
}
|
176 |
+
|
177 |
+
$update_cache->last_checked = current_time( 'timestamp' );
|
178 |
+
$update_cache->checked[ $this->name ] = $this->version;
|
179 |
+
|
180 |
+
set_site_transient( 'update_plugins', $update_cache );
|
181 |
+
|
182 |
+
} else {
|
183 |
+
|
184 |
+
$version_info = $update_cache->response[ $this->name ];
|
185 |
+
|
186 |
+
}
|
187 |
+
|
188 |
+
// Restore our filter
|
189 |
+
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
|
190 |
+
|
191 |
+
if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
192 |
+
|
193 |
+
// build a plugin list row, with update notification
|
194 |
+
$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
|
195 |
+
# <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
|
196 |
+
echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">';
|
197 |
+
echo '<td colspan="3" class="plugin-update colspanchange">';
|
198 |
+
echo '<div class="update-message notice inline notice-warning notice-alt">';
|
199 |
+
|
200 |
+
$changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
|
201 |
+
|
202 |
+
if ( empty( $version_info->download_link ) ) {
|
203 |
+
printf(
|
204 |
+
__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'easy-digital-downloads' ),
|
205 |
+
esc_html( $version_info->name ),
|
206 |
+
'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
|
207 |
+
esc_html( $version_info->new_version ),
|
208 |
+
'</a>'
|
209 |
+
);
|
210 |
+
} else {
|
211 |
+
printf(
|
212 |
+
__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'easy-digital-downloads' ),
|
213 |
+
esc_html( $version_info->name ),
|
214 |
+
'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
|
215 |
+
esc_html( $version_info->new_version ),
|
216 |
+
'</a>',
|
217 |
+
'<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">',
|
218 |
+
'</a>'
|
219 |
+
);
|
220 |
+
}
|
221 |
+
|
222 |
+
do_action( "in_plugin_update_message-{$file}", $plugin, $version_info );
|
223 |
+
|
224 |
+
echo '</div></td></tr>';
|
225 |
+
}
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Updates information on the "View version x.x details" page with custom data.
|
230 |
+
*
|
231 |
+
* @uses api_request()
|
232 |
+
*
|
233 |
+
* @param mixed $_data
|
234 |
+
* @param string $_action
|
235 |
+
* @param object $_args
|
236 |
+
* @return object $_data
|
237 |
+
*/
|
238 |
+
public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
|
239 |
+
|
240 |
+
if ( $_action != 'plugin_information' ) {
|
241 |
+
|
242 |
+
return $_data;
|
243 |
+
|
244 |
+
}
|
245 |
+
|
246 |
+
if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
|
247 |
+
|
248 |
+
return $_data;
|
249 |
+
|
250 |
+
}
|
251 |
+
|
252 |
+
$to_send = array(
|
253 |
+
'slug' => $this->slug,
|
254 |
+
'is_ssl' => is_ssl(),
|
255 |
+
'fields' => array(
|
256 |
+
'banners' => array(),
|
257 |
+
'reviews' => false
|
258 |
+
)
|
259 |
+
);
|
260 |
+
|
261 |
+
$cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
|
262 |
+
|
263 |
+
// Get the transient where we store the api request for this plugin for 24 hours
|
264 |
+
$edd_api_request_transient = $this->get_cached_version_info( $cache_key );
|
265 |
+
|
266 |
+
//If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
|
267 |
+
if ( empty( $edd_api_request_transient ) ) {
|
268 |
+
|
269 |
+
$api_response = $this->api_request( 'plugin_information', $to_send );
|
270 |
+
|
271 |
+
// Expires in 3 hours
|
272 |
+
$this->set_version_info_cache( $api_response, $cache_key );
|
273 |
+
|
274 |
+
if ( false !== $api_response ) {
|
275 |
+
$_data = $api_response;
|
276 |
+
}
|
277 |
+
|
278 |
+
} else {
|
279 |
+
$_data = $edd_api_request_transient;
|
280 |
+
}
|
281 |
+
|
282 |
+
// Convert sections into an associative array, since we're getting an object, but Core expects an array.
|
283 |
+
if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
|
284 |
+
$new_sections = array();
|
285 |
+
foreach ( $_data->sections as $key => $value ) {
|
286 |
+
$new_sections[ $key ] = $value;
|
287 |
+
}
|
288 |
+
|
289 |
+
$_data->sections = $new_sections;
|
290 |
+
}
|
291 |
+
|
292 |
+
// Convert banners into an associative array, since we're getting an object, but Core expects an array.
|
293 |
+
if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
|
294 |
+
$new_banners = array();
|
295 |
+
foreach ( $_data->banners as $key => $value ) {
|
296 |
+
$new_banners[ $key ] = $value;
|
297 |
+
}
|
298 |
+
|
299 |
+
$_data->banners = $new_banners;
|
300 |
+
}
|
301 |
+
|
302 |
+
return $_data;
|
303 |
+
}
|
304 |
+
|
305 |
+
/**
|
306 |
+
* Disable SSL verification in order to prevent download update failures
|
307 |
+
*
|
308 |
+
* @param array $args
|
309 |
+
* @param string $url
|
310 |
+
* @return object $array
|
311 |
+
*/
|
312 |
+
public function http_request_args( $args, $url ) {
|
313 |
+
|
314 |
+
$verify_ssl = $this->verify_ssl();
|
315 |
+
if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
|
316 |
+
$args['sslverify'] = $verify_ssl;
|
317 |
+
}
|
318 |
+
return $args;
|
319 |
+
|
320 |
+
}
|
321 |
+
|
322 |
+
/**
|
323 |
+
* Calls the API and, if successfull, returns the object delivered by the API.
|
324 |
+
*
|
325 |
+
* @uses get_bloginfo()
|
326 |
+
* @uses wp_remote_post()
|
327 |
+
* @uses is_wp_error()
|
328 |
+
*
|
329 |
+
* @param string $_action The requested action.
|
330 |
+
* @param array $_data Parameters for the API action.
|
331 |
+
* @return false|object
|
332 |
+
*/
|
333 |
+
private function api_request( $_action, $_data ) {
|
334 |
+
|
335 |
+
global $wp_version;
|
336 |
+
|
337 |
+
$data = array_merge( $this->api_data, $_data );
|
338 |
+
|
339 |
+
if ( $data['slug'] != $this->slug ) {
|
340 |
+
return;
|
341 |
+
}
|
342 |
+
|
343 |
+
if( $this->api_url == trailingslashit (home_url() ) ) {
|
344 |
+
return false; // Don't allow a plugin to ping itself
|
345 |
+
}
|
346 |
+
|
347 |
+
$api_params = array(
|
348 |
+
'edd_action' => 'get_version',
|
349 |
+
'license' => ! empty( $data['license'] ) ? $data['license'] : '',
|
350 |
+
'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
|
351 |
+
'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
|
352 |
+
'version' => isset( $data['version'] ) ? $data['version'] : false,
|
353 |
+
'slug' => $data['slug'],
|
354 |
+
'author' => $data['author'],
|
355 |
+
'url' => home_url(),
|
356 |
+
'beta' => ! empty( $data['beta'] ),
|
357 |
+
);
|
358 |
+
|
359 |
+
$verify_ssl = $this->verify_ssl();
|
360 |
+
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
|
361 |
+
|
362 |
+
if ( ! is_wp_error( $request ) ) {
|
363 |
+
$request = json_decode( wp_remote_retrieve_body( $request ) );
|
364 |
+
}
|
365 |
+
|
366 |
+
if ( $request && isset( $request->sections ) ) {
|
367 |
+
$request->sections = maybe_unserialize( $request->sections );
|
368 |
+
} else {
|
369 |
+
$request = false;
|
370 |
+
}
|
371 |
+
|
372 |
+
if ( $request && isset( $request->banners ) ) {
|
373 |
+
$request->banners = maybe_unserialize( $request->banners );
|
374 |
+
}
|
375 |
+
|
376 |
+
if( ! empty( $request->sections ) ) {
|
377 |
+
foreach( $request->sections as $key => $section ) {
|
378 |
+
$request->$key = (array) $section;
|
379 |
+
}
|
380 |
+
}
|
381 |
+
|
382 |
+
return $request;
|
383 |
+
}
|
384 |
+
|
385 |
+
public function show_changelog() {
|
386 |
+
|
387 |
+
global $edd_plugin_data;
|
388 |
+
|
389 |
+
if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
|
390 |
+
return;
|
391 |
+
}
|
392 |
+
|
393 |
+
if( empty( $_REQUEST['plugin'] ) ) {
|
394 |
+
return;
|
395 |
+
}
|
396 |
+
|
397 |
+
if( empty( $_REQUEST['slug'] ) ) {
|
398 |
+
return;
|
399 |
+
}
|
400 |
+
|
401 |
+
if( ! current_user_can( 'update_plugins' ) ) {
|
402 |
+
wp_die( __( 'You do not have permission to install plugin updates', 'easy-digital-downloads' ), __( 'Error', 'easy-digital-downloads' ), array( 'response' => 403 ) );
|
403 |
+
}
|
404 |
+
|
405 |
+
$data = $edd_plugin_data[ $_REQUEST['slug'] ];
|
406 |
+
$beta = ! empty( $data['beta'] ) ? true : false;
|
407 |
+
$cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' );
|
408 |
+
$version_info = $this->get_cached_version_info( $cache_key );
|
409 |
+
|
410 |
+
if( false === $version_info ) {
|
411 |
+
|
412 |
+
$api_params = array(
|
413 |
+
'edd_action' => 'get_version',
|
414 |
+
'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
|
415 |
+
'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
|
416 |
+
'slug' => $_REQUEST['slug'],
|
417 |
+
'author' => $data['author'],
|
418 |
+
'url' => home_url(),
|
419 |
+
'beta' => ! empty( $data['beta'] )
|
420 |
+
);
|
421 |
+
|
422 |
+
$verify_ssl = $this->verify_ssl();
|
423 |
+
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
|
424 |
+
|
425 |
+
if ( ! is_wp_error( $request ) ) {
|
426 |
+
$version_info = json_decode( wp_remote_retrieve_body( $request ) );
|
427 |
+
}
|
428 |
+
|
429 |
+
|
430 |
+
if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
|
431 |
+
$version_info->sections = maybe_unserialize( $version_info->sections );
|
432 |
+
} else {
|
433 |
+
$version_info = false;
|
434 |
+
}
|
435 |
+
|
436 |
+
if( ! empty( $version_info ) ) {
|
437 |
+
foreach( $version_info->sections as $key => $section ) {
|
438 |
+
$version_info->$key = (array) $section;
|
439 |
+
}
|
440 |
+
}
|
441 |
+
|
442 |
+
$this->set_version_info_cache( $version_info, $cache_key );
|
443 |
+
|
444 |
+
}
|
445 |
+
|
446 |
+
if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) {
|
447 |
+
echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>';
|
448 |
+
}
|
449 |
+
|
450 |
+
exit;
|
451 |
+
}
|
452 |
+
|
453 |
+
public function get_cached_version_info( $cache_key = '' ) {
|
454 |
+
|
455 |
+
if( empty( $cache_key ) ) {
|
456 |
+
$cache_key = $this->cache_key;
|
457 |
+
}
|
458 |
+
|
459 |
+
$cache = get_option( $cache_key );
|
460 |
+
|
461 |
+
if( empty( $cache['timeout'] ) || current_time( 'timestamp' ) > $cache['timeout'] ) {
|
462 |
+
return false; // Cache is expired
|
463 |
+
}
|
464 |
+
|
465 |
+
return json_decode( $cache['value'] );
|
466 |
+
|
467 |
+
}
|
468 |
+
|
469 |
+
public function set_version_info_cache( $value = '', $cache_key = '' ) {
|
470 |
+
|
471 |
+
if( empty( $cache_key ) ) {
|
472 |
+
$cache_key = $this->cache_key;
|
473 |
+
}
|
474 |
+
|
475 |
+
$data = array(
|
476 |
+
'timeout' => strtotime( '+3 hours', current_time( 'timestamp' ) ),
|
477 |
+
'value' => json_encode( $value )
|
478 |
+
);
|
479 |
+
|
480 |
+
update_option( $cache_key, $data, 'no' );
|
481 |
+
|
482 |
+
}
|
483 |
+
|
484 |
+
/**
|
485 |
+
* Returns if the SSL of the store should be verified.
|
486 |
+
*
|
487 |
+
* @since 1.6.13
|
488 |
+
* @return bool
|
489 |
+
*/
|
490 |
+
private function verify_ssl() {
|
491 |
+
return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
|
492 |
+
}
|
493 |
+
|
494 |
+
}
|
includes/class-capabilities.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Roles and Capabilities
|
4 |
+
*
|
5 |
+
* @package Schema
|
6 |
+
* @subpackage Classes/Roles
|
7 |
+
* @copyright Copyright (c) 2012, Hesham Zebida
|
8 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
+
* @since 1.0
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Schema_WP_Capabilities Class
|
14 |
+
*
|
15 |
+
* This class handles the role creation and assignment of capabilities for those roles.
|
16 |
+
*
|
17 |
+
* @since 1.0
|
18 |
+
*/
|
19 |
+
class Schema_WP_Capabilities {
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Get things going
|
23 |
+
*
|
24 |
+
* @since 1.0
|
25 |
+
*/
|
26 |
+
public function __construct() { /* Do nothing here */ }
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Add new shop roles with default WP caps
|
30 |
+
*
|
31 |
+
* @access public
|
32 |
+
* @since 1.5.9.3
|
33 |
+
* @return void
|
34 |
+
*/
|
35 |
+
public function add_roles() {
|
36 |
+
add_role( 'manage_schema_options', __( 'Manage Schema Options', 'schema-wp' ), array(
|
37 |
+
'read' => true,
|
38 |
+
'edit_posts' => true,
|
39 |
+
'delete_posts' => true,
|
40 |
+
'unfiltered_html' => true,
|
41 |
+
'upload_files' => true,
|
42 |
+
'export' => true,
|
43 |
+
'import' => true,
|
44 |
+
'delete_others_pages' => true,
|
45 |
+
'delete_others_posts' => true,
|
46 |
+
'delete_pages' => true,
|
47 |
+
'delete_private_pages' => true,
|
48 |
+
'delete_private_posts' => true,
|
49 |
+
'delete_published_pages' => true,
|
50 |
+
'delete_published_posts' => true,
|
51 |
+
'edit_others_pages' => true,
|
52 |
+
'edit_others_posts' => true,
|
53 |
+
'edit_pages' => true,
|
54 |
+
'edit_private_pages' => true,
|
55 |
+
'edit_private_posts' => true,
|
56 |
+
'edit_published_pages' => true,
|
57 |
+
'edit_published_posts' => true,
|
58 |
+
'manage_categories' => true,
|
59 |
+
'manage_links' => true,
|
60 |
+
'moderate_comments' => true,
|
61 |
+
'publish_pages' => true,
|
62 |
+
'publish_posts' => true,
|
63 |
+
'read_private_pages' => true,
|
64 |
+
'read_private_posts' => true,
|
65 |
+
|
66 |
+
'activate_plugins' => true,
|
67 |
+
'manage_options' => true
|
68 |
+
) );
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Add new capabilities
|
73 |
+
*
|
74 |
+
* @access public
|
75 |
+
* @since 1.0
|
76 |
+
* @global obj $wp_roles
|
77 |
+
* @return void
|
78 |
+
*/
|
79 |
+
public function add_caps() {
|
80 |
+
global $wp_roles;
|
81 |
+
|
82 |
+
if ( class_exists('WP_Roles') ) {
|
83 |
+
if ( ! isset( $wp_roles ) ) {
|
84 |
+
$wp_roles = new WP_Roles();
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
if ( is_object( $wp_roles ) ) {
|
89 |
+
|
90 |
+
$wp_roles->add_cap( 'administrator', 'manage_schema_options' );
|
91 |
+
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Remove core post type capabilities (called on uninstall)
|
98 |
+
*
|
99 |
+
* @access public
|
100 |
+
* @since 1.0
|
101 |
+
* @return void
|
102 |
+
*/
|
103 |
+
public function remove_caps() {
|
104 |
+
|
105 |
+
if ( class_exists('WP_Roles') ) {
|
106 |
+
if ( ! isset( $wp_roles ) ) {
|
107 |
+
$wp_roles = new WP_Roles();
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
if ( is_object( $wp_roles ) ) {
|
112 |
+
|
113 |
+
/** Site Administrator Capabilities */
|
114 |
+
$wp_roles->remove_cap( 'administrator', 'manage_schema_options' );
|
115 |
+
|
116 |
+
}
|
117 |
+
}
|
118 |
+
}
|
includes/deprecated-functions.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Deprecated Functions
|
5 |
+
*
|
6 |
+
* This file is made to keep older non-used functions as a refrence.
|
7 |
+
*
|
8 |
+
* The functions within these files are loaded since the file itself won't be loaded
|
9 |
+
*
|
10 |
+
* @since 1.6
|
11 |
+
* @return void
|
12 |
+
*/
|
13 |
+
|
includes/extensions/audio-object.php
ADDED
@@ -0,0 +1,419 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* AudioObject extention
|
5 |
+
*
|
6 |
+
* Adds schema AudioObject to oEmbed
|
7 |
+
*
|
8 |
+
* @since 1.5.9.6
|
9 |
+
*/
|
10 |
+
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
12 |
+
|
13 |
+
|
14 |
+
add_action( 'admin_init', 'schema_wp_audio_object_admin_init' );
|
15 |
+
/**
|
16 |
+
* Schema AudioObject init
|
17 |
+
*
|
18 |
+
* @since 1.5.9.6
|
19 |
+
*/
|
20 |
+
function schema_wp_audio_object_admin_init() {
|
21 |
+
|
22 |
+
if ( ! is_admin() ) return;
|
23 |
+
|
24 |
+
if ( ! class_exists( 'Schema_WP' ) ) return;
|
25 |
+
|
26 |
+
$audio_object_enable = schema_wp_get_option( 'audio_object_enable' );
|
27 |
+
|
28 |
+
if ( $audio_object_enable != true )
|
29 |
+
return;
|
30 |
+
|
31 |
+
$prefix = '_schema_audio_object_';
|
32 |
+
|
33 |
+
$fields = array(
|
34 |
+
|
35 |
+
array ( // Radio group
|
36 |
+
'label' => __('Audio Markups', 'schema-wp'), // <label>
|
37 |
+
'tip' => __('Select audio markup type.', 'schema-wp'),
|
38 |
+
'desc' => __('Note: You can enable markups to multiple audios on the same page. However, this may slow down your site, make sure your site is hosted on a reliable web host and cache your site pages by a good caching plugin. (Recommended setting: Single Audio)', 'schema-wp'), // description
|
39 |
+
'id' => $prefix.'type', // field id and name
|
40 |
+
'type' => 'radio', // type of field
|
41 |
+
'options' => array ( // array of options
|
42 |
+
'none' => array ( // array key needs to be the same as the option value
|
43 |
+
'label' => __('None', 'schema-wp'), // text displayed as the option
|
44 |
+
'value' => 'none' // value stored for the option
|
45 |
+
),
|
46 |
+
'one' => array (
|
47 |
+
'label' => __('Single audio', 'schema-wp'),
|
48 |
+
'value' => 'single'
|
49 |
+
),
|
50 |
+
'two' => array (
|
51 |
+
'label' => __('Multiple audios', 'schema-wp'),
|
52 |
+
'value' => 'multiple'
|
53 |
+
)
|
54 |
+
)
|
55 |
+
)
|
56 |
+
);
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Instantiate the class with all variables to create a meta box
|
60 |
+
* var $id string meta box id
|
61 |
+
* var $title string title
|
62 |
+
* var $fields array fields
|
63 |
+
* var $page string|array post type to add meta box to
|
64 |
+
* var $context string context where to add meta box at (normal, side)
|
65 |
+
* var $priority string meta box priority (high, core, default, low)
|
66 |
+
* var $js bool including javascript or not
|
67 |
+
*/
|
68 |
+
$schema_wp_audio_object = new Schema_Custom_Add_Meta_Box( 'schema_audio_object', 'AudioObject', $fields, 'schema', 'normal', 'high', true );
|
69 |
+
}
|
70 |
+
|
71 |
+
|
72 |
+
add_action( 'current_screen', 'schema_wp_audio_object_post_meta' );
|
73 |
+
/**
|
74 |
+
* Create AudioObject post meta box for active post types edit screens
|
75 |
+
*
|
76 |
+
* @since 1.5.9.6
|
77 |
+
*/
|
78 |
+
function schema_wp_audio_object_post_meta() {
|
79 |
+
|
80 |
+
if ( ! is_admin() ) return;
|
81 |
+
|
82 |
+
if ( ! class_exists( 'Schema_WP' ) ) return;
|
83 |
+
|
84 |
+
global $post;
|
85 |
+
|
86 |
+
$prefix = '_schema_audio_object_';
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Create meta box on active post types edit screens
|
90 |
+
*/
|
91 |
+
$fields = array(
|
92 |
+
|
93 |
+
array(
|
94 |
+
'label' => '',
|
95 |
+
'desc' => __('You have enabled AudioObject, if you see an error in the <a target="_blank" href="https://search.google.com/structured-data/testing-tool">testing tool</a>, use the fields below to fill the missing fields, correct markup errors, and add additional details about the audio embedded in your content editor.', 'schema-wp'),
|
96 |
+
'id' => $prefix.'headline',
|
97 |
+
'type' => 'desc'
|
98 |
+
),
|
99 |
+
array( // Text Input
|
100 |
+
'label' => __('Title', 'schema-wp'), // <label>
|
101 |
+
'tip' => __('Audio title', 'schema-wp'), // tooltip
|
102 |
+
'desc' => __('', 'schema-wp'), // description
|
103 |
+
'id' => $prefix.'name', // field id and name
|
104 |
+
'type' => 'text' // type of field
|
105 |
+
),
|
106 |
+
array(
|
107 |
+
'label' => __('Upload Date', 'schema-wp'),
|
108 |
+
'tip' => __('Audio upload date in ISO 8601 format YYYY-MM-DD example: 2016-06-23', 'schema-wp'),
|
109 |
+
'desc' => __('', 'schema-wp'),
|
110 |
+
'id' => $prefix.'upload_date',
|
111 |
+
'type' => 'text'
|
112 |
+
),
|
113 |
+
array(
|
114 |
+
'label' => __('Duration', 'schema-wp'),
|
115 |
+
'tip' => __('Audio duration, example: if duration is 1 Hour 35 MIN, use: PT1H35M', 'schema-wp'),
|
116 |
+
'desc' => __('', 'schema-wp'),
|
117 |
+
'id' => $prefix.'duration',
|
118 |
+
'type' => 'text'
|
119 |
+
),
|
120 |
+
array( // Textarea
|
121 |
+
'label' => __('Description', 'schema-wp'),
|
122 |
+
'tip' => __('Audio short description.', 'schema-wp'),
|
123 |
+
'desc' => __('', 'schema-wp'),
|
124 |
+
'id' => $prefix.'description',
|
125 |
+
'type' => 'textarea'
|
126 |
+
),
|
127 |
+
);
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Get enabled post types to create a meta box on
|
131 |
+
*/
|
132 |
+
$schemas_enabled = array();
|
133 |
+
|
134 |
+
// Get schame enabled array
|
135 |
+
$schemas_enabled = schema_wp_cpt_get_enabled();
|
136 |
+
|
137 |
+
if ( empty($schemas_enabled) ) return;
|
138 |
+
|
139 |
+
// Get post type from current screen
|
140 |
+
$current_screen = get_current_screen();
|
141 |
+
$post_type = $current_screen->post_type;
|
142 |
+
|
143 |
+
foreach( $schemas_enabled as $schema_enabled ) :
|
144 |
+
|
145 |
+
$type = (isset($schema_enabled['audio_object_type']) && $schema_enabled['audio_object_type'] != '') ? $schema_enabled['audio_object_type'] : '';
|
146 |
+
|
147 |
+
// Add meta box only for type signle, preset an entry with one embed audio
|
148 |
+
if ( $type == 'single' ) {
|
149 |
+
|
150 |
+
// Get Schema enabled post types array
|
151 |
+
$schema_cpt = $schema_enabled['post_type'];
|
152 |
+
|
153 |
+
if ( ! empty($schema_cpt) && in_array( $post_type, $schema_cpt, true ) ) {
|
154 |
+
|
155 |
+
$schema_wp_audio_object_active = new Schema_Custom_Add_Meta_Box( 'schema_audio_object', 'AudioObject', $fields, $schema_cpt, 'normal', 'high', true );
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
// debug
|
160 |
+
//print_r($schema_enabled);
|
161 |
+
|
162 |
+
endforeach;
|
163 |
+
}
|
164 |
+
|
165 |
+
|
166 |
+
|
167 |
+
add_filter('schema_wp_cpt_enabled', 'schema_wp_schema_audio_object_extend_cpt_enabled');
|
168 |
+
/**
|
169 |
+
* Extend the CPT Enabled array
|
170 |
+
*
|
171 |
+
* @since 1.5.9.6
|
172 |
+
*/
|
173 |
+
function schema_wp_schema_audio_object_extend_cpt_enabled( $cpt_enabled ) {
|
174 |
+
|
175 |
+
if ( empty($cpt_enabled) )
|
176 |
+
return;
|
177 |
+
|
178 |
+
$audio_object_enable = schema_wp_get_option( 'audio_object_enable' );
|
179 |
+
|
180 |
+
if ( $audio_object_enable != true )
|
181 |
+
return $cpt_enabled;
|
182 |
+
|
183 |
+
$args = array(
|
184 |
+
'post_type' => 'schema',
|
185 |
+
'post_status' => 'publish',
|
186 |
+
'posts_per_page' => -1
|
187 |
+
);
|
188 |
+
|
189 |
+
$schemas_query = new WP_Query( $args );
|
190 |
+
|
191 |
+
$schemas = $schemas_query->get_posts();
|
192 |
+
|
193 |
+
// If there is no schema types set, return and empty array
|
194 |
+
if ( empty($schemas) )
|
195 |
+
return array();
|
196 |
+
|
197 |
+
$i = 0;
|
198 |
+
|
199 |
+
foreach ( $schemas as $schema ) :
|
200 |
+
|
201 |
+
// Get post meta
|
202 |
+
$type = get_post_meta( $schema->ID, '_schema_audio_object_type', true );
|
203 |
+
|
204 |
+
if ( ! isset($type) ) $type = 'none'; // default
|
205 |
+
|
206 |
+
if ( $type != 'none' ) {
|
207 |
+
// Append audio object type
|
208 |
+
$cpt_enabled[$i]['audio_object_type'] = $type;
|
209 |
+
}
|
210 |
+
|
211 |
+
// Or maybe use...
|
212 |
+
/*$cpt_enabled[$i]['misc'] = array (
|
213 |
+
'review_type' => $schema_review_type
|
214 |
+
);*/
|
215 |
+
|
216 |
+
$i++;
|
217 |
+
|
218 |
+
endforeach;
|
219 |
+
|
220 |
+
// debug
|
221 |
+
//echo '<pre>'; print_r($cpt_enabled); echo '</pre>';
|
222 |
+
|
223 |
+
return $cpt_enabled;
|
224 |
+
}
|
225 |
+
|
226 |
+
|
227 |
+
|
228 |
+
add_filter( 'schema_output', 'schema_wp_audio_object_output' );
|
229 |
+
/**
|
230 |
+
* Audio qoject output, filter the schema_output
|
231 |
+
*
|
232 |
+
* @param array $schema
|
233 |
+
* @since 1.5.9.6
|
234 |
+
* @return array $schema
|
235 |
+
*/
|
236 |
+
function schema_wp_audio_object_output( $schema ) {
|
237 |
+
|
238 |
+
//echo'<pre>'; print_r( $schema ); echo'</pre>';
|
239 |
+
//exit;
|
240 |
+
|
241 |
+
// Debug - start of script
|
242 |
+
//$time_start = microtime(true);
|
243 |
+
|
244 |
+
if ( empty($schema) )
|
245 |
+
return;
|
246 |
+
|
247 |
+
$audio_object_enable = schema_wp_get_option( 'audio_object_enable' );
|
248 |
+
|
249 |
+
if ( $audio_object_enable != true )
|
250 |
+
return $schema;
|
251 |
+
|
252 |
+
global $wp_query, $post, $wp_embed;
|
253 |
+
|
254 |
+
// Maybe this is not needed!
|
255 |
+
if ( ! $wp_query->is_main_query() )
|
256 |
+
return $schema;
|
257 |
+
|
258 |
+
// This didn't work, that's why it's commented
|
259 |
+
//if ( $wp_embed->last_url == '' || ! isset($wp_embed->last_url) ) return $schema;
|
260 |
+
|
261 |
+
// Get post meta
|
262 |
+
$schema_ref = get_post_meta( $post->ID, '_schema_ref', true );
|
263 |
+
|
264 |
+
// Check for ref, if is not presented, then get out!
|
265 |
+
if ( ! isset($schema_ref) || $schema_ref == '' ) return $schema;
|
266 |
+
|
267 |
+
// Get audio object type value from enabled Schema post type
|
268 |
+
$type = get_post_meta( $schema_ref, '_schema_audio_object_type', true );
|
269 |
+
|
270 |
+
//if ( ! isset($enabled) ) $enabled = false; // default
|
271 |
+
//if ( ! isset($audio_object_type_enabled) || $audio_object_type_enabled == '' ) $audio_object_type_enabled = false; // default
|
272 |
+
if ( ! isset($type) ) $type = 'none'; // default
|
273 |
+
|
274 |
+
|
275 |
+
if ( $type != 'none' ) {
|
276 |
+
|
277 |
+
require_once( ABSPATH . WPINC . '/class-oembed.php' );
|
278 |
+
|
279 |
+
// Get content
|
280 |
+
$post_object = get_post( $post->ID );
|
281 |
+
$content = $post_object->post_content;
|
282 |
+
|
283 |
+
// Replace line breaks from all HTML elements with placeholders.
|
284 |
+
//$content = wp_replace_in_html_tags( $content, array( "\n" => '<!-- wp-line-break -->' ) );
|
285 |
+
|
286 |
+
// Get regex
|
287 |
+
//$regex = '#\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))#iS';
|
288 |
+
$regex = '|^\s*(https?://[^\s"]+)\s*$|im';
|
289 |
+
|
290 |
+
|
291 |
+
if ( $type == 'single') {
|
292 |
+
|
293 |
+
// Get one audio
|
294 |
+
$reg = preg_match( $regex, $content, $matches );
|
295 |
+
//$matches = schema_wp_get_string_urls($content);
|
296 |
+
|
297 |
+
if ( ! $reg ) return $schema;
|
298 |
+
|
299 |
+
$autoembed = new WP_oEmbed();
|
300 |
+
|
301 |
+
$url = trim($matches[0]); // also, use trim to remove white spaces if any
|
302 |
+
$provider = $autoembed->discover( $url );
|
303 |
+
if (filter_var($provider, FILTER_VALIDATE_URL) != FALSE) {
|
304 |
+
$data = $autoembed->fetch( $provider, $url );
|
305 |
+
if (!empty($data) ) {
|
306 |
+
$schema['audio'] = schema_wp_get_audio_object_array( $data );
|
307 |
+
}
|
308 |
+
}
|
309 |
+
|
310 |
+
/*
|
311 |
+
// Or we can use...
|
312 |
+
foreach ( $matches as $key => $url ) {
|
313 |
+
$provider = $autoembed->discover( $url );
|
314 |
+
if (filter_var($provider, FILTER_VALIDATE_URL) != FALSE) {
|
315 |
+
$data = $autoembed->fetch( $provider, $url );
|
316 |
+
if (!empty($data) ) {
|
317 |
+
$schema['audio'] = schema_wp_get_audio_object_array( $data );
|
318 |
+
}
|
319 |
+
}
|
320 |
+
}*/
|
321 |
+
|
322 |
+
} else {
|
323 |
+
|
324 |
+
// Get them all
|
325 |
+
//$reg = preg_match_all( $regex, $content, $matches );
|
326 |
+
// Or we can use this
|
327 |
+
$matches = wp_extract_urls( $content );
|
328 |
+
|
329 |
+
if ( empty($matches) ) return $schema;
|
330 |
+
|
331 |
+
//$matches = schema_wp_get_string_urls($content);
|
332 |
+
$autoembed = new WP_oEmbed();
|
333 |
+
$schema['audio'] = array();
|
334 |
+
foreach ( $matches as $key => $url ) {
|
335 |
+
$url = trim($url); // remove white spaces if any
|
336 |
+
$provider = $autoembed->discover( $url );
|
337 |
+
if (filter_var($provider, FILTER_VALIDATE_URL) != FALSE) {
|
338 |
+
$data = $autoembed->fetch( $provider, $url );
|
339 |
+
if (!empty($data) ) {
|
340 |
+
$schema['audio'][] = schema_wp_get_audio_object_array( $data );
|
341 |
+
}
|
342 |
+
}
|
343 |
+
}
|
344 |
+
}
|
345 |
+
|
346 |
+
}
|
347 |
+
|
348 |
+
// Debug
|
349 |
+
//if (current_user_can( 'manage_options' )) {
|
350 |
+
//echo'<pre>'; print_r( $schema ); echo'</pre>';
|
351 |
+
//exit;
|
352 |
+
//echo 'Execution time in seconds: ' . (microtime(true) - $time_start) . '<br>';
|
353 |
+
//}
|
354 |
+
|
355 |
+
// finally!
|
356 |
+
return $schema;
|
357 |
+
}
|
358 |
+
|
359 |
+
|
360 |
+
|
361 |
+
/**
|
362 |
+
* Get audio qoject array
|
363 |
+
*
|
364 |
+
* @param array $data
|
365 |
+
* @since 1.5
|
366 |
+
* @return array
|
367 |
+
*/
|
368 |
+
function schema_wp_get_audio_object_array( $data ) {
|
369 |
+
|
370 |
+
global $post;
|
371 |
+
|
372 |
+
// Check for WPRichSnippets
|
373 |
+
//if (function_exists('wprs_is_enabled')) {
|
374 |
+
// if ( wprs_is_enabled($post->ID) ) return;
|
375 |
+
//}
|
376 |
+
|
377 |
+
//echo'<pre>'; print_r( $data ); echo'</pre>'; //exit;
|
378 |
+
|
379 |
+
$audio_id = '';
|
380 |
+
$name = '';
|
381 |
+
$description = '';
|
382 |
+
$image = '';
|
383 |
+
$thumbnail_url = '';
|
384 |
+
$upload_date = '';
|
385 |
+
$duration = '';
|
386 |
+
|
387 |
+
$host = isset($data->provider_name) ? $data->provider_name : '';
|
388 |
+
|
389 |
+
$supported_hosts = array ( 'SoundCloud', 'Mixcloud', 'Spotify' ); // Spotify not tested!
|
390 |
+
|
391 |
+
if ( ! in_array( $host, $supported_hosts) ) return;
|
392 |
+
|
393 |
+
// Get values from post meta
|
394 |
+
$meta_name = get_post_meta( $post->ID, '_schema_audio_object_name', true );
|
395 |
+
$meta_description = get_post_meta( $post->ID, '_schema_audio_object_description', true );
|
396 |
+
$meta_upload_date = get_post_meta( $post->ID, '_schema_audio_object_upload_date', true );
|
397 |
+
$meta_duration = get_post_meta( $post->ID, '_schema_audio_object_duration', true );
|
398 |
+
|
399 |
+
// Override values if found via parsing the data
|
400 |
+
$audio_id = isset($data->audio_id) ? $data->audio_id : '';
|
401 |
+
$name = isset($data->title) ? $data->title : $meta_name;
|
402 |
+
$description = isset($data->description) ? $data->description : $meta_description;
|
403 |
+
$image = isset($data->image) ? $data->image : '';
|
404 |
+
$thumbnail_url = isset($data->thumbnail_url) ? $data->thumbnail_url : '';
|
405 |
+
$upload_date = isset($data->upload_date) ? $data->upload_date : $meta_upload_date;
|
406 |
+
$duration = isset($data->duration) ? schema_wp_get_time_second_to_iso8601_duration( $data->duration ) : $meta_duration;
|
407 |
+
|
408 |
+
$schema = array(
|
409 |
+
'@type' => 'AudioObject',
|
410 |
+
"name" => $name,
|
411 |
+
"description" => $description,
|
412 |
+
"image" => $image,
|
413 |
+
"thumbnailUrl" => $thumbnail_url,
|
414 |
+
'uploadDate' => $upload_date,
|
415 |
+
"duration" => $duration
|
416 |
+
);
|
417 |
+
|
418 |
+
return $schema;
|
419 |
+
}
|
includes/extensions/author.php
ADDED
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Author extention
|
5 |
+
*
|
6 |
+
* Adds schema Author for Article types
|
7 |
+
*
|
8 |
+
* @since 1.5.9.7
|
9 |
+
*/
|
10 |
+
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
12 |
+
|
13 |
+
|
14 |
+
add_filter( 'schema_output', 'schema_wp_do_author' );
|
15 |
+
/**
|
16 |
+
* Filter schema markup output, via schema_output filter
|
17 |
+
*
|
18 |
+
* @since 1.5.9.7
|
19 |
+
* @return array
|
20 |
+
*/
|
21 |
+
function schema_wp_do_author( $schema ) {
|
22 |
+
|
23 |
+
global $post;
|
24 |
+
|
25 |
+
if ( ! isset($schema["@type"]) ) return $schema;
|
26 |
+
|
27 |
+
$schema_type = $schema["@type"];
|
28 |
+
$support_article_types = schema_wp_get_support_article_types();
|
29 |
+
|
30 |
+
$author = schema_wp_get_author_array($post->ID);
|
31 |
+
|
32 |
+
if ( in_array( $schema_type, $support_article_types, false) )
|
33 |
+
$schema["author"] = schema_wp_get_author_array($post->ID);
|
34 |
+
|
35 |
+
return $schema;
|
36 |
+
}
|
37 |
+
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Get author array
|
41 |
+
*
|
42 |
+
* @since 1.5.3
|
43 |
+
* @return array
|
44 |
+
*/
|
45 |
+
function schema_wp_get_author_array( $post_id = null ) {
|
46 |
+
|
47 |
+
global $post;
|
48 |
+
|
49 |
+
// Set post ID
|
50 |
+
If ( ! isset($post_id) ) $post_id = $post->ID;
|
51 |
+
|
52 |
+
$jason = array();
|
53 |
+
|
54 |
+
// Get author from post content
|
55 |
+
$content_post = get_post($post_id);
|
56 |
+
$post_author = get_userdata($content_post->post_author);
|
57 |
+
$email = $post_author->user_email;
|
58 |
+
|
59 |
+
// Debug
|
60 |
+
//print_r($post_author);exit;
|
61 |
+
|
62 |
+
$author = array (
|
63 |
+
'@type' => 'Person',
|
64 |
+
'name' => apply_filters ( 'schema_wp_filter_author_name', $post_author->display_name ),
|
65 |
+
'url' => esc_url( get_author_posts_url( $post_author->ID ) )
|
66 |
+
);
|
67 |
+
|
68 |
+
if ( get_the_author_meta( 'description', $post_author->ID ) ) {
|
69 |
+
$author['description'] = strip_tags( get_the_author_meta( 'description', $post_author->ID ) );
|
70 |
+
}
|
71 |
+
|
72 |
+
if ( schema_wp_validate_gravatar($email) ) {
|
73 |
+
// Default = 96px, since it is a squre image, width = height
|
74 |
+
$image_size = apply_filters( 'schema_wp_get_author_array_img_size', 96);
|
75 |
+
$image_url = get_avatar_url( $email, $image_size );
|
76 |
+
|
77 |
+
if ( $image_url ) {
|
78 |
+
$author['image'] = array (
|
79 |
+
'@type' => 'ImageObject',
|
80 |
+
'url' => $image_url,
|
81 |
+
'height' => $image_size,
|
82 |
+
'width' => $image_size
|
83 |
+
);
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
|
88 |
+
// sameAs
|
89 |
+
$website = esc_attr( stripslashes( get_the_author_meta( 'user_url', $post_author->ID ) ) );
|
90 |
+
$googleplus = esc_attr( stripslashes( get_the_author_meta( 'googleplus', $post_author->ID ) ) );
|
91 |
+
$facebook = esc_attr( stripslashes( get_the_author_meta( 'facebook', $post_author->ID) ) );
|
92 |
+
$twitter = esc_attr( stripslashes( get_the_author_meta( 'twitter', $post_author->ID ) ) );
|
93 |
+
$instagram = esc_attr( stripslashes( get_the_author_meta( 'instagram', $post_author->ID ) ) );
|
94 |
+
$youtube = esc_attr( stripslashes( get_the_author_meta( 'youtube', $post_author->ID ) ) );
|
95 |
+
$linkedin = esc_attr( stripslashes( get_the_author_meta( 'linkedin', $post_author->ID ) ) );
|
96 |
+
$myspace = esc_attr( stripslashes( get_the_author_meta( 'myspace', $post_author->ID ) ) );
|
97 |
+
$pinterest = esc_attr( stripslashes( get_the_author_meta( 'pinterest', $post_author->ID ) ) );
|
98 |
+
$soundcloud = esc_attr( stripslashes( get_the_author_meta( 'soundcloud', $post_author->ID ) ) );
|
99 |
+
$tumblr = esc_attr( stripslashes( get_the_author_meta( 'tumblr', $post_author->ID ) ) );
|
100 |
+
$github = esc_attr( stripslashes( get_the_author_meta( 'github', $post_author->ID ) ) );
|
101 |
+
|
102 |
+
$sameAs_links = array( $website, $googleplus, $facebook, $twitter, $instagram, $youtube, $linkedin, $myspace, $pinterest, $soundcloud, $tumblr, $github);
|
103 |
+
|
104 |
+
$social = array();
|
105 |
+
|
106 |
+
// Remove empty fields
|
107 |
+
foreach( $sameAs_links as $sameAs_link ) {
|
108 |
+
if ( $sameAs_link != '' ) $social[] = $sameAs_link;
|
109 |
+
}
|
110 |
+
|
111 |
+
if ( ! empty($social) ) {
|
112 |
+
$author["sameAs"] = $social;
|
113 |
+
}
|
114 |
+
|
115 |
+
return apply_filters( 'schema_wp_author', $author );
|
116 |
+
}
|
117 |
+
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Validate gravatar by email or id
|
121 |
+
*
|
122 |
+
* Utility function to check if a gravatar exists for a given email or id
|
123 |
+
*
|
124 |
+
* @link https://gist.github.com/justinph/5197810
|
125 |
+
*
|
126 |
+
* @since 1.6
|
127 |
+
* @param int|string|object $id_or_email A user ID, email address, or comment object
|
128 |
+
* @return bool if the gravatar exists or not
|
129 |
+
*/
|
130 |
+
function schema_wp_validate_gravatar( $email ) {
|
131 |
+
|
132 |
+
$hashkey = md5(strtolower(trim($email)));
|
133 |
+
$uri = 'http://www.gravatar.com/avatar/' . $hashkey . '?d=404';
|
134 |
+
$data = get_transient($hashkey);
|
135 |
+
|
136 |
+
if (false === $data) {
|
137 |
+
$response = wp_remote_head($uri);
|
138 |
+
if( is_wp_error($response) ) {
|
139 |
+
$data = 'not200';
|
140 |
+
} else {
|
141 |
+
$data = $response['response']['code'];
|
142 |
+
}
|
143 |
+
set_transient( $hashkey, $data, $expiration = 60*5);
|
144 |
+
}
|
145 |
+
|
146 |
+
if ($data == '200'){
|
147 |
+
return true;
|
148 |
+
} else {
|
149 |
+
return false;
|
150 |
+
}
|
151 |
+
}
|
includes/extensions/breadcrumbs.php
ADDED
@@ -0,0 +1,419 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class JSON LD Breadcrumb.
|
4 |
+
*
|
5 |
+
* @package JSON_LD_Breadcrumbs
|
6 |
+
*
|
7 |
+
* Credits: https://wordpress.org/plugins/json-ld-breadcrumbs/
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if the file is called directy by URL.
|
11 |
+
defined( 'ABSPATH' ) or exit;
|
12 |
+
|
13 |
+
|
14 |
+
if ( ! class_exists( 'SCHEMA_JSON_LD_Breadcrumbs' ) ) {
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Class JSON LD Breadcrumb.
|
18 |
+
*
|
19 |
+
* @since 1.0.0
|
20 |
+
*/
|
21 |
+
class SCHEMA_JSON_LD_Breadcrumbs {
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Instance of JSON_LD_Breadcrumbs
|
25 |
+
*
|
26 |
+
* @since v1.0.0
|
27 |
+
* @var Object JSON_LD_Breadcrumbs
|
28 |
+
*/
|
29 |
+
private static $_instance = null;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Crumb position. Increases everytime a new crumb is added.
|
33 |
+
*
|
34 |
+
* @since 1.0.0
|
35 |
+
* @var integer
|
36 |
+
*/
|
37 |
+
private $crumb_position = 0;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Crunbs Array
|
41 |
+
*
|
42 |
+
* @since 1.0.0
|
43 |
+
* @var array
|
44 |
+
*/
|
45 |
+
private $crumbs = array();
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Initiate the class JSON_LD_Breadcrumbs
|
49 |
+
*
|
50 |
+
* @since 1.0.0
|
51 |
+
* @return (Object) Instance of JSON_LD_Breadcrumbs
|
52 |
+
*/
|
53 |
+
public static function instance() {
|
54 |
+
if ( ! isset( self::$_instance ) ) {
|
55 |
+
self::$_instance = new self;
|
56 |
+
}
|
57 |
+
|
58 |
+
return self::$_instance;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Constructor.
|
63 |
+
*
|
64 |
+
* @since 1.0.0
|
65 |
+
*/
|
66 |
+
private function __construct() {
|
67 |
+
$this->post = ( isset( $GLOBALS['post'] ) ? $GLOBALS['post'] : null );
|
68 |
+
$this->show_on_front = get_option( 'show_on_front' );
|
69 |
+
$this->page_for_posts = get_option( 'page_for_posts' );
|
70 |
+
|
71 |
+
$breadcrumbs_enable = schema_wp_get_option( 'breadcrumbs_enable' );
|
72 |
+
|
73 |
+
if ( $breadcrumbs_enable ) {
|
74 |
+
|
75 |
+
// if Breadcrumbs is enabled within the plugin settings
|
76 |
+
add_action( 'wp_head', array( $this, 'set_crumbs' ) );
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Initialize the Schema for the breadcrumbs markup.
|
82 |
+
*
|
83 |
+
* @since 1.0.0
|
84 |
+
*
|
85 |
+
* @param (Array) $breadcrumb Breadcrumbs array.
|
86 |
+
*
|
87 |
+
* @return (Array) $breadcrumb Breadcrumbs array.
|
88 |
+
*/
|
89 |
+
private function initialize_breadcrumb_schema( $breadcrumb ) {
|
90 |
+
$breadcrumb['@context'] = 'http://schema.org';
|
91 |
+
$breadcrumb['@type'] = 'BreadcrumbList';
|
92 |
+
|
93 |
+
return $breadcrumb;
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Adds homepage to the breadcrumb.
|
98 |
+
*
|
99 |
+
* @since 1.0.0
|
100 |
+
*/
|
101 |
+
private function maybe_add_home_crumb() {
|
102 |
+
// TODO: Add option in the admin panel to enable or disable home page in breadcrumb.
|
103 |
+
// TODO: Add option in the admin panel to choose the text for home page.
|
104 |
+
$this->add_crumb(
|
105 |
+
'Home',
|
106 |
+
get_site_url()
|
107 |
+
);
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Conditionally adds blog page to the breadcrumb.
|
112 |
+
*
|
113 |
+
* @since 1.0.0
|
114 |
+
*/
|
115 |
+
private function maybe_add_blog_crumb() {
|
116 |
+
if ( ( 'page' === $this->show_on_front && 'post' === get_post_type() ) && ( ! is_home() && ! is_search() ) ) {
|
117 |
+
if ( $this->page_for_posts ) {
|
118 |
+
$this->add_crumb( wp_filter_nohtml_kses( get_the_title( $this->page_for_posts ) ), get_permalink( $this->page_for_posts ) );
|
119 |
+
}
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Add crumb to the breadcrumbs array.
|
125 |
+
*
|
126 |
+
* @since 1.0.0
|
127 |
+
*
|
128 |
+
* @param String $name Name of the Breadcrumb element.
|
129 |
+
* @param string $url URL of the Breadcrumb element.
|
130 |
+
* @param string $image Image URL of the Breadcrumb element.
|
131 |
+
*/
|
132 |
+
private function add_crumb( $name, $url = '', $image = '' ) {
|
133 |
+
$this->crumb_position = $this->crumb_position + 1;
|
134 |
+
|
135 |
+
if ( '' == $image ) {
|
136 |
+
$this->crumbs[] = array(
|
137 |
+
'@type' => 'ListItem',
|
138 |
+
'position' => $this->crumb_position,
|
139 |
+
'item' => array(
|
140 |
+
'@id' => $url,
|
141 |
+
'name' => $name,
|
142 |
+
),
|
143 |
+
);
|
144 |
+
} else {
|
145 |
+
$this->crumbs[] = array(
|
146 |
+
'@type' => 'ListItem',
|
147 |
+
'position' => $this->crumb_position,
|
148 |
+
'item' => array(
|
149 |
+
'@id' => $url,
|
150 |
+
'name' => $name,
|
151 |
+
'image' => $image,
|
152 |
+
),
|
153 |
+
);
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Post type archive title.
|
159 |
+
*
|
160 |
+
* @since 1.0.0
|
161 |
+
*
|
162 |
+
* @param string $pt The name of a registered post type.
|
163 |
+
*
|
164 |
+
* @return String Title of the post type.
|
165 |
+
*/
|
166 |
+
private function post_type_archive_title( $pt ) {
|
167 |
+
$archive_title = '';
|
168 |
+
|
169 |
+
$post_type_obj = get_post_type_object( $pt );
|
170 |
+
if ( is_object( $post_type_obj ) ) {
|
171 |
+
if ( isset( $post_type_obj->label ) && '' !== $post_type_obj->label ) {
|
172 |
+
$archive_title = $post_type_obj->label;
|
173 |
+
} elseif ( isset( $post_type_obj->labels->menu_name ) && '' !== $post_type_obj->labels->menu_name ) {
|
174 |
+
$archive_title = $post_type_obj->labels->menu_name;
|
175 |
+
} else {
|
176 |
+
$archive_title = $post_type_obj->name;
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
return $archive_title;
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Conditionally adds the post type archive to the breadcrumb.
|
185 |
+
*
|
186 |
+
* @since 1.0.0
|
187 |
+
*/
|
188 |
+
private function maybe_add_pt_archive_crumb_for_post() {
|
189 |
+
if ( 'post' === $this->post->post_type ) {
|
190 |
+
return;
|
191 |
+
}
|
192 |
+
if ( isset( $this->post->post_type ) && get_post_type_archive_link( $this->post->post_type ) ) {
|
193 |
+
$this->add_crumb( $this->post_type_archive_title( $this->post->post_type ), get_post_type_archive_link( $this->post->post_type ) );
|
194 |
+
}
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Conditionally adds taxanomy titles to the breadcrumb.
|
199 |
+
*
|
200 |
+
* @since 1.0.0
|
201 |
+
*/
|
202 |
+
private function maybe_add_taxonomy_crumbs_for_post() {
|
203 |
+
// TODO: Add an option in admin panel to choose taxanomy base in the breadcrumb.
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Adds post ancestor to the breadcrumb.
|
208 |
+
*
|
209 |
+
* @since 1.0.0
|
210 |
+
*/
|
211 |
+
private function add_post_ancestor_crumbs() {
|
212 |
+
$ancestors = $this->get_post_ancestors();
|
213 |
+
if ( is_array( $ancestors ) && array() !== $ancestors ) {
|
214 |
+
foreach ( $ancestors as $ancestor ) {
|
215 |
+
$this->add_crumb( wp_filter_nohtml_kses( get_the_title( $ancestor ) ), get_permalink( $ancestor ) );
|
216 |
+
}
|
217 |
+
}
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Finds the post ancestors.
|
222 |
+
*
|
223 |
+
* @since 1.0.0
|
224 |
+
* @return Array Ancestors for the current page.
|
225 |
+
*/
|
226 |
+
private function get_post_ancestors() {
|
227 |
+
$ancestors = array();
|
228 |
+
|
229 |
+
if ( isset( $this->post->ancestors ) ) {
|
230 |
+
if ( is_array( $this->post->ancestors ) ) {
|
231 |
+
$ancestors = array_values( $this->post->ancestors );
|
232 |
+
} else {
|
233 |
+
$ancestors = array( $this->post->ancestors );
|
234 |
+
}
|
235 |
+
} elseif ( isset( $this->post->post_parent ) ) {
|
236 |
+
$ancestors = array( $this->post->post_parent );
|
237 |
+
}
|
238 |
+
|
239 |
+
// Reverse the order so it's oldest to newest.
|
240 |
+
$ancestors = array_reverse( $ancestors );
|
241 |
+
|
242 |
+
return $ancestors;
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Add Taxanomies to breadcrumb.
|
247 |
+
*
|
248 |
+
* @since 1.0.0
|
249 |
+
*/
|
250 |
+
private function add_crumbs_for_taxonomy() {
|
251 |
+
$term = $GLOBALS['wp_query']->get_queried_object();
|
252 |
+
$this->add_crumb( $term->name, get_term_link( $term ) );
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Add month to the breadcrumb.
|
257 |
+
*
|
258 |
+
* @since 1.0.0
|
259 |
+
*/
|
260 |
+
private function add_month_crumb() {
|
261 |
+
$this->add_crumb(
|
262 |
+
'Archives for ' . esc_html( single_month_title( ' ', false ) ),
|
263 |
+
get_month_link( get_query_var( 'y' ), get_query_var( 'monthnum' ) )
|
264 |
+
);
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Add Month and year to breadcrumb for date archive.
|
269 |
+
*
|
270 |
+
* @since 1.0.0
|
271 |
+
*/
|
272 |
+
private function add_linked_month_year_crumb() {
|
273 |
+
$this->add_crumb(
|
274 |
+
$GLOBALS['wp_locale']->get_month( get_query_var( 'monthnum' ) ) . ' ' . get_query_var( 'year' ),
|
275 |
+
get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) )
|
276 |
+
);
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* Add date to the breadcrumb.
|
281 |
+
*
|
282 |
+
* @since 1.0.0
|
283 |
+
*/
|
284 |
+
private function add_date_crumb() {
|
285 |
+
$this->add_crumb(
|
286 |
+
'Archives for ' . esc_html( single_month_title( ' ', false ) ),
|
287 |
+
get_day_link( get_query_var( 'year' ), get_query_var( 'monthnum' ), get_query_var( 'day' ) )
|
288 |
+
);
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Add year to the breadcrumb.
|
293 |
+
*
|
294 |
+
* @since 1.0.0
|
295 |
+
*/
|
296 |
+
private function add_year_crumb() {
|
297 |
+
$this->add_crumb(
|
298 |
+
'Archives for ' . esc_html( get_query_var( 'year' ) ),
|
299 |
+
get_year_link( get_query_var( 'year' ) )
|
300 |
+
);
|
301 |
+
}
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Conditionally add individual crumbs to the breadcrumb.
|
305 |
+
*
|
306 |
+
* @since 1.0.0
|
307 |
+
*/
|
308 |
+
private function add_breadcrumb_crumbs() {
|
309 |
+
global $wp_query;
|
310 |
+
|
311 |
+
$this->maybe_add_home_crumb();
|
312 |
+
$this->maybe_add_blog_crumb();
|
313 |
+
|
314 |
+
if ( ( 'page' === $this->show_on_front && is_front_page() ) || ( 'posts' === $this->show_on_front && is_home() ) ) {
|
315 |
+
// Do nothing.
|
316 |
+
} elseif ( 'page' == $this->show_on_front && is_home() ) {
|
317 |
+
$this->add_crumb( wp_filter_nohtml_kses( get_the_title( $this->page_for_posts ) ), get_permalink( $this->page_for_posts ) );
|
318 |
+
} elseif ( is_singular() ) {
|
319 |
+
$this->maybe_add_pt_archive_crumb_for_post();
|
320 |
+
|
321 |
+
if ( isset( $this->post->post_parent ) && 0 == $this->post->post_parent ) {
|
322 |
+
$this->maybe_add_taxonomy_crumbs_for_post();
|
323 |
+
} else {
|
324 |
+
$this->add_post_ancestor_crumbs();
|
325 |
+
}
|
326 |
+
|
327 |
+
if ( isset( $this->post->ID ) ) {
|
328 |
+
$this->add_crumb( wp_filter_nohtml_kses( get_the_title( $this->post->ID ) ), get_permalink( $this->post->ID ), get_the_post_thumbnail_url( $this->post->ID, 'full' ) );
|
329 |
+
}
|
330 |
+
} else {
|
331 |
+
if ( is_post_type_archive() ) {
|
332 |
+
$post_type = $wp_query->get( 'post_type' );
|
333 |
+
|
334 |
+
if ( $post_type && is_string( $post_type ) ) {
|
335 |
+
$this->add_crumb( $this->post_type_archive_title( $post_type ), get_post_type_archive_link( $post_type ) );
|
336 |
+
}
|
337 |
+
} elseif ( is_tax() || is_tag() || is_category() ) {
|
338 |
+
$this->add_crumbs_for_taxonomy();
|
339 |
+
} elseif ( is_date() ) {
|
340 |
+
if ( is_day() ) {
|
341 |
+
$this->add_linked_month_year_crumb();
|
342 |
+
$this->add_date_crumb();
|
343 |
+
} elseif ( is_month() ) {
|
344 |
+
$this->add_month_crumb();
|
345 |
+
} elseif ( is_year() ) {
|
346 |
+
$this->add_year_crumb();
|
347 |
+
}
|
348 |
+
} elseif ( is_author() ) {
|
349 |
+
$user = $wp_query->get_queried_object();
|
350 |
+
$this->add_crumb(
|
351 |
+
'Archives for ' . $user->display_name,
|
352 |
+
get_author_posts_url( $user->ID, $user->nicename ),
|
353 |
+
get_avatar_url( $user->ID )
|
354 |
+
);
|
355 |
+
} elseif ( is_search() ) {
|
356 |
+
$this->add_crumb(
|
357 |
+
'Search results for ' . esc_html( get_search_query() ),
|
358 |
+
get_search_link( get_query_var( 's' ) )
|
359 |
+
);
|
360 |
+
} elseif ( is_404() ) {
|
361 |
+
$this->add_crumb(
|
362 |
+
'Error 404: Page not found',
|
363 |
+
null
|
364 |
+
);
|
365 |
+
}// End if().
|
366 |
+
}// End if().
|
367 |
+
|
368 |
+
return apply_filters( 'schema_json_ld_breadcrumb_itemlist_array', $this->crumbs );
|
369 |
+
}
|
370 |
+
|
371 |
+
/**
|
372 |
+
* Initialize the breadcrumbs.
|
373 |
+
*
|
374 |
+
* @since 1.0.0
|
375 |
+
*/
|
376 |
+
public function set_crumbs() {
|
377 |
+
|
378 |
+
// Allow disbakle/enable breadcrumbs output
|
379 |
+
// @since 1.6.9.5
|
380 |
+
$breadcrumb_enabled = apply_filters( 'schema_wp_breadcrumb_enabled', true );
|
381 |
+
// check if enabled
|
382 |
+
if ( ! $breadcrumb_enabled )
|
383 |
+
return;
|
384 |
+
|
385 |
+
$breadcrumb = array();
|
386 |
+
$breadcrumb = $this->initialize_breadcrumb_schema( $breadcrumb );
|
387 |
+
|
388 |
+
$breadcrumb['itemListElement'] = $this->add_breadcrumb_crumbs();
|
389 |
+
|
390 |
+
$this->json_schema( apply_filters( 'schema_json_ld_breadcrumb_array', $breadcrumb ) );
|
391 |
+
}
|
392 |
+
|
393 |
+
/**
|
394 |
+
* Output the ld+json schema markup.
|
395 |
+
*
|
396 |
+
* @since 1.0.0
|
397 |
+
*
|
398 |
+
* @param Array $schema Array to be converted to json markup.
|
399 |
+
*/
|
400 |
+
private function json_schema( $schema ) {
|
401 |
+
|
402 |
+
$schema_output = null;
|
403 |
+
|
404 |
+
if ( ! empty( $schema ) && is_array( $schema ) ) {
|
405 |
+
$schema_output .= "\n\n";
|
406 |
+
$schema_output .= '<!-- This site is optimized with the Schema plugin v'.SCHEMAWP_VERSION.' - https://schema.press -->';
|
407 |
+
$schema_output .= "\n";
|
408 |
+
$schema_output .= '<script type="application/ld+json">' . json_encode( $schema, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) . '</script>';
|
409 |
+
$schema_output .= "\n\n";
|
410 |
+
}
|
411 |
+
|
412 |
+
echo $schema_output;
|
413 |
+
}
|
414 |
+
|
415 |
+
}
|
416 |
+
|
417 |
+
}// End if().
|
418 |
+
|
419 |
+
add_action( 'wp', 'SCHEMA_JSON_LD_Breadcrumbs::instance' );
|
includes/extensions/comment.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Comment extention
|
5 |
+
*
|
6 |
+
* Adds schema Comment for Article types
|
7 |
+
*
|
8 |
+
* @since 1.5.3
|
9 |
+
*/
|
10 |
+
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
12 |
+
|
13 |
+
|
14 |
+
add_filter( 'schema_output', 'schema_wp_do_comments_number' );
|
15 |
+
/**
|
16 |
+
* Add comments number for Article types via schema_output filter
|
17 |
+
*
|
18 |
+
* @since 1.5.3
|
19 |
+
* @return array
|
20 |
+
*/
|
21 |
+
function schema_wp_do_comments_number( $schema ) {
|
22 |
+
|
23 |
+
$comments_enable = schema_wp_get_option( 'comments_enable' );
|
24 |
+
|
25 |
+
if ( $comments_enable != true )
|
26 |
+
return $schema;
|
27 |
+
|
28 |
+
global $post;
|
29 |
+
|
30 |
+
$schema_type = $schema["@type"];
|
31 |
+
|
32 |
+
$support_article_types = schema_wp_get_support_article_types();
|
33 |
+
|
34 |
+
if ( in_array( $schema_type, $support_article_types, false) )
|
35 |
+
$schema["commentCount"] = get_comments_number($post->ID);
|
36 |
+
|
37 |
+
return $schema;
|
38 |
+
}
|
39 |
+
|
40 |
+
|
41 |
+
add_filter( 'schema_output', 'schema_wp_do_comment' );
|
42 |
+
/**
|
43 |
+
* Add Schema Comment for Article types via schema_output filter
|
44 |
+
*
|
45 |
+
* @since 1.5.3
|
46 |
+
* @return array
|
47 |
+
*/
|
48 |
+
function schema_wp_do_comment( $schema ) {
|
49 |
+
|
50 |
+
$comments_enable = schema_wp_get_option( 'comments_enable' );
|
51 |
+
|
52 |
+
if ( $comments_enable != true )
|
53 |
+
return $schema;
|
54 |
+
|
55 |
+
global $post;
|
56 |
+
|
57 |
+
$schema_type = $schema["@type"];
|
58 |
+
$support_article_types = schema_wp_get_support_article_types();
|
59 |
+
$number = apply_filters( 'schema_wp_do_comment_number', '10'); // default = 10
|
60 |
+
|
61 |
+
if ( in_array( $schema_type, $support_article_types, true) ) {
|
62 |
+
$Comments = schema_wp_get_comments();
|
63 |
+
if ( !empty($Comments) )
|
64 |
+
$schema["comment"] = $Comments;
|
65 |
+
}
|
66 |
+
|
67 |
+
return $schema;
|
68 |
+
}
|
69 |
+
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Get comments
|
73 |
+
*
|
74 |
+
* @since 1.5.4
|
75 |
+
* @return array
|
76 |
+
*/
|
77 |
+
function schema_wp_get_comments() {
|
78 |
+
|
79 |
+
global $post;
|
80 |
+
|
81 |
+
$number = apply_filters( 'schema_wp_do_comments', '10'); // default = 10
|
82 |
+
|
83 |
+
$Comments = array();
|
84 |
+
$PostComments = get_comments( array( 'post_id' => $post->ID, 'number' => $number, 'status' => 'approve', 'type' => 'comment' ) );
|
85 |
+
|
86 |
+
if ( count( $PostComments ) ) {
|
87 |
+
foreach ( $PostComments as $Item ) {
|
88 |
+
$Comments[] = array (
|
89 |
+
'@type' => 'Comment',
|
90 |
+
'dateCreated' => $Item->comment_date,
|
91 |
+
'description' => $Item->comment_content,
|
92 |
+
'author' => array (
|
93 |
+
'@type' => 'Person',
|
94 |
+
'name' => $Item->comment_author,
|
95 |
+
'url' => $Item->comment_author_url,
|
96 |
+
),
|
97 |
+
);
|
98 |
+
}
|
99 |
+
|
100 |
+
return apply_filters( 'schema_wp_filter_comments', $Comments );
|
101 |
+
}
|
102 |
+
}
|
includes/extensions/page-about.php
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Page - About
|
4 |
+
*
|
5 |
+
* @since 1.5.2
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Exit if accessed directly
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
|
12 |
+
add_filter( 'schema_output', 'schema_wp_no_sceham_output_if_page_about' );
|
13 |
+
/**
|
14 |
+
* Do not output schema default json-ld if this is the About page
|
15 |
+
*
|
16 |
+
* @since 1.5.2
|
17 |
+
* @return schema json-ld array or an empy array
|
18 |
+
*/
|
19 |
+
function schema_wp_no_sceham_output_if_page_about( $schema ) {
|
20 |
+
|
21 |
+
$about_page_id = schema_wp_get_option( 'about_page' );
|
22 |
+
|
23 |
+
if ( ! $about_page_id ) return $schema;
|
24 |
+
|
25 |
+
if ( is_page( $about_page_id ) ) {
|
26 |
+
return array();
|
27 |
+
}
|
28 |
+
|
29 |
+
return $schema;
|
30 |
+
}
|
31 |
+
|
32 |
+
|
33 |
+
add_action('wp_head', 'schema_wp_output_page_about');
|
34 |
+
/**
|
35 |
+
* The main function responsible for output schema json-ld
|
36 |
+
*
|
37 |
+
* @since 1.4.5
|
38 |
+
* @return schema json-ld final output
|
39 |
+
*/
|
40 |
+
function schema_wp_output_page_about() {
|
41 |
+
|
42 |
+
$about_page_id = schema_wp_get_option( 'about_page' );
|
43 |
+
|
44 |
+
if ( ! $about_page_id ) return;
|
45 |
+
|
46 |
+
// Run only on author pages
|
47 |
+
if ( is_page( $about_page_id ) ) {
|
48 |
+
|
49 |
+
$json = schema_wp_get_page_about_json( 'AboutPage' );
|
50 |
+
|
51 |
+
$output = '';
|
52 |
+
|
53 |
+
if ($json) {
|
54 |
+
$output .= "\n\n";
|
55 |
+
$output .= '<!-- This site is optimized with the Schema plugin v'.SCHEMAWP_VERSION.' - http://schema.press -->';
|
56 |
+
$output .= "\n";
|
57 |
+
$output .= '<script type="application/ld+json">' . json_encode($json, JSON_UNESCAPED_UNICODE) . '</script>';
|
58 |
+
$output .= "\n\n";
|
59 |
+
}
|
60 |
+
|
61 |
+
echo $output;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
/**
|
67 |
+
* The main function responsible for putting shema array all together
|
68 |
+
*
|
69 |
+
* @param string $type for schema type (example: AboutPage)
|
70 |
+
* @since 1.5.1
|
71 |
+
* @return schema output
|
72 |
+
*/
|
73 |
+
function schema_wp_get_page_about_json( $type ) {
|
74 |
+
|
75 |
+
global $post;
|
76 |
+
|
77 |
+
if ( ! isset($type) ) return array();
|
78 |
+
|
79 |
+
$schema = array();
|
80 |
+
|
81 |
+
// Get schema json array
|
82 |
+
$json = schema_wp_get_schema_json_prepare( $post->ID );
|
83 |
+
|
84 |
+
// Debug
|
85 |
+
//echo '<pre>'; print_r($json); echo '</pre>';
|
86 |
+
|
87 |
+
$schema['@context'] = "http://schema.org";
|
88 |
+
$schema['@type'] = $type;
|
89 |
+
|
90 |
+
$schema["mainEntityOfPage"] = array(
|
91 |
+
"@type" => "WebPage",
|
92 |
+
"@id" => $json['permalink']
|
93 |
+
);
|
94 |
+
|
95 |
+
$schema["url"] = $json['permalink'];
|
96 |
+
|
97 |
+
/*
|
98 |
+
$schema["author"] = array(
|
99 |
+
"@type" => "Person",
|
100 |
+
"name" => $json['author']['author_name'],
|
101 |
+
"url" => $json['author']['author_posts_link'],
|
102 |
+
);
|
103 |
+
*/
|
104 |
+
|
105 |
+
$schema["headline"] = $json["headline"];
|
106 |
+
|
107 |
+
//$schema["datePublished"] = $json["datePublished"];
|
108 |
+
//$schema["dateModified"] = $json["dateModified"];
|
109 |
+
|
110 |
+
if ( ! empty( $json["media"] ) ) {
|
111 |
+
$schema["image"] = array(
|
112 |
+
"@type" => "ImageObject",
|
113 |
+
"url" => isset($json["media"]["url"]) ? $json["media"]["url"] : '',
|
114 |
+
"width" => isset($json["media"]["width"]) ? $json["media"]["width"] : '',
|
115 |
+
"height" => isset($json["media"]["height"]) ? $json["media"]["height"] : ''
|
116 |
+
);
|
117 |
+
}
|
118 |
+
|
119 |
+
if ( ! empty( $json["publisher"] ) ) {
|
120 |
+
$schema["publisher"] = $json["publisher"];
|
121 |
+
}
|
122 |
+
|
123 |
+
|
124 |
+
if ( $json["description"] != '' ) {
|
125 |
+
$schema["description"] = $json["description"];
|
126 |
+
}
|
127 |
+
|
128 |
+
return apply_filters( 'schema_about_page_output', $schema );
|
129 |
+
}
|
includes/extensions/page-contact.php
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Page - Contact
|
4 |
+
*
|
5 |
+
* @since 1.5.2
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Exit if accessed directly
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
|
12 |
+
add_filter( 'schema_output', 'schema_wp_no_sceham_output_if_page_contact' );
|
13 |
+
/**
|
14 |
+
* Do not output schema default json-ld if this is the About page
|
15 |
+
*
|
16 |
+
* @since 1.5.2
|
17 |
+
* @return schema json-ld array or an empy array
|
18 |
+
*/
|
19 |
+
function schema_wp_no_sceham_output_if_page_contact( $schema ) {
|
20 |
+
|
21 |
+
$contact_page_id = schema_wp_get_option( 'contact_page' );
|
22 |
+
|
23 |
+
if ( ! $contact_page_id ) return $schema;
|
24 |
+
|
25 |
+
if ( is_page( $contact_page_id ) ) {
|
26 |
+
return array();
|
27 |
+
}
|
28 |
+
|
29 |
+
return $schema;
|
30 |
+
}
|
31 |
+
|
32 |
+
|
33 |
+
add_action('wp_head', 'schema_wp_output_page_contact');
|
34 |
+
/**
|
35 |
+
* The main function responsible for output schema json-ld
|
36 |
+
*
|
37 |
+
* @since 1.4.5
|
38 |
+
* @return schema json-ld final output
|
39 |
+
*/
|
40 |
+
function schema_wp_output_page_contact() {
|
41 |
+
|
42 |
+
$contact_page_id = schema_wp_get_option( 'contact_page' );
|
43 |
+
|
44 |
+
if ( ! $contact_page_id ) return;
|
45 |
+
|
46 |
+
// Run only on author pages
|
47 |
+
if ( is_page( $contact_page_id ) ) {
|
48 |
+
|
49 |
+
$json = schema_wp_get_page_contact_json( 'ContactPage' );
|
50 |
+
|
51 |
+
$output = '';
|
52 |
+
|
53 |
+
if ($json) {
|
54 |
+
$output .= "\n\n";
|
55 |
+
$output .= '<!-- This site is optimized with the Schema plugin v'.SCHEMAWP_VERSION.' - http://schema.press -->';
|
56 |
+
$output .= "\n";
|
57 |
+
$output .= '<script type="application/ld+json">' . json_encode($json, JSON_UNESCAPED_UNICODE) . '</script>';
|
58 |
+
$output .= "\n\n";
|
59 |
+
}
|
60 |
+
|
61 |
+
echo $output;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
/**
|
67 |
+
* The main function responsible for putting shema array all together
|
68 |
+
*
|
69 |
+
* @param string $type for schema type (example: ContactPage)
|
70 |
+
* @since 1.5.1
|
71 |
+
* @return schema output
|
72 |
+
*/
|
73 |
+
function schema_wp_get_page_contact_json( $type ) {
|
74 |
+
|
75 |
+
global $post;
|
76 |
+
|
77 |
+
if ( ! isset($type) ) return array();
|
78 |
+
|
79 |
+
$schema = array();
|
80 |
+
|
81 |
+
// Get schema json array
|
82 |
+
$json = schema_wp_get_schema_json_prepare( $post->ID );
|
83 |
+
|
84 |
+
// Debug
|
85 |
+
//echo '<pre>'; print_r($json); echo '</pre>';
|
86 |
+
|
87 |
+
$schema['@context'] = "http://schema.org";
|
88 |
+
$schema['@type'] = $type;
|
89 |
+
|
90 |
+
$schema["mainEntityOfPage"] = array(
|
91 |
+
"@type" => "WebPage",
|
92 |
+
"@id" => $json['permalink']
|
93 |
+
);
|
94 |
+
|
95 |
+
$schema["url"] = $json['permalink'];
|
96 |
+
|
97 |
+
/*
|
98 |
+
$schema["author"] = array(
|
99 |
+
"@type" => "Person",
|
100 |
+
"name" => $json['author']['author_name'],
|
101 |
+
"url" => $json['author']['author_posts_link'],
|
102 |
+
);
|
103 |
+
*/
|
104 |
+
|
105 |
+
$schema["headline"] = $json["headline"];
|
106 |
+
|
107 |
+
//$schema["datePublished"] = $json["datePublished"];
|
108 |
+
//$schema["dateModified"] = $json["dateModified"];
|
109 |
+
|
110 |
+
if ( ! empty( $json["media"] ) ) {
|
111 |
+
$schema["image"] = array(
|
112 |
+
"@type" => "ImageObject",
|
113 |
+
"url" => isset($json["media"]["url"]) ? $json["media"]["url"] : '',
|
114 |
+
"width" => isset($json["media"]["width"]) ? $json["media"]["width"] : '',
|
115 |
+
"height" => isset($json["media"]["height"]) ? $json["media"]["height"] : ''
|
116 |
+
);
|
117 |
+
}
|
118 |
+
|
119 |
+
if ( ! empty( $json["publisher"] ) ) {
|
120 |
+
$schema["publisher"] = $json["publisher"];
|
121 |
+
}
|
122 |
+
|
123 |
+
|
124 |
+
if ( $json["description"] != '' ) {
|
125 |
+
$schema["description"] = $json["description"];
|
126 |
+
}
|
127 |
+
|
128 |
+
return apply_filters( 'schema_contact_page_output', $schema );
|
129 |
+
}
|
includes/extensions/post-meta-generator.php
ADDED
@@ -0,0 +1,206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Generate post meta fields
|
4 |
+
*
|
5 |
+
* @package Schema
|
6 |
+
* @subpackage Schema Post Meta
|
7 |
+
* @copyright Copyright (c) 2016, Hesham Zebida
|
8 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
+
* @since 1.5.9
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Post Meta Generator Class
|
17 |
+
*
|
18 |
+
* @since 1.5.9
|
19 |
+
*/
|
20 |
+
class Schema_Post_Meta_Generator {
|
21 |
+
|
22 |
+
public function __construct() {
|
23 |
+
|
24 |
+
global $post, $meta_key;
|
25 |
+
|
26 |
+
// check if generator is activated
|
27 |
+
// @since 1.6.9.4
|
28 |
+
$activate = apply_filters('schema_wp_post_meta_generator_activate', true);
|
29 |
+
if ( ! $activate )
|
30 |
+
return;
|
31 |
+
|
32 |
+
// get schema ref
|
33 |
+
$ref = isset($post->ID) ? get_post_meta( $post->ID, '_schema_ref', true ) : false;
|
34 |
+
|
35 |
+
if ( $ref ) {
|
36 |
+
|
37 |
+
// Check if enabled
|
38 |
+
//$enabled = get_post_meta( $ref, '_schema_post_meta_box_enabled' , true );
|
39 |
+
|
40 |
+
//if ( ! isset($enabled) || $enabled != 1 ) return;
|
41 |
+
|
42 |
+
// Start working....
|
43 |
+
|
44 |
+
$meta = get_post_meta( $ref, '_schema_post_meta_box' , true );
|
45 |
+
|
46 |
+
if ( ! empty($meta) ) {
|
47 |
+
|
48 |
+
//echo '<pre>'; print_r($meta); echo '</pre>'; exit;
|
49 |
+
|
50 |
+
foreach ( $meta as $key => $value) :
|
51 |
+
|
52 |
+
// This is not needed as it will stop filtering meta keys with no post meta fields
|
53 |
+
//if ( isset($value['field']) && $value['field'] == 1 ) { // check if field is enabled
|
54 |
+
|
55 |
+
if ( isset($value['filter']) && $value['filter'] != '' && isset($value['key']) && $value['key'] != '' ) {
|
56 |
+
|
57 |
+
$filter_name = $value['filter'];
|
58 |
+
$meta_key = $value['key'];
|
59 |
+
|
60 |
+
$this->filter_name_value = $filter_name;
|
61 |
+
$this->meta_key_value = $meta_key;
|
62 |
+
$this->post_id = $post->ID;
|
63 |
+
|
64 |
+
$post_meta_value = '';
|
65 |
+
// Check if has value!
|
66 |
+
$post_meta_value = get_post_meta( $this->post_id, $meta_key, true );
|
67 |
+
|
68 |
+
if ( isset($post_meta_value) && $post_meta_value != '' ) {
|
69 |
+
|
70 |
+
// Anonymous function: automatically use filters to add values to schema output
|
71 |
+
add_filter( $filter_name, function ($field_value) use ( $meta_key ) {
|
72 |
+
// Here we can do more conditions
|
73 |
+
// we can modify the output based on complix field types
|
74 |
+
$field_value = get_post_meta( $this->post_id, $meta_key, true );
|
75 |
+
return $field_value;
|
76 |
+
} );
|
77 |
+
}
|
78 |
+
} // end if
|
79 |
+
|
80 |
+
//} // end if
|
81 |
+
|
82 |
+
endforeach;
|
83 |
+
}
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
|
91 |
+
add_action( 'template_redirect', 'schema_wp_post_meta_generator_init' );
|
92 |
+
/**
|
93 |
+
* init post meta generator class
|
94 |
+
*
|
95 |
+
* @since 1.5.9
|
96 |
+
*/
|
97 |
+
function schema_wp_post_meta_generator_init() {
|
98 |
+
$schema_post_meta_generator = new Schema_Post_Meta_Generator();
|
99 |
+
}
|
100 |
+
|
101 |
+
|
102 |
+
|
103 |
+
add_action( 'current_screen', 'schema_wp_generate_custom_post_meta_box' );
|
104 |
+
/**
|
105 |
+
* Generate custom post meta box
|
106 |
+
*
|
107 |
+
* @since 1.5.9
|
108 |
+
*/
|
109 |
+
function schema_wp_generate_custom_post_meta_box() {
|
110 |
+
|
111 |
+
if ( ! class_exists( 'Schema_WP' ) ) return;
|
112 |
+
|
113 |
+
// check if post meta box generator is activated
|
114 |
+
// @since 1.6.9.4
|
115 |
+
$activate = apply_filters('schema_wp_post_meta_box_generator_activate', true);
|
116 |
+
if ( ! $activate )
|
117 |
+
return;
|
118 |
+
|
119 |
+
global $post;
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Get enabled post types to create a meta box on
|
123 |
+
*/
|
124 |
+
$schemas_enabled = array();
|
125 |
+
|
126 |
+
// Get schame enabled array
|
127 |
+
$schemas_enabled = schema_wp_cpt_get_enabled();
|
128 |
+
|
129 |
+
if ( empty($schemas_enabled) ) return;
|
130 |
+
|
131 |
+
// debug
|
132 |
+
//echo'<pre>';print_r($schemas_enabled);echo'</pre>';
|
133 |
+
|
134 |
+
// Get post type from current screen
|
135 |
+
$current_screen = get_current_screen();
|
136 |
+
$post_type = $current_screen->post_type;
|
137 |
+
$fields = array();
|
138 |
+
|
139 |
+
foreach( $schemas_enabled as $schema_enabled ) :
|
140 |
+
|
141 |
+
// debug
|
142 |
+
//echo '<pre>'; print_r($current_screen); echo '</pre>';
|
143 |
+
|
144 |
+
// Get Schema enabled post types array
|
145 |
+
$schema_cpt = $schema_enabled['post_type'];
|
146 |
+
|
147 |
+
if ( ! empty($schema_cpt) && in_array( $post_type, $schema_cpt, true ) ) {
|
148 |
+
|
149 |
+
foreach ( $schema_cpt as $key => $value) :
|
150 |
+
|
151 |
+
if ( $post_type == $value ) {
|
152 |
+
|
153 |
+
$ref = $schema_enabled['id'];
|
154 |
+
|
155 |
+
$enabled = get_post_meta( $ref, '_schema_post_meta_box_enabled', true );
|
156 |
+
|
157 |
+
if ( isset($enabled) && $enabled == 1 ) {
|
158 |
+
|
159 |
+
$title = get_post_meta( $ref, '_schema_post_meta_box_title', true );
|
160 |
+
if ( ! isset($title) || $title == '' ) $title = __('Schema', 'schema-wp');
|
161 |
+
|
162 |
+
$repeated = get_post_meta( $ref, '_schema_post_meta_box', true );
|
163 |
+
|
164 |
+
if ( ! empty($repeated) ) {
|
165 |
+
|
166 |
+
// Add to fields array
|
167 |
+
foreach ( $repeated as $repeated_key => $repeated_value) :
|
168 |
+
|
169 |
+
if ( isset($repeated_value['field']) && $repeated_value['field'] == 1 ) {
|
170 |
+
|
171 |
+
$id = isset($repeated_value['key']) ? $repeated_value['key'] : '';
|
172 |
+
$label = isset($repeated_value['label']) ? $repeated_value['label'] : '';
|
173 |
+
$type = isset($repeated_value['type']) ? $repeated_value['type'] : '';
|
174 |
+
$desc = isset($repeated_value['desc']) ? $repeated_value['desc'] : '';
|
175 |
+
|
176 |
+
if ( $id )
|
177 |
+
|
178 |
+
$fields[] = array
|
179 |
+
(
|
180 |
+
'label' => $label, // <label>
|
181 |
+
'desc' => $desc, // description
|
182 |
+
'id' => $id, // field id and name
|
183 |
+
'type' => $type, // type of field
|
184 |
+
);
|
185 |
+
}
|
186 |
+
|
187 |
+
endforeach;
|
188 |
+
|
189 |
+
//echo '<pre>'; print_r($fields); echo '</pre>'; exit;
|
190 |
+
|
191 |
+
if ( empty($fields) ) return;
|
192 |
+
|
193 |
+
$meta = new Schema_Custom_Add_Meta_Box( 'schema_custom_post_meta', $title, $fields, $post_type, 'normal', 'high', true );
|
194 |
+
} // end if
|
195 |
+
} // end if
|
196 |
+
|
197 |
+
} // end if
|
198 |
+
|
199 |
+
endforeach;
|
200 |
+
}
|
201 |
+
|
202 |
+
// debug
|
203 |
+
//print_r($schema_enabled);
|
204 |
+
|
205 |
+
endforeach;
|
206 |
+
}
|
includes/extensions/sameAs.php
ADDED
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema sameAs
|
4 |
+
*
|
5 |
+
* @package Schema
|
6 |
+
* @subpackage Schema sameAs
|
7 |
+
* @copyright Copyright (c) 2016, Hesham Zebida
|
8 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
+
* @since 1.5.9.9
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
add_action( 'current_screen', 'schema_wp_sameAs_post_meta' );
|
16 |
+
/**
|
17 |
+
* Add exclude post meta box
|
18 |
+
*
|
19 |
+
* @since 1.5.9.9
|
20 |
+
*/
|
21 |
+
function schema_wp_sameAs_post_meta() {
|
22 |
+
|
23 |
+
if ( ! class_exists( 'Schema_WP' ) ) return;
|
24 |
+
|
25 |
+
// filter this and return false to disable the function
|
26 |
+
$enabled = apply_filters('schema_wp_sameAs_post_meta_enabled', true);
|
27 |
+
if ( ! $enabled)
|
28 |
+
return;
|
29 |
+
|
30 |
+
global $post;
|
31 |
+
|
32 |
+
$prefix = '_schema_';
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Create meta box on active post types edit screens
|
36 |
+
*/
|
37 |
+
$fields = apply_filters( 'schema_wp_sameAs', array(
|
38 |
+
array( // Single checkbox
|
39 |
+
'label' => __('URLs', 'schema-wp'), // <label>
|
40 |
+
'tip' => __("URL of a reference Web page that unambiguously indicates the item's identity. E.g. the URL of the item's Wikipedia page, Freebase page, or official website.", 'schema-wp'), // description
|
41 |
+
'desc' => __('Enter sameAs URLs, one per line.', 'schema-wp'), // description
|
42 |
+
'id' => $prefix.'sameAs', // field id and name
|
43 |
+
'type' => 'textarea', // type of field
|
44 |
+
'sanitizer' => 'no_santitize' // do not santitize field value
|
45 |
+
)
|
46 |
+
));
|
47 |
+
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Get enabled post types to create a meta box on
|
51 |
+
*/
|
52 |
+
$schemas_enabled = array();
|
53 |
+
|
54 |
+
// Get schame enabled array
|
55 |
+
$schemas_enabled = schema_wp_cpt_get_enabled();
|
56 |
+
|
57 |
+
if ( empty($schemas_enabled) ) return;
|
58 |
+
|
59 |
+
// Get post type from current screen
|
60 |
+
$current_screen = get_current_screen();
|
61 |
+
$post_type = $current_screen->post_type;
|
62 |
+
|
63 |
+
foreach( $schemas_enabled as $schema_enabled ) :
|
64 |
+
|
65 |
+
// debug
|
66 |
+
//echo '<pre>'; print_r($current_screen); echo '</pre>';
|
67 |
+
|
68 |
+
// Get Schema enabled post types array
|
69 |
+
$schema_cpt = $schema_enabled['post_type'];
|
70 |
+
|
71 |
+
if ( ! empty($schema_cpt) && in_array( $post_type, $schema_cpt, true ) ) {
|
72 |
+
|
73 |
+
|
74 |
+
$schema_wp_exclude = new Schema_Custom_Add_Meta_Box( 'schema_sameAs', __('sameAs','schema-wp'), $fields, $post_type, 'normal', 'low', true );
|
75 |
+
|
76 |
+
}
|
77 |
+
|
78 |
+
// debug
|
79 |
+
//print_r($schema_enabled);
|
80 |
+
|
81 |
+
endforeach;
|
82 |
+
}
|
83 |
+
|
84 |
+
add_filter('schema_output', 'schema_wp_sameAs_output' );
|
85 |
+
add_filter('schema_about_page_output', 'schema_wp_sameAs_output' );
|
86 |
+
add_filter('schema_contact_page_output', 'schema_wp_sameAs_output' );
|
87 |
+
/**
|
88 |
+
* sameAs Schema output
|
89 |
+
*
|
90 |
+
* @since 1.5.9.9
|
91 |
+
*/
|
92 |
+
function schema_wp_sameAs_output( $schema ) {
|
93 |
+
|
94 |
+
// filter this and return false to disable the function
|
95 |
+
$enabled = apply_filters('schema_wp_sameAs_output_enabled', true);
|
96 |
+
if ( ! $enabled)
|
97 |
+
return $schema;
|
98 |
+
|
99 |
+
global $post;
|
100 |
+
|
101 |
+
if ( empty($schema) ) return;
|
102 |
+
|
103 |
+
$sameAs = get_post_meta( $post->ID, '_schema_sameAs' , true );
|
104 |
+
|
105 |
+
// make sure is set and it is not empty array
|
106 |
+
if ( !isset($sameAs) || empty($sameAs) ) return $schema;
|
107 |
+
|
108 |
+
//$sameAs_array = explode("\n", $sameAs);
|
109 |
+
//$sameAs_array = preg_split ('/$\R?^/m', $sameAs);
|
110 |
+
$sameAs_array = preg_split("/\r\n|\n|\r/", $sameAs);
|
111 |
+
|
112 |
+
// debug
|
113 |
+
//echo '<pre>'; print_r($sameAs_array); echo '</pre>';exit;
|
114 |
+
|
115 |
+
$schema['sameAs'] = $sameAs_array;
|
116 |
+
|
117 |
+
return $schema;
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Get sameAs
|
122 |
+
*
|
123 |
+
* @since 1.6
|
124 |
+
*/
|
125 |
+
function schema_wp_get_sameAs( $post_id = null ) {
|
126 |
+
|
127 |
+
global $post;
|
128 |
+
|
129 |
+
// Set post ID
|
130 |
+
If ( ! isset($post_id) ) $post_id = $post->ID;
|
131 |
+
|
132 |
+
$sameAs = get_post_meta( $post_id, '_schema_sameAs' , true );
|
133 |
+
|
134 |
+
// make sure is set and it is not empty array
|
135 |
+
if ( !isset($sameAs) || empty($sameAs) ) return;
|
136 |
+
|
137 |
+
//$sameAs_array = explode("\n", $sameAs);
|
138 |
+
//$sameAs_array = preg_split ('/$\R?^/m', $sameAs);
|
139 |
+
$sameAs_array = preg_split("/\r\n|\n|\r/", $sameAs);
|
140 |
+
|
141 |
+
// debug
|
142 |
+
//echo '<pre>'; print_r($sameAs_array); echo '</pre>';exit;
|
143 |
+
|
144 |
+
return $sameAs_array;
|
145 |
+
}
|
includes/extensions/shared-count.php
ADDED
@@ -0,0 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Comment extention
|
5 |
+
*
|
6 |
+
* Adds schema Comment for Article types
|
7 |
+
*
|
8 |
+
* @since 1.5.3
|
9 |
+
*/
|
10 |
+
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
12 |
+
|
13 |
+
|
14 |
+
function mashsbGetShareObj( $url ) {
|
15 |
+
global $mashsb_options;
|
16 |
+
$mashengine = true;
|
17 |
+
if( $mashengine ) {
|
18 |
+
if( !class_exists( 'RollingCurlX' ) )
|
19 |
+
require_once MASHSB_PLUGIN_DIR . 'includes/libraries/RolingCurlX.php';
|
20 |
+
if( !class_exists( 'mashengine' ) )
|
21 |
+
require_once(MASHSB_PLUGIN_DIR . 'includes/mashengine.php');
|
22 |
+
mashdebug()->error( 'mashsbGetShareObj() url: ' . $url );
|
23 |
+
$mashsbSharesObj = new mashengine( $url );
|
24 |
+
return $mashsbSharesObj;
|
25 |
+
}
|
26 |
+
require_once(MASHSB_PLUGIN_DIR . 'includes/sharedcount.class.php');
|
27 |
+
$apikey = isset( $mashsb_options['mashsharer_apikey'] ) ? $mashsb_options['mashsharer_apikey'] : '';
|
28 |
+
$mashsbSharesObj = new mashsbSharedcount( $url, 10, $apikey );
|
29 |
+
return $mashsbSharesObj;
|
30 |
+
}
|
31 |
+
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Sharecount functions
|
35 |
+
* Get the share count from the service sharedcount.com
|
36 |
+
*
|
37 |
+
* @package MASHSB
|
38 |
+
* @subpackage Functions/sharedcount
|
39 |
+
* @copyright Copyright (c) 2014, René Hermenau
|
40 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
41 |
+
* @since 2.0.9
|
42 |
+
*/
|
43 |
+
|
44 |
+
class schema_Sharedcount {
|
45 |
+
private $url,$timeout;
|
46 |
+
|
47 |
+
function __construct($url,$timeout=10, $apikey = '') {
|
48 |
+
global $mashsb_options;
|
49 |
+
$this->url = rawurlencode($url);
|
50 |
+
$this->timeout= $timeout;
|
51 |
+
$this->apikey = trim($apikey);
|
52 |
+
}
|
53 |
+
|
54 |
+
function getFBTWCounts(){
|
55 |
+
global $mashsb_options;
|
56 |
+
|
57 |
+
isset($mashsb_options['facebook_count_mode']) ? $fb_mode = $mashsb_options['facebook_count_mode'] : $fb_mode = '';
|
58 |
+
|
59 |
+
$sharecounts = $this->get_sharedcount();
|
60 |
+
|
61 |
+
if(!$sharecounts){
|
62 |
+
$this->sharecount = new stdClass;
|
63 |
+
$this->sharecount->total = 0;
|
64 |
+
return $this->sharecount;
|
65 |
+
}
|
66 |
+
$counts = array('shares'=>array(),'total'=>0);
|
67 |
+
switch ($fb_mode){
|
68 |
+
case $fb_mode === 'likes':
|
69 |
+
$counts['shares']['fb'] = $sharecounts['Facebook']['like_count'];
|
70 |
+
break;
|
71 |
+
case $fb_mode === 'total':
|
72 |
+
$counts['shares']['fb'] = $sharecounts['Facebook']['total_count'];
|
73 |
+
break;
|
74 |
+
default:
|
75 |
+
$counts['shares']['fb'] = $sharecounts['Facebook']['share_count'];
|
76 |
+
}
|
77 |
+
$counts['shares']['tw'] = $sharecounts['Twitter'];
|
78 |
+
|
79 |
+
foreach ($counts['shares'] as $mashsbcounts => $sharecount) $counts['total'] += (int)$sharecount;
|
80 |
+
mashdebug()->error("sharedcount.com getFBTWCounts: " . $counts['total']);
|
81 |
+
|
82 |
+
$totalArr = array ('total' => $counts['total']);
|
83 |
+
$objMerged = (object)array_merge((array)$sharecounts, (array)$totalArr);
|
84 |
+
return $objMerged;
|
85 |
+
|
86 |
+
}
|
87 |
+
/* Only used when mashshare-networks is enabled */
|
88 |
+
function getAllCounts(){
|
89 |
+
global $mashsb_options;
|
90 |
+
|
91 |
+
isset($mashsb_options['facebook_count_mode']) ? $fb_mode = $mashsb_options['facebook_count_mode'] : $fb_mode = '';
|
92 |
+
|
93 |
+
$sharecounts = $this->get_sharedcount();
|
94 |
+
if(!$sharecounts){
|
95 |
+
$this->sharecount = new stdClass;
|
96 |
+
$this->sharecount->total = 0;
|
97 |
+
return $this->sharecount;
|
98 |
+
}
|
99 |
+
|
100 |
+
$counts = array('shares'=>array(),'total'=>0);
|
101 |
+
$counts = array('shares'=>array(),'total'=>0);
|
102 |
+
switch ($fb_mode){
|
103 |
+
case $fb_mode === 'likes':
|
104 |
+
$counts['shares']['fb'] = $sharecounts['Facebook']['like_count'];
|
105 |
+
break;
|
106 |
+
case $fb_mode === 'total':
|
107 |
+
$counts['shares']['fb'] = $sharecounts['Facebook']['total_count'];
|
108 |
+
break;
|
109 |
+
default:
|
110 |
+
$counts['shares']['fb'] = $sharecounts['Facebook']['share_count'];
|
111 |
+
}
|
112 |
+
isset($sharecounts['Twitter']) ? $counts['shares']['tw'] = $sharecounts['Twitter'] : $sharecounts['Twitter'] = 0;
|
113 |
+
isset($sharecounts['GooglePlusOne']) ? $counts['shares']['gp'] = $sharecounts['GooglePlusOne'] : $counts['shares']['gp'] = 0 ;
|
114 |
+
isset($sharecounts['LinkedIn']) ? $counts['shares']['li'] = $sharecounts['LinkedIn'] : $counts['shares']['li'] = 0;
|
115 |
+
isset($sharecounts['StumbleUpon']) ? $counts['shares']['st'] = $sharecounts['StumbleUpon'] : $counts['shares']['st'] = 0 ;
|
116 |
+
isset($sharecounts['Pinterest']) ? $counts['shares']['pin'] = $sharecounts['Pinterest'] : $counts['shares']['pin'] = 0;
|
117 |
+
|
118 |
+
$total = 0;
|
119 |
+
foreach ($counts['shares'] as $totalcount) $total += (int)$totalcount;
|
120 |
+
$totalArr = array ('total' => $total);
|
121 |
+
$objMerged = (object)array_merge((array)$sharecounts, (array)$totalArr);
|
122 |
+
mashdebug()->info("sharedcount.com getAllCounts: " . $counts['total']);
|
123 |
+
return $objMerged;
|
124 |
+
}
|
125 |
+
|
126 |
+
function update_sharedcount_domain($domain = false){
|
127 |
+
global $mashsb_options;
|
128 |
+
if(!$domain){
|
129 |
+
try{
|
130 |
+
$domain_obj = $this->_curl('http://'. $mashsb_options["mashsharer_sharecount_domain"] . "/account?apikey=" . $this->apikey);
|
131 |
+
$domain = $domain_obj["domain"];
|
132 |
+
}
|
133 |
+
catch (Exception $e){
|
134 |
+
mashdebug()->error("error: " . $domain_obj);
|
135 |
+
return 0;
|
136 |
+
}
|
137 |
+
}
|
138 |
+
$mashsb_options["mashsharer_sharecount_domain"] = $domain;
|
139 |
+
update_option( 'mashsb_settings', $mashsb_options);
|
140 |
+
return 1;
|
141 |
+
}
|
142 |
+
|
143 |
+
private function _curl($url){
|
144 |
+
$curl = curl_init();
|
145 |
+
curl_setopt($curl, CURLOPT_URL, $url);
|
146 |
+
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
147 |
+
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT ,5);
|
148 |
+
curl_setopt($curl, CURLOPT_TIMEOUT, 5); //timeout in seconds
|
149 |
+
$curl_results = curl_exec ($curl);
|
150 |
+
curl_close ($curl);
|
151 |
+
return json_decode($curl_results, true);
|
152 |
+
}
|
153 |
+
|
154 |
+
function get_sharedcount() {
|
155 |
+
mashdebug()->info("Share URL: " . $this->url);
|
156 |
+
global $mashsb_options;
|
157 |
+
if( empty($this->apikey) ){
|
158 |
+
return 0; //quit early if there's no API key.
|
159 |
+
}
|
160 |
+
//$apikey = trim($mashsb_options['mashsharer_apikey']);
|
161 |
+
$domain = isset($mashsb_options['mashsharer_sharecount_domain']) ? trim($mashsb_options['mashsharer_sharecount_domain']) : '';
|
162 |
+
if(!isset($domain) || empty($domain)){
|
163 |
+
$domain = "free.sharedcount.com";
|
164 |
+
$this->update_sharedcount_domain($domain);
|
165 |
+
}
|
166 |
+
|
167 |
+
try {
|
168 |
+
$counts = $this->_curl('http://'.$domain . "/?url=" . $this->url . "&apikey=" . $this->apikey);
|
169 |
+
//mashdebug()->error('check ' . $domain . $this->apikey . $this->url);
|
170 |
+
if(isset($counts["Error"]) && isset($counts['Domain']) && $counts["Type"] === "domain_apikey_mismatch"){
|
171 |
+
$this->update_sharedcount_domain($counts['Domain']);
|
172 |
+
return 0;
|
173 |
+
}
|
174 |
+
else if(isset($counts["Error"]) && isset($counts['Type']) && $counts['Type'] === 'invalid_api_key' ){
|
175 |
+
$this->update_sharedcount_domain();
|
176 |
+
return 0;
|
177 |
+
}
|
178 |
+
|
179 |
+
mashdebug()->error("Facebook total count: " . $counts['Facebook']['total_count']);
|
180 |
+
MASHSB()->logger->info("URL: " . urldecode($this->url) . " API Key:" . $this->apikey . " sharedcount.com FB total_count: " . $counts['Facebook']['total_count'] . " FB share_count:" . $counts['Facebook']['share_count'] . " TW: " . $counts['Twitter'] . " G+:" . $counts['GooglePlusOne'] . " Linkedin:" . $counts['LinkedIn'] . " Stumble: " . $counts['StumbleUpon'] . " Pinterest: " . $counts['Pinterest']);
|
181 |
+
|
182 |
+
return $counts;
|
183 |
+
} catch (Exception $e){
|
184 |
+
mashdebug()->error("error: " . $counts);
|
185 |
+
MASHSB()->logger->info('ERROR: Curl()' . $counts);
|
186 |
+
return 0;
|
187 |
+
}
|
188 |
+
mashdebug()->error("error2: " . $counts);
|
189 |
+
MASHSB()->logger->info('ERROR 2: Curl()' . $counts);
|
190 |
+
return 0;
|
191 |
+
}
|
192 |
+
|
193 |
+
}
|
includes/extensions/video-object.php
ADDED
@@ -0,0 +1,409 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* VideoObject extention
|
5 |
+
*
|
6 |
+
* Adds schema VideoObject to oEmbed
|
7 |
+
*
|
8 |
+
* @since 1.5
|
9 |
+
*/
|
10 |
+
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
12 |
+
|
13 |
+
|
14 |
+
add_action( 'admin_init', 'schema_wp_video_object_admin_init' );
|
15 |
+
/**
|
16 |
+
* Schema VideoObject init
|
17 |
+
*
|
18 |
+
* @since 1.5
|
19 |
+
*/
|
20 |
+
function schema_wp_video_object_admin_init() {
|
21 |
+
|
22 |
+
if ( ! is_admin() ) return;
|
23 |
+
|
24 |
+
if ( ! class_exists( 'Schema_WP' ) )
|
25 |
+
return;
|
26 |
+
|
27 |
+
$video_objec_enable = schema_wp_get_option( 'video_object_enable' );
|
28 |
+
|
29 |
+
if ( $video_objec_enable != true )
|
30 |
+
return;
|
31 |
+
|
32 |
+
$prefix = '_schema_video_object_';
|
33 |
+
|
34 |
+
$fields = array(
|
35 |
+
|
36 |
+
array ( // Radio group
|
37 |
+
'label' => __('Video Markups', 'schema-wp'), // <label>
|
38 |
+
'tip' => __('Select video markup type.', 'schema-wp'),
|
39 |
+
'desc' => __('Note: You can enable markups to multiple videos on the same page. However, this may slow down your site, make sure your site is hosted on a reliable web host and cache your site pages by a good caching plugin. (Recommended setting: Single Video)', 'schema-wp'), // description
|
40 |
+
'id' => $prefix.'type', // field id and name
|
41 |
+
'type' => 'radio', // type of field
|
42 |
+
'options' => array ( // array of options
|
43 |
+
'none' => array ( // array key needs to be the same as the option value
|
44 |
+
'label' => __('None', 'schema-wp'), // text displayed as the option
|
45 |
+
'value' => 'none' // value stored for the option
|
46 |
+
),
|
47 |
+
'one' => array (
|
48 |
+
'label' => __('Single video', 'schema-wp'),
|
49 |
+
'value' => 'single'
|
50 |
+
),
|
51 |
+
'two' => array (
|
52 |
+
'label' => __('Multiple videos', 'schema-wp'),
|
53 |
+
'value' => 'multiple'
|
54 |
+
)
|
55 |
+
)
|
56 |
+
)
|
57 |
+
);
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Instantiate the class with all variables to create a meta box
|
61 |
+
* var $id string meta box id
|
62 |
+
* var $title string title
|
63 |
+
* var $fields array fields
|
64 |
+
* var $page string|array post type to add meta box to
|
65 |
+
* var $context string context where to add meta box at (normal, side)
|
66 |
+
* var $priority string meta box priority (high, core, default, low)
|
67 |
+
* var $js bool including javascript or not
|
68 |
+
*/
|
69 |
+
$schema_wp_video_object = new Schema_Custom_Add_Meta_Box( 'schema_video_object', 'VideoObject', $fields, 'schema', 'normal', 'high', true );
|
70 |
+
}
|
71 |
+
|
72 |
+
|
73 |
+
add_action( 'current_screen', 'schema_wp_video_object_post_meta' );
|
74 |
+
/**
|
75 |
+
* Create VideoObject post meta box for active post types edit screens
|
76 |
+
*
|
77 |
+
* @since 1.5
|
78 |
+
*/
|
79 |
+
function schema_wp_video_object_post_meta() {
|
80 |
+
|
81 |
+
if ( ! is_admin() ) return;
|
82 |
+
|
83 |
+
if ( ! class_exists( 'Schema_WP' ) ) return;
|
84 |
+
|
85 |
+
global $post;
|
86 |
+
|
87 |
+
$prefix = '_schema_video_object_';
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Create meta box on active post types edit screens
|
91 |
+
*/
|
92 |
+
$fields = array(
|
93 |
+
|
94 |
+
array(
|
95 |
+
'label' => '',
|
96 |
+
'desc' => __('You have enabled VideoObject, if you see an error in the <a target="_blank" href="https://search.google.com/structured-data/testing-tool">testing tool</a>, use the fields below to fill the missing fields, correct markup errors, and add additional details about the video embedded in your content editor.', 'schema-wp'),
|
97 |
+
'id' => $prefix.'headline',
|
98 |
+
'type' => 'desc'
|
99 |
+
),
|
100 |
+
array( // Text Input
|
101 |
+
'label' => __('Title', 'schema-wp'), // <label>
|
102 |
+
'tip' => __('Video title', 'schema-wp'), // tooltip
|
103 |
+
'desc' => __('', 'schema-wp'), // description
|
104 |
+
'id' => $prefix.'name', // field id and name
|
105 |
+
'type' => 'text' // type of field
|
106 |
+
),
|
107 |
+
array(
|
108 |
+
'label' => __('Upload Date', 'schema-wp'),
|
109 |
+
'tip' => __('Video upload date in ISO 8601 format YYYY-MM-DD example: 2016-06-23', 'schema-wp'),
|
110 |
+
'desc' => __('', 'schema-wp'),
|
111 |
+
'id' => $prefix.'upload_date',
|
112 |
+
'type' => 'text'
|
113 |
+
),
|
114 |
+
array(
|
115 |
+
'label' => __('Duration', 'schema-wp'),
|
116 |
+
'tip' => __('Video duration, example: if duration is 1 Hour 35 MIN, use: PT1H35M', 'schema-wp'),
|
117 |
+
'desc' => __('', 'schema-wp'),
|
118 |
+
'id' => $prefix.'duration',
|
119 |
+
'type' => 'text'
|
120 |
+
),
|
121 |
+
array( // Textarea
|
122 |
+
'label' => __('Description', 'schema-wp'),
|
123 |
+
'tip' => __('Video short description.', 'schema-wp'),
|
124 |
+
'desc' => __('', 'schema-wp'),
|
125 |
+
'id' => $prefix.'description',
|
126 |
+
'type' => 'textarea'
|
127 |
+
),
|
128 |
+
);
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Get enabled post types to create a meta box on
|
132 |
+
*/
|
133 |
+
$schemas_enabled = array();
|
134 |
+
|
135 |
+
// Get schame enabled array
|
136 |
+
$schemas_enabled = schema_wp_cpt_get_enabled();
|
137 |
+
|
138 |
+
if ( empty($schemas_enabled) ) return;
|
139 |
+
|
140 |
+
// Get post type from current screen
|
141 |
+
$current_screen = get_current_screen();
|
142 |
+
$post_type = $current_screen->post_type;
|
143 |
+
|
144 |
+
foreach( $schemas_enabled as $schema_enabled ) :
|
145 |
+
|
146 |
+
$type = (isset($schema_enabled['video_object_type']) && $schema_enabled['video_object_type'] != '') ? $schema_enabled['video_object_type'] : '';
|
147 |
+
|
148 |
+
// Add meta box only for type signle, preset an entry with one embed video
|
149 |
+
if ( $type == 'single' ) {
|
150 |
+
|
151 |
+
// Get Schema enabled post types array
|
152 |
+
$schema_cpt = $schema_enabled['post_type'];
|
153 |
+
|
154 |
+
if ( ! empty($schema_cpt) && in_array( $post_type, $schema_cpt, true ) ) {
|
155 |
+
|
156 |
+
$schema_wp_video_object_active = new Schema_Custom_Add_Meta_Box( 'schema_video_object', 'VideoObject', $fields, $schema_cpt, 'normal', 'high', true );
|
157 |
+
}
|
158 |
+
}
|
159 |
+
|
160 |
+
// debug
|
161 |
+
//print_r($schema_enabled);
|
162 |
+
|
163 |
+
endforeach;
|
164 |
+
}
|
165 |
+
|
166 |
+
|
167 |
+
|
168 |
+
add_filter('schema_wp_cpt_enabled', 'schema_wp_schema_video_object_extend_cpt_enabled');
|
169 |
+
/**
|
170 |
+
* Extend the CPT Enabled array
|
171 |
+
*
|
172 |
+
* @since 1.5
|
173 |
+
*/
|
174 |
+
function schema_wp_schema_video_object_extend_cpt_enabled( $cpt_enabled ) {
|
175 |
+
|
176 |
+
if ( empty($cpt_enabled) ) return;
|
177 |
+
|
178 |
+
$video_object_enable = schema_wp_get_option( 'video_object_enable' );
|
179 |
+
|
180 |
+
if ( $video_object_enable != true )
|
181 |
+
return $cpt_enabled;
|
182 |
+
|
183 |
+
$args = array(
|
184 |
+
'post_type' => 'schema',
|
185 |
+
'post_status' => 'publish',
|
186 |
+
'posts_per_page' => -1
|
187 |
+
);
|
188 |
+
|
189 |
+
$schemas_query = new WP_Query( $args );
|
190 |
+
|
191 |
+
$schemas = $schemas_query->get_posts();
|
192 |
+
|
193 |
+
// If there is no schema types set, return and empty array
|
194 |
+
if ( empty($schemas) ) return array();
|
195 |
+
|
196 |
+
$i = 0;
|
197 |
+
|
198 |
+
foreach ( $schemas as $schema ) :
|
199 |
+
|
200 |
+
// Get post meta
|
201 |
+
$type = get_post_meta( $schema->ID, '_schema_video_object_type', true );
|
202 |
+
|
203 |
+
if ( ! isset($type) ) $type = 'none'; // default
|
204 |
+
|
205 |
+
if ( $type != 'none' ) {
|
206 |
+
// Append video object type
|
207 |
+
$cpt_enabled[$i]['video_object_type'] = $type;
|
208 |
+
}
|
209 |
+
|
210 |
+
// Or maybe use...
|
211 |
+
/*$cpt_enabled[$i]['misc'] = array (
|
212 |
+
'review_type' => $schema_review_type
|
213 |
+
);*/
|
214 |
+
|
215 |
+
$i++;
|
216 |
+
|
217 |
+
endforeach;
|
218 |
+
|
219 |
+
// debug
|
220 |
+
//echo '<pre>'; print_r($cpt_enabled); echo '</pre>';
|
221 |
+
|
222 |
+
return $cpt_enabled;
|
223 |
+
}
|
224 |
+
|
225 |
+
|
226 |
+
|
227 |
+
add_filter( 'schema_output', 'schema_wp_video_object_output' );
|
228 |
+
/**
|
229 |
+
* Video qoject output, filter the schema_output
|
230 |
+
*
|
231 |
+
* @param array $schema
|
232 |
+
* @since 1.5
|
233 |
+
* @return array $schema
|
234 |
+
*/
|
235 |
+
function schema_wp_video_object_output( $schema ) {
|
236 |
+
|
237 |
+
// Debug - start of script
|
238 |
+
//$time_start = microtime(true);
|
239 |
+
|
240 |
+
if ( empty($schema) ) return;
|
241 |
+
|
242 |
+
$video_object_enable = schema_wp_get_option( 'video_object_enable' );
|
243 |
+
|
244 |
+
if ( $video_object_enable != true )
|
245 |
+
return $schema;
|
246 |
+
|
247 |
+
global $wp_query, $post, $wp_embed;
|
248 |
+
|
249 |
+
// Maybe this is not needed!
|
250 |
+
if ( ! $wp_query->is_main_query() ) return $schema;
|
251 |
+
|
252 |
+
// This didn't work, that's why it's commented
|
253 |
+
//if ( $wp_embed->last_url == '' || ! isset($wp_embed->last_url) ) return $schema;
|
254 |
+
|
255 |
+
// Get post meta
|
256 |
+
$schema_ref = get_post_meta( $post->ID, '_schema_ref', true );
|
257 |
+
|
258 |
+
// Check for ref, if is not presented, then get out!
|
259 |
+
if ( ! isset($schema_ref) || $schema_ref == '' ) return $schema;
|
260 |
+
|
261 |
+
// Get video object type value from enabled Schema post type
|
262 |
+
$type = get_post_meta( $schema_ref, '_schema_video_object_type', true );
|
263 |
+
|
264 |
+
//if ( ! isset($enabled) ) $enabled = false; // default
|
265 |
+
//if ( ! isset($video_object_type_enabled) || $video_object_type_enabled == '' ) $video_object_type_enabled = false; // default
|
266 |
+
if ( ! isset($type) ) $type = 'none'; // default
|
267 |
+
|
268 |
+
if ( $type != 'none' ) {
|
269 |
+
|
270 |
+
require_once( ABSPATH . WPINC . '/class-oembed.php' );
|
271 |
+
|
272 |
+
// Get content
|
273 |
+
$post_object = get_post( $post->ID );
|
274 |
+
$content = $post_object->post_content;
|
275 |
+
|
276 |
+
// Replace line breaks from all HTML elements with placeholders.
|
277 |
+
//$content = wp_replace_in_html_tags( $content, array( "\n" => '<!-- wp-line-break -->' ) );
|
278 |
+
|
279 |
+
// Get regex
|
280 |
+
//$regex = '#\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))#iS';
|
281 |
+
$regex = '|^\s*(https?://[^\s"]+)\s*$|im';
|
282 |
+
|
283 |
+
|
284 |
+
if ( $type == 'single') {
|
285 |
+
|
286 |
+
// Get one video
|
287 |
+
$reg = preg_match( $regex, $content, $matches );
|
288 |
+
//$matches = schema_wp_get_string_urls($content);
|
289 |
+
|
290 |
+
if ( ! $reg ) return $schema;
|
291 |
+
|
292 |
+
$autoembed = new WP_oEmbed();
|
293 |
+
$url = trim($matches[0]); // also, use trim to remove white spaces if any
|
294 |
+
$provider = $autoembed->discover( $url );
|
295 |
+
if (filter_var($provider, FILTER_VALIDATE_URL) != FALSE) {
|
296 |
+
$data = $autoembed->fetch( $provider, $url );
|
297 |
+
if (!empty($data) ) {
|
298 |
+
$schema['video'] = schema_wp_get_video_object_array( $data );
|
299 |
+
}
|
300 |
+
}
|
301 |
+
|
302 |
+
/*
|
303 |
+
// Or we can use...
|
304 |
+
foreach ( $matches as $key => $url ) {
|
305 |
+
$provider = $autoembed->discover( $url );
|
306 |
+
if (filter_var($provider, FILTER_VALIDATE_URL) != FALSE) {
|
307 |
+
$data = $autoembed->fetch( $provider, $url );
|
308 |
+
if (!empty($data) ) {
|
309 |
+
$schema['video'] = schema_wp_get_video_object_array( $data );
|
310 |
+
}
|
311 |
+
}
|
312 |
+
}*/
|
313 |
+
|
314 |
+
} else {
|
315 |
+
|
316 |
+
// Get them all
|
317 |
+
//$reg = preg_match_all( $regex, $content, $matches );
|
318 |
+
// Or we can use this
|
319 |
+
$matches = wp_extract_urls( $content );
|
320 |
+
|
321 |
+
if ( empty($matches) ) return $schema;
|
322 |
+
|
323 |
+
//$matches = schema_wp_get_string_urls($content);
|
324 |
+
$autoembed = new WP_oEmbed();
|
325 |
+
$schema['video'] = array();
|
326 |
+
foreach ( $matches as $key => $url ) {
|
327 |
+
$url = trim($url); // remove white spaces if any
|
328 |
+
$provider = $autoembed->discover( $url );
|
329 |
+
if (filter_var($provider, FILTER_VALIDATE_URL) != FALSE) {
|
330 |
+
$data = $autoembed->fetch( $provider, $url );
|
331 |
+
if (!empty($data) ) {
|
332 |
+
$schema['video'][] = schema_wp_get_video_object_array( $data );
|
333 |
+
}
|
334 |
+
}
|
335 |
+
}
|
336 |
+
}
|
337 |
+
|
338 |
+
}
|
339 |
+
|
340 |
+
// Debug
|
341 |
+
/*if (current_user_can( 'manage_options' )) {
|
342 |
+
echo'<pre>'; print_r( $schema ); echo'</pre>';
|
343 |
+
exit;
|
344 |
+
echo 'Execution time in seconds: ' . (microtime(true) - $time_start) . '<br>';
|
345 |
+
}
|
346 |
+
*/
|
347 |
+
|
348 |
+
// finally!
|
349 |
+
return $schema;
|
350 |
+
}
|
351 |
+
|
352 |
+
|
353 |
+
|
354 |
+
/**
|
355 |
+
* Get video qoject array
|
356 |
+
*
|
357 |
+
* @param array $data
|
358 |
+
* @since 1.5
|
359 |
+
* @return array
|
360 |
+
*/
|
361 |
+
function schema_wp_get_video_object_array( $data ) {
|
362 |
+
|
363 |
+
global $post;
|
364 |
+
|
365 |
+
// Check for WPRichSnippets
|
366 |
+
//if (function_exists('wprs_is_enabled')) {
|
367 |
+
// if ( wprs_is_enabled($post->ID) ) return;
|
368 |
+
//}
|
369 |
+
|
370 |
+
//print_r($data); exit;
|
371 |
+
|
372 |
+
$video_id = '';
|
373 |
+
$name = '';
|
374 |
+
$description = '';
|
375 |
+
$thumbnail_url = '';
|
376 |
+
$upload_date = '';
|
377 |
+
$duration = '';
|
378 |
+
|
379 |
+
$host = isset($data->provider_name) ? $data->provider_name : '';
|
380 |
+
|
381 |
+
$supported_hosts = array ( 'TED', 'Vimeo', 'Dailymotion', 'VideoPress', 'Vine', 'YouTube' );
|
382 |
+
|
383 |
+
if ( ! in_array( $host, $supported_hosts) ) return;
|
384 |
+
|
385 |
+
// Get values from post meta
|
386 |
+
$meta_name = get_post_meta( $post->ID, '_schema_video_object_name', true );
|
387 |
+
$meta_description = get_post_meta( $post->ID, '_schema_video_object_description', true );
|
388 |
+
$meta_upload_date = get_post_meta( $post->ID, '_schema_video_object_upload_date', true );
|
389 |
+
$meta_duration = get_post_meta( $post->ID, '_schema_video_object_duration', true );
|
390 |
+
|
391 |
+
// Override values if found via parsing the data
|
392 |
+
$video_id = isset($data->video_id) ? $data->video_id : '';
|
393 |
+
$name = isset($data->title) ? $data->title : $meta_name;
|
394 |
+
$description = isset($data->description) ? $data->description : $meta_description;
|
395 |
+
$thumbnail_url = isset($data->thumbnail_url) ? $data->thumbnail_url : '';
|
396 |
+
$upload_date = isset($data->upload_date) ? $data->upload_date : $meta_upload_date;
|
397 |
+
$duration = isset($data->duration) ? schema_wp_get_time_second_to_iso8601_duration( $data->duration ) : $meta_duration;
|
398 |
+
|
399 |
+
$schema = array(
|
400 |
+
'@type' => 'VideoObject',
|
401 |
+
"name" => $name,
|
402 |
+
"description" => $description,
|
403 |
+
"thumbnailUrl" => $thumbnail_url,
|
404 |
+
'uploadDate' => $upload_date,
|
405 |
+
"duration" => $duration
|
406 |
+
);
|
407 |
+
|
408 |
+
return $schema;
|
409 |
+
}
|
includes/install.php
ADDED
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema Install
|
4 |
+
*
|
5 |
+
* @since 1.0
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Exit if accessed directly
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
function schema_wp_install() {
|
12 |
+
|
13 |
+
// Create caps
|
14 |
+
$roles = new Schema_WP_Capabilities;
|
15 |
+
$roles->add_roles();
|
16 |
+
$roles->add_caps();
|
17 |
+
|
18 |
+
$older_plugin_version = get_option( 'schema_wp_version' );
|
19 |
+
|
20 |
+
// Add Upgraded From Option
|
21 |
+
if ( $older_plugin_version ) {
|
22 |
+
update_option( 'schema_wp_version_upgraded_from', $older_plugin_version );
|
23 |
+
}
|
24 |
+
|
25 |
+
if ( ! get_option( 'schema_wp_is_installed' ) || $older_plugin_version < 1.4 ) {
|
26 |
+
|
27 |
+
// Auto create Schema entries for Post and Page post types
|
28 |
+
// @since 1.4
|
29 |
+
|
30 |
+
// Check if Schema post type exists,
|
31 |
+
// if not then initiate the function so we can insert post
|
32 |
+
//if ( ! post_type_exists( 'schema' ) ) schema_wp_cpt_init();
|
33 |
+
|
34 |
+
// Check if Post already exists
|
35 |
+
// @since 1.5.9.6
|
36 |
+
//$check_old_post = get_page_by_title( 'Post' );
|
37 |
+
// @since 1.6
|
38 |
+
$check_old_post = schema_wp_get_post_by_title( 'Post', 'schema' );
|
39 |
+
|
40 |
+
/*
|
41 |
+
* Insert schema for posts
|
42 |
+
*/
|
43 |
+
$schema_post = ($check_old_post == null) ? wp_insert_post(
|
44 |
+
array(
|
45 |
+
'post_title' => __( 'Post', 'schema-wp' ),
|
46 |
+
'post_content' => '',
|
47 |
+
'post_status' => 'publish',
|
48 |
+
'post_author' => 1,
|
49 |
+
'post_type' => 'page'
|
50 |
+
)
|
51 |
+
) : false; // set to false if already exists
|
52 |
+
|
53 |
+
|
54 |
+
// update post meta
|
55 |
+
if ($schema_post) {
|
56 |
+
set_post_type( $schema_post, 'schema');
|
57 |
+
update_post_meta( $schema_post, '_schema_type', __('Article') );
|
58 |
+
update_post_meta( $schema_post, '_schema_article_type', __('BlogPosting') );
|
59 |
+
$schema_types = array();
|
60 |
+
$schema_types[0] = 'post';
|
61 |
+
update_post_meta( $schema_post, '_schema_post_types', $schema_types );
|
62 |
+
|
63 |
+
// Add reference to every post
|
64 |
+
// @since 1.4.4
|
65 |
+
$posts = get_posts( array( 'post_type' => 'post', 'numberposts' => -1 ) );
|
66 |
+
|
67 |
+
foreach( $posts as $p ) :
|
68 |
+
// - Update the post's metadata.
|
69 |
+
$check_ref = get_post_meta( $p->ID, '_schema_ref', true );
|
70 |
+
if ( ! isset($check_ref) || $check_ref =='' ) {
|
71 |
+
update_post_meta( $p->ID, '_schema_ref', $schema_post);
|
72 |
+
}
|
73 |
+
endforeach;
|
74 |
+
}
|
75 |
+
|
76 |
+
|
77 |
+
// Check if Page already exists
|
78 |
+
// @since 1.5.9.6
|
79 |
+
//$check_old_page = get_page_by_title( 'Page' );
|
80 |
+
// @since 1.6
|
81 |
+
$check_old_page = schema_wp_get_post_by_title( 'Page', 'schema' );
|
82 |
+
|
83 |
+
/*
|
84 |
+
* Insert schema for pages
|
85 |
+
*/
|
86 |
+
$schema_page = ($check_old_page == null) ? wp_insert_post(
|
87 |
+
array(
|
88 |
+
'post_title' => __( 'Page', 'schema-wp' ),
|
89 |
+
'post_content' => '',
|
90 |
+
'post_status' => 'publish',
|
91 |
+
'post_author' => 1,
|
92 |
+
'post_type' => 'page'
|
93 |
+
)
|
94 |
+
) : false; // set to false if already exists
|
95 |
+
|
96 |
+
// Update post meta
|
97 |
+
if ( $schema_page ) {
|
98 |
+
set_post_type( $schema_page, 'schema');
|
99 |
+
update_post_meta( $schema_page, '_schema_type', __('Article') );
|
100 |
+
$schema_types = array();
|
101 |
+
$schema_types[0] = 'page';
|
102 |
+
update_post_meta( $schema_page, '_schema_post_types', $schema_types );
|
103 |
+
|
104 |
+
// Add reference to every page
|
105 |
+
// @since 1.4.4
|
106 |
+
$pages = get_posts( array( 'post_type' => 'page', 'numberposts' => -1 ) );
|
107 |
+
|
108 |
+
foreach( $pages as $p ) :
|
109 |
+
// - Update the page's metadata.
|
110 |
+
$check_ref = get_post_meta( $p->ID, '_schema_ref', true );
|
111 |
+
if ( ! isset($check_ref) || $check_ref == '' ) {
|
112 |
+
update_post_meta( $p->ID, '_schema_ref', $schema_post);
|
113 |
+
}
|
114 |
+
endforeach;
|
115 |
+
}
|
116 |
+
|
117 |
+
// Update plugin settings
|
118 |
+
$options = schema_wp_get_settings();
|
119 |
+
$options['schema_wp_post'] = $schema_post;
|
120 |
+
$options['schema_wp_page'] = $schema_page;
|
121 |
+
update_option( 'schema_wp_settings', $options );
|
122 |
+
}
|
123 |
+
|
124 |
+
// Update pliugin version
|
125 |
+
update_option( 'schema_wp_is_installed', '1' );
|
126 |
+
update_option( 'schema_wp_version', SCHEMAWP_VERSION );
|
127 |
+
|
128 |
+
// Bail if activating from network, or bulk
|
129 |
+
if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
|
130 |
+
return;
|
131 |
+
}
|
132 |
+
|
133 |
+
// Add the transient to redirect
|
134 |
+
set_transient( '_schema_wp_activation_redirect', true, 30 );
|
135 |
+
|
136 |
+
}
|
137 |
+
register_activation_hook( SCHEMAWP_PLUGIN_FILE, 'schema_wp_install' );
|
138 |
+
|
139 |
+
|
140 |
+
function schema_wp_check_if_installed() {
|
141 |
+
|
142 |
+
// this is mainly for network activated installs
|
143 |
+
if( ! get_option( 'schema_wp_is_installed' ) ) {
|
144 |
+
schema_wp_install();
|
145 |
+
}
|
146 |
+
}
|
147 |
+
add_action( 'admin_init', 'schema_wp_check_if_installed' );
|
148 |
+
|
149 |
+
|
150 |
+
/**
|
151 |
+
* Install user roles on sub-sites of a network
|
152 |
+
*
|
153 |
+
* Roles do not get created when Schema is network activation so we need to create them during admin_init
|
154 |
+
*
|
155 |
+
* @since 1.5.9.3
|
156 |
+
* @return void
|
157 |
+
*/
|
158 |
+
function schema_wp_install_roles_on_network() {
|
159 |
+
|
160 |
+
global $wp_roles;
|
161 |
+
|
162 |
+
if( ! is_object( $wp_roles ) ) {
|
163 |
+
return;
|
164 |
+
}
|
165 |
+
|
166 |
+
if( ! in_array( 'manage_schema', $wp_roles->roles ) ) {
|
167 |
+
|
168 |
+
// Create EDD shop roles
|
169 |
+
$roles = new Schema_WP_Capabilities;
|
170 |
+
$roles->add_roles();
|
171 |
+
$roles->add_caps();
|
172 |
+
}
|
173 |
+
|
174 |
+
}
|
175 |
+
add_action( 'admin_init', 'schema_wp_install_roles_on_network' );
|
includes/integrations/amp.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* AMP plugin integration
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* plugin url: https://wordpress.org/plugins/amp/
|
7 |
+
* @since 1.3
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
add_filter( 'amp_post_template_metadata', 'schema_wp_amp_modify_json_output', 10, 2 );
|
14 |
+
/**
|
15 |
+
* Modify AMP json-ld output
|
16 |
+
*
|
17 |
+
* @since 1.6.9.5
|
18 |
+
*/
|
19 |
+
function schema_wp_amp_modify_json_output( $metadata, $post ) {
|
20 |
+
|
21 |
+
$json = schema_wp_get_jsonld( $post->ID );
|
22 |
+
|
23 |
+
if ( $json ) {
|
24 |
+
return $json;
|
25 |
+
}
|
26 |
+
|
27 |
+
// Return the un-filtered array
|
28 |
+
return $metadata;
|
29 |
+
}
|
includes/integrations/divi.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Divi Theme integration
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* plugin url: http://elegantthemes.com/
|
7 |
+
* @since 1.5.9
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
|
14 |
+
add_filter( 'schema_wp_filter_content', 'remove_divi_shortcodes' );
|
15 |
+
/**
|
16 |
+
* Remove Divi shortcodes from content
|
17 |
+
*
|
18 |
+
* @since 1.5.9
|
19 |
+
* @return string
|
20 |
+
*/
|
21 |
+
function remove_divi_shortcodes( $content ) {
|
22 |
+
|
23 |
+
$my_theme = wp_get_theme();
|
24 |
+
|
25 |
+
if ( $my_theme == 'Divi') {
|
26 |
+
|
27 |
+
$content = preg_replace('/\[\/?et_pb.*?\]/', '', $content);
|
28 |
+
}
|
29 |
+
|
30 |
+
return $content;
|
31 |
+
}
|
includes/integrations/edd.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Easy Digital Downloads (EDD)
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* Integrate with EDD plugin
|
7 |
+
*
|
8 |
+
* plugin url: https://wordpress.org/plugins/easy-digital-downloads/
|
9 |
+
* @since 1.6.9.8
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
//add_filter( 'schema_wp_breadcrumb_enabled', 'schema_wp_breadcrumb_edd_product_disable' );
|
16 |
+
/*
|
17 |
+
* Disable breadcrumbs on WooCommerce
|
18 |
+
*
|
19 |
+
* @since 1.6.9.5
|
20 |
+
*/
|
21 |
+
function schema_wp_breadcrumb_edd_product_disable( $breadcrumb_enabled ){
|
22 |
+
|
23 |
+
if ( function_exists( 'edd_add_schema_microdata' ) ) {
|
24 |
+
if ( edd_add_schema_microdata() ) return false;
|
25 |
+
}
|
26 |
+
return true;
|
27 |
+
}
|
28 |
+
|
29 |
+
add_action( 'schema_wp_action_post_type_archive', 'schema_wp_edd_add_schema_microdata_disable' );
|
30 |
+
/*
|
31 |
+
* Disable EDD Product markup output , it's hook to the post type archive function
|
32 |
+
*
|
33 |
+
* @since 1.6.9.8
|
34 |
+
*/
|
35 |
+
function schema_wp_edd_add_schema_microdata_disable(){
|
36 |
+
|
37 |
+
if ( function_exists( 'edd_add_schema_microdata' ) ) {
|
38 |
+
add_filter( 'edd_add_schema_microdata', '__return_false' );
|
39 |
+
}
|
40 |
+
}
|
includes/integrations/genesis.php
ADDED
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Genesis Theme
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* Remove Geiesis schema output
|
7 |
+
*
|
8 |
+
* plugin url: https://www.studiopress.com/
|
9 |
+
* @since 1.5.4
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
//add_filter( 'genesis_attr_head', 'schema_wp_genesis_attributes_removal_function', 20 );
|
16 |
+
|
17 |
+
//add_filter( 'genesis_attr_site-header', 'schema_wp_genesis_attributes_removal_function', 20 );
|
18 |
+
//add_filter( 'genesis_attr_site-title', 'schema_wp_genesis_attributes_removal_function', 20 );
|
19 |
+
//add_filter( 'genesis_attr_site-description', 'schema_wp_genesis_attributes_removal_function', 20 );
|
20 |
+
|
21 |
+
add_filter( 'genesis_attr_search-form', 'schema_wp_genesis_attributes_removal_function', 20 );
|
22 |
+
|
23 |
+
//add_filter( 'genesis_attr_nav-primary', 'schema_wp_genesis_attributes_removal_function', 20 );
|
24 |
+
//add_filter( 'genesis_attr_nav-secondary', 'schema_wp_genesis_attributes_removal_function', 20 );
|
25 |
+
|
26 |
+
add_filter( 'genesis_attr_body', 'schema_wp_genesis_attributes_removal_function', 20 );
|
27 |
+
|
28 |
+
add_filter( 'genesis_attr_content', 'schema_wp_genesis_attributes_removal_function', 20 );
|
29 |
+
|
30 |
+
add_filter( 'genesis_attr_entry', 'schema_wp_genesis_attributes_removal_function', 20 );
|
31 |
+
add_filter( 'genesis_attr_entry-author', 'schema_wp_genesis_attributes_removal_function', 20 );
|
32 |
+
add_filter( 'genesis_attr_entry-author-name', 'schema_wp_genesis_attributes_removal_function', 20 );
|
33 |
+
add_filter( 'genesis_attr_entry-author-link', 'schema_wp_genesis_attributes_removal_function', 20 );
|
34 |
+
add_filter( 'genesis_attr_entry-image', 'schema_wp_genesis_attributes_removal_function', 20 );
|
35 |
+
add_filter( 'genesis_attr_entry-image-widget', 'schema_wp_genesis_attributes_removal_function', 20 );
|
36 |
+
add_filter( 'genesis_attr_entry-image-grid-loop', 'schema_wp_genesis_attributes_removal_function', 20 );
|
37 |
+
add_filter( 'genesis_attr_entry-time', 'schema_wp_genesis_attributes_removal_function', 20 );
|
38 |
+
add_filter( 'genesis_attr_entry-title', 'schema_wp_genesis_attributes_removal_function', 20 );
|
39 |
+
add_filter( 'genesis_attr_entry-content', 'schema_wp_genesis_attributes_removal_function', 20 );
|
40 |
+
add_filter( 'genesis_attr_entry-comments', 'schema_wp_genesis_attributes_removal_function', 20 );
|
41 |
+
|
42 |
+
add_filter( 'genesis_attr_author', 'schema_wp_genesis_attributes_removal_function', 20 );
|
43 |
+
add_filter( 'genesis_attr_author-box', 'schema_wp_genesis_attributes_removal_function', 20 );
|
44 |
+
|
45 |
+
add_filter( 'genesis_attr_comment', 'schema_wp_genesis_attributes_removal_function', 20 );
|
46 |
+
add_filter( 'genesis_attr_comment-content', 'schema_wp_genesis_attributes_removal_function', 20 );
|
47 |
+
add_filter( 'genesis_attr_comment-author', 'schema_wp_genesis_attributes_removal_function', 20 );
|
48 |
+
add_filter( 'genesis_attr_comment-time-link', 'schema_wp_genesis_attributes_removal_function', 20 );
|
49 |
+
|
50 |
+
//add_filter( 'genesis_attr_sidebar-primary', 'schema_wp_genesis_attributes_removal_function', 20 );
|
51 |
+
//add_filter( 'genesis_attr_sidebar-secondary', 'schema_wp_genesis_attributes_removal_function', 20 );
|
52 |
+
|
53 |
+
//add_filter( 'genesis_attr_site-footer', 'schema_wp_genesis_attributes_removal_function', 20 );
|
54 |
+
|
55 |
+
/*
|
56 |
+
* Remove Genesis schema markups
|
57 |
+
*
|
58 |
+
* @since 1.5.4
|
59 |
+
*/
|
60 |
+
function schema_wp_genesis_attributes_removal_function( $attributes ) {
|
61 |
+
|
62 |
+
$attributes['role'] = '';
|
63 |
+
$attributes['itemprop'] = '';
|
64 |
+
$attributes['itemscope'] = '';
|
65 |
+
$attributes['itemtype'] = '';
|
66 |
+
|
67 |
+
return $attributes;
|
68 |
+
}
|
69 |
+
|
70 |
+
add_action( 'init', 'schema_wp_wprs_remove_genesis_search_form' );
|
71 |
+
/*
|
72 |
+
* Remove Genesis search form filter
|
73 |
+
*
|
74 |
+
* @since 1.5.4
|
75 |
+
*/
|
76 |
+
function schema_wp_wprs_remove_genesis_search_form() {
|
77 |
+
|
78 |
+
remove_filter( 'get_search_form', 'genesis_search_form' );
|
79 |
+
}
|
80 |
+
|
81 |
+
/*
|
82 |
+
* Add Genesis search form without markup
|
83 |
+
*
|
84 |
+
* @since 1.5.4
|
85 |
+
*/
|
86 |
+
add_filter( 'get_search_form', 'wp_schema_genesis_search_form' );
|
87 |
+
/**
|
88 |
+
* Replace the default search form with a Genesis-specific form.
|
89 |
+
*
|
90 |
+
* The exact output depends on whether the child theme supports HTML5 or not.
|
91 |
+
*
|
92 |
+
* Applies the `genesis_search_text`, `genesis_search_button_text`, `genesis_search_form_label` and
|
93 |
+
* `genesis_search_form` filters.
|
94 |
+
*
|
95 |
+
* @since 0.2.0
|
96 |
+
*
|
97 |
+
* @uses genesis_html5() Check for HTML5 support.
|
98 |
+
*
|
99 |
+
* @return string HTML markup.
|
100 |
+
*/
|
101 |
+
function wp_schema_genesis_search_form( $form) {
|
102 |
+
|
103 |
+
// Added extra checks for older versions of Genesis to prevent errors
|
104 |
+
// @since 1.6.2
|
105 |
+
if ( ! function_exists('genesis_html5') ) return $form;
|
106 |
+
if ( ! function_exists('genesis_a11y') ) return $form;
|
107 |
+
if ( ! function_exists('genesis_attr') ) return $form;
|
108 |
+
|
109 |
+
|
110 |
+
$search_text = get_search_query() ? apply_filters( 'the_search_query', get_search_query() ) : apply_filters( 'genesis_search_text', __( 'Search this website', 'genesis' ) . ' …' );
|
111 |
+
|
112 |
+
$button_text = apply_filters( 'genesis_search_button_text', esc_attr__( 'Search', 'genesis' ) );
|
113 |
+
|
114 |
+
$onfocus = "if ('" . esc_js( $search_text ) . "' === this.value) {this.value = '';}";
|
115 |
+
$onblur = "if ('' === this.value) {this.value = '" . esc_js( $search_text ) . "';}";
|
116 |
+
|
117 |
+
//* Empty label, by default. Filterable.
|
118 |
+
$label = apply_filters( 'genesis_search_form_label', '' );
|
119 |
+
|
120 |
+
$value_or_placeholder = ( get_search_query() == '' ) ? 'placeholder' : 'value';
|
121 |
+
|
122 |
+
if ( genesis_html5() ) {
|
123 |
+
|
124 |
+
$form = sprintf( '<form %s>', genesis_attr( 'search-form' ) );
|
125 |
+
|
126 |
+
if ( genesis_a11y( 'search-form' ) ) {
|
127 |
+
|
128 |
+
if ( '' == $label ) {
|
129 |
+
$label = apply_filters( 'genesis_search_text', __( 'Search this website', 'genesis' ) );
|
130 |
+
}
|
131 |
+
|
132 |
+
$form_id = uniqid( 'searchform-' );
|
133 |
+
|
134 |
+
$form .= sprintf(
|
135 |
+
'<label class="search-form-label screen-reader-text" for="%s">%s</label><input type="search" name="s" id="%s" %s="%s" /><input type="submit" value="%s" /></form>',
|
136 |
+
//home_url( '/?s={s}' ),
|
137 |
+
esc_attr( $form_id ),
|
138 |
+
esc_html( $label ),
|
139 |
+
esc_attr( $form_id ),
|
140 |
+
$value_or_placeholder,
|
141 |
+
esc_attr( $search_text ),
|
142 |
+
esc_attr( $button_text )
|
143 |
+
);
|
144 |
+
|
145 |
+
} else {
|
146 |
+
|
147 |
+
$form .= sprintf(
|
148 |
+
'%s<input type="search" name="s" %s="%s" /><input type="submit" value="%s" /></form>',
|
149 |
+
esc_html( $label ),
|
150 |
+
//home_url( '/?s={s}' ),
|
151 |
+
$value_or_placeholder,
|
152 |
+
esc_attr( $search_text ),
|
153 |
+
esc_attr( $button_text )
|
154 |
+
);
|
155 |
+
}
|
156 |
+
|
157 |
+
} else {
|
158 |
+
|
159 |
+
$form = sprintf(
|
160 |
+
'<form method="get" class="searchform search-form" action="%s" role="search" >%s<input type="text" value="%s" name="s" class="s search-input" onfocus="%s" onblur="%s" /><input type="submit" class="searchsubmit search-submit" value="%s" /></form>',
|
161 |
+
home_url( '/' ),
|
162 |
+
esc_html( $label ),
|
163 |
+
esc_attr( $search_text ),
|
164 |
+
esc_attr( $onfocus ),
|
165 |
+
esc_attr( $onblur ),
|
166 |
+
esc_attr( $button_text )
|
167 |
+
);
|
168 |
+
|
169 |
+
}
|
170 |
+
|
171 |
+
return apply_filters( 'genesis_search_form', $form, $search_text, $button_text, $label );
|
172 |
+
}
|
173 |
+
|
174 |
+
add_action( 'init', 'schema_wp_remove_genesis_breadcrumbs_attr_markup' );
|
175 |
+
/*
|
176 |
+
* Remove Genesis Breadcrumbs attributes
|
177 |
+
*
|
178 |
+
* @since 1.6.9.4
|
179 |
+
*/
|
180 |
+
function schema_wp_remove_genesis_breadcrumbs_attr_markup() {
|
181 |
+
|
182 |
+
$breadcrumbs_enable = schema_wp_get_option( 'breadcrumbs_enable' );
|
183 |
+
|
184 |
+
if ( $breadcrumbs_enable ) {
|
185 |
+
|
186 |
+
add_filter( 'genesis_attr_breadcrumb', 'schema_wp_genesis_attributes_removal_function', 20 );
|
187 |
+
add_filter( 'genesis_attr_breadcrumb-link-wrap', 'schema_wp_genesis_attributes_removal_function', 20 );
|
188 |
+
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
add_action( 'genesis_breadcrumb_link', 'schema_wp_remove_genesis_breadcrumbs_link_markup' );
|
193 |
+
/*
|
194 |
+
* Remove Genesis Breadcrumbs itemprop markup
|
195 |
+
*
|
196 |
+
* @since 1.6.9.4
|
197 |
+
*/
|
198 |
+
function schema_wp_remove_genesis_breadcrumbs_link_markup( $output ) {
|
199 |
+
|
200 |
+
$breadcrumbs_enable = schema_wp_get_option( 'breadcrumbs_enable' );
|
201 |
+
|
202 |
+
if ( $breadcrumbs_enable ) {
|
203 |
+
|
204 |
+
$output = str_replace('itemprop="name"', '', $output);
|
205 |
+
$output = str_replace('itemprop="item"', '', $output);
|
206 |
+
|
207 |
+
}
|
208 |
+
|
209 |
+
return $output;
|
210 |
+
}
|
includes/integrations/seo-framework.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The SEO Framework
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* Integrate with SEO Framework plugin
|
7 |
+
*
|
8 |
+
* plugin url: https://wordpress.org/plugins/autodescription/
|
9 |
+
* @since 1.5.6
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
add_filter( 'schema_wp_filter_output_knowledge_graph', 'schema_wp_seo_framework_knowledge_graph_remove' );
|
16 |
+
/*
|
17 |
+
* Remove Knowledge Graph
|
18 |
+
*
|
19 |
+
* @since 1.5.6
|
20 |
+
*/
|
21 |
+
function schema_wp_seo_framework_knowledge_graph_remove( $knowledge_graph ) {
|
22 |
+
// Run only on front page and make sure Yoast SEO isn't active
|
23 |
+
if (is_front_page() && defined('THE_SEO_FRAMEWORK_VERSION') ) return;
|
24 |
+
return $knowledge_graph;
|
25 |
+
}
|
26 |
+
|
27 |
+
add_filter( 'schema_wp_output_sitelinks_search_box', 'schema_wp_seo_framework_sitelinks_search_box_remove' );
|
28 |
+
/*
|
29 |
+
* Remove SiteLinks Search Box
|
30 |
+
*
|
31 |
+
* @since 1.5.6
|
32 |
+
*/
|
33 |
+
function schema_wp_seo_framework_sitelinks_search_box_remove( $sitelinks_search_box ) {
|
34 |
+
// Run only on front page and make sure Yoast SEO isn't active
|
35 |
+
if (is_front_page() && defined('THE_SEO_FRAMEWORK_VERSION') ) return;
|
36 |
+
return $sitelinks_search_box;
|
37 |
+
}
|
includes/integrations/thesis.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Thesis Theme 2.x integration
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* plugin url: http://diythemes.com/
|
7 |
+
* @since 1.4
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Remove Thesis post meta from Schema post type
|
16 |
+
*
|
17 |
+
* @since 1.3
|
18 |
+
* @return schema json-ld final output
|
19 |
+
*/
|
20 |
+
if (is_admin()) :
|
21 |
+
function my_remove_meta_boxes() {
|
22 |
+
|
23 |
+
// Check if Thesis theme is active,
|
24 |
+
// Popup comments do not work with Thesis theme
|
25 |
+
$my_theme = wp_get_theme();
|
26 |
+
if ( $my_theme->get( 'Name' ) == 'Thesis') {
|
27 |
+
|
28 |
+
remove_meta_box('thesis_title_tag', 'schema', 'normal');
|
29 |
+
remove_meta_box('thesis_meta_description', 'schema', 'normal');
|
30 |
+
remove_meta_box('thesis_meta_keywords', 'schema', 'normal');
|
31 |
+
remove_meta_box('thesis_meta_robots', 'schema', 'normal');
|
32 |
+
remove_meta_box('thesis_canonical_link', 'schema', 'normal');
|
33 |
+
remove_meta_box('thesis_html_body', 'schema', 'normal');
|
34 |
+
remove_meta_box('thesis_post_content', 'schema', 'normal');
|
35 |
+
remove_meta_box('thesis_post_image', 'schema', 'normal');
|
36 |
+
remove_meta_box('thesis_post_thumbnail', 'schema', 'normal');
|
37 |
+
remove_meta_box('thesis_redirect', 'schema', 'normal');
|
38 |
+
}
|
39 |
+
}
|
40 |
+
add_action( 'do_meta_boxes', 'my_remove_meta_boxes', 99 );
|
41 |
+
endif;
|
includes/integrations/thirstyaffiliates.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* ThirstyAffiliates
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* Integrate with ThirstyAffiliates plugin
|
7 |
+
*
|
8 |
+
* plugin url: https://wprichsnippets.com/
|
9 |
+
* @since 1.6.9.1
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
|
16 |
+
add_action( 'schema_wp_post_types', 'schema_wp_thirstyaffiliates_remove_cpt' );
|
17 |
+
/*
|
18 |
+
* Unset ThirstyAffiliates post type "thirstylink", plugin shouldn't ever run here at this pont!
|
19 |
+
*
|
20 |
+
* @since 1.6.9.1
|
21 |
+
*/
|
22 |
+
function schema_wp_thirstyaffiliates_remove_cpt( $post_types ) {
|
23 |
+
|
24 |
+
if (!is_plugin_active('thirstyaffiliates/thirstyaffiliates.php'))
|
25 |
+
return $post_types;
|
26 |
+
|
27 |
+
unset($post_types['thirstylink']);
|
28 |
+
|
29 |
+
return $post_types;
|
30 |
+
}
|
includes/integrations/visual-composer.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Visual Composer plugin integration
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* plugin url: https://vc.wpbakery.com/
|
7 |
+
* @since 1.5.9.3
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
|
14 |
+
add_filter( 'schema_wp_filter_content', 'remove_visual_composer_shortcodes' );
|
15 |
+
/**
|
16 |
+
* Remove VC shortcodes from content
|
17 |
+
*
|
18 |
+
* @since 1.5.9.3
|
19 |
+
* @return string
|
20 |
+
*/
|
21 |
+
function remove_visual_composer_shortcodes( $content ) {
|
22 |
+
|
23 |
+
global $post;
|
24 |
+
|
25 |
+
$vc_enabled = get_post_meta($post->ID, '_wpb_vc_js_status', true);
|
26 |
+
|
27 |
+
if ( isset($vc_enabled) && $vc_enabled == 'true') {
|
28 |
+
|
29 |
+
$content = preg_replace('/\[\/?vc_.*?\]/', '', $content);
|
30 |
+
}
|
31 |
+
|
32 |
+
return $content;
|
33 |
+
}
|
includes/integrations/woocommerce.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* Integrate with WooCommerce plugin
|
7 |
+
*
|
8 |
+
* plugin url: https://wordpress.org/plugins/woocommerce/
|
9 |
+
* @since 1.6.9.5
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
add_filter( 'schema_wp_breadcrumb_enabled', 'schema_wp_breadcrumb_woo_product_disable' );
|
16 |
+
/*
|
17 |
+
* Disable breadcrumbs on WooCommerce
|
18 |
+
*
|
19 |
+
* @since 1.6.9.5
|
20 |
+
*/
|
21 |
+
function schema_wp_breadcrumb_woo_product_disable( $breadcrumb_enabled ){
|
22 |
+
|
23 |
+
if ( class_exists( 'woocommerce' ) ) {
|
24 |
+
if ( is_woocommerce() ) return false;
|
25 |
+
}
|
26 |
+
return true;
|
27 |
+
}
|
includes/integrations/wp-rich-snippets.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WPRichSnippets
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* Integrate with WPRichSnippets plugin
|
7 |
+
*
|
8 |
+
* plugin url: https://wprichsnippets.com/
|
9 |
+
* @since 1.5.4
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
|
16 |
+
add_action( 'schema_output', 'schema_wp_wprs_output_remove' );
|
17 |
+
/*
|
18 |
+
* Remove bar menu
|
19 |
+
*
|
20 |
+
* @since 1.5.6
|
21 |
+
*/
|
22 |
+
function schema_wp_wprs_output_remove( $schema ) {
|
23 |
+
global $post;
|
24 |
+
if (function_exists('wprs_is_enabled')) {
|
25 |
+
if ( wprs_is_enabled( $post->ID ) ) return array();
|
26 |
+
}
|
27 |
+
return $schema;
|
28 |
+
}
|
29 |
+
|
30 |
+
|
31 |
+
add_action( 'init', 'schema_wp_wprs_remove_admin_bar_menu' );
|
32 |
+
/*
|
33 |
+
* Remove bar menu
|
34 |
+
*
|
35 |
+
* @since 1.5.4
|
36 |
+
*/
|
37 |
+
function schema_wp_wprs_remove_admin_bar_menu() {
|
38 |
+
// Check if AMP function exists
|
39 |
+
if ( ! function_exists('wprs_admin_bar_menu_items') ) return;
|
40 |
+
remove_action( 'admin_bar_menu', 'wprs_admin_bar_menu_items', 99 );
|
41 |
+
}
|
includes/integrations/yoast-seo.php
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Yoast SEO
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* Integrate with Yoast SEO plugin
|
7 |
+
*
|
8 |
+
* plugin url: https://wordpress.org/plugins/wordpress-seo/
|
9 |
+
* @since 1.5.6
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
add_filter( 'wpseo_json_ld_output', 'schema_wp_remove_yoast_json', 10, 1 );
|
16 |
+
/*
|
17 |
+
* Remove Yoast SEO plugin JSON-LD output
|
18 |
+
*
|
19 |
+
* @since 1.6.4
|
20 |
+
*/
|
21 |
+
function schema_wp_remove_yoast_json( $data ){
|
22 |
+
|
23 |
+
$use_yoast_seo_json = schema_wp_get_option( 'use_yoast_seo_json' );
|
24 |
+
|
25 |
+
if ( empty($use_yoast_seo_json) ) {
|
26 |
+
$data = array();
|
27 |
+
}
|
28 |
+
|
29 |
+
return $data;
|
30 |
+
}
|
31 |
+
|
32 |
+
add_filter( 'wpseo_breadcrumb_output', 'my_wpseo_breadcrumb_output' );
|
33 |
+
/*
|
34 |
+
* Remove Yoast SEO plugin breadcrumb markup output
|
35 |
+
*
|
36 |
+
* @since 1.6.9.4
|
37 |
+
*/
|
38 |
+
function my_wpseo_breadcrumb_output( $output ) {
|
39 |
+
|
40 |
+
$breadcrumbs_enable = schema_wp_get_option( 'breadcrumbs_enable' );
|
41 |
+
|
42 |
+
if ( $breadcrumbs_enable ) {
|
43 |
+
|
44 |
+
// clean Yoast SEO from RDF markups
|
45 |
+
$output = str_replace('xmlns:v="http://rdf.data-vocabulary.org/#"', '', $output);
|
46 |
+
$output = str_replace('typeof="v:Breadcrumb"', '', $output);
|
47 |
+
$output = str_replace('rel="v:url"', '', $output);
|
48 |
+
$output = str_replace('property="v:title"', '', $output);
|
49 |
+
$output = str_replace('rel="v:child"', '', $output);
|
50 |
+
}
|
51 |
+
|
52 |
+
return $output;
|
53 |
+
}
|
54 |
+
|
55 |
+
add_action( 'admin_init', 'schema_wp_yoast_seo_register_settings', 1 );
|
56 |
+
/*
|
57 |
+
* Register Yoast SEO plugin settings
|
58 |
+
*
|
59 |
+
* @since 1.6.4
|
60 |
+
*/
|
61 |
+
function schema_wp_yoast_seo_register_settings() {
|
62 |
+
|
63 |
+
if ( ! defined('WPSEO_VERSION') ) return;
|
64 |
+
|
65 |
+
add_filter( 'schema_wp_settings_knowledge_graph', 'schema_wp_yoast_seo_settings_knowledge_graph');
|
66 |
+
}
|
67 |
+
|
68 |
+
/*
|
69 |
+
* Add Yoast SEO plugin settings
|
70 |
+
*
|
71 |
+
* @since 1.6.4
|
72 |
+
*/
|
73 |
+
function schema_wp_yoast_seo_settings_knowledge_graph( $settings_knowledge_graph ) {
|
74 |
+
|
75 |
+
$settings_knowledge_graph['organization']['use_yoast_seo_json'] = array(
|
76 |
+
'id' => 'use_yoast_seo_json',
|
77 |
+
'name' => __( 'Use Yoast SEO markup?', 'schema-wp' ),
|
78 |
+
'desc' => '<span class="dashicons dashicons-warning"></span> '. __( 'Yoast SEO plugin is active!', 'schema-wp'). '<p>'. __('By default, Schema plugin will override Yoast SEO output. Check this box if you would like to disable Schema markup and use Yoast SEO output instead. (This will be enabled on Search Results feature as well)', 'schema-wp') . '</p>',
|
79 |
+
'type' => 'checkbox'
|
80 |
+
);
|
81 |
+
|
82 |
+
return $settings_knowledge_graph;
|
83 |
+
}
|
84 |
+
|
85 |
+
add_filter( 'schema_wp_filter_output_knowledge_graph', 'schema_wp_yoast_knowledge_graph_remove' );
|
86 |
+
/*
|
87 |
+
* Remove Knowledge Graph
|
88 |
+
*
|
89 |
+
* @since 1.5.6
|
90 |
+
*/
|
91 |
+
function schema_wp_yoast_knowledge_graph_remove( $knowledge_graph ) {
|
92 |
+
|
93 |
+
include_once(ABSPATH.'wp-admin/includes/plugin.php');
|
94 |
+
|
95 |
+
// Plugin is active ?
|
96 |
+
if( is_plugin_active( 'wordpress-seo/wp-seo.php' ) || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' ) ) {
|
97 |
+
|
98 |
+
$use_yoast_seo_json = schema_wp_get_option( 'use_yoast_seo_json' );
|
99 |
+
|
100 |
+
if ( ! empty($use_yoast_seo_json) )
|
101 |
+
return; // do nothing!
|
102 |
+
}
|
103 |
+
|
104 |
+
return $knowledge_graph;
|
105 |
+
}
|
106 |
+
|
107 |
+
add_filter( 'schema_wp_output_sitelinks_search_box', 'schema_wp_yoast_sitelinks_search_box_remove' );
|
108 |
+
/*
|
109 |
+
* Remove SiteLinks & Search Box
|
110 |
+
*
|
111 |
+
* @since 1.5.6
|
112 |
+
*/
|
113 |
+
function schema_wp_yoast_sitelinks_search_box_remove( $sitelinks_search_box ) {
|
114 |
+
// Run only on front page and if Yoast SEO is active
|
115 |
+
if ( ! is_front_page() ) return;
|
116 |
+
|
117 |
+
$use_yoast_seo_json = schema_wp_get_option( 'use_yoast_seo_json' );
|
118 |
+
|
119 |
+
if ( ! empty($use_yoast_seo_json) && defined('WPSEO_VERSION') ) {
|
120 |
+
return; // do nothing!
|
121 |
+
}
|
122 |
+
|
123 |
+
return $sitelinks_search_box;
|
124 |
+
}
|
includes/json/author.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Author
|
4 |
+
*
|
5 |
+
* @since 1.4.5
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Exit if accessed directly
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
add_action('wp_head', 'schema_wp_output_author');
|
12 |
+
/**
|
13 |
+
* The main function responsible for output schema json-ld
|
14 |
+
*
|
15 |
+
* @since 1.4.5
|
16 |
+
* @return schema json-ld final output
|
17 |
+
*/
|
18 |
+
function schema_wp_output_author() {
|
19 |
+
|
20 |
+
// Run only on author pages
|
21 |
+
if (is_author() ) {
|
22 |
+
|
23 |
+
$json = schema_wp_get_author_json( 'Person' );
|
24 |
+
|
25 |
+
$output = '';
|
26 |
+
|
27 |
+
if ($json) {
|
28 |
+
$output .= "\n\n";
|
29 |
+
$output .= '<!-- This site is optimized with the Schema plugin v'.SCHEMAWP_VERSION.' - http://schema.press -->';
|
30 |
+
$output .= "\n";
|
31 |
+
$output .= '<script type="application/ld+json">' . json_encode($json, JSON_UNESCAPED_UNICODE) . '</script>';
|
32 |
+
$output .= "\n\n";
|
33 |
+
}
|
34 |
+
|
35 |
+
echo $output;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
|
40 |
+
/**
|
41 |
+
* The main function responsible for putting schema array all together
|
42 |
+
*
|
43 |
+
* @param string $type for schema type (example: Person)
|
44 |
+
* @since 1.4.5
|
45 |
+
* @return schema output
|
46 |
+
*/
|
47 |
+
function schema_wp_get_author_json( $type ) {
|
48 |
+
|
49 |
+
if ( ! isset($type) ) return;
|
50 |
+
|
51 |
+
// Get current author data
|
52 |
+
if(get_query_var('author_name')) :
|
53 |
+
$curauth = get_user_by('slug', get_query_var('author_name'));
|
54 |
+
else :
|
55 |
+
$curauth = get_userdata(get_query_var('author'));
|
56 |
+
endif;
|
57 |
+
|
58 |
+
// debug
|
59 |
+
//echo '<pre>'; print_r($curauth); echo '</pre>'; exit;
|
60 |
+
|
61 |
+
$schema = array();
|
62 |
+
|
63 |
+
$name = $curauth->display_name;
|
64 |
+
$email = $curauth->user_email;
|
65 |
+
$url = $curauth->user_url;
|
66 |
+
$desc = $curauth->description;
|
67 |
+
|
68 |
+
if ( empty($name) || empty($email) ) return;
|
69 |
+
|
70 |
+
$schema['@context'] = "http://schema.org";
|
71 |
+
$schema['@type'] = $type;
|
72 |
+
|
73 |
+
if ( !empty($name) ) $schema['name'] = $name;
|
74 |
+
//if ( !empty($email) ) $schema['email'] = $email;
|
75 |
+
if ( !empty($url) ) {
|
76 |
+
$schema['url'] = $url;
|
77 |
+
$schema['@id'] = $url;
|
78 |
+
}
|
79 |
+
if ( !empty($desc) ) $schema['description'] = $desc;
|
80 |
+
|
81 |
+
return apply_filters( 'schema_author_output', $schema );
|
82 |
+
}
|
includes/json/blog.php
ADDED
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Blog
|
4 |
+
*
|
5 |
+
* @since 1.5.4
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Exit if accessed directly
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
add_action('wp_head', 'schema_wp_output_blog');
|
12 |
+
/**
|
13 |
+
* The main function responsible for output schema json-ld
|
14 |
+
*
|
15 |
+
* @since 1.5.4
|
16 |
+
* @return schema json-ld final output
|
17 |
+
*/
|
18 |
+
function schema_wp_output_blog() {
|
19 |
+
|
20 |
+
// Run only on blog list page
|
21 |
+
if ( ! is_front_page() && is_home() || is_home() ) {
|
22 |
+
|
23 |
+
$json = schema_wp_get_blog_json( 'Blog' );
|
24 |
+
|
25 |
+
$output = '';
|
26 |
+
|
27 |
+
// debug
|
28 |
+
//echo'<pre>';print_r($json);echo'</pre>';
|
29 |
+
|
30 |
+
if ( $json ) {
|
31 |
+
$output .= "\n\n";
|
32 |
+
$output .= '<!-- This site is optimized with the Schema plugin v'.SCHEMAWP_VERSION.' - https://schema.press -->';
|
33 |
+
$output .= "\n";
|
34 |
+
$output .= '<script type="application/ld+json">' . json_encode($json, JSON_UNESCAPED_UNICODE) . '</script>';
|
35 |
+
$output .= "\n\n";
|
36 |
+
}
|
37 |
+
|
38 |
+
echo $output;
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
|
43 |
+
/**
|
44 |
+
* The main function responsible for putting shema array all together
|
45 |
+
*
|
46 |
+
* @param string $type for schema type (example: Person)
|
47 |
+
* @since 1.6.9.5
|
48 |
+
* @return schema output
|
49 |
+
*/
|
50 |
+
function schema_wp_get_blog_json( $type ) {
|
51 |
+
|
52 |
+
global $post, $wp_query, $query_string;
|
53 |
+
|
54 |
+
// debug
|
55 |
+
//echo'<pre>';print_r($wp_query);echo'</pre>';exit;
|
56 |
+
//var_dump( $GLOBALS['wp_query'] );
|
57 |
+
|
58 |
+
if ( empty($wp_query->query_vars) ) return;
|
59 |
+
|
60 |
+
$blogPost = array();
|
61 |
+
$schema = array();
|
62 |
+
|
63 |
+
$secondary_loop = new WP_Query( $wp_query->query_vars );
|
64 |
+
|
65 |
+
if ( $secondary_loop->have_posts() ):
|
66 |
+
|
67 |
+
// get markup data for each post in the query
|
68 |
+
if ( ! empty($secondary_loop->posts) ) {
|
69 |
+
foreach ($secondary_loop->posts as $schema_post) {
|
70 |
+
|
71 |
+
// pull json from post meta
|
72 |
+
$schema_json = get_post_meta( $schema_post->ID, '_schema_json', true );
|
73 |
+
|
74 |
+
if ( isset($schema_json) && is_array($schema_json) ) {
|
75 |
+
|
76 |
+
$blogPost[] = $schema_json;
|
77 |
+
|
78 |
+
} else {
|
79 |
+
|
80 |
+
// create it
|
81 |
+
$blogPost[] = apply_filters( 'schema_output_blog_post', array
|
82 |
+
(
|
83 |
+
'@type' => 'BlogPosting',
|
84 |
+
'headline' => wp_filter_nohtml_kses( get_the_title() ),
|
85 |
+
//'description' => strip_shortcodes( get_the_excerpt($post->ID) ),
|
86 |
+
'url' => get_the_permalink(),
|
87 |
+
'sameAs' => schema_wp_get_sameAs($schema_post->ID),
|
88 |
+
'datePublished' => get_the_date('c'),
|
89 |
+
'dateModified' => get_the_modified_date('c'),
|
90 |
+
'mainEntityOfPage' => get_the_permalink(),
|
91 |
+
'author' => schema_wp_get_author_array(),
|
92 |
+
'publisher' => schema_wp_get_publisher_array(),
|
93 |
+
'image' => schema_wp_get_media($schema_post->ID),
|
94 |
+
'keywords' => schema_wp_get_post_tags($schema_post->ID),
|
95 |
+
'commentCount' => get_comments_number(),
|
96 |
+
'comment' => schema_wp_get_comments(),
|
97 |
+
));
|
98 |
+
}
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
wp_reset_postdata();
|
103 |
+
|
104 |
+
// put all together
|
105 |
+
$schema = array
|
106 |
+
(
|
107 |
+
'@context' => 'http://schema.org/',
|
108 |
+
'@type' => "Blog",
|
109 |
+
'headline' => get_option( 'page_for_posts' ) ? wp_filter_nohtml_kses( get_the_title( get_option( 'page_for_posts' ) ) ) : get_bloginfo( 'name' ),
|
110 |
+
'description' => get_bloginfo( 'description' ),
|
111 |
+
'url' => get_option( 'page_for_posts' ) ? get_permalink( get_option( 'page_for_posts' ) ) : get_home_url(),
|
112 |
+
'blogPost' => $blogPost,
|
113 |
+
);
|
114 |
+
|
115 |
+
endif;
|
116 |
+
|
117 |
+
// debug
|
118 |
+
//echo'<pre>';print_r($schema);echo'</pre>';exit;
|
119 |
+
|
120 |
+
return apply_filters( 'schema_blog_output', $schema );
|
121 |
+
}
|
includes/json/category.php
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Category
|
4 |
+
*
|
5 |
+
* @since 1.5.7
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Exit if accessed directly
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
add_action('wp_head', 'schema_wp_output_category');
|
12 |
+
/**
|
13 |
+
* The main function responsible for output schema json-ld
|
14 |
+
*
|
15 |
+
* @since 1.5.7
|
16 |
+
* @return schema json-ld final output
|
17 |
+
*/
|
18 |
+
function schema_wp_output_category() {
|
19 |
+
|
20 |
+
// filter this and return false to disable the function
|
21 |
+
$enabled = apply_filters('schema_wp_output_category_enabled', true);
|
22 |
+
if ( ! $enabled)
|
23 |
+
return;
|
24 |
+
|
25 |
+
if ( is_admin() ) return;
|
26 |
+
|
27 |
+
// Run only on category pages
|
28 |
+
if ( is_category() ) {
|
29 |
+
|
30 |
+
$output = '';
|
31 |
+
|
32 |
+
$json = schema_wp_get_category_json();
|
33 |
+
|
34 |
+
if ($json) {
|
35 |
+
$output .= "\n\n";
|
36 |
+
$output .= '<!-- This site is optimized with the Schema plugin v'.SCHEMAWP_VERSION.' - https://schema.press -->';
|
37 |
+
$output .= "\n";
|
38 |
+
$output .= '<script type="application/ld+json">' . json_encode($json, JSON_UNESCAPED_UNICODE) . '</script>';
|
39 |
+
$output .= "\n\n";
|
40 |
+
}
|
41 |
+
|
42 |
+
echo $output;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
|
47 |
+
/**
|
48 |
+
* The main function responsible for putting shema array all together
|
49 |
+
*
|
50 |
+
* @param string $type for schema type (example: CollectionPage)
|
51 |
+
* @since 1.5.7
|
52 |
+
* @return array json
|
53 |
+
*/
|
54 |
+
function schema_wp_get_category_json() {
|
55 |
+
|
56 |
+
global $post, $query_string;
|
57 |
+
|
58 |
+
// debug
|
59 |
+
//echo'<pre>';print_r($query_string);echo'</pre>';exit;
|
60 |
+
|
61 |
+
$blogPost = array();
|
62 |
+
$json = array();
|
63 |
+
|
64 |
+
$secondary_loop = new WP_Query( $query_string );
|
65 |
+
|
66 |
+
if ( $secondary_loop->have_posts() ):
|
67 |
+
|
68 |
+
// Faster way to get markup data
|
69 |
+
// @since 1.6.9.4
|
70 |
+
if ( ! empty($secondary_loop->posts) ) {
|
71 |
+
foreach ($secondary_loop->posts as $schema_post) {
|
72 |
+
$schema_json = get_post_meta( $schema_post->ID, '_schema_json', true );
|
73 |
+
if ( isset($schema_json) ) {
|
74 |
+
$blogPost[] = $schema_json;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
/*
|
80 |
+
while( $secondary_loop->have_posts() ): $secondary_loop->the_post();
|
81 |
+
|
82 |
+
$blogPost[] = apply_filters( 'schema_output_category_post', array
|
83 |
+
(
|
84 |
+
'@type' => 'BlogPosting',
|
85 |
+
'headline' => get_the_title(),
|
86 |
+
'url' => get_the_permalink(),
|
87 |
+
'datePublished' => get_the_date('c'),
|
88 |
+
'dateModified' => get_the_modified_date('c'),
|
89 |
+
'mainEntityOfPage' => get_the_permalink(),
|
90 |
+
'author' => schema_wp_get_author_array(),
|
91 |
+
'publisher' => schema_wp_get_publisher_array(),
|
92 |
+
'image' => schema_wp_get_media(),
|
93 |
+
'keywords' => schema_wp_get_post_tags($post->ID),
|
94 |
+
'commentCount' => get_comments_number(),
|
95 |
+
'comment' => schema_wp_get_comments(),
|
96 |
+
));
|
97 |
+
|
98 |
+
endwhile;
|
99 |
+
*/
|
100 |
+
|
101 |
+
wp_reset_postdata();
|
102 |
+
|
103 |
+
$category = get_the_category();
|
104 |
+
|
105 |
+
$category_id = intval($category[0]->term_id);
|
106 |
+
$category_link = get_category_link( $category_id );
|
107 |
+
//$category_link = get_term_link( $category[0]->term_id , 'category' );
|
108 |
+
$category_headline = single_cat_title( '', false ) . __(' Category', 'schema-wp');
|
109 |
+
$sameAs = get_term_meta( $category_id, 'schema_wp_sameAs' );
|
110 |
+
|
111 |
+
$json = array
|
112 |
+
(
|
113 |
+
'@context' => 'http://schema.org/',
|
114 |
+
'@type' => "CollectionPage",
|
115 |
+
'headline' => $category_headline,
|
116 |
+
'description' => strip_tags(category_description()),
|
117 |
+
'url' => $category_link,
|
118 |
+
'sameAs' => $sameAs,
|
119 |
+
'hasPart' => $blogPost
|
120 |
+
);
|
121 |
+
|
122 |
+
endif;
|
123 |
+
|
124 |
+
return apply_filters( 'schema_category_json', $json );
|
125 |
+
}
|
includes/json/knowledge-graph.php
ADDED
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Knowledge Graph
|
4 |
+
*
|
5 |
+
* @since 1.0
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Exit if accessed directly
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
add_filter( 'schema_wp_filter_output_knowledge_graph', 'schema_wp_do_output_knowledge_graph' );
|
12 |
+
/*
|
13 |
+
* Output Knowledge Graph markup
|
14 |
+
*
|
15 |
+
* @since 1.6.9.2
|
16 |
+
*/
|
17 |
+
function schema_wp_do_output_knowledge_graph( $knowledge_graph ) {
|
18 |
+
// Output Knowledge Graph only on front page
|
19 |
+
if( ! is_front_page() )
|
20 |
+
return;
|
21 |
+
|
22 |
+
return $knowledge_graph;
|
23 |
+
}
|
24 |
+
|
25 |
+
add_action('wp_head', 'schema_wp_output_knowledge_graph');
|
26 |
+
/**
|
27 |
+
* The main function responsible for output schema json-ld
|
28 |
+
*
|
29 |
+
* @since 1.0
|
30 |
+
* @return schema json-ld final output
|
31 |
+
*/
|
32 |
+
function schema_wp_output_knowledge_graph() {
|
33 |
+
|
34 |
+
$json = schema_wp_get_knowledge_graph_json();
|
35 |
+
|
36 |
+
$knowledge_graph = '';
|
37 |
+
|
38 |
+
if ( $json ) {
|
39 |
+
$knowledge_graph .= "\n\n";
|
40 |
+
$knowledge_graph .= '<!-- This site is optimized with the Schema plugin v'.SCHEMAWP_VERSION.' - https://schema.press -->';
|
41 |
+
$knowledge_graph .= "\n";
|
42 |
+
$knowledge_graph .= '<script type="application/ld+json">' . json_encode($json, JSON_UNESCAPED_UNICODE) . '</script>';
|
43 |
+
$knowledge_graph .= "\n\n";
|
44 |
+
}
|
45 |
+
|
46 |
+
$knowledge_graph = apply_filters( 'schema_wp_filter_output_knowledge_graph', $knowledge_graph );
|
47 |
+
|
48 |
+
echo $knowledge_graph;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* The main function responsible for putting schema array all together
|
53 |
+
*
|
54 |
+
* @param string $type for schema type (example: Organization)
|
55 |
+
* @since 1.0
|
56 |
+
* @return array, schema output
|
57 |
+
*/
|
58 |
+
function schema_wp_get_knowledge_graph_json() {
|
59 |
+
|
60 |
+
$organization_or_person = schema_wp_get_option( 'organization_or_person' );
|
61 |
+
|
62 |
+
if ( empty($organization_or_person) ) return;
|
63 |
+
|
64 |
+
switch ( $organization_or_person ) {
|
65 |
+
case "organization":
|
66 |
+
$type = 'Organization';
|
67 |
+
break;
|
68 |
+
case "person":
|
69 |
+
$type = 'Person';
|
70 |
+
break;
|
71 |
+
}
|
72 |
+
|
73 |
+
$schema = array();
|
74 |
+
|
75 |
+
$name = schema_wp_get_option( 'name' );
|
76 |
+
$url = esc_attr( stripslashes( schema_wp_get_option( 'url' ) ) );
|
77 |
+
|
78 |
+
if ( empty($name) || empty($url) ) return;
|
79 |
+
|
80 |
+
// Set logo only when type = Organization
|
81 |
+
if ( $type == 'Organization' ) {
|
82 |
+
$logo = esc_attr( stripslashes( schema_wp_get_option( 'logo' ) ) );
|
83 |
+
} else {
|
84 |
+
$logo = '';
|
85 |
+
}
|
86 |
+
|
87 |
+
$schema['@context'] = "http://schema.org";
|
88 |
+
$schema['@type'] = $type;
|
89 |
+
$schema['@id'] = '#' . $organization_or_person;
|
90 |
+
|
91 |
+
if ( !empty($name) ) $schema['name'] = $name;
|
92 |
+
if ( !empty($url) ) $schema['url'] = $url;
|
93 |
+
if ( !empty($logo) ) $schema['logo'] = $logo;
|
94 |
+
|
95 |
+
// Get corporate contacts types array
|
96 |
+
$corporate_contacts_types = schema_wp_get_corporate_contacts_types_array();
|
97 |
+
// Add contact
|
98 |
+
if ( ! empty($corporate_contacts_types) ) {
|
99 |
+
$schema["contactPoint"] = $corporate_contacts_types;
|
100 |
+
}
|
101 |
+
|
102 |
+
// Get social links array
|
103 |
+
$social = schema_wp_get_social_array();
|
104 |
+
// Add sameAs
|
105 |
+
if ( ! empty($social) ) {
|
106 |
+
$schema["sameAs"] = $social;
|
107 |
+
}
|
108 |
+
|
109 |
+
return apply_filters( 'schema_wp_knowledge_graph_json', $schema );
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Get Get corporate contacts types array
|
114 |
+
*
|
115 |
+
* @since 1.0
|
116 |
+
* @return array
|
117 |
+
*/
|
118 |
+
function schema_wp_get_corporate_contacts_types_array() {
|
119 |
+
|
120 |
+
$corporate_contacts_types = array();
|
121 |
+
|
122 |
+
$corporate_contacts_telephone = ( schema_wp_get_option( 'corporate_contacts_telephone' ) ) ? schema_wp_get_option( 'corporate_contacts_telephone' ) : '';
|
123 |
+
$corporate_contacts_url = ( schema_wp_get_option( 'corporate_contacts_url' ) ) ? schema_wp_get_option( 'corporate_contacts_url' ) : '';
|
124 |
+
$corporate_contacts_contact_type = ( schema_wp_get_option( 'corporate_contacts_contact_type' ) ) ? schema_wp_get_option( 'corporate_contacts_contact_type' ) : '';
|
125 |
+
|
126 |
+
if ( $corporate_contacts_telephone || $corporate_contacts_url ) {
|
127 |
+
|
128 |
+
// Remove dashes and replace it with a space
|
129 |
+
$corporate_contacts_telephone = str_replace("_", " ", $corporate_contacts_telephone);
|
130 |
+
$corporate_contacts_contact_type = str_replace("_", " ", $corporate_contacts_contact_type);
|
131 |
+
|
132 |
+
$corporate_contacts_types = array(
|
133 |
+
'@type' => 'ContactPoint', // default required value
|
134 |
+
'telephone' => $corporate_contacts_telephone,
|
135 |
+
'url' => $corporate_contacts_url,
|
136 |
+
'contactType' => $corporate_contacts_contact_type
|
137 |
+
);
|
138 |
+
}
|
139 |
+
|
140 |
+
return $corporate_contacts_types;
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Get social links array
|
145 |
+
*
|
146 |
+
* @since 1.0
|
147 |
+
* @return array
|
148 |
+
*/
|
149 |
+
function schema_wp_get_social_array() {
|
150 |
+
|
151 |
+
$social = array();
|
152 |
+
|
153 |
+
$google = esc_attr( stripslashes( schema_wp_get_option( 'google' ) ) );
|
154 |
+
$facebook = esc_attr( stripslashes( schema_wp_get_option( 'facebook') ) );
|
155 |
+
$twitter = esc_attr( stripslashes( schema_wp_get_option( 'twitter' ) ) );
|
156 |
+
$instagram = esc_attr( stripslashes( schema_wp_get_option( 'instagram' ) ) );
|
157 |
+
$youtube = esc_attr( stripslashes( schema_wp_get_option( 'youtube' ) ) );
|
158 |
+
$linkedin = esc_attr( stripslashes( schema_wp_get_option( 'linkedin' ) ) );
|
159 |
+
$myspace = esc_attr( stripslashes( schema_wp_get_option( 'myspace' ) ) );
|
160 |
+
$pinterest = esc_attr( stripslashes( schema_wp_get_option( 'pinterest' ) ) );
|
161 |
+
$soundcloud = esc_attr( stripslashes( schema_wp_get_option( 'soundcloud' ) ) );
|
162 |
+
$tumblr = esc_attr( stripslashes( schema_wp_get_option( 'tumblr' ) ) );
|
163 |
+
|
164 |
+
$social_links = array( $google, $facebook, $twitter, $instagram, $youtube, $linkedin, $myspace, $pinterest, $soundcloud, $tumblr );
|
165 |
+
|
166 |
+
// Remove empty fields
|
167 |
+
foreach( $social_links as $profile ) {
|
168 |
+
if ( $profile != '' ) $social[] = $profile;
|
169 |
+
}
|
170 |
+
|
171 |
+
return $social;
|
172 |
+
}
|
includes/json/post-type-archive.php
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Post Type Archives
|
4 |
+
*
|
5 |
+
* @since 1.6.9.8
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Exit if accessed directly
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
add_action('wp_head', 'schema_wp_output_post_type_archive');
|
12 |
+
/**
|
13 |
+
* The main function responsible for output schema json-ld
|
14 |
+
*
|
15 |
+
* @since 1.6.9.8
|
16 |
+
* @return schema json-ld final output
|
17 |
+
*/
|
18 |
+
function schema_wp_output_post_type_archive() {
|
19 |
+
|
20 |
+
global $post;
|
21 |
+
|
22 |
+
// Run only on blog list page
|
23 |
+
if ( is_post_type_archive() ) {
|
24 |
+
|
25 |
+
$post_type = get_post_type();
|
26 |
+
|
27 |
+
$enabled = schema_wp_is_post_type_enabled( $post_type ) ;
|
28 |
+
if ( ! $enabled) return;
|
29 |
+
|
30 |
+
//add_filter( 'edd_add_schema_microdata', '__return_false' );
|
31 |
+
// add action to hook to this function
|
32 |
+
do_action('schema_wp_action_post_type_archive');
|
33 |
+
|
34 |
+
$json = schema_wp_get_post_type_archive_json( $post_type );
|
35 |
+
|
36 |
+
$output = '';
|
37 |
+
|
38 |
+
// debug
|
39 |
+
//echo'<pre>';print_r($json);echo'</pre>';
|
40 |
+
|
41 |
+
if ( $json ) {
|
42 |
+
$output .= "\n\n";
|
43 |
+
$output .= '<!-- This site is optimized with the Schema plugin v'.SCHEMAWP_VERSION.' - https://schema.press -->';
|
44 |
+
$output .= "\n";
|
45 |
+
$output .= '<script type="application/ld+json">' . json_encode($json, JSON_UNESCAPED_UNICODE) . '</script>';
|
46 |
+
$output .= "\n\n";
|
47 |
+
}
|
48 |
+
|
49 |
+
echo $output;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* The main function responsible for putting shema array all together
|
55 |
+
*
|
56 |
+
* @param string $type for schema type (example: Person)
|
57 |
+
* @since 1.6.9.8
|
58 |
+
* @return schema output
|
59 |
+
*/
|
60 |
+
function schema_wp_get_post_type_archive_json( $post_type ) {
|
61 |
+
|
62 |
+
global $post, $wp_query, $query_string;
|
63 |
+
|
64 |
+
// debug
|
65 |
+
//echo'<pre>';print_r($wp_query);echo'</pre>';exit;
|
66 |
+
//var_dump( $GLOBALS['wp_query'] );
|
67 |
+
|
68 |
+
if ( empty($wp_query->query_vars) ) return;
|
69 |
+
|
70 |
+
$blogPost = array();
|
71 |
+
$schema = array();
|
72 |
+
$url = schema_wp_get_archive_link( $post_type ) ? schema_wp_get_archive_link($post_type) : get_home_url();
|
73 |
+
|
74 |
+
$secondary_loop = new WP_Query( $wp_query->query_vars );
|
75 |
+
|
76 |
+
if ( $secondary_loop->have_posts() ):
|
77 |
+
|
78 |
+
// get markup data for each post in the query
|
79 |
+
if ( ! empty($secondary_loop->posts) ) {
|
80 |
+
|
81 |
+
$i = 1;
|
82 |
+
|
83 |
+
foreach ($secondary_loop->posts as $schema_post) {
|
84 |
+
|
85 |
+
// pull json from post meta
|
86 |
+
$schema_json = get_post_meta( $schema_post->ID, '_schema_json', true );
|
87 |
+
|
88 |
+
if ( isset($schema_json) && is_array($schema_json) ) {
|
89 |
+
|
90 |
+
// override urls, fix for: All values provided for url must point to the same page.
|
91 |
+
$schema_json['url'] = $url.'#'.$schema_post->post_name;
|
92 |
+
|
93 |
+
$blogPost[] = array(
|
94 |
+
'@type' => 'ListItem',
|
95 |
+
//'url' => '', // ListItem with url and ListItem with item are incompatible.
|
96 |
+
'position' => $i,
|
97 |
+
'item' => $schema_json
|
98 |
+
);
|
99 |
+
}
|
100 |
+
|
101 |
+
$i++;
|
102 |
+
}// end foreach
|
103 |
+
}
|
104 |
+
|
105 |
+
wp_reset_postdata();
|
106 |
+
|
107 |
+
// get post type details
|
108 |
+
$post_type_archive_title = post_type_archive_title( __(''), false );
|
109 |
+
$obj = get_post_type_object( $post_type );
|
110 |
+
|
111 |
+
if ( ! empty($blogPost)) {
|
112 |
+
// put all together
|
113 |
+
$schema = array
|
114 |
+
(
|
115 |
+
'@context' => 'http://schema.org/',
|
116 |
+
//'@type' => array('ItemList', 'CreativeWork', 'WebPage'),
|
117 |
+
'@type' => array('ItemList', 'CreativeWork'),
|
118 |
+
'name' => isset($post_type_archive_title) ? $post_type_archive_title : get_bloginfo( 'name' ),
|
119 |
+
'description' => isset($obj->description) ? $obj->description : '',
|
120 |
+
'url' => $url,
|
121 |
+
'itemListOrder' => 'http://schema.org/ItemListOrderAscending',
|
122 |
+
'numberOfItems' => count($blogPost),
|
123 |
+
'itemListElement' => $blogPost,
|
124 |
+
);
|
125 |
+
}
|
126 |
+
|
127 |
+
endif;
|
128 |
+
|
129 |
+
// debug
|
130 |
+
//echo'<pre>';print_r($schema);echo'</pre>';exit;
|
131 |
+
|
132 |
+
return apply_filters( 'schema_post_type_archive_output', $schema );
|
133 |
+
}
|
includes/json/schema-output.php
ADDED
@@ -0,0 +1,269 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Schema Output
|
4 |
+
*
|
5 |
+
* @since 1.4
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Exit if accessed directly
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
add_action('wp_head', 'schema_wp_output');
|
12 |
+
/**
|
13 |
+
* The main function responsible for output schema json-ld
|
14 |
+
*
|
15 |
+
* @since 1.4
|
16 |
+
* @return schema json-ld final output
|
17 |
+
*/
|
18 |
+
function schema_wp_output() {
|
19 |
+
|
20 |
+
global $post;
|
21 |
+
|
22 |
+
// do not run if default search query has been set (mostly not needed)
|
23 |
+
// @todo remove this if not needed
|
24 |
+
//if ( isset($_GET['s']) ) return;
|
25 |
+
|
26 |
+
// do not run on front, home page, archive pages, search result pages, and 404 error pages
|
27 |
+
if ( is_archive() || is_home() || is_front_page() || is_search() || is_404() ) return;
|
28 |
+
|
29 |
+
// check for WPRichSnippets plugin
|
30 |
+
// @since 1.4.5
|
31 |
+
//if (function_exists('wprs_is_enabled')) {
|
32 |
+
// if ( wprs_is_enabled( $post->ID ) ) return;
|
33 |
+
//}
|
34 |
+
|
35 |
+
$pttimestamp = time() + get_option('gmt_offset') * 60*60;
|
36 |
+
$pttimestamp_old = get_post_meta( $post->ID, '_schema_json_timestamp', true );
|
37 |
+
$json = array();
|
38 |
+
|
39 |
+
// exclude entry, do not output the schema markup
|
40 |
+
// @since 1.6
|
41 |
+
$exclude = get_post_meta( $post->ID, '_schema_exclude' , true );
|
42 |
+
if ( $exclude )
|
43 |
+
return;
|
44 |
+
|
45 |
+
// compare time stamp and check if json post meta value already exists
|
46 |
+
// @since 1.5.9.7
|
47 |
+
if ( isset($pttimestamp_old) && is_numeric($pttimestamp_old) ) {
|
48 |
+
$time_diff = $pttimestamp - $pttimestamp_old;
|
49 |
+
if ( $time_diff <= DAY_IN_SECONDS ) {
|
50 |
+
$json = get_post_meta( $post->ID, '_schema_json', true );
|
51 |
+
} else {
|
52 |
+
delete_post_meta( $post->ID, '_schema_json' );
|
53 |
+
$json = array();
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
if ( !isset($json) || empty($json) ) {
|
58 |
+
|
59 |
+
$schemas_enabled = array();
|
60 |
+
|
61 |
+
// get Schema enabled array
|
62 |
+
$schemas_enabled = schema_wp_cpt_get_enabled();
|
63 |
+
|
64 |
+
if ( empty($schemas_enabled) ) return;
|
65 |
+
|
66 |
+
$post_type = get_post_type();
|
67 |
+
|
68 |
+
foreach( $schemas_enabled as $schema_enabled ) :
|
69 |
+
|
70 |
+
// debug
|
71 |
+
//print_r($schema_enabled);
|
72 |
+
|
73 |
+
// get Schema enabled post types array
|
74 |
+
$schema_cpt = $schema_enabled['post_type'];
|
75 |
+
|
76 |
+
if ( ! empty($schema_cpt) && in_array( $post_type, $schema_cpt, true ) ) {
|
77 |
+
|
78 |
+
// get enabled categories
|
79 |
+
$categories = schema_wp_get_categories( $post->ID );
|
80 |
+
$categories_enabled = $schema_enabled['categories'];
|
81 |
+
// Get an array of common categories between the two arrays
|
82 |
+
$categories_intersect = array_intersect($categories, $categories_enabled);
|
83 |
+
//print_r($result); exit;
|
84 |
+
|
85 |
+
if ( empty($categories_enabled) ) {
|
86 |
+
|
87 |
+
// apply on all posts
|
88 |
+
$type = ($schema_enabled['type_sub'] && $schema_enabled['type']=='Article') ? $schema_enabled['type_sub'] : $schema_enabled['type'];
|
89 |
+
$json = schema_wp_get_schema_json( $type );
|
90 |
+
|
91 |
+
} else {
|
92 |
+
|
93 |
+
// Apply only on enabled categories
|
94 |
+
$cat_enabled = array_intersect_key( $categories, $categories_enabled );
|
95 |
+
|
96 |
+
if ( ! empty($cat_enabled) && ! empty($categories_intersect) ) {
|
97 |
+
|
98 |
+
//foreach( $categories as $key => $value ){
|
99 |
+
|
100 |
+
// if ( in_array( $value, $cat_enabled, true ) ) {
|
101 |
+
|
102 |
+
//print_r($value); exit;
|
103 |
+
|
104 |
+
$type = ($schema_enabled['type_sub'] && $schema_enabled['type']=='Article') ? $schema_enabled['type_sub'] : $schema_enabled['type'];
|
105 |
+
$json = schema_wp_get_schema_json( $type );
|
106 |
+
|
107 |
+
// } // end if
|
108 |
+
//} // end foreach
|
109 |
+
|
110 |
+
|
111 |
+
}
|
112 |
+
|
113 |
+
}
|
114 |
+
|
115 |
+
}
|
116 |
+
|
117 |
+
|
118 |
+
// debug
|
119 |
+
//print_r($schema_enabled);
|
120 |
+
|
121 |
+
endforeach;
|
122 |
+
|
123 |
+
} // end if
|
124 |
+
|
125 |
+
$output = '';
|
126 |
+
|
127 |
+
if ( ! empty($json) ) {
|
128 |
+
$output .= "\n\n";
|
129 |
+
$output .= '<!-- This site is optimized with the Schema plugin v'.SCHEMAWP_VERSION.' - https://schema.press -->';
|
130 |
+
$output .= "\n";
|
131 |
+
$output .= '<script type="application/ld+json">' . json_encode($json, JSON_UNESCAPED_UNICODE) .'</script>';
|
132 |
+
$output .= "\n\n";
|
133 |
+
}
|
134 |
+
|
135 |
+
// update post meta with new generated json value and time stamp
|
136 |
+
// @since 1.5.9.7
|
137 |
+
update_post_meta( $post->ID, '_schema_json', $json );
|
138 |
+
update_post_meta( $post->ID, '_schema_json_timestamp', $pttimestamp );
|
139 |
+
|
140 |
+
echo $output;
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* The main function responsible for putting shema array all together
|
145 |
+
*
|
146 |
+
* @param string $type for schema type (example: Article)
|
147 |
+
* @since 1.4
|
148 |
+
* @return schema output
|
149 |
+
*/
|
150 |
+
function schema_wp_get_schema_json( $type ) {
|
151 |
+
|
152 |
+
global $post;
|
153 |
+
|
154 |
+
if ( ! isset($type) ) return array();
|
155 |
+
|
156 |
+
$schema = array();
|
157 |
+
|
158 |
+
// Get schema json array
|
159 |
+
$json = schema_wp_get_schema_json_prepare( $post->ID );
|
160 |
+
|
161 |
+
// Debug
|
162 |
+
//echo '<pre>'; print_r($json); echo '</pre>';
|
163 |
+
|
164 |
+
// Start our schema array
|
165 |
+
// @since 1.4
|
166 |
+
|
167 |
+
// Stuff for any page
|
168 |
+
$schema["@context"] = "http://schema.org/";
|
169 |
+
|
170 |
+
$schema["@type"] = $type;
|
171 |
+
|
172 |
+
$schema["mainEntityOfPage"] = array(
|
173 |
+
"@type" => "WebPage",
|
174 |
+
"@id" => $json['permalink']
|
175 |
+
);
|
176 |
+
|
177 |
+
$schema["url"] = $json['permalink'];
|
178 |
+
|
179 |
+
if ( ! empty( $json["author"] ) ) {
|
180 |
+
//$schema["author"] = $json['author'];
|
181 |
+
}
|
182 |
+
|
183 |
+
// get supported article types
|
184 |
+
$support_article_types = schema_wp_get_support_article_types();
|
185 |
+
|
186 |
+
// check if this type is supported Article, or sub of Article
|
187 |
+
// if so, add required markup
|
188 |
+
if ( in_array( $type, $support_article_types) ) {
|
189 |
+
$schema["headline"] = $json["headline"];
|
190 |
+
$schema["datePublished"] = $json["datePublished"];
|
191 |
+
$schema["dateModified"] = $json["dateModified"];
|
192 |
+
|
193 |
+
if ( ! empty( $json["publisher"] ) ) {
|
194 |
+
$schema["publisher"] = $json["publisher"];
|
195 |
+
}
|
196 |
+
}
|
197 |
+
|
198 |
+
if ( ! empty( $json["media"] ) ) {
|
199 |
+
$schema["image"] = $json["media"];
|
200 |
+
}
|
201 |
+
|
202 |
+
if ( $json['category'] != '' ) {
|
203 |
+
$schema["articleSection"] = $json['category'];
|
204 |
+
}
|
205 |
+
|
206 |
+
if ( $json['keywords'] != '' && $type == 'BlogPosting' ) {
|
207 |
+
$schema["keywords"] = $json['keywords'];
|
208 |
+
}
|
209 |
+
|
210 |
+
if ( $json["description"] != '' ) {
|
211 |
+
$schema["description"] = $json["description"];
|
212 |
+
}
|
213 |
+
|
214 |
+
return apply_filters( 'schema_output', $schema );
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Prepare for json array
|
219 |
+
*
|
220 |
+
* @param string $id post id
|
221 |
+
* @since 1.4
|
222 |
+
* @return an array
|
223 |
+
*/
|
224 |
+
function schema_wp_get_schema_json_prepare( $post_id = null ) {
|
225 |
+
|
226 |
+
global $post;
|
227 |
+
|
228 |
+
// Set post ID
|
229 |
+
If ( ! isset($post_id) ) $post_id = $post->ID;
|
230 |
+
|
231 |
+
$jason = array();
|
232 |
+
|
233 |
+
|
234 |
+
// Get post content
|
235 |
+
$content_post = get_post($post_id);
|
236 |
+
|
237 |
+
// Get description
|
238 |
+
$description = schema_wp_get_description( $post_id );
|
239 |
+
|
240 |
+
// Stuff for any page, if it exists
|
241 |
+
$permalink = get_permalink( $post_id) ;
|
242 |
+
$category = schema_wp_get_post_category( $post_id );
|
243 |
+
$keywords = schema_wp_get_post_tags( $post_id );
|
244 |
+
|
245 |
+
// Get publisher array
|
246 |
+
$publisher = schema_wp_get_publisher_array();
|
247 |
+
|
248 |
+
//
|
249 |
+
// Putting all together
|
250 |
+
//
|
251 |
+
$json["headline"] = apply_filters ( 'schema_wp_filter_headline', $content_post->post_title );
|
252 |
+
$json['description'] = $description;
|
253 |
+
$json['permalink'] = $permalink;
|
254 |
+
|
255 |
+
$json["datePublished"] = get_the_date( 'c', $post_id );
|
256 |
+
$json["dateModified"] = get_post_modified_time( 'c', false, $post_id, false );
|
257 |
+
|
258 |
+
$json['category'] = $category;
|
259 |
+
$json['keywords'] = $keywords;
|
260 |
+
|
261 |
+
$json['media'] = schema_wp_get_media($post_id);
|
262 |
+
|
263 |
+
$json['publisher'] = $publisher;
|
264 |
+
|
265 |
+
// debug
|
266 |
+
//echo '<pre>'; print_r($json); echo '</pre>';
|
267 |
+
|
268 |
+
return apply_filters( 'schema_json', $json );
|
269 |
+
}
|
includes/json/search-results.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SiteLinks Search Box
|
4 |
+
*
|
5 |
+
* @since 1.0
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Exit if accessed directly
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
add_action('wp_head', 'schema_wp_output_sitelinks_search_box');
|
12 |
+
/**
|
13 |
+
* The main function responsible for output schema json-ld into
|
14 |
+
*
|
15 |
+
* @since 1.0
|
16 |
+
* @return schema json-ld final output
|
17 |
+
*/
|
18 |
+
function schema_wp_output_sitelinks_search_box() {
|
19 |
+
|
20 |
+
// Run only on front page
|
21 |
+
if ( is_front_page() ) {
|
22 |
+
$output = '';
|
23 |
+
$sitelinks_search_box = schema_wp_get_option( 'sitelinks_search_box' );
|
24 |
+
$site_name_enable = schema_wp_get_option( 'site_name_enable' );
|
25 |
+
$site_name = schema_wp_get_option( 'site_name' );
|
26 |
+
$site_alternate_name = schema_wp_get_option( 'site_alternate_name' );
|
27 |
+
|
28 |
+
if ( ! isset($sitelinks_search_box) || ! $sitelinks_search_box ) return;
|
29 |
+
|
30 |
+
$output .= PHP_EOL . '<script type="application/ld+json">' . PHP_EOL;
|
31 |
+
$output .= '{' . PHP_EOL;
|
32 |
+
$output .= ' "@context": "http://schema.org",' . PHP_EOL;
|
33 |
+
$output .= ' "@type": "WebSite",' . PHP_EOL;
|
34 |
+
$output .= ' "@id": "#website",' . PHP_EOL;
|
35 |
+
|
36 |
+
if ( $site_name_enable ) {
|
37 |
+
$output .= ' "name": "' . $site_name . '",' . PHP_EOL;
|
38 |
+
if ( $site_alternate_name ) $output .= ' "alternateName": "' . $site_alternate_name . '",' . PHP_EOL;
|
39 |
+
}
|
40 |
+
|
41 |
+
$output .= ' "url": "' . get_home_url() . '/",' . PHP_EOL;
|
42 |
+
$output .= ' "potentialAction": {' . PHP_EOL;
|
43 |
+
$output .= ' "@type": "SearchAction",' . PHP_EOL;
|
44 |
+
$output .= ' "target": "' . get_home_url() . '/?s={search_term_string}",' . PHP_EOL;
|
45 |
+
$output .= ' "query-input": "required name=search_term_string"' . PHP_EOL;
|
46 |
+
$output .= ' }' . PHP_EOL;
|
47 |
+
$output .= '}' . PHP_EOL;
|
48 |
+
$output .= '</script>' . PHP_EOL . PHP_EOL;
|
49 |
+
|
50 |
+
$output = apply_filters( 'schema_wp_output_sitelinks_search_box', $output );;
|
51 |
+
|
52 |
+
echo $output;
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
|
57 |
+
//add_action('wp_head', 'schema_wp_output_sitelinks_search_box_disable');
|
58 |
+
/**
|
59 |
+
* Disable SiteLinks Search Box
|
60 |
+
*
|
61 |
+
* This function was disabled @since 1.5.9.2, I don't see it important!
|
62 |
+
* @since 1.0
|
63 |
+
* @return meta
|
64 |
+
*/
|
65 |
+
/*
|
66 |
+
function schema_wp_output_sitelinks_search_box_disable() {
|
67 |
+
|
68 |
+
// Run only on front page
|
69 |
+
if ( is_front_page() ) {
|
70 |
+
|
71 |
+
$sitelinks_search_box_disable = schema_wp_get_option( 'sitelinks_search_box_disable' );
|
72 |
+
|
73 |
+
if ( isset($sitelinks_search_box_disable) && $sitelinks_search_box_disable == 1 ) {
|
74 |
+
echo "\n";
|
75 |
+
echo '<!-- Tell Google not to show a Sitelinks search box -->';
|
76 |
+
echo "\n";
|
77 |
+
echo '<meta name="google" content="nositelinkssearchbox" />';
|
78 |
+
echo "\n\n";
|
79 |
+
}
|
80 |
+
}
|
81 |
+
}
|
82 |
+
*/
|
includes/json/tag.php
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Tag
|
4 |
+
*
|
5 |
+
* @since 1.6.9.5
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Exit if accessed directly
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
add_action('wp_head', 'schema_wp_output_tag');
|
12 |
+
/**
|
13 |
+
* The main function responsible for output schema json-ld
|
14 |
+
*
|
15 |
+
* @since 1.6.9.5
|
16 |
+
* @return schema json-ld final output
|
17 |
+
*/
|
18 |
+
function schema_wp_output_tag() {
|
19 |
+
|
20 |
+
// filter this and return false to disable the function
|
21 |
+
$enabled = apply_filters('schema_wp_output_tag_enabled', true);
|
22 |
+
if ( ! $enabled)
|
23 |
+
return;
|
24 |
+
|
25 |
+
if ( is_admin() ) return;
|
26 |
+
|
27 |
+
// Run only on category pages
|
28 |
+
if ( is_tag() ) {
|
29 |
+
|
30 |
+
$output = '';
|
31 |
+
|
32 |
+
$json = schema_wp_get_tag_json();
|
33 |
+
|
34 |
+
if ($json) {
|
35 |
+
$output .= "\n\n";
|
36 |
+
$output .= '<!-- This site is optimized with the Schema plugin v'.SCHEMAWP_VERSION.' - https://schema.press -->';
|
37 |
+
$output .= "\n";
|
38 |
+
$output .= '<script type="application/ld+json">' . json_encode($json, JSON_UNESCAPED_UNICODE) . '</script>';
|
39 |
+
$output .= "\n\n";
|
40 |
+
}
|
41 |
+
|
42 |
+
echo $output;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
|
47 |
+
/**
|
48 |
+
* The main function responsible for putting schema array all together
|
49 |
+
*
|
50 |
+
* @param string $type for schema type (example: CollectionPage)
|
51 |
+
* @since 1.6.9.5
|
52 |
+
* @return array json
|
53 |
+
*/
|
54 |
+
function schema_wp_get_tag_json() {
|
55 |
+
|
56 |
+
global $post, $query_string;
|
57 |
+
|
58 |
+
// debug
|
59 |
+
//echo'<pre>';print_r($query_string);echo'</pre>';exit;
|
60 |
+
|
61 |
+
$blogPost = array();
|
62 |
+
$json = array();
|
63 |
+
|
64 |
+
$secondary_loop = new WP_Query( $query_string );
|
65 |
+
|
66 |
+
if ( $secondary_loop->have_posts() ):
|
67 |
+
|
68 |
+
// Get the markup data
|
69 |
+
if ( ! empty($secondary_loop->posts) ) {
|
70 |
+
foreach ($secondary_loop->posts as $schema_post) {
|
71 |
+
$schema_json = get_post_meta( $schema_post->ID, '_schema_json', true );
|
72 |
+
if ( isset($schema_json) ) {
|
73 |
+
$blogPost[] = $schema_json;
|
74 |
+
}
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
wp_reset_postdata();
|
79 |
+
|
80 |
+
$tag = get_the_tags();
|
81 |
+
|
82 |
+
$tag_id = intval($tag[0]->term_id);
|
83 |
+
$tag_link = get_tag_link( $tag_id );
|
84 |
+
$tag_headline = single_tag_title( '', false ) . __(' Tag', 'schema-wp');
|
85 |
+
$sameAs = get_term_meta( $tag_id, 'schema_wp_sameAs' );
|
86 |
+
|
87 |
+
$json = array
|
88 |
+
(
|
89 |
+
'@context' => 'http://schema.org/',
|
90 |
+
'@type' => "CollectionPage",
|
91 |
+
'headline' => $tag_headline,
|
92 |
+
'description' => strip_tags(tag_description()),
|
93 |
+
'url' => $tag_link,
|
94 |
+
'sameAs' => $sameAs,
|
95 |
+
'hasPart' => $blogPost
|
96 |
+
);
|
97 |
+
|
98 |
+
endif;
|
99 |
+
|
100 |
+
return apply_filters( 'schema_tag_json', $json );
|
101 |
+
}
|
includes/json/taxonomy.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Taxonomy
|
4 |
+
*
|
5 |
+
* @since 1.6.9.4
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Exit if accessed directly
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
add_action('wp_head', 'schema_wp_output_taxonomy');
|
12 |
+
/**
|
13 |
+
* The main function responsible for output schema json-ld
|
14 |
+
*
|
15 |
+
* @since 1.6.9.4
|
16 |
+
* @return schema json-ld final output
|
17 |
+
*/
|
18 |
+
function schema_wp_output_taxonomy() {
|
19 |
+
|
20 |
+
// filter this and return false to disable the function
|
21 |
+
$enabled = apply_filters('schema_wp_output_taxonomy_enabled', true);
|
22 |
+
if ( ! $enabled)
|
23 |
+
return;
|
24 |
+
|
25 |
+
if ( is_admin() ) return;
|
26 |
+
|
27 |
+
// Run only on taxonomy pages
|
28 |
+
if ( is_tax() ) {
|
29 |
+
|
30 |
+
$output = '';
|
31 |
+
|
32 |
+
$json = schema_wp_get_taxonomy_json();
|
33 |
+
|
34 |
+
if ($json) {
|
35 |
+
$output = "\n\n";
|
36 |
+
$output .= '<!-- This site is optimized with the Schema plugin v'.SCHEMAWP_VERSION.' - https://schema.press -->';
|
37 |
+
$output .= "\n";
|
38 |
+
$output .= '<script type="application/ld+json">' . json_encode($json, JSON_UNESCAPED_UNICODE) . '</script>';
|
39 |
+
$output .= "\n\n";
|
40 |
+
}
|
41 |
+
|
42 |
+
echo $output;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* The main function responsible for putting shema array all together
|
48 |
+
*
|
49 |
+
* @since 1.6.9.4
|
50 |
+
* @return array json
|
51 |
+
*/
|
52 |
+
function schema_wp_get_taxonomy_json() {
|
53 |
+
|
54 |
+
global $post, $query_string;
|
55 |
+
|
56 |
+
$json = array();
|
57 |
+
|
58 |
+
$secondary_loop = new WP_Query( $query_string );
|
59 |
+
|
60 |
+
if ( $secondary_loop->have_posts() ):
|
61 |
+
|
62 |
+
while( $secondary_loop->have_posts() ): $secondary_loop->the_post();
|
63 |
+
|
64 |
+
$schema_json = get_post_meta( $post->ID, '_schema_json', true );
|
65 |
+
|
66 |
+
if ( isset($schema_json) ) {
|
67 |
+
$json[] = $schema_json;
|
68 |
+
}
|
69 |
+
|
70 |
+
endwhile;
|
71 |
+
|
72 |
+
wp_reset_postdata();
|
73 |
+
|
74 |
+
endif;
|
75 |
+
|
76 |
+
return apply_filters( 'schema_taxonomy_json', $json );
|
77 |
+
}
|
includes/json/web-page-element.php
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WebPageElement > WPHeader
|
4 |
+
* WebPageElement > WPFooter
|
5 |
+
*
|
6 |
+
* @since 1.6.9.8
|
7 |
+
*/
|
8 |
+
|
9 |
+
// Exit if accessed directly
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
+
|
12 |
+
add_action('wp_head', 'schema_wp_output_web_page_element');
|
13 |
+
/**
|
14 |
+
* The main function responsible for output schema json-ld
|
15 |
+
*
|
16 |
+
* @since 1.6.9.8
|
17 |
+
* @return schema json-ld final output
|
18 |
+
*/
|
19 |
+
function schema_wp_output_web_page_element() {
|
20 |
+
|
21 |
+
global $post;
|
22 |
+
|
23 |
+
$enable = schema_wp_get_option( 'web_page_element_enable' );
|
24 |
+
|
25 |
+
if ( $enable != true )
|
26 |
+
return;
|
27 |
+
|
28 |
+
// disable Genesis header markup
|
29 |
+
add_filter( 'genesis_attr_site-header', 'schema_wp_genesis_attributes_removal_function', 20 );
|
30 |
+
// disable Genesis footer markup
|
31 |
+
add_filter( 'genesis_attr_site-footer', 'schema_wp_genesis_attributes_removal_function', 20 );
|
32 |
+
|
33 |
+
$json = schema_wp_get_web_page_element_json();
|
34 |
+
|
35 |
+
$output = '';
|
36 |
+
|
37 |
+
// debug
|
38 |
+
//echo'<pre>';print_r($json);echo'</pre>';
|
39 |
+
|
40 |
+
if ( $json ) {
|
41 |
+
$output .= "\n\n";
|
42 |
+
$output .= '<!-- This site is optimized with the Schema plugin v'.SCHEMAWP_VERSION.' - https://schema.press -->';
|
43 |
+
$output .= "\n";
|
44 |
+
$output .= '<script type="application/ld+json">' . json_encode($json, JSON_UNESCAPED_UNICODE) . '</script>';
|
45 |
+
$output .= "\n\n";
|
46 |
+
}
|
47 |
+
|
48 |
+
echo $output;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* The main function responsible for putting header array all together
|
53 |
+
*
|
54 |
+
* @since 1.6.9.8
|
55 |
+
* @return schema output
|
56 |
+
*/
|
57 |
+
function schema_wp_get_web_page_element_json() {
|
58 |
+
|
59 |
+
global $wp_query;
|
60 |
+
|
61 |
+
// get post type
|
62 |
+
$post_type = get_post_type();
|
63 |
+
|
64 |
+
// set defaults
|
65 |
+
$headline = wp_filter_nohtml_kses( get_the_title() );
|
66 |
+
$description = get_bloginfo( 'description' );
|
67 |
+
$url = get_bloginfo( 'url' );
|
68 |
+
|
69 |
+
if ( is_404() ) {
|
70 |
+
// 404
|
71 |
+
$headline = __( 'Page not found', 'schema-wp' );
|
72 |
+
$description = __('It looks like nothing was found at this location!', 'schema-wp');
|
73 |
+
$url = '';
|
74 |
+
} elseif ( is_front_page() && is_home() ) {
|
75 |
+
// Default homepage
|
76 |
+
$headline = get_bloginfo( 'name' );
|
77 |
+
$description = get_bloginfo( 'description' );
|
78 |
+
$url = get_bloginfo( 'url' );
|
79 |
+
} elseif ( is_front_page() ) {
|
80 |
+
// static homepage
|
81 |
+
$headline = get_bloginfo( 'name' );
|
82 |
+
$description = get_bloginfo( 'description' );
|
83 |
+
$url = get_bloginfo( 'url' );
|
84 |
+
} elseif ( is_home() ) {
|
85 |
+
// blog page
|
86 |
+
$headline = get_bloginfo( 'name' );
|
87 |
+
$description = get_bloginfo( 'description' );
|
88 |
+
$url = schema_wp_get_blog_posts_page_url();
|
89 |
+
} else {
|
90 |
+
//everything else
|
91 |
+
|
92 |
+
// get enabled post types
|
93 |
+
$schema_enabled = schema_wp_cpt_get_enabled_post_types();
|
94 |
+
|
95 |
+
if ( in_array( $post_type , $schema_enabled ) ) {
|
96 |
+
if ( is_single() || is_singular() ) {
|
97 |
+
// single and singular pages
|
98 |
+
$headline = wp_filter_nohtml_kses( get_the_title() );
|
99 |
+
$description = schema_wp_get_description();
|
100 |
+
$url = get_permalink();
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
}
|
105 |
+
|
106 |
+
if ( is_archive() ) {
|
107 |
+
// archive pages
|
108 |
+
$headline = get_the_archive_title();
|
109 |
+
$description = get_the_archive_description();
|
110 |
+
$url = '';
|
111 |
+
}
|
112 |
+
|
113 |
+
if ( is_post_type_archive() ) {
|
114 |
+
// post type archive pages
|
115 |
+
$headline = post_type_archive_title( __(''), false );
|
116 |
+
$obj = get_post_type_object($post_type);
|
117 |
+
$description = isset($obj->description) ? $obj->description : '';
|
118 |
+
$url = schema_wp_get_archive_link($post_type) ? schema_wp_get_archive_link($post_type) : get_home_url();
|
119 |
+
}
|
120 |
+
|
121 |
+
if ( is_search() ) {
|
122 |
+
// search
|
123 |
+
$query = get_search_query();
|
124 |
+
$headline = sprintf( __( 'Search Results for “%s”' ), $query );
|
125 |
+
$url = get_search_link( $query );
|
126 |
+
$description = $wp_query->found_posts.' search results found for "'.$query.'".';
|
127 |
+
}
|
128 |
+
|
129 |
+
/*
|
130 |
+
* WPHeader
|
131 |
+
*/
|
132 |
+
$header = array(
|
133 |
+
'@context' => 'http://schema.org/',
|
134 |
+
'@type' => 'WPHeader',
|
135 |
+
//'name' => get_bloginfo( 'name' ),
|
136 |
+
'url' => $url,
|
137 |
+
'headline' => wp_strip_all_tags($headline),
|
138 |
+
'description' => wp_trim_words( wp_strip_all_tags($description), 18, '...' ),
|
139 |
+
//'keywords' => schema_wp_get_categories_as_keywords(),
|
140 |
+
);
|
141 |
+
|
142 |
+
/*
|
143 |
+
* WPFooter
|
144 |
+
*/
|
145 |
+
$footer = array(
|
146 |
+
'@context' => 'http://schema.org/',
|
147 |
+
'@type' => 'WPFooter',
|
148 |
+
//'name' => get_bloginfo( 'name' ),
|
149 |
+
'url' => $url,
|
150 |
+
'headline' => wp_strip_all_tags($headline),
|
151 |
+
'description' => wp_trim_words( wp_strip_all_tags($description), 18, '...' ),
|
152 |
+
//'keywords' => schema_wp_get_categories_as_keywords(),
|
153 |
+
'copyrightYear' => schema_wp_first_post_date( $format = 'Y' ),
|
154 |
+
//'copyrightHolder' => schema_wp_get_knowledge_graph_json() // Organization or Person, @todo this didn't go well, it breaks Organization markup.
|
155 |
+
);
|
156 |
+
|
157 |
+
$page_element_output = array($header, $footer);
|
158 |
+
|
159 |
+
// debug
|
160 |
+
//echo'<pre>';print_r($schema);echo'</pre>';exit;
|
161 |
+
|
162 |
+
return apply_filters( 'schema_web_page_element_output', $page_element_output );
|
163 |
+
}
|
includes/misc-functions.php
ADDED
@@ -0,0 +1,865 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Misc functions
|
4 |
+
*
|
5 |
+
* @package Schema
|
6 |
+
* @subpackage Functions/Formatting
|
7 |
+
* @copyright Copyright (c) 2016, Hesham Zebida
|
8 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
+
* @since 1.0
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Check if post type is enabled
|
17 |
+
*
|
18 |
+
* @since 1.6.9.8
|
19 |
+
*
|
20 |
+
* @param int $post_type The post type.
|
21 |
+
* @return string post ID, or false
|
22 |
+
*/
|
23 |
+
function schema_wp_is_post_type_enabled( $post_type = null ) {
|
24 |
+
|
25 |
+
if ( ! isset($post_type) ) $post_type = get_post_type();
|
26 |
+
if ( ! isset($post_type) )
|
27 |
+
return false;
|
28 |
+
|
29 |
+
$enabled = false;
|
30 |
+
$enabled_post_types = schema_wp_cpt_get_enabled_post_types();
|
31 |
+
|
32 |
+
if ( in_array( $post_type, $enabled_post_types, false ) ) $enabled = true;
|
33 |
+
|
34 |
+
return apply_filters( 'schema_wp_is_post_type_enabled', $enabled );
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Get schema ref for a post
|
39 |
+
*
|
40 |
+
* @since 1.6.9.5
|
41 |
+
*
|
42 |
+
* @param int $post_id The post ID.
|
43 |
+
* @return string post ID, or false
|
44 |
+
*/
|
45 |
+
function schema_wp_get_ref( $post_id = null ) {
|
46 |
+
|
47 |
+
if ( ! isset($post_id) ) $post_id = isset($_GET['post']) ? $_GET['post'] : null;
|
48 |
+
|
49 |
+
if ( ! isset($post_id) ) return false;
|
50 |
+
|
51 |
+
$schema_ref = get_post_meta( $post_id, '_schema_ref', true );
|
52 |
+
|
53 |
+
If ( ! isset($schema_ref) ) $schema_ref = fasle;
|
54 |
+
|
55 |
+
return apply_filters( 'schema_wp_ref', $schema_ref );
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Get schema type for a post
|
60 |
+
*
|
61 |
+
* @since 1.6.9.5
|
62 |
+
*
|
63 |
+
* @param int $post_id The post ID.
|
64 |
+
* @return string schema type, or false
|
65 |
+
*/
|
66 |
+
function schema_wp_get_type( $post_id = null ) {
|
67 |
+
|
68 |
+
if ( ! isset($post_id) ) $post_id = isset($_GET['post']) ? $_GET['post'] : null;
|
69 |
+
|
70 |
+
if ( ! isset($post_id) ) return false;
|
71 |
+
|
72 |
+
|
73 |
+
$schema_ref = schema_wp_get_ref( $post_id );
|
74 |
+
|
75 |
+
$schema_type = false;
|
76 |
+
|
77 |
+
if ( $schema_ref ) {
|
78 |
+
|
79 |
+
$schema_type = get_post_meta( $schema_ref, '_schema_type', true );
|
80 |
+
}
|
81 |
+
|
82 |
+
return apply_filters( 'schema_wp_type', $schema_type );
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Get schema json-ld for a post
|
87 |
+
*
|
88 |
+
* @since 1.6.9.5
|
89 |
+
*
|
90 |
+
* @param int $post_id The post ID.
|
91 |
+
* @return string post ID, or false
|
92 |
+
*/
|
93 |
+
function schema_wp_get_jsonld( $post_id = null ) {
|
94 |
+
|
95 |
+
global $post;
|
96 |
+
|
97 |
+
if ( ! isset($post_id) ) $post_id = $post->ID;
|
98 |
+
|
99 |
+
if ( ! isset($post_id ) ) return false;
|
100 |
+
|
101 |
+
$schema_json = get_post_meta( $post_id, '_schema_json', true);
|
102 |
+
|
103 |
+
If ( ! isset($schema_json )) $schema_json = fasle;
|
104 |
+
|
105 |
+
return apply_filters( 'schema_wp_json', $schema_json );
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Get publisher array
|
110 |
+
*
|
111 |
+
* @since 1.2
|
112 |
+
* @return array
|
113 |
+
*/
|
114 |
+
function schema_wp_get_publisher_array() {
|
115 |
+
|
116 |
+
$publisher = array();
|
117 |
+
|
118 |
+
$name = schema_wp_get_option( 'name' );
|
119 |
+
|
120 |
+
// Use site name as organization name for publisher if not presented in plugin settings
|
121 |
+
// @since 1.5.9.5
|
122 |
+
if ( empty($name) ) $name = get_bloginfo( 'name' );
|
123 |
+
|
124 |
+
// @since 1.5.9.3
|
125 |
+
$logo = esc_attr( stripslashes( schema_wp_get_option( 'publisher_logo' ) ) );
|
126 |
+
|
127 |
+
$publisher = array(
|
128 |
+
"@type" => "Organization", // default required value
|
129 |
+
"@id" => get_bloginfo("url") . "/#organization",
|
130 |
+
"name" => wp_filter_nohtml_kses($name),
|
131 |
+
"logo" => array(
|
132 |
+
"@type" => "ImageObject",
|
133 |
+
"url" => $logo,
|
134 |
+
"width" => 600,
|
135 |
+
"height" => 60
|
136 |
+
)
|
137 |
+
);
|
138 |
+
|
139 |
+
return apply_filters( 'schema_wp_publisher', $publisher );
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Get an array of enabled post types
|
144 |
+
*
|
145 |
+
* @since 1.4
|
146 |
+
* @return array of enabled post types, schema type
|
147 |
+
*/
|
148 |
+
function schema_wp_cpt_get_enabled() {
|
149 |
+
|
150 |
+
$cpt_enabled = array();
|
151 |
+
|
152 |
+
$args = array(
|
153 |
+
'post_type' => 'schema',
|
154 |
+
'post_status' => 'publish',
|
155 |
+
'posts_per_page' => -1
|
156 |
+
);
|
157 |
+
|
158 |
+
$schemas_query = new WP_Query( $args );
|
159 |
+
|
160 |
+
$schemas = $schemas_query->get_posts();
|
161 |
+
|
162 |
+
// If there is no schema types set, return and empty array
|
163 |
+
if ( empty($schemas) ) return array();
|
164 |
+
|
165 |
+
foreach( $schemas as $schema ) :
|
166 |
+
|
167 |
+
// Get post meta
|
168 |
+
$schema_type = get_post_meta( $schema->ID, '_schema_type' , true );
|
169 |
+
$schema_type_sub_pre = get_post_meta( $schema->ID, '_schema_article_type' , true );
|
170 |
+
$schema_type_sub = ( $schema_type_sub_pre == 'General' ) ? $schema_type : $schema_type_sub_pre;
|
171 |
+
$schema_post_types = get_post_meta( $schema->ID, '_schema_post_types' , true );
|
172 |
+
$schema_categories = schema_wp_get_categories( $schema->ID );
|
173 |
+
|
174 |
+
// Build our array
|
175 |
+
$cpt_enabled[] = array (
|
176 |
+
'id' => $schema->ID,
|
177 |
+
'type' => $schema_type,
|
178 |
+
'type_sub' => $schema_type_sub,
|
179 |
+
'post_type' => $schema_post_types,
|
180 |
+
'categories' => $schema_categories
|
181 |
+
);
|
182 |
+
|
183 |
+
endforeach;
|
184 |
+
|
185 |
+
wp_reset_postdata();
|
186 |
+
|
187 |
+
// debug
|
188 |
+
//echo '<pre>'; print_r($cpt_enabled); echo '</pre>'; exit;
|
189 |
+
|
190 |
+
return apply_filters('schema_wp_cpt_enabled', $cpt_enabled);
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Get an array of enabled post types
|
195 |
+
*
|
196 |
+
* @since 1.5.9.6
|
197 |
+
* @return array of enabled post types, schema type
|
198 |
+
*/
|
199 |
+
function schema_wp_cpt_get_enabled_post_types() {
|
200 |
+
|
201 |
+
$cpt_enabled = array();
|
202 |
+
|
203 |
+
$args = array(
|
204 |
+
'post_type' => 'schema',
|
205 |
+
'post_status' => 'publish',
|
206 |
+
'posts_per_page' => -1
|
207 |
+
);
|
208 |
+
|
209 |
+
$schemas_query = new WP_Query( $args );
|
210 |
+
|
211 |
+
$schemas = $schemas_query->get_posts();
|
212 |
+
|
213 |
+
// If there is no schema types set, return and empty array
|
214 |
+
if ( empty($schemas) ) return array();
|
215 |
+
|
216 |
+
foreach( $schemas as $schema ) :
|
217 |
+
|
218 |
+
$schema_post_types = get_post_meta( $schema->ID, '_schema_post_types' , true );
|
219 |
+
|
220 |
+
// Build our array
|
221 |
+
$cpt_enabled[] = (is_array($schema_post_types)) ? reset($schema_post_types) : array();
|
222 |
+
|
223 |
+
endforeach;
|
224 |
+
|
225 |
+
wp_reset_postdata();
|
226 |
+
|
227 |
+
// debug
|
228 |
+
//echo '<pre>'; print_r($cpt_enabled); echo '</pre>'; exit;
|
229 |
+
//echo reset($cpt_enabled[0]);
|
230 |
+
return apply_filters('schema_wp_cpt_enabled_post_types', $cpt_enabled);
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Get schema ref by post type in admin page editor screen
|
235 |
+
*
|
236 |
+
* @since 1.6.9.3
|
237 |
+
* @return array of enabled post types, schema type
|
238 |
+
*/
|
239 |
+
function schema_wp_get_ref_by_post_type( $post_type = null ) {
|
240 |
+
|
241 |
+
global $wpdb, $post;
|
242 |
+
|
243 |
+
if ( ! isset($post_type) ) {
|
244 |
+
// Get post type from current screen
|
245 |
+
$current_screen = get_current_screen();
|
246 |
+
$post_type = $current_screen->post_type;
|
247 |
+
}
|
248 |
+
|
249 |
+
$schema_posts = $wpdb->get_results ( "
|
250 |
+
SELECT *
|
251 |
+
FROM $wpdb->posts
|
252 |
+
WHERE post_type = 'schema'
|
253 |
+
AND post_status = 'publish'
|
254 |
+
" );
|
255 |
+
|
256 |
+
//echo '<pre>'; print_r($schema_posts); echo '</pre>';exit;
|
257 |
+
if ( empty($schema_posts) ) return array();
|
258 |
+
|
259 |
+
foreach ( $schema_posts as $key => $post ) {
|
260 |
+
$supported_types = get_post_meta( $post->ID, '_schema_post_types', true );
|
261 |
+
if ( ! empty($supported_types) && in_array( $post_type, $supported_types, true ) ) {
|
262 |
+
return $post->ID;
|
263 |
+
}
|
264 |
+
}
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Get description
|
269 |
+
*
|
270 |
+
* @since 1.6.9.4
|
271 |
+
* return string
|
272 |
+
*/
|
273 |
+
function schema_wp_get_description( $post_id = null ) {
|
274 |
+
|
275 |
+
global $post;
|
276 |
+
|
277 |
+
if ( ! isset($post_id) ) $post_id = $post->ID;
|
278 |
+
|
279 |
+
// Get post content
|
280 |
+
$content_post = get_post($post_id);
|
281 |
+
|
282 |
+
// Get description
|
283 |
+
$full_content = $content_post->post_content;
|
284 |
+
$excerpt = $content_post->post_excerpt;
|
285 |
+
|
286 |
+
$full_content = str_replace(']]>', ']]>', $full_content);
|
287 |
+
$full_content = wp_strip_all_tags( $full_content );
|
288 |
+
|
289 |
+
// Filter content before it gets shorter ;)
|
290 |
+
// @since 1.5.9
|
291 |
+
$full_content = apply_filters( 'schema_wp_filter_content', $full_content );
|
292 |
+
|
293 |
+
$desc_word_count = apply_filters( 'schema_wp_filter_description_word_count', 49 );
|
294 |
+
$short_content = wp_trim_words( $full_content, $desc_word_count, '' );
|
295 |
+
$description = apply_filters( 'schema_wp_filter_description', ( $excerpt != '' ) ? $excerpt : $short_content );
|
296 |
+
|
297 |
+
return $description;
|
298 |
+
}
|
299 |
+
|
300 |
+
/**
|
301 |
+
* Get an array of enabled post types
|
302 |
+
*
|
303 |
+
* @since 1.4
|
304 |
+
* @return array
|
305 |
+
*/
|
306 |
+
function schema_wp_get_media( $post_id = null) {
|
307 |
+
|
308 |
+
global $post;
|
309 |
+
|
310 |
+
if ( ! isset( $post_id ) ) $post_id = $post->ID;
|
311 |
+
|
312 |
+
$media = array();
|
313 |
+
|
314 |
+
// Featured image
|
315 |
+
$image_attributes = wp_get_attachment_image_src( get_post_thumbnail_id($post_id), 'full' );
|
316 |
+
$image_url = $image_attributes[0];
|
317 |
+
$image_width = ( $image_attributes[1] > 696 ) ? $image_attributes[1] : 696; // Images should be at least 696 pixels wide
|
318 |
+
$image_height = $image_attributes[2];
|
319 |
+
|
320 |
+
// Thesis 2.x Post Image
|
321 |
+
$my_theme = wp_get_theme();
|
322 |
+
if ( $my_theme->get( 'Name' ) == 'Thesis') {
|
323 |
+
$image_attributes = get_post_meta( $post_id, '_thesis_post_image', true);
|
324 |
+
if ( ! empty($image_attributes) ) {
|
325 |
+
$image_url = $image_attributes['image']['url'];
|
326 |
+
// Make sure url is valid
|
327 |
+
if ( filter_var( $image_url, FILTER_VALIDATE_URL ) === FALSE ) {
|
328 |
+
//die('Not a valid URL');
|
329 |
+
$image_url = get_site_url() . $image_attributes['image']['url'];
|
330 |
+
}
|
331 |
+
$image_width = ( $image_attributes['image']['width'] > 696 ) ? $image_attributes['image']['width'] : 696;
|
332 |
+
$image_height = $image_attributes['image']['height'];
|
333 |
+
}
|
334 |
+
}
|
335 |
+
|
336 |
+
// Try something else...
|
337 |
+
// @since 1.5.4
|
338 |
+
if ( ! isset($image_url) || $image_url == '' ) {
|
339 |
+
// Make sure that PHP-XML extension is installed before parsing page HTML
|
340 |
+
// @since 1.6.9.6
|
341 |
+
if ( extension_loaded('xml') || extension_loaded('SimpleXML')) {
|
342 |
+
|
343 |
+
if ( $post->post_content ) {
|
344 |
+
$Document = new DOMDocument();
|
345 |
+
@$Document->loadHTML( $post->post_content );
|
346 |
+
$DocumentImages = $Document->getElementsByTagName( 'img' );
|
347 |
+
|
348 |
+
if ( $DocumentImages->length ) {
|
349 |
+
$image_url = $DocumentImages->item( 0 )->getAttribute( 'src' );
|
350 |
+
$image_width = ( $DocumentImages->item( 0 )->getAttribute( 'width' ) > 696 ) ? $DocumentImages->item( 0 )->getAttribute( 'width' ) : 696;
|
351 |
+
$image_height = $DocumentImages->item( 0 )->getAttribute( 'height' );
|
352 |
+
}
|
353 |
+
}
|
354 |
+
}
|
355 |
+
}
|
356 |
+
|
357 |
+
// Check if there is no image, then return an empy array
|
358 |
+
// @since 1.4.3
|
359 |
+
if ( ! isset($image_url) || $image_url == '' ) return $media;
|
360 |
+
// @since 1.4.4
|
361 |
+
if ( ! isset($image_width) || $image_width == '' ) return $media;
|
362 |
+
if ( ! isset($image_height) || $image_height == '' ) return $media;
|
363 |
+
|
364 |
+
$media = array (
|
365 |
+
'@type' => 'ImageObject',
|
366 |
+
'url' => $image_url,
|
367 |
+
'width' => $image_width,
|
368 |
+
'height' => $image_height,
|
369 |
+
);
|
370 |
+
|
371 |
+
// debug
|
372 |
+
//echo '<pre>'; print_r($media); echo '</pre>';
|
373 |
+
|
374 |
+
return apply_filters( 'schema_wp_filter_media', $media );
|
375 |
+
}
|
376 |
+
|
377 |
+
/**
|
378 |
+
* Get post single category,
|
379 |
+
* the first category
|
380 |
+
*
|
381 |
+
* @param int $post_id The post ID.
|
382 |
+
* @since 1.4.5
|
383 |
+
*/
|
384 |
+
function schema_wp_get_post_category( $post_id ) {
|
385 |
+
|
386 |
+
global $post;
|
387 |
+
|
388 |
+
if ( ! isset( $post_id ) ) $post_id = $post->ID;
|
389 |
+
|
390 |
+
$cats = get_the_category($post_id);
|
391 |
+
$cat = !empty($cats) ? $cats : array();
|
392 |
+
$category = (isset($cat[0]->cat_name)) ? $cat[0]->cat_name : '';
|
393 |
+
|
394 |
+
return $category;
|
395 |
+
}
|
396 |
+
|
397 |
+
/**
|
398 |
+
* Get post tags separate by commas,
|
399 |
+
* to be used as schema keywords for BlogPosting
|
400 |
+
*
|
401 |
+
* @param int $post_id The post ID.
|
402 |
+
* @since 1.4.5
|
403 |
+
*/
|
404 |
+
function schema_wp_get_post_tags( $post_id ) {
|
405 |
+
|
406 |
+
global $post;
|
407 |
+
|
408 |
+
if ( ! isset( $post_id ) ) $post_id = $post->ID;
|
409 |
+
|
410 |
+
$tags = '';
|
411 |
+
$posttags = get_the_tags();
|
412 |
+
if ($posttags) {
|
413 |
+
$taglist = "";
|
414 |
+
foreach($posttags as $tag) {
|
415 |
+
$taglist .= $tag->name . ', ';
|
416 |
+
}
|
417 |
+
$tags = rtrim($taglist, ", ");
|
418 |
+
}
|
419 |
+
|
420 |
+
return $tags;
|
421 |
+
}
|
422 |
+
|
423 |
+
|
424 |
+
/**
|
425 |
+
* Get an array of schema enabed categories
|
426 |
+
*
|
427 |
+
* @since 1.4.7
|
428 |
+
* @return array of enabled categories, schema type
|
429 |
+
*/
|
430 |
+
|
431 |
+
function schema_wp_get_categories( $post_id ) {
|
432 |
+
|
433 |
+
global $post;
|
434 |
+
|
435 |
+
if ( ! isset($post_id) ) $post_id = $post->ID;
|
436 |
+
|
437 |
+
$post_categories = wp_get_post_categories( $post_id );
|
438 |
+
$categories = array();
|
439 |
+
|
440 |
+
if ( empty($post_categories) ) return $categories;
|
441 |
+
|
442 |
+
$cats = array();
|
443 |
+
|
444 |
+
foreach( $post_categories as $c ){
|
445 |
+
$cat = get_category( $c );
|
446 |
+
$cats[] = $cat->slug;
|
447 |
+
}
|
448 |
+
|
449 |
+
if ( empty($cats) ) return $categories;
|
450 |
+
|
451 |
+
// Flat
|
452 |
+
$categories = schema_wp_array_flatten($cats);
|
453 |
+
|
454 |
+
return apply_filters( 'schema_wp_filter_categories', $categories );
|
455 |
+
}
|
456 |
+
|
457 |
+
add_action( 'save_post', 'schema_save_categories', 10, 3 );
|
458 |
+
/**
|
459 |
+
* Save categories when a Schema post is saved.
|
460 |
+
*
|
461 |
+
* @param int $post_id The post ID.
|
462 |
+
* @param post $post The post object.
|
463 |
+
* @param bool $update Whether this is an existing post being updated or not.
|
464 |
+
* @since 1.4.7
|
465 |
+
*/
|
466 |
+
function schema_save_categories( $post_id, $post, $update ) {
|
467 |
+
|
468 |
+
if( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
469 |
+
|| ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )
|
470 |
+
return;
|
471 |
+
|
472 |
+
$slug = 'schema';
|
473 |
+
|
474 |
+
// If this isn't a 'schema' post, don't update it.
|
475 |
+
if ( $slug != $post->post_type ) {
|
476 |
+
return;
|
477 |
+
}
|
478 |
+
|
479 |
+
// If this is just a revision, don't save ref.
|
480 |
+
if ( wp_is_post_revision( $post_id ) )
|
481 |
+
return;
|
482 |
+
|
483 |
+
// - Update the post's metadata.
|
484 |
+
$post_categories = schema_wp_get_categories( $post_id );
|
485 |
+
|
486 |
+
update_post_meta($post_id, '_schema_categories', $post_categories);
|
487 |
+
}
|
488 |
+
|
489 |
+
/**
|
490 |
+
* Get categories as a comma separated keywords
|
491 |
+
*
|
492 |
+
* @since 1.6.9.8
|
493 |
+
* @return string
|
494 |
+
*/
|
495 |
+
function schema_wp_get_categories_as_keywords() {
|
496 |
+
|
497 |
+
$categories = get_categories( array(
|
498 |
+
'orderby' => 'name',
|
499 |
+
'order' => 'ASC'
|
500 |
+
) );
|
501 |
+
|
502 |
+
$cat = array();
|
503 |
+
|
504 |
+
foreach ( $categories as $category ) {
|
505 |
+
$cat[] = $category->name;
|
506 |
+
}
|
507 |
+
|
508 |
+
// transform into a comma separated string
|
509 |
+
$cat = implode(", ", $cat);
|
510 |
+
|
511 |
+
return apply_filters( 'schema_wp_get_categories', $cat );
|
512 |
+
}
|
513 |
+
|
514 |
+
/**
|
515 |
+
* Get supported Article types
|
516 |
+
*
|
517 |
+
* @since 1.5.3
|
518 |
+
* @return array
|
519 |
+
*/
|
520 |
+
function schema_wp_get_support_article_types() {
|
521 |
+
|
522 |
+
$support_article_types = array( 'Article', 'BlogPosting', 'NewsArticle', 'Report', 'ScholarlyArticle', 'TechArticle' );
|
523 |
+
|
524 |
+
return apply_filters( 'schema_wp_support_article_types', $support_article_types );
|
525 |
+
}
|
526 |
+
|
527 |
+
/**
|
528 |
+
* Get time Seconds in ISO format
|
529 |
+
*
|
530 |
+
* @link http://stackoverflow.com/questions/13301142/php-how-to-convert-string-duration-to-iso-8601-duration-format-ie-30-minute
|
531 |
+
* @param string $time
|
532 |
+
* @since 1.5
|
533 |
+
* @return string The time Seconds in ISO format
|
534 |
+
*/
|
535 |
+
function schema_wp_get_time_second_to_iso8601_duration( $time ) {
|
536 |
+
|
537 |
+
$units = array(
|
538 |
+
"Y" => 365*24*3600,
|
539 |
+
"D" => 24*3600,
|
540 |
+
"H" => 3600,
|
541 |
+
"M" => 60,
|
542 |
+
"S" => 1,
|
543 |
+
);
|
544 |
+
|
545 |
+
$str = "P";
|
546 |
+
$istime = false;
|
547 |
+
|
548 |
+
foreach ($units as $unitName => &$unit) {
|
549 |
+
$quot = intval($time / $unit);
|
550 |
+
$time -= $quot * $unit;
|
551 |
+
$unit = $quot;
|
552 |
+
if ($unit > 0) {
|
553 |
+
if (!$istime && in_array($unitName, array("H", "M", "S"))) { // There may be a better way to do this
|
554 |
+
$str .= "T";
|
555 |
+
$istime = true;
|
556 |
+
}
|
557 |
+
$str .= strval($unit) . $unitName;
|
558 |
+
}
|
559 |
+
}
|
560 |
+
|
561 |
+
return $str;
|
562 |
+
}
|
563 |
+
|
564 |
+
add_action( 'save_post', 'schema_wp_clear_json_on_post_save', 10, 3 );
|
565 |
+
/**
|
566 |
+
* Clear schema json on post save
|
567 |
+
*
|
568 |
+
* @param int $post_id The post ID.
|
569 |
+
* @param post $post The post object.
|
570 |
+
* @param bool $update Whether this is an existing post being updated or not.
|
571 |
+
* @since 1.5.9.8
|
572 |
+
*/
|
573 |
+
function schema_wp_clear_json_on_post_save( $post_id, $post, $update ) {
|
574 |
+
|
575 |
+
if( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
576 |
+
|| ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )
|
577 |
+
return $post_id;
|
578 |
+
|
579 |
+
$slug = 'schema';
|
580 |
+
|
581 |
+
// If this is a 'schema' post, don't update it.
|
582 |
+
if ( get_post_type( $post_id ) == $slug ) {
|
583 |
+
return $post_id;
|
584 |
+
}
|
585 |
+
|
586 |
+
// If this is just a revision, don't save ref.
|
587 |
+
if ( wp_is_post_revision( $post_id ) )
|
588 |
+
return $post_id;
|
589 |
+
|
590 |
+
// - Delete the post's metadata.
|
591 |
+
delete_post_meta( $post_id, '_schema_json' );
|
592 |
+
delete_post_meta( $post_id, '_schema_json_timestamp' );
|
593 |
+
|
594 |
+
// update ref
|
595 |
+
// @since 1.6
|
596 |
+
schema_wp_update_meta_ref( $post_id );
|
597 |
+
|
598 |
+
// Debug
|
599 |
+
//$msg = 'Is this un update? ';
|
600 |
+
//$msg .= $update ? 'Yes.' : 'No.';
|
601 |
+
//wp_die( $msg );
|
602 |
+
|
603 |
+
return $post_id;
|
604 |
+
}
|
605 |
+
|
606 |
+
/**
|
607 |
+
* Retrieves all the available currencies.
|
608 |
+
*
|
609 |
+
* @since 1.6.9
|
610 |
+
* @return array
|
611 |
+
*/
|
612 |
+
function schema_wp_get_currencies() {
|
613 |
+
$currencies = array(
|
614 |
+
'AUD' => __( 'Australian Dollars', 'schema-wp' ),
|
615 |
+
'BDT' => __( 'Bangladeshi Taka', 'schema-wp' ),
|
616 |
+
'BRL' => __( 'Brazilian Real', 'schema-wp' ),
|
617 |
+
'BGN' => __( 'Bulgarian Lev', 'schema-wp' ),
|
618 |
+
'CAD' => __( 'Canadian Dollars', 'schema-wp' ),
|
619 |
+
'CLP' => __( 'Chilean Peso', 'schema-wp' ),
|
620 |
+
'CNY' => __( 'Chinese Yuan', 'schema-wp' ),
|
621 |
+
'COP' => __( 'Colombian Peso', 'schema-wp' ),
|
622 |
+
'CZK' => __( 'Czech Koruna', 'schema-wp' ),
|
623 |
+
'DKK' => __( 'Danish Krone', 'schema-wp' ),
|
624 |
+
'DOP' => __( 'Dominican Peso', 'schema-wp' ),
|
625 |
+
'EUR' => __( 'Euros', 'schema-wp' ),
|
626 |
+
'HKD' => __( 'Hong Kong Dollar', 'schema-wp' ),
|
627 |
+
'HRK' => __( 'Croatia kuna', 'schema-wp' ),
|
628 |
+
'HUF' => __( 'Hungarian Forint', 'schema-wp' ),
|
629 |
+
'ISK' => __( 'Icelandic krona', 'schema-wp' ),
|
630 |
+
'IDR' => __( 'Indonesia Rupiah', 'schema-wp' ),
|
631 |
+
'INR' => __( 'Indian Rupee', 'schema-wp' ),
|
632 |
+
'NPR' => __( 'Nepali Rupee', 'schema-wp' ),
|
633 |
+
'ILS' => __( 'Israeli Shekel', 'schema-wp' ),
|
634 |
+
'JPY' => __( 'Japanese Yen', 'schema-wp' ),
|
635 |
+
'KIP' => __( 'Lao Kip', 'schema-wp' ),
|
636 |
+
'KRW' => __( 'South Korean Won', 'schema-wp' ),
|
637 |
+
'MYR' => __( 'Malaysian Ringgits', 'schema-wp' ),
|
638 |
+
'MXN' => __( 'Mexican Peso', 'schema-wp' ),
|
639 |
+
'NGN' => __( 'Nigerian Naira', 'schema-wp' ),
|
640 |
+
'NOK' => __( 'Norwegian Krone', 'schema-wp' ),
|
641 |
+
'NZD' => __( 'New Zealand Dollar', 'schema-wp' ),
|
642 |
+
'PYG' => __( 'Paraguayan Guaraní', 'schema-wp' ),
|
643 |
+
'PHP' => __( 'Philippine Pesos', 'schema-wp' ),
|
644 |
+
'PLN' => __( 'Polish Zloty', 'schema-wp' ),
|
645 |
+
'GBP' => __( 'Pounds Sterling', 'schema-wp' ),
|
646 |
+
'RON' => __( 'Romanian Leu', 'schema-wp' ),
|
647 |
+
'RUB' => __( 'Russian Ruble', 'schema-wp' ),
|
648 |
+
'SGD' => __( 'Singapore Dollar', 'schema-wp' ),
|
649 |
+
'ZAR' => __( 'South African rand', 'schema-wp' ),
|
650 |
+
'SEK' => __( 'Swedish Krona', 'schema-wp' ),
|
651 |
+
'CHF' => __( 'Swiss Franc', 'schema-wp' ),
|
652 |
+
'TWD' => __( 'Taiwan New Dollars', 'schema-wp' ),
|
653 |
+
'THB' => __( 'Thai Baht', 'schema-wp' ),
|
654 |
+
'TRY' => __( 'Turkish Lira', 'schema-wp' ),
|
655 |
+
'USD' => __( 'US Dollars', 'schema-wp' ),
|
656 |
+
'VND' => __( 'Vietnamese Dong', 'schema-wp' ),
|
657 |
+
'EGP' => __( 'Egyptian Pound', 'schema-wp' ),
|
658 |
+
);
|
659 |
+
|
660 |
+
return apply_filters( 'schema_wp_currencies', $currencies );
|
661 |
+
}
|
662 |
+
|
663 |
+
/**
|
664 |
+
* Retrieves symbol of the given currency.
|
665 |
+
*
|
666 |
+
* @since 1.6.9
|
667 |
+
*
|
668 |
+
* @param string $currency Currency code.
|
669 |
+
*
|
670 |
+
* @return string $currency_symbol Currency symbol.
|
671 |
+
*/
|
672 |
+
function schema_wp_get_currency_symbol( $currency ) {
|
673 |
+
switch ( $currency ) {
|
674 |
+
case 'BDT':
|
675 |
+
$currency_symbol = '৳ ';
|
676 |
+
break;
|
677 |
+
case 'BRL' :
|
678 |
+
$currency_symbol = 'R$';
|
679 |
+
break;
|
680 |
+
case 'BGN' :
|
681 |
+
$currency_symbol = 'лв.';
|
682 |
+
break;
|
683 |
+
case 'AUD' :
|
684 |
+
case 'CAD' :
|
685 |
+
case 'CLP' :
|
686 |
+
case 'COP' :
|
687 |
+
case 'MXN' :
|
688 |
+
case 'NZD' :
|
689 |
+
case 'HKD' :
|
690 |
+
case 'SGD' :
|
691 |
+
case 'USD' :
|
692 |
+
$currency_symbol = '$';
|
693 |
+
break;
|
694 |
+
case 'EUR' :
|
695 |
+
$currency_symbol = '€';
|
696 |
+
break;
|
697 |
+
case 'CNY' :
|
698 |
+
case 'RMB' :
|
699 |
+
case 'JPY' :
|
700 |
+
$currency_symbol = '¥';
|
701 |
+
break;
|
702 |
+
case 'RUB' :
|
703 |
+
$currency_symbol = 'руб.';
|
704 |
+
break;
|
705 |
+
case 'KRW' :
|
706 |
+
$currency_symbol = '₩';
|
707 |
+
break;
|
708 |
+
case 'PYG' :
|
709 |
+
$currency_symbol = '₲';
|
710 |
+
break;
|
711 |
+
case 'TRY' :
|
712 |
+
$currency_symbol = '₺';
|
713 |
+
break;
|
714 |
+
case 'NOK' :
|
715 |
+
$currency_symbol = 'kr';
|
716 |
+
break;
|
717 |
+
case 'ZAR' :
|
718 |
+
$currency_symbol = 'R';
|
719 |
+
break;
|
720 |
+
case 'CZK' :
|
721 |
+
$currency_symbol = 'Kč';
|
722 |
+
break;
|
723 |
+
case 'MYR' :
|
724 |
+
$currency_symbol = 'RM';
|
725 |
+
break;
|
726 |
+
case 'DKK' :
|
727 |
+
$currency_symbol = 'kr.';
|
728 |
+
break;
|
729 |
+
case 'HUF' :
|
730 |
+
$currency_symbol = 'Ft';
|
731 |
+
break;
|
732 |
+
case 'IDR' :
|
733 |
+
$currency_symbol = 'Rp';
|
734 |
+
break;
|
735 |
+
case 'INR' :
|
736 |
+
$currency_symbol = '₹';
|
737 |
+
break;
|
738 |
+
case 'NPR' :
|
739 |
+
$currency_symbol = 'Rs.';
|
740 |
+
break;
|
741 |
+
case 'ISK' :
|
742 |
+
$currency_symbol = 'Kr.';
|
743 |
+
break;
|
744 |
+
case 'ILS' :
|
745 |
+
$currency_symbol = '₪';
|
746 |
+
break;
|
747 |
+
case 'PHP' :
|
748 |
+
$currency_symbol = '₱';
|
749 |
+
break;
|
750 |
+
case 'PLN' :
|
751 |
+
$currency_symbol = 'zł';
|
752 |
+
break;
|
753 |
+
case 'SEK' :
|
754 |
+
$currency_symbol = 'kr';
|
755 |
+
break;
|
756 |
+
case 'CHF' :
|
757 |
+
$currency_symbol = 'CHF';
|
758 |
+
break;
|
759 |
+
case 'TWD' :
|
760 |
+
$currency_symbol = 'NT$';
|
761 |
+
break;
|
762 |
+
case 'THB' :
|
763 |
+
$currency_symbol = '฿';
|
764 |
+
break;
|
765 |
+
case 'GBP' :
|
766 |
+
$currency_symbol = '£';
|
767 |
+
break;
|
768 |
+
case 'RON' :
|
769 |
+
$currency_symbol = 'lei';
|
770 |
+
break;
|
771 |
+
case 'VND' :
|
772 |
+
$currency_symbol = '₫';
|
773 |
+
break;
|
774 |
+
case 'NGN' :
|
775 |
+
$currency_symbol = '₦';
|
776 |
+
break;
|
777 |
+
case 'HRK' :
|
778 |
+
$currency_symbol = 'Kn';
|
779 |
+
break;
|
780 |
+
case 'EGP' :
|
781 |
+
$currency_symbol = 'EGP';
|
782 |
+
break;
|
783 |
+
case 'DOP' :
|
784 |
+
$currency_symbol = 'RD$';
|
785 |
+
break;
|
786 |
+
case 'KIP' :
|
787 |
+
$currency_symbol = '₭';
|
788 |
+
break;
|
789 |
+
default :
|
790 |
+
$currency_symbol = $currency;
|
791 |
+
break;
|
792 |
+
}
|
793 |
+
|
794 |
+
return apply_filters( 'schema_wp_currency_symbol', $currency_symbol, $currency );
|
795 |
+
}
|
796 |
+
|
797 |
+
/**
|
798 |
+
* Get archive link
|
799 |
+
*
|
800 |
+
* @param string $post_type for custom post type
|
801 |
+
* @since 1.6.9.8
|
802 |
+
* @return string
|
803 |
+
*/
|
804 |
+
function schema_wp_get_archive_link( $post_type ) {
|
805 |
+
global $wp_post_types;
|
806 |
+
$archive_link = false;
|
807 |
+
if (isset($wp_post_types[$post_type])) {
|
808 |
+
$wp_post_type = $wp_post_types[$post_type];
|
809 |
+
if ($wp_post_type->publicly_queryable)
|
810 |
+
if ($wp_post_type->has_archive && $wp_post_type->has_archive!==true)
|
811 |
+
$slug = $wp_post_type->has_archive;
|
812 |
+
else if (isset($wp_post_type->rewrite['slug']))
|
813 |
+
$slug = $wp_post_type->rewrite['slug'];
|
814 |
+
else
|
815 |
+
$slug = $post_type;
|
816 |
+
$archive_link = get_option( 'siteurl' ) . "/{$slug}/";
|
817 |
+
}
|
818 |
+
return apply_filters( 'schema_wp_archive_link', $archive_link, $post_type );
|
819 |
+
}
|
820 |
+
|
821 |
+
/**
|
822 |
+
* Get blog posts page URL.
|
823 |
+
*
|
824 |
+
* @source https://gist.github.com/kellenmace/9ef19dd86580cb7e63720b396c8c2721
|
825 |
+
* @since 1.6.9.8
|
826 |
+
* @return string The blog posts page URL.
|
827 |
+
*/
|
828 |
+
function schema_wp_get_blog_posts_page_url() {
|
829 |
+
// If front page is set to display a static page, get the URL of the posts page.
|
830 |
+
if ( 'page' === get_option( 'show_on_front' ) ) {
|
831 |
+
return get_permalink( get_option( 'page_for_posts' ) );
|
832 |
+
}
|
833 |
+
// The front page IS the posts page. Get its URL.
|
834 |
+
return get_home_url();
|
835 |
+
}
|
836 |
+
|
837 |
+
/**
|
838 |
+
* Get First Post Date Function
|
839 |
+
*
|
840 |
+
* @since 1.6.9.8
|
841 |
+
* @param $format Type of date format to return, using PHP date standard, default Y-m-d
|
842 |
+
* @return Date of first post
|
843 |
+
*/
|
844 |
+
function schema_wp_first_post_date( $format = 'Y-m-d' ) {
|
845 |
+
// Setup get_posts arguments
|
846 |
+
$ax_args = array(
|
847 |
+
'numberposts' => -1,
|
848 |
+
'post_status' => 'publish',
|
849 |
+
'order' => 'ASC'
|
850 |
+
);
|
851 |
+
|
852 |
+
// Get all posts in order of first to last
|
853 |
+
$ax_get_all = get_posts($ax_args);
|
854 |
+
|
855 |
+
// Extract first post from array
|
856 |
+
$ax_first_post = $ax_get_all[0];
|
857 |
+
|
858 |
+
// Assign first post date to var
|
859 |
+
$ax_first_post_date = $ax_first_post->post_date;
|
860 |
+
|
861 |
+
// return date in required format
|
862 |
+
$output = date($format, strtotime($ax_first_post_date));
|
863 |
+
|
864 |
+
return $output;
|
865 |
+
}
|
includes/scripts.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Load the frontend scripts and styles
|
5 |
+
*
|
6 |
+
* This is not used since there is no scripts to load on front-end
|
7 |
+
*
|
8 |
+
* @since 1.0
|
9 |
+
* @return void
|
10 |
+
*/
|
11 |
+
function schema_wp_frontend_scripts_and_styles() {
|
12 |
+
|
13 |
+
global $post;
|
14 |
+
|
15 |
+
if ( ! is_object( $post ) ) {
|
16 |
+
return;
|
17 |
+
}
|
18 |
+
|
19 |
+
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
|
20 |
+
|
21 |
+
}
|
22 |
+
//add_action( 'wp_enqueue_scripts', 'schema_wp_frontend_scripts_and_styles' );
|
license.txt
ADDED
@@ -0,0 +1,661 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU AFFERO GENERAL PUBLIC LICENSE
|
2 |
+
Version 3, 19 November 2007
|
3 |
+
|
4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
6 |
+
of this license document, but changing it is not allowed.
|
7 |
+
|
8 |
+
Preamble
|
9 |
+
|
10 |
+
The GNU Affero General Public License is a free, copyleft license for
|
11 |
+
software and other kinds of works, specifically designed to ensure
|
12 |
+
cooperation with the community in the case of network server software.
|
13 |
+
|
14 |
+
The licenses for most software and other practical works are designed
|
15 |
+
to take away your freedom to share and change the works. By contrast,
|
16 |
+
our General Public Licenses are intended to guarantee your freedom to
|
17 |
+
share and change all versions of a program--to make sure it remains free
|
18 |
+
software for all its users.
|
19 |
+
|
20 |
+
When we speak of free software, we are referring to freedom, not
|
21 |
+
price. Our General Public Licenses are designed to make sure that you
|
22 |
+
have the freedom to distribute copies of free software (and charge for
|
23 |
+
them if you wish), that you receive source code or can get it if you
|
24 |
+
want it, that you can change the software or use pieces of it in new
|
25 |
+
free programs, and that you know you can do these things.
|
26 |
+
|
27 |
+
Developers that use our General Public Licenses protect your rights
|
28 |
+
with two steps: (1) assert copyright on the software, and (2) offer
|
29 |
+
you this License which gives you legal permission to copy, distribute
|
30 |
+
and/or modify the software.
|
31 |
+
|
32 |
+
A secondary benefit of defending all users' freedom is that
|
33 |
+
improvements made in alternate versions of the program, if they
|
34 |
+
receive widespread use, become available for other developers to
|
35 |
+
incorporate. Many developers of free software are heartened and
|
36 |
+
encouraged by the resulting cooperation. However, in the case of
|
37 |
+
software used on network servers, this result may fail to come about.
|
38 |
+
The GNU General Public License permits making a modified version and
|
39 |
+
letting the public access it on a server without ever releasing its
|
40 |
+
source code to the public.
|
41 |
+
|
42 |
+
The GNU Affero General Public License is designed specifically to
|
43 |
+
ensure that, in such cases, the modified source code becomes available
|
44 |
+
to the community. It requires the operator of a network server to
|
45 |
+
provide the source code of the modified version running there to the
|
46 |
+
users of that server. Therefore, public use of a modified version, on
|
47 |
+
a publicly accessible server, gives the public access to the source
|
48 |
+
code of the modified version.
|
49 |
+
|
50 |
+
An older license, called the Affero General Public License and
|
51 |
+
published by Affero, was designed to accomplish similar goals. This is
|
52 |
+
a different license, not a version of the Affero GPL, but Affero has
|
53 |
+
released a new version of the Affero GPL which permits relicensing under
|
54 |
+
this license.
|
55 |
+
|
56 |
+
The precise terms and conditions for copying, distribution and
|
57 |
+
modification follow.
|
58 |
+
|
59 |
+
TERMS AND CONDITIONS
|
60 |
+
|
61 |
+
0. Definitions.
|
62 |
+
|
63 |
+
"This License" refers to version 3 of the GNU Affero General Public License.
|
64 |
+
|
65 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
66 |
+
works, such as semiconductor masks.
|
67 |
+
|
68 |
+
"The Program" refers to any copyrightable work licensed under this
|
69 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
70 |
+
"recipients" may be individuals or organizations.
|
71 |
+
|
72 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
73 |
+
in a fashion requiring copyright permission, other than the making of an
|
74 |
+
exact copy. The resulting work is called a "modified version" of the
|
75 |
+
earlier work or a work "based on" the earlier work.
|
76 |
+
|
77 |
+
A "covered work" means either the unmodified Program or a work based
|
78 |
+
on the Program.
|
79 |
+
|
80 |
+
To "propagate" a work means to do anything with it that, without
|
81 |
+
permission, would make you directly or secondarily liable for
|
82 |
+
infringement under applicable copyright law, except executing it on a
|
83 |
+
computer or modifying a private copy. Propagation includes copying,
|
84 |
+
distribution (with or without modification), making available to the
|
85 |
+
public, and in some countries other activities as well.
|
86 |
+
|
87 |
+
To "convey" a work means any kind of propagation that enables other
|
88 |
+
parties to make or receive copies. Mere interaction with a user through
|
89 |
+
a computer network, with no transfer of a copy, is not conveying.
|
90 |
+
|
91 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
92 |
+
to the extent that it includes a convenient and prominently visible
|
93 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
94 |
+
tells the user that there is no warranty for the work (except to the
|
95 |
+
extent that warranties are provided), that licensees may convey the
|
96 |
+
work under this License, and how to view a copy of this License. If
|
97 |
+
the interface presents a list of user commands or options, such as a
|
98 |
+
menu, a prominent item in the list meets this criterion.
|
99 |
+
|
100 |
+
1. Source Code.
|
101 |
+
|
102 |
+
The "source code" for a work means the preferred form of the work
|
103 |
+
for making modifications to it. "Object code" means any non-source
|
104 |
+
form of a work.
|
105 |
+
|
106 |
+
A "Standard Interface" means an interface that either is an official
|
107 |
+
standard defined by a recognized standards body, or, in the case of
|
108 |
+
interfaces specified for a particular programming language, one that
|
109 |
+
is widely used among developers working in that language.
|
110 |
+
|
111 |
+
The "System Libraries" of an executable work include anything, other
|
112 |
+
than the work as a whole, that (a) is included in the normal form of
|
113 |
+
packaging a Major Component, but which is not part of that Major
|
114 |
+
Component, and (b) serves only to enable use of the work with that
|
115 |
+
Major Component, or to implement a Standard Interface for which an
|
116 |
+
implementation is available to the public in source code form. A
|
117 |
+
"Major Component", in this context, means a major essential component
|
118 |
+
(kernel, window system, and so on) of the specific operating system
|
119 |
+
(if any) on which the executable work runs, or a compiler used to
|
120 |
+
produce the work, or an object code interpreter used to run it.
|
121 |
+
|
122 |
+
The "Corresponding Source" for a work in object code form means all
|
123 |
+
the source code needed to generate, install, and (for an executable
|
124 |
+
work) run the object code and to modify the work, including scripts to
|
125 |
+
control those activities. However, it does not include the work's
|
126 |
+
System Libraries, or general-purpose tools or generally available free
|
127 |
+
programs which are used unmodified in performing those activities but
|
128 |
+
which are not part of the work. For example, Corresponding Source
|
129 |
+
includes interface definition files associated with source files for
|
130 |
+
the work, and the source code for shared libraries and dynamically
|
131 |
+
linked subprograms that the work is specifically designed to require,
|
132 |
+
such as by intimate data communication or control flow between those
|
133 |
+
subprograms and other parts of the work.
|
134 |
+
|
135 |
+
The Corresponding Source need not include anything that users
|
136 |
+
can regenerate automatically from other parts of the Corresponding
|
137 |
+
Source.
|
138 |
+
|
139 |
+
The Corresponding Source for a work in source code form is that
|
140 |
+
same work.
|
141 |
+
|
142 |
+
2. Basic Permissions.
|
143 |
+
|
144 |
+
All rights granted under this License are granted for the term of
|
145 |
+
copyright on the Program, and are irrevocable provided the stated
|
146 |
+
conditions are met. This License explicitly affirms your unlimited
|
147 |
+
permission to run the unmodified Program. The output from running a
|
148 |
+
covered work is covered by this License only if the output, given its
|
149 |
+
content, constitutes a covered work. This License acknowledges your
|
150 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
151 |
+
|
152 |
+
You may make, run and propagate covered works that you do not
|
153 |
+
convey, without conditions so long as your license otherwise remains
|
154 |
+
in force. You may convey covered works to others for the sole purpose
|
155 |
+
of having them make modifications exclusively for you, or provide you
|
156 |
+
with facilities for running those works, provided that you comply with
|
157 |
+
the terms of this License in conveying all material for which you do
|
158 |
+
not control copyright. Those thus making or running the covered works
|
159 |
+
for you must do so exclusively on your behalf, under your direction
|
160 |
+
and control, on terms that prohibit them from making any copies of
|
161 |
+
your copyrighted material outside their relationship with you.
|
162 |
+
|
163 |
+
Conveying under any other circumstances is permitted solely under
|
164 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
165 |
+
makes it unnecessary.
|
166 |
+
|
167 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
168 |
+
|
169 |
+
No covered work shall be deemed part of an effective technological
|
170 |
+
measure under any applicable law fulfilling obligations under article
|
171 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
172 |
+
similar laws prohibiting or restricting circumvention of such
|
173 |
+
measures.
|
174 |
+
|
175 |
+
When you convey a covered work, you waive any legal power to forbid
|
176 |
+
circumvention of technological measures to the extent such circumvention
|
177 |
+
is effected by exercising rights under this License with respect to
|
178 |
+
the covered work, and you disclaim any intention to limit operation or
|
179 |
+
modification of the work as a means of enforcing, against the work's
|
180 |
+
users, your or third parties' legal rights to forbid circumvention of
|
181 |
+
technological measures.
|
182 |
+
|
183 |
+
4. Conveying Verbatim Copies.
|
184 |
+
|
185 |
+
You may convey verbatim copies of the Program's source code as you
|
186 |
+
receive it, in any medium, provided that you conspicuously and
|
187 |
+
appropriately publish on each copy an appropriate copyright notice;
|
188 |
+
keep intact all notices stating that this License and any
|
189 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
190 |
+
keep intact all notices of the absence of any warranty; and give all
|
191 |
+
recipients a copy of this License along with the Program.
|
192 |
+
|
193 |
+
You may charge any price or no price for each copy that you convey,
|
194 |
+
and you may offer support or warranty protection for a fee.
|
195 |
+
|
196 |
+
5. Conveying Modified Source Versions.
|
197 |
+
|
198 |
+
You may convey a work based on the Program, or the modifications to
|
199 |
+
produce it from the Program, in the form of source code under the
|
200 |
+
terms of section 4, provided that you also meet all of these conditions:
|
201 |
+
|
202 |
+
a) The work must carry prominent notices stating that you modified
|
203 |
+
it, and giving a relevant date.
|
204 |
+
|
205 |
+
b) The work must carry prominent notices stating that it is
|
206 |
+
released under this License and any conditions added under section
|
207 |
+
7. This requirement modifies the requirement in section 4 to
|
208 |
+
"keep intact all notices".
|
209 |
+
|
210 |
+
c) You must license the entire work, as a whole, under this
|
211 |
+
License to anyone who comes into possession of a copy. This
|
212 |
+
License will therefore apply, along with any applicable section 7
|
213 |
+
additional terms, to the whole of the work, and all its parts,
|
214 |
+
regardless of how they are packaged. This License gives no
|
215 |
+
permission to license the work in any other way, but it does not
|
216 |
+
invalidate such permission if you have separately received it.
|
217 |
+
|
218 |
+
d) If the work has interactive user interfaces, each must display
|
219 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
220 |
+
interfaces that do not display Appropriate Legal Notices, your
|
221 |
+
work need not make them do so.
|
222 |
+
|
223 |
+
A compilation of a covered work with other separate and independent
|
224 |
+
works, which are not by their nature extensions of the covered work,
|
225 |
+
and which are not combined with it such as to form a larger program,
|
226 |
+
in or on a volume of a storage or distribution medium, is called an
|
227 |
+
"aggregate" if the compilation and its resulting copyright are not
|
228 |
+
used to limit the access or legal rights of the compilation's users
|
229 |
+
beyond what the individual works permit. Inclusion of a covered work
|
230 |
+
in an aggregate does not cause this License to apply to the other
|
231 |
+
parts of the aggregate.
|
232 |
+
|
233 |
+
6. Conveying Non-Source Forms.
|
234 |
+
|
235 |
+
You may convey a covered work in object code form under the terms
|
236 |
+
of sections 4 and 5, provided that you also convey the
|
237 |
+
machine-readable Corresponding Source under the terms of this License,
|
238 |
+
in one of these ways:
|
239 |
+
|
240 |
+
a) Convey the object code in, or embodied in, a physical product
|
241 |
+
(including a physical distribution medium), accompanied by the
|
242 |
+
Corresponding Source fixed on a durable physical medium
|
243 |
+
customarily used for software interchange.
|
244 |
+
|
245 |
+
b) Convey the object code in, or embodied in, a physical product
|
246 |
+
(including a physical distribution medium), accompanied by a
|
247 |
+
written offer, valid for at least three years and valid for as
|
248 |
+
long as you offer spare parts or customer support for that product
|
249 |
+
model, to give anyone who possesses the object code either (1) a
|
250 |
+
copy of the Corresponding Source for all the software in the
|
251 |
+
product that is covered by this License, on a durable physical
|
252 |
+
medium customarily used for software interchange, for a price no
|
253 |
+
more than your reasonable cost of physically performing this
|
254 |
+
conveying of source, or (2) access to copy the
|
255 |
+
Corresponding Source from a network server at no charge.
|
256 |
+
|
257 |
+
c) Convey individual copies of the object code with a copy of the
|
258 |
+
written offer to provide the Corresponding Source. This
|
259 |
+
alternative is allowed only occasionally and noncommercially, and
|
260 |
+
only if you received the object code with such an offer, in accord
|
261 |
+
with subsection 6b.
|
262 |
+
|
263 |
+
d) Convey the object code by offering access from a designated
|
264 |
+
place (gratis or for a charge), and offer equivalent access to the
|
265 |
+
Corresponding Source in the same way through the same place at no
|
266 |
+
further charge. You need not require recipients to copy the
|
267 |
+
Corresponding Source along with the object code. If the place to
|
268 |
+
copy the object code is a network server, the Corresponding Source
|
269 |
+
may be on a different server (operated by you or a third party)
|
270 |
+
that supports equivalent copying facilities, provided you maintain
|
271 |
+
clear directions next to the object code saying where to find the
|
272 |
+
Corresponding Source. Regardless of what server hosts the
|
273 |
+
Corresponding Source, you remain obligated to ensure that it is
|
274 |
+
available for as long as needed to satisfy these requirements.
|
275 |
+
|
276 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
277 |
+
you inform other peers where the object code and Corresponding
|
278 |
+
Source of the work are being offered to the general public at no
|
279 |
+
charge under subsection 6d.
|
280 |
+
|
281 |
+
A separable portion of the object code, whose source code is excluded
|
282 |
+
from the Corresponding Source as a System Library, need not be
|
283 |
+
included in conveying the object code work.
|
284 |
+
|
285 |
+
A "User Product" is either (1) a "consumer product", which means any
|
286 |
+
tangible personal property which is normally used for personal, family,
|
287 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
288 |
+
into a dwelling. In determining whether a product is a consumer product,
|
289 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
290 |
+
product received by a particular user, "normally used" refers to a
|
291 |
+
typical or common use of that class of product, regardless of the status
|
292 |
+
of the particular user or of the way in which the particular user
|
293 |
+
actually uses, or expects or is expected to use, the product. A product
|
294 |
+
is a consumer product regardless of whether the product has substantial
|
295 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
296 |
+
the only significant mode of use of the product.
|
297 |
+
|
298 |
+
"Installation Information" for a User Product means any methods,
|
299 |
+
procedures, authorization keys, or other information required to install
|
300 |
+
and execute modified versions of a covered work in that User Product from
|
301 |
+
a modified version of its Corresponding Source. The information must
|
302 |
+
suffice to ensure that the continued functioning of the modified object
|
303 |
+
code is in no case prevented or interfered with solely because
|
304 |
+
modification has been made.
|
305 |
+
|
306 |
+
If you convey an object code work under this section in, or with, or
|
307 |
+
specifically for use in, a User Product, and the conveying occurs as
|
308 |
+
part of a transaction in which the right of possession and use of the
|
309 |
+
User Product is transferred to the recipient in perpetuity or for a
|
310 |
+
fixed term (regardless of how the transaction is characterized), the
|
311 |
+
Corresponding Source conveyed under this section must be accompanied
|
312 |
+
by the Installation Information. But this requirement does not apply
|
313 |
+
if neither you nor any third party retains the ability to install
|
314 |
+
modified object code on the User Product (for example, the work has
|
315 |
+
been installed in ROM).
|
316 |
+
|
317 |
+
The requirement to provide Installation Information does not include a
|
318 |
+
requirement to continue to provide support service, warranty, or updates
|
319 |
+
for a work that has been modified or installed by the recipient, or for
|
320 |
+
the User Product in which it has been modified or installed. Access to a
|
321 |
+
network may be denied when the modification itself materially and
|
322 |
+
adversely affects the operation of the network or violates the rules and
|
323 |
+
protocols for communication across the network.
|
324 |
+
|
325 |
+
Corresponding Source conveyed, and Installation Information provided,
|
326 |
+
in accord with this section must be in a format that is publicly
|
327 |
+
documented (and with an implementation available to the public in
|
328 |
+
source code form), and must require no special password or key for
|
329 |
+
unpacking, reading or copying.
|
330 |
+
|
331 |
+
7. Additional Terms.
|
332 |
+
|
333 |
+
"Additional permissions" are terms that supplement the terms of this
|
334 |
+
License by making exceptions from one or more of its conditions.
|
335 |
+
Additional permissions that are applicable to the entire Program shall
|
336 |
+
be treated as though they were included in this License, to the extent
|
337 |
+
that they are valid under applicable law. If additional permissions
|
338 |
+
apply only to part of the Program, that part may be used separately
|
339 |
+
under those permissions, but the entire Program remains governed by
|
340 |
+
this License without regard to the additional permissions.
|
341 |
+
|
342 |
+
When you convey a copy of a covered work, you may at your option
|
343 |
+
remove any additional permissions from that copy, or from any part of
|
344 |
+
it. (Additional permissions may be written to require their own
|
345 |
+
removal in certain cases when you modify the work.) You may place
|
346 |
+
additional permissions on material, added by you to a covered work,
|
347 |
+
for which you have or can give appropriate copyright permission.
|
348 |
+
|
349 |
+
Notwithstanding any other provision of this License, for material you
|
350 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
351 |
+
that material) supplement the terms of this License with terms:
|
352 |
+
|
353 |
+
a) Disclaiming warranty or limiting liability differently from the
|
354 |
+
terms of sections 15 and 16 of this License; or
|
355 |
+
|
356 |
+
b) Requiring preservation of specified reasonable legal notices or
|
357 |
+
author attributions in that material or in the Appropriate Legal
|
358 |
+
Notices displayed by works containing it; or
|
359 |
+
|
360 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
361 |
+
requiring that modified versions of such material be marked in
|
362 |
+
reasonable ways as different from the original version; or
|
363 |
+
|
364 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
365 |
+
authors of the material; or
|
366 |
+
|
367 |
+
e) Declining to grant rights under trademark law for use of some
|
368 |
+
trade names, trademarks, or service marks; or
|
369 |
+
|
370 |
+
f) Requiring indemnification of licensors and authors of that
|
371 |
+
material by anyone who conveys the material (or modified versions of
|
372 |
+
it) with contractual assumptions of liability to the recipient, for
|
373 |
+
any liability that these contractual assumptions directly impose on
|
374 |
+
those licensors and authors.
|
375 |
+
|
376 |
+
All other non-permissive additional terms are considered "further
|
377 |
+
restrictions" within the meaning of section 10. If the Program as you
|
378 |
+
received it, or any part of it, contains a notice stating that it is
|
379 |
+
governed by this License along with a term that is a further
|
380 |
+
restriction, you may remove that term. If a license document contains
|
381 |
+
a further restriction but permits relicensing or conveying under this
|
382 |
+
License, you may add to a covered work material governed by the terms
|
383 |
+
of that license document, provided that the further restriction does
|
384 |
+
not survive such relicensing or conveying.
|
385 |
+
|
386 |
+
If you add terms to a covered work in accord with this section, you
|
387 |
+
must place, in the relevant source files, a statement of the
|
388 |
+
additional terms that apply to those files, or a notice indicating
|
389 |
+
where to find the applicable terms.
|
390 |
+
|
391 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
392 |
+
form of a separately written license, or stated as exceptions;
|
393 |
+
the above requirements apply either way.
|
394 |
+
|
395 |
+
8. Termination.
|
396 |
+
|
397 |
+
You may not propagate or modify a covered work except as expressly
|
398 |
+
provided under this License. Any attempt otherwise to propagate or
|
399 |
+
modify it is void, and will automatically terminate your rights under
|
400 |
+
this License (including any patent licenses granted under the third
|
401 |
+
paragraph of section 11).
|
402 |
+
|
403 |
+
However, if you cease all violation of this License, then your
|
404 |
+
license from a particular copyright holder is reinstated (a)
|
405 |
+
provisionally, unless and until the copyright holder explicitly and
|
406 |
+
finally terminates your license, and (b) permanently, if the copyright
|
407 |
+
holder fails to notify you of the violation by some reasonable means
|
408 |
+
prior to 60 days after the cessation.
|
409 |
+
|
410 |
+
Moreover, your license from a particular copyright holder is
|
411 |
+
reinstated permanently if the copyright holder notifies you of the
|
412 |
+
violation by some reasonable means, this is the first time you have
|
413 |
+
received notice of violation of this License (for any work) from that
|
414 |
+
copyright holder, and you cure the violation prior to 30 days after
|
415 |
+
your receipt of the notice.
|
416 |
+
|
417 |
+
Termination of your rights under this section does not terminate the
|
418 |
+
licenses of parties who have received copies or rights from you under
|
419 |
+
this License. If your rights have been terminated and not permanently
|
420 |
+
reinstated, you do not qualify to receive new licenses for the same
|
421 |
+
material under section 10.
|
422 |
+
|
423 |
+
9. Acceptance Not Required for Having Copies.
|
424 |
+
|
425 |
+
You are not required to accept this License in order to receive or
|
426 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
427 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
428 |
+
to receive a copy likewise does not require acceptance. However,
|
429 |
+
nothing other than this License grants you permission to propagate or
|
430 |
+
modify any covered work. These actions infringe copyright if you do
|
431 |
+
not accept this License. Therefore, by modifying or propagating a
|
432 |
+
covered work, you indicate your acceptance of this License to do so.
|
433 |
+
|
434 |
+
10. Automatic Licensing of Downstream Recipients.
|
435 |
+
|
436 |
+
Each time you convey a covered work, the recipient automatically
|
437 |
+
receives a license from the original licensors, to run, modify and
|
438 |
+
propagate that work, subject to this License. You are not responsible
|
439 |
+
for enforcing compliance by third parties with this License.
|
440 |
+
|
441 |
+
An "entity transaction" is a transaction transferring control of an
|
442 |
+
organization, or substantially all assets of one, or subdividing an
|
443 |
+
organization, or merging organizations. If propagation of a covered
|
444 |
+
work results from an entity transaction, each party to that
|
445 |
+
transaction who receives a copy of the work also receives whatever
|
446 |
+
licenses to the work the party's predecessor in interest had or could
|
447 |
+
give under the previous paragraph, plus a right to possession of the
|
448 |
+
Corresponding Source of the work from the predecessor in interest, if
|
449 |
+
the predecessor has it or can get it with reasonable efforts.
|
450 |
+
|
451 |
+
You may not impose any further restrictions on the exercise of the
|
452 |
+
rights granted or affirmed under this License. For example, you may
|
453 |
+
not impose a license fee, royalty, or other charge for exercise of
|
454 |
+
rights granted under this License, and you may not initiate litigation
|
455 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
456 |
+
any patent claim is infringed by making, using, selling, offering for
|
457 |
+
sale, or importing the Program or any portion of it.
|
458 |
+
|
459 |
+
11. Patents.
|
460 |
+
|
461 |
+
A "contributor" is a copyright holder who authorizes use under this
|
462 |
+
License of the Program or a work on which the Program is based. The
|
463 |
+
work thus licensed is called the contributor's "contributor version".
|
464 |
+
|
465 |
+
A contributor's "essential patent claims" are all patent claims
|
466 |
+
owned or controlled by the contributor, whether already acquired or
|
467 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
468 |
+
by this License, of making, using, or selling its contributor version,
|
469 |
+
but do not include claims that would be infringed only as a
|
470 |
+
consequence of further modification of the contributor version. For
|
471 |
+
purposes of this definition, "control" includes the right to grant
|
472 |
+
patent sublicenses in a manner consistent with the requirements of
|
473 |
+
this License.
|
474 |
+
|
475 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
476 |
+
patent license under the contributor's essential patent claims, to
|
477 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
478 |
+
propagate the contents of its contributor version.
|
479 |
+
|
480 |
+
In the following three paragraphs, a "patent license" is any express
|
481 |
+
agreement or commitment, however denominated, not to enforce a patent
|
482 |
+
(such as an express permission to practice a patent or covenant not to
|
483 |
+
sue for patent infringement). To "grant" such a patent license to a
|
484 |
+
party means to make such an agreement or commitment not to enforce a
|
485 |
+
patent against the party.
|
486 |
+
|
487 |
+
If you convey a covered work, knowingly relying on a patent license,
|
488 |
+
and the Corresponding Source of the work is not available for anyone
|
489 |
+
to copy, free of charge and under the terms of this License, through a
|
490 |
+
publicly available network server or other readily accessible means,
|
491 |
+
then you must either (1) cause the Corresponding Source to be so
|
492 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
493 |
+
patent license for this particular work, or (3) arrange, in a manner
|
494 |
+
consistent with the requirements of this License, to extend the patent
|
495 |
+
license to downstream recipients. "Knowingly relying" means you have
|
496 |
+
actual knowledge that, but for the patent license, your conveying the
|
497 |
+
covered work in a country, or your recipient's use of the covered work
|
498 |
+
in a country, would infringe one or more identifiable patents in that
|
499 |
+
country that you have reason to believe are valid.
|
500 |
+
|
501 |
+
If, pursuant to or in connection with a single transaction or
|
502 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
503 |
+
covered work, and grant a patent license to some of the parties
|
504 |
+
receiving the covered work authorizing them to use, propagate, modify
|
505 |
+
or convey a specific copy of the covered work, then the patent license
|
506 |
+
you grant is automatically extended to all recipients of the covered
|
507 |
+
work and works based on it.
|
508 |
+
|
509 |
+
A patent license is "discriminatory" if it does not include within
|
510 |
+
the scope of its coverage, prohibits the exercise of, or is
|
511 |
+
conditioned on the non-exercise of one or more of the rights that are
|
512 |
+
specifically granted under this License. You may not convey a covered
|
513 |
+
work if you are a party to an arrangement with a third party that is
|
514 |
+
in the business of distributing software, under which you make payment
|
515 |
+
to the third party based on the extent of your activity of conveying
|
516 |
+
the work, and under which the third party grants, to any of the
|
517 |
+
parties who would receive the covered work from you, a discriminatory
|
518 |
+
patent license (a) in connection with copies of the covered work
|
519 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
520 |
+
for and in connection with specific products or compilations that
|
521 |
+
contain the covered work, unless you entered into that arrangement,
|
522 |
+
or that patent license was granted, prior to 28 March 2007.
|
523 |
+
|
524 |
+
Nothing in this License shall be construed as excluding or limiting
|
525 |
+
any implied license or other defenses to infringement that may
|
526 |
+
otherwise be available to you under applicable patent law.
|
527 |
+
|
528 |
+
12. No Surrender of Others' Freedom.
|
529 |
+
|
530 |
+
If conditions are imposed on you (whether by court order, agreement or
|
531 |
+
otherwise) that contradict the conditions of this License, they do not
|
532 |
+
excuse you from the conditions of this License. If you cannot convey a
|
533 |
+
covered work so as to satisfy simultaneously your obligations under this
|
534 |
+
License and any other pertinent obligations, then as a consequence you may
|
535 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
536 |
+
to collect a royalty for further conveying from those to whom you convey
|
537 |
+
the Program, the only way you could satisfy both those terms and this
|
538 |
+
License would be to refrain entirely from conveying the Program.
|
539 |
+
|
540 |
+
13. Remote Network Interaction; Use with the GNU General Public License.
|
541 |
+
|
542 |
+
Notwithstanding any other provision of this License, if you modify the
|
543 |
+
Program, your modified version must prominently offer all users
|
544 |
+
interacting with it remotely through a computer network (if your version
|
545 |
+
supports such interaction) an opportunity to receive the Corresponding
|
546 |
+
Source of your version by providing access to the Corresponding Source
|
547 |
+
from a network server at no charge, through some standard or customary
|
548 |
+
means of facilitating copying of software. This Corresponding Source
|
549 |
+
shall include the Corresponding Source for any work covered by version 3
|
550 |
+
of the GNU General Public License that is incorporated pursuant to the
|
551 |
+
following paragraph.
|
552 |
+
|
553 |
+
Notwithstanding any other provision of this License, you have
|
554 |
+
permission to link or combine any covered work with a work licensed
|
555 |
+
under version 3 of the GNU General Public License into a single
|
556 |
+
combined work, and to convey the resulting work. The terms of this
|
557 |
+
License will continue to apply to the part which is the covered work,
|
558 |
+
but the work with which it is combined will remain governed by version
|
559 |
+
3 of the GNU General Public License.
|
560 |
+
|
561 |
+
14. Revised Versions of this License.
|
562 |
+
|
563 |
+
The Free Software Foundation may publish revised and/or new versions of
|
564 |
+
the GNU Affero General Public License from time to time. Such new versions
|
565 |
+
will be similar in spirit to the present version, but may differ in detail to
|
566 |
+
address new problems or concerns.
|
567 |
+
|
568 |
+
Each version is given a distinguishing version number. If the
|
569 |
+
Program specifies that a certain numbered version of the GNU Affero General
|
570 |
+
Public License "or any later version" applies to it, you have the
|
571 |
+
option of following the terms and conditions either of that numbered
|
572 |
+
version or of any later version published by the Free Software
|
573 |
+
Foundation. If the Program does not specify a version number of the
|
574 |
+
GNU Affero General Public License, you may choose any version ever published
|
575 |
+
by the Free Software Foundation.
|
576 |
+
|
577 |
+
If the Program specifies that a proxy can decide which future
|
578 |
+
versions of the GNU Affero General Public License can be used, that proxy's
|
579 |
+
public statement of acceptance of a version permanently authorizes you
|
580 |
+
to choose that version for the Program.
|
581 |
+
|
582 |
+
Later license versions may give you additional or different
|
583 |
+
permissions. However, no additional obligations are imposed on any
|
584 |
+
author or copyright holder as a result of your choosing to follow a
|
585 |
+
later version.
|
586 |
+
|
587 |
+
15. Disclaimer of Warranty.
|
588 |
+
|
589 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
590 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
591 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
592 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
593 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
594 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
595 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
596 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
597 |
+
|
598 |
+
16. Limitation of Liability.
|
599 |
+
|
600 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
601 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
602 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
603 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
604 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
605 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
606 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
607 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
608 |
+
SUCH DAMAGES.
|
609 |
+
|
610 |
+
17. Interpretation of Sections 15 and 16.
|
611 |
+
|
612 |
+
If the disclaimer of warranty and limitation of liability provided
|
613 |
+
above cannot be given local legal effect according to their terms,
|
614 |
+
reviewing courts shall apply local law that most closely approximates
|
615 |
+
an absolute waiver of all civil liability in connection with the
|
616 |
+
Program, unless a warranty or assumption of liability accompanies a
|
617 |
+
copy of the Program in return for a fee.
|
618 |
+
|
619 |
+
END OF TERMS AND CONDITIONS
|
620 |
+
|
621 |
+
How to Apply These Terms to Your New Programs
|
622 |
+
|
623 |
+
If you develop a new program, and you want it to be of the greatest
|
624 |
+
possible use to the public, the best way to achieve this is to make it
|
625 |
+
free software which everyone can redistribute and change under these terms.
|
626 |
+
|
627 |
+
To do so, attach the following notices to the program. It is safest
|
628 |
+
to attach them to the start of each source file to most effectively
|
629 |
+
state the exclusion of warranty; and each file should have at least
|
630 |
+
the "copyright" line and a pointer to where the full notice is found.
|
631 |
+
|
632 |
+
<one line to give the program's name and a brief idea of what it does.>
|
633 |
+
Copyright (C) <year> <name of author>
|
634 |
+
|
635 |
+
This program is free software: you can redistribute it and/or modify
|
636 |
+
it under the terms of the GNU Affero General Public License as published
|
637 |
+
by the Free Software Foundation, either version 3 of the License, or
|
638 |
+
(at your option) any later version.
|
639 |
+
|
640 |
+
This program is distributed in the hope that it will be useful,
|
641 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
642 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
643 |
+
GNU Affero General Public License for more details.
|
644 |
+
|
645 |
+
You should have received a copy of the GNU Affero General Public License
|
646 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
647 |
+
|
648 |
+
Also add information on how to contact you by electronic and paper mail.
|
649 |
+
|
650 |
+
If your software can interact with users remotely through a computer
|
651 |
+
network, you should also make sure that it provides a way for users to
|
652 |
+
get its source. For example, if your program is a web application, its
|
653 |
+
interface could display a "Source" link that leads users to an archive
|
654 |
+
of the code. There are many ways you could offer source, and different
|
655 |
+
solutions will be better for different programs; see section 13 for the
|
656 |
+
specific requirements.
|
657 |
+
|
658 |
+
You should also get your employer (if you work as a programmer) or school,
|
659 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
660 |
+
For more information on this, and how to apply and follow the GNU AGPL, see
|
661 |
+
<http://www.gnu.org/licenses/>.
|
readme.txt
ADDED
@@ -0,0 +1,731 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Schema ===
|
2 |
+
Contributors: hishaman, schemapress
|
3 |
+
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=NGVUBT2QXN7YL
|
4 |
+
Tags: schema, schema.org, json, json-ld, google, seo, structured data, markup, search engine, search, rich snippets, breadcrumbs, social, post, page, plugin, wordpress, content, article, news, search results, site name, knowledge graph, social, social profiles, keywords, meta-tags, metadata, tags, categories, optimize, ranking, search engine optimization, search engines, serp, sitelinks, google sitelinks, sitelinks search box, google sitelinks search box, semantic, structured, canonical, custom post types, post type, title, terms, media, images, thumb, featured, url, video, video markup, video object, VideoObject, video schema, audio object, AudioObject, audio schema, audio, sameAs, about, contact, amp, mobile, taxonomy
|
5 |
+
Requires at least: 4.0
|
6 |
+
Tested up to: 4.9.6
|
7 |
+
Requires PHP: 5.4
|
8 |
+
Stable tag: 1.6.9.8
|
9 |
+
License: GPLv2 or later
|
10 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
+
|
12 |
+
Get the next generation of Schema Structured Data to enhance your WordPress site presentation in Google search results.
|
13 |
+
|
14 |
+
== Description ==
|
15 |
+
|
16 |
+
Like Schema plugin? Consider leaving a [5 star review](https://wordpress.org/support/plugin/schema/reviews/).
|
17 |
+
|
18 |
+
Super fast, light-weight plugin for adding schema.org structured data markup in recommended JSON-LD format automatically to WordPress sites.
|
19 |
+
|
20 |
+
Enhanced Presentation in Search Results By including structured data appropriate to your content, your site can enhance its search results and presentation.
|
21 |
+
|
22 |
+
Check out the [Plugin Homepage](https://schema.press/) for more info and [documentation](https://schema.press/docs/).
|
23 |
+
|
24 |
+
|
25 |
+
**What is Schema markup?**
|
26 |
+
|
27 |
+
Schema markup is code (semantic vocabulary) that you put on your website to help the search engines return more informative results for users. So, Schema is not just for SEO reasons, it’s also for the benefit of the searcher.
|
28 |
+
|
29 |
+
**Schema Key Features**
|
30 |
+
|
31 |
+
* Easy to use, set it and forget it, with minimal settings.
|
32 |
+
* Enable Schema types at once per post type or post category.
|
33 |
+
* Valid markup, test it in Google Structured Data Testing Tool.
|
34 |
+
* Output JSON-LD format, the most recommended by Google.
|
35 |
+
* Reuse data saved in post meta, which is created by other plugins.
|
36 |
+
* Extensible, means you can extend its functionality via other plugins, extensions or within your Theme’s functions.php file.
|
37 |
+
|
38 |
+
**Plugin Extensions**
|
39 |
+
|
40 |
+
* [Schema Review](https://wordpress.org/plugins/schema-review/): Extend Schema functionality by adding review and rating Structured Data functionality for Editors and Authors.
|
41 |
+
* [Schema Default Image](https://wordpress.org/plugins/schema-default-image/): Add ability to set a default WordPress Featured image for schema.org markup.
|
42 |
+
|
43 |
+
**Supported Google/Schema Markups**
|
44 |
+
|
45 |
+
* [Knowledge Graph](https://developers.google.com/structured-data/customize/overview)
|
46 |
+
* [Logos](https://developers.google.com/structured-data/customize/logos)
|
47 |
+
* [Company Contact Numbers](https://developers.google.com/structured-data/customize/contact-points)
|
48 |
+
* [Social Profile Links](https://developers.google.com/structured-data/customize/social-profiles)
|
49 |
+
|
50 |
+
* Style Your Search Results:
|
51 |
+
* [Enable Sitelinks Search Box](https://developers.google.com/structured-data/customize/logos)
|
52 |
+
* [Show Your Site Name in Search](https://developers.google.com/structured-data/site-name)
|
53 |
+
|
54 |
+
**Supported Schema Types**
|
55 |
+
|
56 |
+
* Creative Work
|
57 |
+
* [Article](https://schema.org/Article) enabled on Pages
|
58 |
+
* [BlogPosting](https://schema.org/BlogPosting) enabled on Posts
|
59 |
+
* [NewsArticle](https://schema.org/NewsArticle)
|
60 |
+
* [Report](https://schema.org/Report)
|
61 |
+
* [ScholarlyArticle](https://schema.org/ScholarlyArticle)
|
62 |
+
* [TechArticle](https://schema.org/TechArticle)
|
63 |
+
|
64 |
+
* [Blog](https://schema.org/Blog) to markup Blog posts list page.
|
65 |
+
* [WPHeader](https://schema.org/WPHeader) to markup Web Page Header.
|
66 |
+
* [WPFooter](https://schema.org/WPFooter) to markup Web Page Footer.
|
67 |
+
* [BreadcrumbList](https://schema.org/BreadcrumbList) to markup Breadcrumbs.
|
68 |
+
* [CollectionPage](https://schema.org/CollectionPage) to markup Categories Archives.
|
69 |
+
* [CollectionPage](https://schema.org/CollectionPage) to markup Tags Archives.
|
70 |
+
* [ItemList](https://schema.org/ItemList) to markup Post Type Archives.
|
71 |
+
* [AboutPage](https://schema.org/AboutPage) to markup the About page.
|
72 |
+
* [ContactPage](https://schema.org/ContactPage) to markup the Contact page.
|
73 |
+
* [Person](https://schema.org/Person) enabled on Author pages
|
74 |
+
* [VideoObject](https://schema.org/VideoObject) enable automatically on all videos embedded with oEmbed. Supports VideoPress, YouTube, TED, Vimeo, Dailymotion, and Vine.
|
75 |
+
* [AudioObject](https://schema.org/AudioObject) enable automatically on all audio embedded with oEmbed. Supports SoundCloud, and Mixcloud.
|
76 |
+
|
77 |
+
**Supported Plugins**
|
78 |
+
|
79 |
+
Schema plugin integrates, and play nicely with:
|
80 |
+
|
81 |
+
* Yoast SEO
|
82 |
+
* AMP plugin
|
83 |
+
* WPRichSnippets
|
84 |
+
* The SEO Framework
|
85 |
+
* Visual Composer
|
86 |
+
* ThirstyAffiliates
|
87 |
+
* WooCommerce
|
88 |
+
* Easy Digital Downloads (EDD)
|
89 |
+
|
90 |
+
**Supported Themes**
|
91 |
+
|
92 |
+
* Genesis 2.x
|
93 |
+
* Thesis 2.x
|
94 |
+
* Divi
|
95 |
+
|
96 |
+
**Developers?**
|
97 |
+
|
98 |
+
Feel free to [fork the project on GitHub](https://github.com/schemapress/Schema) and submit your contributions via pull request.
|
99 |
+
|
100 |
+
== Installation ==
|
101 |
+
|
102 |
+
1. Upload the entire `schema` folder to the `/wp-content/plugins/` directory
|
103 |
+
2. DO NOT change the name of the `schema` folder
|
104 |
+
3. Activate the plugin through the 'Plugins' menu in WordPress
|
105 |
+
4. Navigate to the `Schema > Settings` menu to configure the plugin
|
106 |
+
5. If you cache your site, make sure to clear cache after configuring the plugin settings.
|
107 |
+
|
108 |
+
== Frequently Asked Questions ==
|
109 |
+
|
110 |
+
= The plugin isn't working or have a bug? =
|
111 |
+
|
112 |
+
Post detailed information about the issue in the [support forum](https://wordpress.org/support/plugin/schema) and we will work to fix it.
|
113 |
+
|
114 |
+
= Is there any Documentation for this plugin? =
|
115 |
+
|
116 |
+
Indeed, detailed information about the plugin can be found on the [documentation section](https://schema.press/docs/) on our website.
|
117 |
+
|
118 |
+
= Are you going to add support for new schema.org types in the future? =
|
119 |
+
|
120 |
+
Nope! The Schema plugin is meant to add markup to a basic WordPress installation, including those types (mostly Article, BlogPosting) which needs to be supported on a fresh install.
|
121 |
+
|
122 |
+
Other schema.org types shall be added via [Plugin Extensions](https://schema.press/downloads/), or a custom code.
|
123 |
+
|
124 |
+
|
125 |
+
= Is there a way to add a new schema.org type? =
|
126 |
+
|
127 |
+
Luckily… Yes! Schema plugin has a filter which can be used to [add support for new schema.org types](https://schema.press/docs/adding-support-new-schema-org-types/).
|
128 |
+
|
129 |
+
= Knowledge Graph is not showing? =
|
130 |
+
|
131 |
+
The plugin meant to validate markup in Google Structured Data Testing Tool, we don’t have control over the actual display of Knowledge Graph.
|
132 |
+
|
133 |
+
= I see an error in Google Structure Data Testing Tool =
|
134 |
+
|
135 |
+
This could be for one -or more- of the following reasons:
|
136 |
+
|
137 |
+
* Image error: This is a missing WordPress Featured image, try to upload a Featured image.
|
138 |
+
* Logo error: This is a missing Publisher logo, it can be set in the plugin settings page, Schema > Settings > General > Publisher Logo.
|
139 |
+
|
140 |
+
P.S. You may encounter errors for sites hosted locally, for accessibility reasons.
|
141 |
+
|
142 |
+
= Compatible with Yoast SEO? =
|
143 |
+
|
144 |
+
Yes, Schema plugin will detect Yoast SEO plugin and override its output on the front page of your site, this means all Knowledge Graph and Site Search output will be generated by Schema. However, the plugin settings gives you control over which plugin should output Knowledge Graph markup, Search Results, and Breadcrumbs.
|
145 |
+
|
146 |
+
= Compatible with AMP plugin? =
|
147 |
+
|
148 |
+
Yes, Schema plugin will detect AMP plugin and output a more complete and valid schema.org markup.
|
149 |
+
|
150 |
+
== Screenshots ==
|
151 |
+
1. Plugin Settings page.
|
152 |
+
2. Create new schema type screen.
|
153 |
+
3. Create post meta fields with Post Meta Box generator feature.
|
154 |
+
4. Google Structured Data Testing Tool.
|
155 |
+
|
156 |
+
== Changelog ==
|
157 |
+
|
158 |
+
= 1.6.9.8.2 =
|
159 |
+
* Fixed typos when return false in a couple of functions.
|
160 |
+
* Fixed fatal errors caused due duplicate function names with other plugin in post meta.
|
161 |
+
* Fixed ImageObject output in the About and Contact pages.
|
162 |
+
* Fixed the About admin sub menu item url, it was not pointing correctly in some cases.
|
163 |
+
* Fixed duplicate schema output in some cases when Sitelinks Search Box is enabled.
|
164 |
+
* Removed the Auto Featured Image feature, it was causing several issues.
|
165 |
+
* Removed class-settings.php file, which was not used in the plugin.
|
166 |
+
* Reverted all changes made in version 1.6.9.8 back, since issue has been solved!
|
167 |
+
* Updated Chosen script and CSS to version 1.8.5 for post meta fields.
|
168 |
+
* Updated the plugin welcome page.
|
169 |
+
* Updated readme.txt file to include GPL license details.
|
170 |
+
|
171 |
+
= 1.6.9.8.1 =
|
172 |
+
* Reverted back all changes made in version 1.6.9.8, since it breaks!
|
173 |
+
|
174 |
+
= 1.6.9.8 =
|
175 |
+
* Fixed reset post query in post type enabled function.
|
176 |
+
* Fixed headlines and names, make sure to remove and clean HTML tags.
|
177 |
+
* Fixed front-end styles and scripts is not needed, commented the function for now.
|
178 |
+
* Enhanced the Knowledge Graph functionality by adding a new field for contact URL.
|
179 |
+
* Added new feature, support for WPHeader and WPFooter markup.
|
180 |
+
* Added new feature, support for ItemList markup on post types archive pages.
|
181 |
+
* Added new admin page for plugin Extensions.
|
182 |
+
* Added new function schema_wp_get_archive_link to get archive page link.
|
183 |
+
* Added new function schema_wp_get_categories_as_keywords to be used by WPHeader.
|
184 |
+
* Added new function to get blog posts page URL.
|
185 |
+
* Added new integration and fix for Easy Digital Downloads (EDD) plugin.
|
186 |
+
* Updated the readme.txt and README.md files and pumped the tested WP version to 4.9
|
187 |
+
* Code cleanup.
|
188 |
+
|
189 |
+
= 1.6.9.7 =
|
190 |
+
* Fix for Sitelinks Search Box markup output, echo the value instead of returning it.
|
191 |
+
|
192 |
+
= 1.6.9.6 =
|
193 |
+
* Fixed video object, removed a check for variable that always returns false.
|
194 |
+
* Fixed Organization markup output, it was not working.
|
195 |
+
* Fixed error, make sure PHP-XML extension is installed before parsing page HTML.
|
196 |
+
* Fixed the query on home page, the blog posts page.
|
197 |
+
* Fixed PHP notice when enabled types returns a string instead of an array.
|
198 |
+
* Modified some wording and corrected typos across the plugin.
|
199 |
+
* Added post id to the media function which is responsible for pulling images.
|
200 |
+
* Added organization and author ids so Google can identify multiple.
|
201 |
+
* Added post id to schema_wp_get_ref in schema_wp_get_type function.
|
202 |
+
* Added new filter for overriding post type in Schema > Types screen.
|
203 |
+
* Added new filter schema_author_output for overriding author markup output.
|
204 |
+
* Added new filter sitelinks_search_box for overriding Sitelinks Search Box.
|
205 |
+
* Added new function to get current post type.
|
206 |
+
* Updated README.md file.
|
207 |
+
|
208 |
+
= 1.6.9.5 =
|
209 |
+
* Fixed markup errors on AMP pages, now markup is pulled correctly form Schema.
|
210 |
+
* Fixed an error due to conflict with previously declared function in another plugin.
|
211 |
+
* Fixed CSS style used to hide the taxonomy add new link, target only schema post type.
|
212 |
+
* Fixed Warning raised by delete_term_meta when deleting tags.
|
213 |
+
* Fixed breadcrumbs, disabled breadcrumbs on WooCommerce to avoid duplication.
|
214 |
+
* Fixed meta tax styles for sameAs input.
|
215 |
+
* Fixed Blog posts page markup, create own loop with WP_Query to avoid conflicts.
|
216 |
+
* Added new function schema_wp_get_type to get schema type by post id.
|
217 |
+
* Added new function schema_wp_get_ref to get schema reference by post id.
|
218 |
+
* Added two new filters to allow disable default sameAs feature.
|
219 |
+
* Added a new filter to disable breadcrumbs.
|
220 |
+
* Added new feature, support for schema.org markup on tags archives pages.
|
221 |
+
* Added new features, support for sameAs markup on tag archive pages.
|
222 |
+
* Updated readme.txt file.
|
223 |
+
|
224 |
+
= 1.6.9.4 =
|
225 |
+
* Fixed bug in AMP plugin integration, function was called too early.
|
226 |
+
* Fixed bug in post meta input field types when object post type is not set.
|
227 |
+
* Fixed broken link in Contextual Help with the plugin settings pages.
|
228 |
+
* Fixed bad requests happened in the backend for broken links.
|
229 |
+
* Fixed PHP notice for undefined variable: results, in schema ref.
|
230 |
+
* Fixed PHP notice in post meta Text input field when $meta has an array.
|
231 |
+
* Added support for schema.org markup for taxonomy archive pages.
|
232 |
+
* Added support for breadcrumbs json-ld, added new settings for it under Content tab.
|
233 |
+
* Enhanced integration of Yoast SEO plugin, remove breadcrumb markup output automatically.
|
234 |
+
* Enhanced integration of Genesis theme, remove breadcrumb markup output automatically.
|
235 |
+
* Enhanced category archives markup, reduced 4 database queries, so now it is faster.
|
236 |
+
* Enhanced Article schema output, only output if Article or sub types is chosen.
|
237 |
+
* Enhanced post meta generator, added activation filters to generator and meta box.
|
238 |
+
* Enhanced the display of post types list in Schema Types edit page.
|
239 |
+
* Enhanced post meta save function, remove check for permissions on save.
|
240 |
+
* Enhanced description by giving it its own function.
|
241 |
+
* Updated readme.txt file, modified the plugin details and extended the FAQ section.
|
242 |
+
|
243 |
+
= 1.6.9.3 =
|
244 |
+
* Fixed a bug in Yoast SEO integration while checking if plugin is active.
|
245 |
+
* Fixed a warning showing when original post status is not set.
|
246 |
+
* Fixed a warning when use the Quick Edit screen, could not retrieve post type.
|
247 |
+
* Fixed input field styles in post meta.
|
248 |
+
* Added new filter schema_wp_filter_description_word_count for description words count.
|
249 |
+
* Added new property for post meta called class, to allow styling and targeting inputs.
|
250 |
+
* Added new custom Bootstrap 4 styles to be used by extensions.
|
251 |
+
* Extended readme.txt file FAQ section with more details about the plugin.
|
252 |
+
* Pumped tested version to 4.8.2
|
253 |
+
|
254 |
+
= 1.6.9.2 =
|
255 |
+
* Fixed post meta fields array, it was not defined properly.
|
256 |
+
* Fixed minifying admin css file.
|
257 |
+
* Fixed a bug in the Knowledge Graph markup output with other plugins.
|
258 |
+
* Tweak modified admin menus to allow ordering admin sub menus by priority.
|
259 |
+
* Added new filter schema_wp_types_post_meta_fields to allow adding fields to post meta.
|
260 |
+
* Added new post meta field type for checkbox group inline.
|
261 |
+
* Added better way to output Knowledge Graph markup, make it filterable.
|
262 |
+
|
263 |
+
= 1.6.9.1 =
|
264 |
+
* Fixed a notice when WP Rich Snippets plugin is active on a post.
|
265 |
+
* Fixed post meta class issue, scripts was not loading properly for some types.
|
266 |
+
* Fixed post meta slider field and added range min property for better presentation.
|
267 |
+
* Tweak repeated row fields styles, removed the extra li height from post meta CSS.
|
268 |
+
* Tweak remove repeated fields icon link hover, force mouse cursor to pointer.
|
269 |
+
* Tweak remove functions from deprecated-functions file.
|
270 |
+
* Added new post meta sanitizers, santitize_title_with_dashes and sanitize_html_class.
|
271 |
+
* Added new alert when deleting repeated fields to enhance user experience.
|
272 |
+
* Added new function and filter to admin backend schema_wp_get_post_types.
|
273 |
+
* Added new integration for ThirstyAffiliates, prevent thirstylink type from showing.
|
274 |
+
* Added the required PHP version 5.4 in readme.txt file.
|
275 |
+
|
276 |
+
= 1.6.9 =
|
277 |
+
* Fixed using JSON_UNESCAPED_UNICODE of PHP 5.4 or later.
|
278 |
+
* Added new function schema_wp_get_currency_symbol to misc functions file.
|
279 |
+
* Moved function schema_wp_get_currencies to misc file so it can be used globally.
|
280 |
+
* Deprecate schema_wp_get_currency function, never been used.
|
281 |
+
* Update: Bumped minimum required PHP version from 5.3 to 5.4
|
282 |
+
|
283 |
+
= 1.6.8 =
|
284 |
+
* Fixed googleplus key in user profile meta.
|
285 |
+
* Fixed Quick Edit links removed on all post types, this should be limited only to schema.
|
286 |
+
|
287 |
+
= 1.6.7 =
|
288 |
+
* Added new class for admin post list columns, not Schema type has new columns.
|
289 |
+
* Added new columns to Schema post type, example Schema Type, Post Type, and Content.
|
290 |
+
* Removed the View and Quick Edit links from actions column.
|
291 |
+
* Updated custom post meta class, added required and default options for fields.
|
292 |
+
* Updated a few wording in the Types section in backend.
|
293 |
+
* Updated custom post meta boxes CSS, set select input field width to auto.
|
294 |
+
* Cleaned some code and removed code comments.
|
295 |
+
* Tested with PHP version 7.0.22
|
296 |
+
|
297 |
+
= 1.6.6 =
|
298 |
+
* Fixed logo guidelines link in plugin settings.
|
299 |
+
* Fixed site url by using get_home_url instead of get_site_url.
|
300 |
+
* Fixed a few notices in about, contact, category, and 404 pages.
|
301 |
+
* Fixed a Trying to get property of non-object warning when saving ref.
|
302 |
+
* Fixed unwanted field id was showing in the repeated post meta generator.
|
303 |
+
* Updated to version 1.6.13 of license handler for EDD.
|
304 |
+
* Updated to version 1.6.11 of EDD updater class.
|
305 |
+
|
306 |
+
= 1.6.5 =
|
307 |
+
* Fixed empty array output on front page when set Yoast SEO output to true.
|
308 |
+
* Cleaned comments in code files and corrected a couple of typos.
|
309 |
+
|
310 |
+
= 1.6.4 =
|
311 |
+
* Removed Yoast SEO plugin check, now it is done via the plugin settings.
|
312 |
+
* Added new settings checkbox will show when Yoast SEO plugin is active.
|
313 |
+
* Added Person markup, now a site can be defined as an Organization or a Person.
|
314 |
+
* Added missing @id to Website markup.
|
315 |
+
* Added missing @id to Organization markup.
|
316 |
+
* Updated the welcome page.
|
317 |
+
* Cleaned and enhanced wording in settings and comments in code files.
|
318 |
+
* Modified tested up to version to 4.7
|
319 |
+
* Modified requires at least version to 4.0
|
320 |
+
* Modified readme.txt file.
|
321 |
+
|
322 |
+
= 1.6.3 =
|
323 |
+
* Fixed an error in schema markup caused by misspelling articleSection.
|
324 |
+
|
325 |
+
= 1.6.2 =
|
326 |
+
* Fixed fatal error when previewing or activating non-Genesis themes.
|
327 |
+
* Fixed fatal error when calling get_current_screen in admin pages.
|
328 |
+
* Fixes gravatar cached response problem.
|
329 |
+
* Modified readme.txt file.
|
330 |
+
|
331 |
+
= 1.6.1 =
|
332 |
+
* Fixed hide VideoObject and AudioObject meta boxes if not enabled in settings.
|
333 |
+
* Added new hook schema_wp_do_after_settings_updated.
|
334 |
+
* Added new function schema_wp_json_delete_cache to flush cached json-ld post meta.
|
335 |
+
* Added flush cached json-ld post meta whenever plugin settings got updated.
|
336 |
+
|
337 |
+
= 1.6 =
|
338 |
+
* Fixed exclude post was not working properly.
|
339 |
+
* Fixed cached post meta timestamp should be deleted on post save.
|
340 |
+
* Fixed Schema post type label value.
|
341 |
+
* Fixed Schema post types was not created on plugin activation.
|
342 |
+
* Fixed schema reference post meta was not saved for scheduled posts.
|
343 |
+
* Enhanced gravatar validation function.
|
344 |
+
* Enhanced Blog markup performance by pulling data from cached post meta.
|
345 |
+
* Added missing BlogPosting description in Blog page markup.
|
346 |
+
* Added sameAs markup to BlogPosting property in Blog page markup.
|
347 |
+
* Added sameAs markup to About page.
|
348 |
+
* Added sameAs markup to Contact page.
|
349 |
+
* Added new filter schema_blog_output to allow dev extend markups.
|
350 |
+
* Added new filter schema_about_page_output to allow dev extend markups.
|
351 |
+
* Added new filter schema_contact_page_output to allow dev extend markups.
|
352 |
+
* Added missing post meta to the plugin uninstall function.
|
353 |
+
* Added new function for recursive array search to admin functions file.
|
354 |
+
* Modified readme.txt file.
|
355 |
+
|
356 |
+
= 1.5.9.9 =
|
357 |
+
* Fixed category id on category pages.
|
358 |
+
* Fixed a notice on VideoObject function.
|
359 |
+
* Fixed Schema JSON-LD not updating by flushing cache on schema type save.
|
360 |
+
* Added Schema property sameAs core extension.
|
361 |
+
* Added delete Schema JSON-LD post meta on plugin uninstall.
|
362 |
+
* Added delete Schema Exclude post meta on plugin uninstall.
|
363 |
+
|
364 |
+
= 1.5.9.8 =
|
365 |
+
* Fixed missing translation in category title.
|
366 |
+
* Added new filter to schema_category_json to extend category markup.
|
367 |
+
* Added new function to clear/delete schema json post meta value on post save.
|
368 |
+
* Added support for schema.org sameAS property for category pages.
|
369 |
+
* Added new custom taxonomy meta fields class.
|
370 |
+
* Added new admin link to the plugin About page.
|
371 |
+
* Corrected names of some functions, and renamed files.
|
372 |
+
* Modified readme.txt file.
|
373 |
+
|
374 |
+
= 1.5.9.7 =
|
375 |
+
* Fixed slow performance by reducing number of queries made by the plugin.
|
376 |
+
* Fixed post meta generator, empty meta box display.
|
377 |
+
* Fixed an error on post save, global post variable needed to be called.
|
378 |
+
* Enhanced overall performance by caching JSON-LD array in post meta.
|
379 |
+
* Enhanced author output, now it has been added as a core extension.
|
380 |
+
* Added new settings to control AudioObject, VideoObject, and Comments.
|
381 |
+
* Cleaned up some code and moved admin and other functions to its own files.
|
382 |
+
* Pumped WordPress version, checked and tested with 4.6.1 release.
|
383 |
+
|
384 |
+
= 1.5.9.6 =
|
385 |
+
* Added new extension support for AudioObject.
|
386 |
+
* Added missing translation to Schema VideoObject settings.
|
387 |
+
* Enhanced plugin activation process.
|
388 |
+
* Enhanced update post meta reference.
|
389 |
+
* Added deprecated functions to its own file.
|
390 |
+
* Corrected words in the Contextual Help screen.
|
391 |
+
* Updated the welcome screen.
|
392 |
+
* Updated the readme.txt file.
|
393 |
+
|
394 |
+
= 1.5.9.5 =
|
395 |
+
* Fixed post meta generator missing description.
|
396 |
+
* Fixed Publisher logo image, image url was not used correctly in some cases.
|
397 |
+
* Updated plugin settings text fields with placeholder info.
|
398 |
+
* Updated plugin settings page screenshot.
|
399 |
+
* Pumped WordPress version, checked and tested with 4.6 release.
|
400 |
+
* Modified readme.txt file, added link to updated plugin documentation page.
|
401 |
+
|
402 |
+
= 1.5.9.4 =
|
403 |
+
* Fixed capabilities issue, plugin settings was not saving properly.
|
404 |
+
* Modified readme.txt file, added more info to the FAQ section.
|
405 |
+
|
406 |
+
= 1.5.9.3 =
|
407 |
+
* Added new integration file for Visual Composer plugin.
|
408 |
+
* Added save new setting field to save the upgraded from version on plugin install.
|
409 |
+
* Added new filter schema_output_blog_post.
|
410 |
+
* Added new filter schema_output_category_post.
|
411 |
+
* Added new filter schema_wp_exclude.
|
412 |
+
* Added size class for post meta field with the type of number.
|
413 |
+
* Added new Contextual Help tab to the plugin settings page.
|
414 |
+
* Added new filters and hooks to allow developers to extend the settings page.
|
415 |
+
* Added new features for extensions, now it supports licenses and auto upgrades.
|
416 |
+
* Added new settings field for Publisher Logo.
|
417 |
+
* Fixed schema markup for Publisher Logo.
|
418 |
+
* Fixed schema markup for Organization Logo.
|
419 |
+
* Enhanced preview image display in plugin settings, set width to 300px.
|
420 |
+
* Enhanced wording in plugin settings page and simplified settings fields.
|
421 |
+
|
422 |
+
= 1.5.9.2 =
|
423 |
+
* Removed the Disable SiteLinks Search Box feature, not needed in the plugin.
|
424 |
+
* Removed the Content tab within the plugin settings page.
|
425 |
+
* Enhanced the plugin settings page, rearranged settings in a simpler way.
|
426 |
+
|
427 |
+
= 1.5.9.1 =
|
428 |
+
* Fixed a warning notice when saving drafts in editor, editing posts was not possible.
|
429 |
+
|
430 |
+
= 1.5.9 =
|
431 |
+
* Fixed query conflicts on category pages by creating a secondary loop.
|
432 |
+
* Fixed category description, apply strip_tags function to remove HTML tags.
|
433 |
+
* Added check to prevent processing code in backend when runs category schema.
|
434 |
+
* Added new Post Meta Box feature.
|
435 |
+
* Added a new schema_wp_filter_content filter.
|
436 |
+
* Added new integration filter function for Divi theme.
|
437 |
+
* Use wp_strip_all_tags instead of strip_tags for short content.
|
438 |
+
* Updated plugin screenshots, added a new screenshot for post meta box feature.
|
439 |
+
* Corrected a typo in plugin settings page.
|
440 |
+
* Modified readme.txt file, corrected link to support forum and some typos.
|
441 |
+
|
442 |
+
= 1.5.8 =
|
443 |
+
* Fixed datePublished and dateModified markups, make sure it is in ISO 8601 format.
|
444 |
+
* Fixed Preview button was not showing in edit screen.
|
445 |
+
* Extended the plugin settings extensibility with new repeatable field type.
|
446 |
+
* Enhanced post meta wording and fixed typos.
|
447 |
+
* Modified readme.txt file, corrected link to support forum and some typos.
|
448 |
+
|
449 |
+
= 1.5.7 =
|
450 |
+
* Added support for schema type CollectionPage for Categories.
|
451 |
+
* Added new filter schema_wp_types to override or extend options.
|
452 |
+
* Added new filter schema_wp_publisher to override publisher array.
|
453 |
+
* Added new filter schema_wp_author to override author array.
|
454 |
+
* Added new function schema_wp_do_post_meta to allow adding custom post meta boxes.
|
455 |
+
* Added new function to return Author array.
|
456 |
+
|
457 |
+
= 1.5.6 =
|
458 |
+
* Fixed a notice on front end caused when admin bar menu is called.
|
459 |
+
* Added new post meta box for Schema exclusions, turn off Schema on specific posts.
|
460 |
+
* Added new integration for SEO Framework plugin.
|
461 |
+
* Modified search_term to search_term_string search variable in SiteLinks Search Box.
|
462 |
+
* Enhanced WPRichSnippets integration, put code on its own file.
|
463 |
+
* Enhanced Yoast SEO integration, put code on its own file.
|
464 |
+
* Enhanced functions naming to prevent any possible conflict with Schema Removal.
|
465 |
+
* Updated the plugin welcome page.
|
466 |
+
* Modified readme.txt file.
|
467 |
+
|
468 |
+
= 1.5.5 =
|
469 |
+
* Fixed a fatal error when Genesis is not the active Theme.
|
470 |
+
|
471 |
+
= 1.5.4 =
|
472 |
+
* Added admin notification for feedback.
|
473 |
+
* Added support for Schema type Blog, markup blog post list.
|
474 |
+
* Added new function to retrieve post comments.
|
475 |
+
* Added admin bar menu item for easy Structured Data testing access.
|
476 |
+
* Added a check if WPRichSnippets plugin is active, remove its admin bar menu.
|
477 |
+
* Added integration with Genesis Framework.
|
478 |
+
* Enhanced Media function, check for images in content if Featured image not found.
|
479 |
+
* Enhanced plugin wording in menu, change Schema Types to read Types, make it simple.
|
480 |
+
* Updated the plugin welcome page.
|
481 |
+
* Modified readme.txt file.
|
482 |
+
|
483 |
+
= 1.5.3 =
|
484 |
+
* Added better support for enabled AMP post types.
|
485 |
+
* Added support Schema for comment to markup comments in Article types.
|
486 |
+
* Added support Schema for commentCount markup to Article types.
|
487 |
+
* Added new filter to override default comments number to include in markups.
|
488 |
+
* Added better support for author, now include description and gravatar.
|
489 |
+
* Added support for author sameAs for social profiles if provided in user account.
|
490 |
+
* Added GNU GENERAL PUBLIC LICENSE file.
|
491 |
+
* Added README.md
|
492 |
+
|
493 |
+
= 1.5.2 =
|
494 |
+
* Fixed a warning on 404 and search result pages.
|
495 |
+
* Added new schema type AboutPage, core extension for the about page.
|
496 |
+
* Added new schema type ContactPage, core extension for the contact page.
|
497 |
+
* Added new settings under the Content tab to select About and Contact pages.
|
498 |
+
* Updated the plugin welcome page.
|
499 |
+
* Modified readme.txt file.
|
500 |
+
|
501 |
+
= 1.5.1 =
|
502 |
+
* Fixed an error, AMP was not working because a call to wrong function.
|
503 |
+
* Fixed wrong Class name for post meta creation.
|
504 |
+
* Fixed schema output when set a static page as Front page.
|
505 |
+
* Fixed a bug in WPRichSnippets integration on pages that includes VideoObject.
|
506 |
+
* Added several checks not to process oEmbed unless an embedded video is in content.
|
507 |
+
* Tested with WordPress, version 4.5.3 release.
|
508 |
+
* Updated the plugin welcome page.
|
509 |
+
|
510 |
+
= 1.5 =
|
511 |
+
* Fixed error caused on plugin activation.
|
512 |
+
* Fixed Schema post was saved as a draft.
|
513 |
+
* Added ability to filter the Schema JSON array schema_json.
|
514 |
+
* Added support for Schema VideoObject markups through oEmbed.
|
515 |
+
* Added new post meta box features for VideoObject with Schema type edit page.
|
516 |
+
* Added new post meta box features for completing missing video info.
|
517 |
+
* Modified wording in the Schema post type post meta.
|
518 |
+
* Modified the Publish button to read Save.
|
519 |
+
|
520 |
+
= 1.4.7 =
|
521 |
+
* Fixed admin notices by adding conditions to run the Auto Featured image script.
|
522 |
+
* Added new ability to filter schema markups to work with post categories.
|
523 |
+
* Added new function to automatically save categories in Schema post meta.
|
524 |
+
* Added an alert on Schema post save when no Post Type is selected.
|
525 |
+
* Enhanced the default submit box on Schema post type and made cleaner.
|
526 |
+
* Removed the Preview button from Create Schema meta box.
|
527 |
+
* Modified the Publish button in Create Schema meta box to read “Create Schema”.
|
528 |
+
* Updated the plugin welcome page.
|
529 |
+
* Modified readme.txt file.
|
530 |
+
|
531 |
+
= 1.4.6 =
|
532 |
+
* Added ability to set Featured image automatically.
|
533 |
+
* Added back settings Content tab.
|
534 |
+
* Fixed post id in schema output function.
|
535 |
+
* Fixed admin notices.
|
536 |
+
* Modified readme.txt file.
|
537 |
+
|
538 |
+
= 1.4.5 =
|
539 |
+
* Added Person schema to author archive pages.
|
540 |
+
* Added schema keywords to BlogPosting.
|
541 |
+
* Added a new function to retrieve post first category to be set as articleSection.
|
542 |
+
* Now play nice with WPRichSnippets plugin, do not output schema if WPRS is enabled.
|
543 |
+
* Fixed notices in edit screen by running functions only on schema post type screen.
|
544 |
+
|
545 |
+
= 1.4.4 =
|
546 |
+
* Added support for schema specific type Article > Report.
|
547 |
+
* Added new filter schema_wp_cpt_enabled to override enabled post types array.
|
548 |
+
* Added new function to insert schema post ref on wp_insert_post.
|
549 |
+
* Added new function to insert meta post ref on schema type save.
|
550 |
+
* Added insert ref on plugin activation for post and page post types.
|
551 |
+
* Added delete ref on uninstall.
|
552 |
+
* Fixed media, do not output media if image width and height are not presented.
|
553 |
+
|
554 |
+
= 1.4.3 =
|
555 |
+
* Fixed media output, do not output media if image url is not presented.
|
556 |
+
|
557 |
+
= 1.4.2 =
|
558 |
+
* Fixed invalid Thesis post image url, make sure url is a valid one.
|
559 |
+
|
560 |
+
= 1.4.1 =
|
561 |
+
* Fixed avoid running schema output on home page and archive pages.
|
562 |
+
|
563 |
+
= 1.4 =
|
564 |
+
* Introduced new way to output schema.
|
565 |
+
* Added new schema post type to allow users to create new Schema types.
|
566 |
+
* Added new post meta functions for easy creation.
|
567 |
+
* Added the ability to enable Schema.org markups on Post Type bases.
|
568 |
+
* Added automatically insert post and page schema types on plugin activation.
|
569 |
+
* Added new schema types, now Article can have sub types.
|
570 |
+
* Added a new function for media handling.
|
571 |
+
* Added new filter schema_output for overriding schema output array.
|
572 |
+
* Added integration for Thesis theme 2.x Post Image.
|
573 |
+
* Added check version, if below 1.4 run required functions on activation.
|
574 |
+
* Removed functions that has been used to output schema in version 1.3
|
575 |
+
* Removed the content tab from settings page.
|
576 |
+
* Fixed uninstall.php issue, it was not working properly on multisite.
|
577 |
+
* Cleaned admin styles file.
|
578 |
+
* Enhanced the plugin Welcome page.
|
579 |
+
* Updated plugin screenshots.
|
580 |
+
* Modified readme.txt file.
|
581 |
+
|
582 |
+
= 1.3 =
|
583 |
+
* Added integration for AMP plugin, Schema will take over for better schema output handling.
|
584 |
+
* Enhanced JSON-LD output functions.
|
585 |
+
|
586 |
+
= 1.2 =
|
587 |
+
* Added new schema type BlogPosting.
|
588 |
+
* Switched blog posts schema to BlogPosting.
|
589 |
+
* Set schema for Article on page post type.
|
590 |
+
* Added new filters schema_blog_posting to override schema BlogPosting array output.
|
591 |
+
* Added new filters schema_article to override schema Article array output.
|
592 |
+
* Added new screenshot.
|
593 |
+
* Modified readme.txt file.
|
594 |
+
|
595 |
+
= 1.1.1 =
|
596 |
+
* Now play nicely with Yoast SEO plugin.
|
597 |
+
* Updated screenshot.
|
598 |
+
* Modified readme.txt file.
|
599 |
+
|
600 |
+
= 1.1 =
|
601 |
+
* Added new settings tab for content.
|
602 |
+
* Added support for schema type Article on blog posts.
|
603 |
+
* Fixed a bug within plugin settings functions.
|
604 |
+
|
605 |
+
= 1.0 =
|
606 |
+
* Initial Release
|
607 |
+
|
608 |
+
== Upgrade Notice ==
|
609 |
+
|
610 |
+
= 1.6.9.8.2 =
|
611 |
+
In this release, most of the reported bugs has been fixed. Please, update the plugin on your website now to get fixes and enhancements.
|
612 |
+
|
613 |
+
= 1.6.9.8.1 =
|
614 |
+
In this release, we reverted back to 1.6.9.8, update the plugin on your website now to get fixes.
|
615 |
+
|
616 |
+
= 1.6.9.8 =
|
617 |
+
In this release, most of the reported bugs has been fixed, including a fix for Easy Digital Downloads plugin. Also, new features has been introduced, example WPHeader and WPFooter markups, and support for ItemList markup on post types archive pages. Please, update the plugin on your website now to get fixes and enhancements.
|
618 |
+
|
619 |
+
= 1.6.9.7 =
|
620 |
+
This quick update include a fixe for Sitelinks Search Box markup output. Please, update the plugin on your site to get these fixes and enhancements.
|
621 |
+
|
622 |
+
= 1.6.9.6 =
|
623 |
+
This update include several bug fixes and enhancements. Please, update the plugin on your site to get these fixes and enhancements.
|
624 |
+
|
625 |
+
= 1.6.9.5 =
|
626 |
+
This update include several bug fixes and enhancements including AMP fixes, WooCommerce breadcrumb fixes, and introducing schema markup on tags archives pages. Please, update the plugin on your site to get these fixes and features.
|
627 |
+
|
628 |
+
= 1.6.9.4 =
|
629 |
+
This update include several bug fixes, enhancements, and new features including Breadcrumbs JSON-LD markup, which play nicely with Yoast SEO and Genesis. Please, update the plugin on your site to get these fixes and features.
|
630 |
+
|
631 |
+
= 1.6.9.3 =
|
632 |
+
This update include several bug fixes and new enhancements. Please, update the plugin on your site to get these fixes and enhancements.
|
633 |
+
|
634 |
+
= 1.6.9.2 =
|
635 |
+
This update include several bug fixes and new enhancements. Please, update the plugin on your site to get these fixes and enhancements.
|
636 |
+
|
637 |
+
= 1.6.9.1 =
|
638 |
+
This update include several bug fixes and user experience enhancements. Please, update the plugin on your site to get these fixes and enhancements.
|
639 |
+
|
640 |
+
= 1.6.9 =
|
641 |
+
This update include bug fixes, and more. Also minimum version of PHP is set to 5.4, so make sure you have this version running on your server. Please, update the plugin on your site to get these fixes.
|
642 |
+
|
643 |
+
= 1.6.8 =
|
644 |
+
This update include bug fixes. Please, update the plugin on your site to get these fixes.
|
645 |
+
|
646 |
+
= 1.6.7 =
|
647 |
+
This update include important functions, and introduce a new columns in Schema post type. Please, update the plugin on your site to get these new features.
|
648 |
+
|
649 |
+
= 1.6.6 =
|
650 |
+
This update include an important fixes. Please, update the plugin on your site to get this fix.
|
651 |
+
|
652 |
+
= 1.6.5 =
|
653 |
+
This update include important fixes for empty array output on front page when set Yoast SEO output to true. Please, update the plugin on your site to get this fix.
|
654 |
+
|
655 |
+
= 1.6.4 =
|
656 |
+
In this update, Schema will override Yoast SEO plugin JSON-LD output on the front page, also a new feature has been added to allow you define the site for an Organization or a Person. Upgrade now to get these enhancements, Note: you will need to configure the Knowledge Graph settings after the upgrade.
|
657 |
+
|
658 |
+
= 1.6.3 =
|
659 |
+
This update includes a fix for articleSection which caused an error in schema.org markup. Please, upgrade now to get this fix.
|
660 |
+
|
661 |
+
= 1.6.2 =
|
662 |
+
In this update, important bug fixes has been made, prevent fatal errors on admin pages and with older versions of Genesis. Please, upgrade now to get this fix.
|
663 |
+
|
664 |
+
= 1.6.1 =
|
665 |
+
In this update, a bug got fixed and a couple of other enhancements which enhance plugin settings usability has been applied. Please, upgrade now to get these enhancements.
|
666 |
+
|
667 |
+
= 1.6 =
|
668 |
+
Several bug fixes and enhancement has been done in this release, plus a new extension release for Schema Review. Please, upgrade now to get these enhancements.
|
669 |
+
|
670 |
+
= 1.5.9.9 =
|
671 |
+
Several bug fixes and enhancement has been made to the plugin in this release, plus a new sameAs property for your content. Please, upgrade now to get these enhancements.
|
672 |
+
|
673 |
+
= 1.5.9.8 =
|
674 |
+
More enhancement has been made to the plugin in this release, plus a couple of new features. Please, upgrade now to get these enhancements.
|
675 |
+
|
676 |
+
= 1.5.9.7 =
|
677 |
+
This update includes enhancement to performance by caching JSON-LD output in post meta, this will reduce database queries and make your site loads faster. Please, upgrade now to get these enhancements.
|
678 |
+
|
679 |
+
= 1.5.9.6 =
|
680 |
+
This update includes enhancement to plugin activation, support for schema.org AudioObject and more. Please, upgrade now to get these enhancements.
|
681 |
+
|
682 |
+
= 1.5.9.5 =
|
683 |
+
This update has an important fix for Publisher logo and some other functions in the plugin. Please, upgrade now to get this fix.
|
684 |
+
|
685 |
+
= 1.5.9.4 =
|
686 |
+
This update has an important fix for capabilities, plugin settings was not saving properly on newly installed sites. Please, upgrade now to get this fix.
|
687 |
+
|
688 |
+
= 1.5.9.3 =
|
689 |
+
This update has several features and enhancements, fix for Publisher Logo image, and support for Visual Composer plugin. Please, upgrade now to get this fix.
|
690 |
+
|
691 |
+
= 1.5.9.2 =
|
692 |
+
In this release, the disable SiteLinks Search Box feature has been removed, this feature was causing issues and having a bug. Please, upgrade now to get this fix.
|
693 |
+
|
694 |
+
= 1.5.9.1 =
|
695 |
+
This release has a bug fix for a warning notice when saving drafts in editor, editing posts was not possible. Please update the plugin on your website to git this important fix.
|
696 |
+
|
697 |
+
= 1.5.9 =
|
698 |
+
In this release, reported bugs has been fixed. Also, new fixes and integration for Divi theme has been introduced. Please, update the plugin on your website now to get fixes and enhancements.
|
699 |
+
|
700 |
+
= 1.5.8 =
|
701 |
+
In this release, reported bugs has been fixed. Please, update the plugin on your website now to get fixes and enhancements.
|
702 |
+
|
703 |
+
= 1.5.7 =
|
704 |
+
In this release, a new Schema type CollectionPage has been added to empower your site Categories. Please, update the plugin on your website now to get the new enhancements.
|
705 |
+
|
706 |
+
= 1.5.6 =
|
707 |
+
In this release, new integration for SEO Framework plugin and other cool features has been introduced. Please, update the plugin on your website now to get the new enhancements.
|
708 |
+
|
709 |
+
= 1.5.5 =
|
710 |
+
Fixed a fatal error. Please, update the plugin on your website now to get the new enhancements.
|
711 |
+
|
712 |
+
= 1.5.4 =
|
713 |
+
In this release, a good set of enhancements has been added, also introduced new Schema type Blog, which markup your Blog posts page automatically. Also added integration for Genesis Framework. Please, update the plugin on your website now to get the new enhancements.
|
714 |
+
|
715 |
+
= 1.5.3 =
|
716 |
+
In this release, a better support added to AMP pages, now the plugin will work on post types enabled AMP pages if found, and present Schema type by ref post meta saved in each post. Also added support Schema markup for comments. Please, update the plugin on your website now to get the new enhancements.
|
717 |
+
|
718 |
+
= 1.5.2 =
|
719 |
+
New features introduced in this update release, fixed a minor warning on 404 pages. Please, update the plugin on your website now to get this fix and new features.
|
720 |
+
|
721 |
+
= 1.5.1 =
|
722 |
+
Fixed a fatal error on AMP posts, also another fix for VideoObject. Please, update the plugin on your website now to get this fix and other enhancements.
|
723 |
+
|
724 |
+
= 1.5 =
|
725 |
+
Fixed a fatal error on plugin activation, added VideoObject support and more awesome enhancements. Please, update the plugin on your website now to get this fix and other enhancements.
|
726 |
+
|
727 |
+
= 1.4.8 =
|
728 |
+
Fixed an important bug within the plugin, Schema post was saved as draft and no way to set is as publish.Please, update the plugin on your website now to get this fix and other enhancements.
|
729 |
+
|
730 |
+
= 1.4.6 =
|
731 |
+
Added ability to set Featured image automatically when creating or editing a post. Added back settings Content tab. Fixed admin notices and bugs. A few minor code/ documentation tweaks, updated readme.txt file with new details. Please, update the plugin on your website now to get bug fixes, enhancements and new cool features in this release.
|
schema.php
ADDED
@@ -0,0 +1,334 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: Schema
|
4 |
+
* Plugin URI: https://schema.press
|
5 |
+
* Description: The next generation of Structured Data.
|
6 |
+
* Author: Hesham
|
7 |
+
* Author URI: http://zebida.com
|
8 |
+
* Version: 1.6.9.8.2
|
9 |
+
* Text Domain: schema-wp
|
10 |
+
* Domain Path: languages
|
11 |
+
*
|
12 |
+
* Schema is distributed under the terms of the GNU General Public License as published by
|
13 |
+
* the Free Software Foundation, either version 2 of the License, or
|
14 |
+
* any later version.
|
15 |
+
*
|
16 |
+
* Schema is distributed in the hope that it will be useful,
|
17 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
+
* GNU General Public License for more details.
|
20 |
+
*
|
21 |
+
* You should have received a copy of the GNU General Public License
|
22 |
+
* along with Schema. If not, see <http://www.gnu.org/licenses/>.
|
23 |
+
*
|
24 |
+
* @package Schema
|
25 |
+
* @category Core
|
26 |
+
* @author Hesham Zebida
|
27 |
+
* @version 1.0
|
28 |
+
*/
|
29 |
+
|
30 |
+
// Exit if accessed directly
|
31 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
32 |
+
|
33 |
+
if ( ! class_exists( 'Schema_WP' ) ) :
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Main Schema_WP Class
|
37 |
+
*
|
38 |
+
* @since 1.0
|
39 |
+
*/
|
40 |
+
final class Schema_WP {
|
41 |
+
/** Singleton *************************************************************/
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @var Schema_WP The one true Schema_WP
|
45 |
+
* @since 1.0
|
46 |
+
*/
|
47 |
+
private static $instance;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* The version number of Schema
|
51 |
+
*
|
52 |
+
* @since 1.0
|
53 |
+
*/
|
54 |
+
private $version = '1.6.9.8.2';
|
55 |
+
|
56 |
+
/**
|
57 |
+
* The settings instance variable
|
58 |
+
*
|
59 |
+
* @var Schema_WP_Settings
|
60 |
+
* @since 1.0
|
61 |
+
*/
|
62 |
+
public $settings;
|
63 |
+
|
64 |
+
/**
|
65 |
+
* The rewrite class instance variable
|
66 |
+
*
|
67 |
+
* @var Schema_WP_Rewrites
|
68 |
+
* @since 1.0
|
69 |
+
*/
|
70 |
+
public $rewrites;
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Main Schema_WP Instance
|
74 |
+
*
|
75 |
+
* Insures that only one instance of Schema_WP exists in memory at any one
|
76 |
+
* time. Also prevents needing to define globals all over the place.
|
77 |
+
*
|
78 |
+
* @since 1.0
|
79 |
+
* @static
|
80 |
+
* @staticvar array $instance
|
81 |
+
* @uses Schema_WP::setup_globals() Setup the globals needed
|
82 |
+
* @uses Schema_WP::includes() Include the required files
|
83 |
+
* @return Schema_WP
|
84 |
+
*/
|
85 |
+
public static function instance() {
|
86 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof SCHEMA_WP ) ) {
|
87 |
+
self::$instance = new SCHEMA_WP;
|
88 |
+
|
89 |
+
if( version_compare( PHP_VERSION, '5.4', '<' ) ) {
|
90 |
+
|
91 |
+
add_action( 'admin_notices', array( 'SCHEMA_WP', 'below_php_version_notice' ) );
|
92 |
+
|
93 |
+
return self::$instance;
|
94 |
+
}
|
95 |
+
|
96 |
+
self::$instance->setup_constants();
|
97 |
+
self::$instance->includes();
|
98 |
+
|
99 |
+
add_action( 'plugins_loaded', array( self::$instance, 'setup_objects' ), -1 );
|
100 |
+
add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
|
101 |
+
}
|
102 |
+
return self::$instance;
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Throw error on object clone
|
107 |
+
*
|
108 |
+
* The whole idea of the singleton design pattern is that there is a single
|
109 |
+
* object therefore, we don't want the object to be cloned.
|
110 |
+
*
|
111 |
+
* @since 1.0
|
112 |
+
* @access protected
|
113 |
+
* @return void
|
114 |
+
*/
|
115 |
+
public function __clone() {
|
116 |
+
// Cloning instances of the class is forbidden
|
117 |
+
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'schema-wp' ), '1.0' );
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Disable unserializing of the class
|
122 |
+
*
|
123 |
+
* @since 1.0
|
124 |
+
* @access protected
|
125 |
+
* @return void
|
126 |
+
*/
|
127 |
+
public function __wakeup() {
|
128 |
+
// Unserializing instances of the class is forbidden
|
129 |
+
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'schema-wp' ), '1.0' );
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Show a warning to sites running PHP < 5.3
|
134 |
+
*
|
135 |
+
* @access private
|
136 |
+
* @since 1.0
|
137 |
+
* @return void
|
138 |
+
*/
|
139 |
+
public function below_php_version_notice() {
|
140 |
+
echo '<div class="error"><p>' . __( 'Your version of PHP is below the minimum version of PHP required by Schema plugin. Please contact your host and request that your version be upgraded to 5.4 or later.', 'schema-wp' ) . '</p></div>';
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Setup plugin constants
|
145 |
+
*
|
146 |
+
* @access private
|
147 |
+
* @since 1.0
|
148 |
+
* @return void
|
149 |
+
*/
|
150 |
+
private function setup_constants() {
|
151 |
+
// Plugin version
|
152 |
+
if ( ! defined( 'SCHEMAWP_VERSION' ) ) {
|
153 |
+
define( 'SCHEMAWP_VERSION', $this->version );
|
154 |
+
}
|
155 |
+
|
156 |
+
// Plugin Folder Path
|
157 |
+
if ( ! defined( 'SCHEMAWP_PLUGIN_DIR' ) ) {
|
158 |
+
define( 'SCHEMAWP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
159 |
+
}
|
160 |
+
|
161 |
+
// Plugin Folder URL
|
162 |
+
if ( ! defined( 'SCHEMAWP_PLUGIN_URL' ) ) {
|
163 |
+
define( 'SCHEMAWP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
164 |
+
}
|
165 |
+
|
166 |
+
// Plugin Root File
|
167 |
+
if ( ! defined( 'SCHEMAWP_PLUGIN_FILE' ) ) {
|
168 |
+
define( 'SCHEMAWP_PLUGIN_FILE', __FILE__ );
|
169 |
+
}
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Include required files
|
174 |
+
*
|
175 |
+
* @access private
|
176 |
+
* @since 1.0
|
177 |
+
* @return void
|
178 |
+
*/
|
179 |
+
private function includes() {
|
180 |
+
|
181 |
+
global $schema_wp_options;
|
182 |
+
|
183 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/settings/register-settings.php';
|
184 |
+
|
185 |
+
// get settings
|
186 |
+
$schema_wp_options = schema_wp_get_settings();
|
187 |
+
|
188 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/class-capabilities.php';
|
189 |
+
|
190 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/post-type/schema-post-type.php';
|
191 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/post-type/schema-wp-submit.php';
|
192 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/post-type/schema-wp-ajax.php';
|
193 |
+
|
194 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/admin-functions.php';
|
195 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/ref.php';
|
196 |
+
|
197 |
+
if( is_admin() ) {
|
198 |
+
|
199 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/meta/class-meta.php';
|
200 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/meta.php';
|
201 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/meta-tax/class-meta-tax.php';
|
202 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/meta-tax.php';
|
203 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/meta-exclude.php';
|
204 |
+
|
205 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/settings/display-settings.php';
|
206 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/settings/contextual-help.php';
|
207 |
+
|
208 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/admin-pages.php';
|
209 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/extensions.php';
|
210 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/scripts.php';
|
211 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/class-menu.php';
|
212 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/class-notices.php';
|
213 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/class-welcome.php';
|
214 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/class-feedback.php';
|
215 |
+
|
216 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/post-type/class-columns.php';
|
217 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/post-type/schema-columns.php';
|
218 |
+
}
|
219 |
+
|
220 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/misc-functions.php';
|
221 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/scripts.php';
|
222 |
+
|
223 |
+
// Schema outputs
|
224 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/json/web-page-element.php';
|
225 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/json/knowledge-graph.php';
|
226 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/json/search-results.php';
|
227 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/json/blog.php';
|
228 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/json/category.php';
|
229 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/json/tag.php';
|
230 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/json/post-type-archive.php';
|
231 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/json/taxonomy.php';
|
232 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/json/author.php';
|
233 |
+
|
234 |
+
// Schema main output
|
235 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/json/schema-output.php';
|
236 |
+
|
237 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/admin-bar-menu.php';
|
238 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/admin/updater/class-license-handler.php';
|
239 |
+
|
240 |
+
// Plugin Integrations
|
241 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/integrations/yoast-seo.php';
|
242 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/integrations/amp.php';
|
243 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/integrations/wp-rich-snippets.php';
|
244 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/integrations/seo-framework.php';
|
245 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/integrations/visual-composer.php';
|
246 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/integrations/thirstyaffiliates.php';
|
247 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/integrations/woocommerce.php';
|
248 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/integrations/edd.php';
|
249 |
+
|
250 |
+
// Theme Integrations
|
251 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/integrations/genesis.php';
|
252 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/integrations/thesis.php';
|
253 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/integrations/divi.php';
|
254 |
+
|
255 |
+
// Core Extensions
|
256 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/extensions/post-meta-generator.php';
|
257 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/extensions/breadcrumbs.php';
|
258 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/extensions/author.php';
|
259 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/extensions/page-about.php';
|
260 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/extensions/page-contact.php';
|
261 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/extensions/video-object.php';
|
262 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/extensions/audio-object.php';
|
263 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/extensions/sameAs.php';
|
264 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/extensions/comment.php';
|
265 |
+
|
266 |
+
// Install
|
267 |
+
require_once SCHEMAWP_PLUGIN_DIR . 'includes/install.php';
|
268 |
+
}
|
269 |
+
|
270 |
+
/**
|
271 |
+
* Setup all objects
|
272 |
+
*
|
273 |
+
* @access public
|
274 |
+
* @since 1.0
|
275 |
+
* @return void
|
276 |
+
*/
|
277 |
+
public function setup_objects() {
|
278 |
+
|
279 |
+
//self::$instance->settings = new Schema_WP_Settings;
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Loads the plugin language files
|
284 |
+
*
|
285 |
+
* @access public
|
286 |
+
* @since 1.0
|
287 |
+
* @return void
|
288 |
+
*/
|
289 |
+
public function load_textdomain() {
|
290 |
+
|
291 |
+
// Set filter for plugin's languages directory
|
292 |
+
$lang_dir = dirname( plugin_basename( SCHEMAWP_PLUGIN_FILE ) ) . '/languages/';
|
293 |
+
$lang_dir = apply_filters( 'schema_wp_languages_directory', $lang_dir );
|
294 |
+
|
295 |
+
// Traditional WordPress plugin locale filter
|
296 |
+
$locale = apply_filters( 'plugin_locale', get_locale(), 'schema-wp' );
|
297 |
+
$mofile = sprintf( '%1$s-%2$s.mo', 'schema-wp', $locale );
|
298 |
+
|
299 |
+
// Setup paths to current locale file
|
300 |
+
$mofile_local = $lang_dir . $mofile;
|
301 |
+
$mofile_global = WP_LANG_DIR . '/schema-wp/' . $mofile;
|
302 |
+
|
303 |
+
if ( file_exists( $mofile_global ) ) {
|
304 |
+
// Look in global /wp-content/languages/schema/ folder
|
305 |
+
load_textdomain( 'schema-wp', $mofile_global );
|
306 |
+
} elseif ( file_exists( $mofile_local ) ) {
|
307 |
+
// Look in local /wp-content/plugins/schema/languages/ folder
|
308 |
+
load_textdomain( 'schema-wp', $mofile_local );
|
309 |
+
} else {
|
310 |
+
// Load the default language files
|
311 |
+
load_plugin_textdomain( 'schema-wp', false, $lang_dir );
|
312 |
+
}
|
313 |
+
}
|
314 |
+
}
|
315 |
+
|
316 |
+
endif; // End if class_exists check
|
317 |
+
|
318 |
+
|
319 |
+
/**
|
320 |
+
* The main function responsible for returning the one true Schema_WP
|
321 |
+
* Instance to functions everywhere.
|
322 |
+
*
|
323 |
+
* Use this function like you would a global variable, except without needing
|
324 |
+
* to declare the global.
|
325 |
+
*
|
326 |
+
* Example: <?php $schema_wp = schema_wp(); ?>
|
327 |
+
*
|
328 |
+
* @since 1.0
|
329 |
+
* @return Schema_WP The one true Schema_WP Instance
|
330 |
+
*/
|
331 |
+
function schema_wp() {
|
332 |
+
return Schema_WP::instance();
|
333 |
+
}
|
334 |
+
schema_wp();
|
uninstall.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall Schema
|
4 |
+
*
|
5 |
+
* @package Schema
|
6 |
+
* @subpackage Uninstall
|
7 |
+
* @copyright Copyright (c) 2016, Hesham Zebida
|
8 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
+
* @since 1.0
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) exit;
|
14 |
+
|
15 |
+
// Make sure that we are uninstalling
|
16 |
+
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) )
|
17 |
+
exit();
|
18 |
+
|
19 |
+
// Load Schema file
|
20 |
+
include_once( 'schema.php' );
|
21 |
+
|
22 |
+
// Leave no trail
|
23 |
+
$option_name = 'schema_wp_settings';
|
24 |
+
|
25 |
+
if ( !is_multisite() ) {
|
26 |
+
|
27 |
+
$options = get_option( $option_name );
|
28 |
+
|
29 |
+
// Debug
|
30 |
+
//echo '<pre>'; print_r($options); echo '</pre>'; exit;
|
31 |
+
|
32 |
+
|
33 |
+
if ( isset($options['uninstall_on_delete']) && $options['uninstall_on_delete'] == true ) {
|
34 |
+
|
35 |
+
// Remove the Schema entries for posts and pages
|
36 |
+
wp_delete_post( $options['schema_wp_post'] );
|
37 |
+
wp_delete_post( $options['schema_wp_page'] );
|
38 |
+
|
39 |
+
// Delete all meta keys
|
40 |
+
// @since 1.4.4
|
41 |
+
delete_post_meta_by_key( '_schema_ref' );
|
42 |
+
delete_post_meta_by_key( '_schema_json' );
|
43 |
+
delete_post_meta_by_key( '_schema_json_timestamp' );
|
44 |
+
delete_post_meta_by_key( '_schema_exclude' );
|
45 |
+
|
46 |
+
// Remove all plugin settings
|
47 |
+
delete_option( $option_name );
|
48 |
+
delete_option( 'schema_wp_version' );
|
49 |
+
delete_option( 'schema_wp_is_installed' );
|
50 |
+
|
51 |
+
// Remove all capabilities and roles
|
52 |
+
$caps = new Schema_WP_Capabilities;
|
53 |
+
$caps->remove_caps();
|
54 |
+
}
|
55 |
+
|
56 |
+
} else {
|
57 |
+
|
58 |
+
// This is a multisite
|
59 |
+
//
|
60 |
+
// @since 1.4
|
61 |
+
|
62 |
+
global $wpdb;
|
63 |
+
|
64 |
+
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
|
65 |
+
$original_blog_id = get_current_blog_id();
|
66 |
+
|
67 |
+
foreach ( $blog_ids as $blog_id ) {
|
68 |
+
|
69 |
+
switch_to_blog( $blog_id );
|
70 |
+
|
71 |
+
$options = get_option( $option_name );
|
72 |
+
|
73 |
+
if ( isset($options['uninstall_on_delete']) && $options['uninstall_on_delete'] == true ) {
|
74 |
+
|
75 |
+
// Remove the Schema entries for posts and pages
|
76 |
+
wp_delete_post( $options['schema_wp_post'] );
|
77 |
+
wp_delete_post( $options['schema_wp_page'] );
|
78 |
+
|
79 |
+
// Delete all JSON-LD meta keys
|
80 |
+
// @since 1.5.9.9
|
81 |
+
delete_post_meta_by_key( '_schema_ref' );
|
82 |
+
delete_post_meta_by_key( '_schema_json' );
|
83 |
+
delete_post_meta_by_key( '_schema_json_timestamp' );
|
84 |
+
delete_post_meta_by_key( '_schema_exclude' );
|
85 |
+
|
86 |
+
// Remove all plugin settings
|
87 |
+
delete_option( $option_name );
|
88 |
+
delete_option( 'schema_wp_version' );
|
89 |
+
delete_option( 'schema_wp_is_installed' );
|
90 |
+
|
91 |
+
// Remove all capabilities and roles
|
92 |
+
$caps = new Schema_WP_Capabilities;
|
93 |
+
$caps->remove_caps();
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
switch_to_blog( $original_blog_id );
|
98 |
+
}
|