Kirki 3.1.0

This commit is contained in:
Alexander Agnarson 2020-03-23 20:16:04 +01:00
parent 53841c831e
commit 9c731b4d7d
21 changed files with 963 additions and 1969 deletions

View file

@ -1,3 +1,15 @@
## 3.1.0 - 2020-03-01
### Changed
* Completely refactored the google-fonts downloader. Fonts now get stored in `wp-content/fonts/{font-family}/{file}`.
* Updated Google-Fonts lists.
### Removed
* Removed the `branding` module.
* Removed the `styling` module.
* Removed the `telemetry` module.
* Removed the `Kirki_Fonts_Helper` class.
## 3.0.45 - 2019-09-01
### Fixed

View file

@ -1,36 +1,28 @@
.select2-dropdown {
border-color: rgba(0, 0, 0, 0.1);
border-radius: 0;
}
border-radius: 0; }
.select2-container {
min-width: 100px;
width: 100% !important;
}
width: 100% !important; }
.select2-container--open .select2-dropdown--above,
.select2-container--open .select2-dropdown--below {
z-index: 9999999;
min-width: 100px;
}
min-width: 100px; }
.select2-container--default .select2-search--dropdown .select2-search__field {
border-color: rgba(0, 0, 0, 0.1);
}
border-color: rgba(0, 0, 0, 0.1); }
.select2-container--default .select2-selection--multiple, .select2-container--default .select2-selection--single {
border-color: rgba(0, 0, 0, 0.1);
border-radius: 0;
}
border-radius: 0; }
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: rgba(255, 255, 255, 0);
background-color: transparent;
border: none;
border-radius: 0;
}
border-radius: 0; }
.wp-customizer .select2-container {
z-index: 8 !important;
}
z-index: 8 !important; }
.wp-customizer .select2-container.select2-container--open {
z-index: 999999 !important;
}
z-index: 999999 !important; }
/*# sourceMappingURL=kirki.css.map */

View file

@ -1,19 +1,16 @@
@charset "UTF-8";
.customize-control-kirki-background {
position: relative;
}
position: relative; }
.customize-control-kirki-background .background-attachment h4,
.customize-control-kirki-background .background-color h4,
.customize-control-kirki-background .background-position h4,
.customize-control-kirki-background .background-repeat h4,
.customize-control-kirki-background .background-size h4 {
margin-bottom: 5px;
}
margin-bottom: 5px; }
.customize-control-kirki-background .background-attachment .buttonset,
.customize-control-kirki-background .background-size .buttonset {
display: flex;
flex-wrap: wrap;
}
flex-wrap: wrap; }
.customize-control-kirki-background .background-attachment .buttonset .switch-label,
.customize-control-kirki-background .background-size .buttonset .switch-label {
background: rgba(0, 0, 0, 0.05);
@ -22,52 +19,42 @@
padding: 0.5em 1em;
margin: 0;
text-align: center;
flex-grow: 1;
}
flex-grow: 1; }
.customize-control-kirki-background .background-attachment .buttonset .switch-input:checked + .switch-label,
.customize-control-kirki-background .background-size .buttonset .switch-input:checked + .switch-label {
background-color: #3498DB;
color: #fff;
}
color: #fff; }
.customize-control-kirki-code textarea {
width: 100%;
min-height: 200px;
}
min-height: 200px; }
.customize-control-kirki-color-palette {
position: relative;
}
position: relative; }
.customize-control-kirki-color-palette label {
position: relative;
display: inline-block;
padding: 0;
margin: 0;
}
margin: 0; }
.customize-control-kirki-color-palette .colors-wrapper {
max-height: 300px;
overflow-y: auto;
padding: 10px;
display: flex;
flex-wrap: wrap;
}
flex-wrap: wrap; }
.customize-control-kirki-color-palette .colors-wrapper .color-palette-color {
color: transparent;
display: block;
width: 100%;
height: 100%;
overflow: hidden;
border: 1px solid rgba(0, 0, 0, 0.2);
}
border: 1px solid rgba(0, 0, 0, 0.2); }
.customize-control-kirki-color-palette .colors-wrapper.round label {
padding: 3px;
}
padding: 3px; }
.customize-control-kirki-color-palette .colors-wrapper.round .color-palette-color {
border-radius: 50%;
}
border-radius: 50%; }
.customize-control-kirki-color-palette .colors-wrapper.box-shadow .color-palette-color {
box-shadow: inset 3px 3px 13px 2px rgba(0, 0, 0, 0.22);
}
box-shadow: inset 3px 3px 13px 2px rgba(0, 0, 0, 0.22); }
.customize-control-kirki-color-palette .colors-wrapper input:checked + label .color-palette-color {
border: 0;
width: 150%;
@ -75,239 +62,182 @@
position: relative;
left: -25%;
top: -25%;
z-index: 1;
}
z-index: 1; }
.customize-control-kirki-color-palette .colors-wrapper.with-margin label {
margin: 3px;
}
margin: 3px; }
.customize-control-kirki-color-palette .colors-wrapper input {
display: none;
}
display: none; }
.customize-control-kirki-color-palette .colors-wrapper input:checked + label .color-palette-color {
box-shadow: 1px 1px 10px 1px #333333;
border: 1px solid rgba(0, 0, 0, 0.3);
}
border: 1px solid rgba(0, 0, 0, 0.3); }
.customize-control-kirki-color input[data-type=hue] + .iris-strip-horiz .iris-slider {
background-image: -webkit-linear-gradient(left, red, #ff7f00, yellow, #80ff00, lime, #00ff80, aqua, #007fff, blue, #7f00ff, fuchsia, #ff0080, red) !important;
widows: 100% !important;
}
.customize-control-kirki-color input[data-type="hue"] + .iris-strip-horiz .iris-slider {
background-image: -webkit-linear-gradient(left, red, #ff7f00, yellow, #80ff00, lime, #00ff80, cyan, #007fff, blue, #7f00ff, magenta, #ff0080, red) !important;
widows: 100% !important; }
.customize-control-kirki-color .iris-picker .iris-square-handle {
z-index: 8;
}
z-index: 8; }
.customize-control-kirki-color .iris-picker.iris-border {
width: 100% !important;
}
width: 100% !important; }
.customize-control-kirki-color .iris-picker-inner {
display: grid;
grid-template-columns: 1fr 20px;
grid-gap: 7px;
}
grid-gap: 7px; }
.customize-control-kirki-color .iris-picker-inner > * {
width: 100% !important;
margin-left: 0 !important;
margin-right: 0 !important;
}
margin-right: 0 !important; }
.customize-control-kirki-color .kirki-input-container[data-has-alpha=true] .iris-picker-inner {
grid-template-columns: 1fr 20px 20px;
}
grid-template-columns: 1fr 20px 20px; }
.customize-control-kirki-color .iris-only-strip {
width: 100% !important;
}
width: 100% !important; }
.customize-control-kirki-color .iris-only-strip .iris-picker-inner {
grid-template-columns: 1fr;
}
grid-template-columns: 1fr; }
.customize-control-kirki-dashicons {
position: relative;
}
position: relative; }
.customize-control-kirki-dashicons label {
position: relative;
display: inline-block;
}
display: inline-block; }
.customize-control-kirki-dashicons .icons-wrapper {
max-height: 300px;
overflow-y: scroll;
}
overflow-y: scroll; }
.customize-control-kirki-dashicons .icons-wrapper h4 {
font-weight: 300;
margin: 0.7em 0;
}
margin: 0.7em 0; }
.customize-control-kirki-dashicons .icons-wrapper .dashicons {
padding: 3px;
font-size: 25px;
width: 25px;
height: 25px;
border: 1px solid transparent;
}
border: 1px solid transparent; }
.customize-control-kirki-dashicons .icons-wrapper input {
display: none;
}
display: none; }
.customize-control-kirki-dashicons .icons-wrapper input:checked + label .dashicons {
border: 1px solid #3498DB;
color: #000;
}
color: #000; }
.wp-customizer div.ui-datepicker {
z-index: 500001 !important;
width: 255px;
background: #fff;
border: 1px solid #dedede;
}
border: 1px solid #dedede; }
.wp-customizer div.ui-datepicker .ui-datepicker-header {
padding: 10px;
background: #e5e5e5;
border-bottom: 1px solid #fff;
}
border-bottom: 1px solid #fff; }
.wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-next,
.wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-prev {
display: block;
position: absolute;
width: 1em;
overflow: hidden;
}
overflow: hidden; }
.wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-next:after, .wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-next:before,
.wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-prev:after,
.wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-prev:before {
font-family: dashicons;
}
font-family: dashicons; }
.wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-next:after:hover, .wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-next:before:hover,
.wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-prev:after:hover,
.wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-prev:before:hover {
cursor: pointer;
}
cursor: pointer; }
.wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-next .ui-icon,
.wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-prev .ui-icon {
display: none;
}
display: none; }
.wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-prev {
left: 10px;
}
left: 10px; }
.wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-prev:before {
content: "";
}
content: "\f341"; }
.wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-next {
right: 10px;
}
right: 10px; }
.wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-next:after {
content: "";
}
content: "\f345"; }
.wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-title {
text-align: center;
}
text-align: center; }
.wp-customizer div.ui-datepicker .ui-datepicker-calendar {
border-collapse: collapse;
width: 100%;
}
width: 100%; }
.wp-customizer div.ui-datepicker .ui-datepicker-calendar thead {
background: #e5e5e5;
padding: 5px;
}
padding: 5px; }
.wp-customizer div.ui-datepicker .ui-datepicker-calendar tr td {
text-align: center;
}
text-align: center; }
.wp-customizer div.ui-datepicker .ui-datepicker-calendar tr td a {
display: block;
padding: 5px;
color: #333;
text-decoration: none;
}
text-decoration: none; }
.wp-customizer div.ui-datepicker .ui-datepicker-calendar tr td a.ui-state-active, .wp-customizer div.ui-datepicker .ui-datepicker-calendar tr td a:hover {
color: #fff;
background-color: #0073aa;
}
background-color: #0073aa; }
.wp-customizer div.ui-datepicker .ui-datepicker-calendar tr td.ui-state-disabled a, .wp-customizer div.ui-datepicker .ui-datepicker-calendar tr td.ui-state-disabled .ui-state-default a {
color: #999;
}
color: #999; }
.customize-control-kirki-dimensions {
position: relative;
}
position: relative; }
.customize-control-kirki-dimensions .wrapper {
border: 1px solid rgba(0, 0, 0, 0.1);
padding: 10px;
}
padding: 10px; }
.customize-control-kirki-dimensions .wrapper .control {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
justify-content: space-between; }
.customize-control-kirki-dimensions .wrapper .control > div {
width: 48%;
}
width: 48%; }
.customize-control-kirki-dimensions .wrapper .control > div h5 {
margin: 10px 0 7px;
}
margin: 10px 0 7px; }
.customize-control-kirki-dimensions .wrapper .control > div .inner {
display: flex;
}
display: flex; }
.customize-control-kirki-editor textarea {
width: 100%;
}
width: 100%; }
.customize-control-kirki-generic input {
width: 100%;
}
width: 100%; }
.customize-control-kirki-generic textarea {
width: 100%;
border: 1px solid rgba(0, 0, 0, 0.1);
-webkit-box-shadow: none;
box-shadow: none;
}
box-shadow: none; }
.customize-control-kirki-multicolor .multicolor-single-color-wrapper {
display: flex;
justify-content: space-between;
}
justify-content: space-between; }
.customize-control-kirki-multicolor .multicolor-single-label {
order: 2;
}
order: 2; }
.customize-control-kirki-multicolor .wp-picker-container {
width: 100%;
}
width: 100%; }
.customize-control-kirki-multicolor .wp-picker-container > .wp-color-result {
width: 100%;
}
width: 100%; }
.customize-control-kirki-multicolor .wp-picker-container.wp-picker-active + .multicolor-single-label {
display: none;
}
display: none; }
.customize-control-kirki-number .customize-control-content {
display: flex;
align-items: stretch;
}
align-items: stretch; }
.customize-control-kirki-number .customize-control-content input {
width: 100%;
-moz-appearance: textfield;
}
-moz-appearance: textfield; }
.customize-control-kirki-number .customize-control-content input::-webkit-inner-spin-button, .customize-control-kirki-number .customize-control-content input::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
margin: 0; }
.customize-control-kirki-number .customize-control-content .quantity {
min-width: 2rem;
max-width: 2rem;
text-align: center;
line-height: 24px;
}
line-height: 24px; }
.customize-control-kirki-palette {
position: relative;
}
.customize-control-kirki-palette input[type=radio] {
display: none;
}
.customize-control-kirki-palette input[type=radio]:checked + label {
border: 3px solid rgba(0, 0, 0, 0.4);
}
position: relative; }
.customize-control-kirki-palette input[type="radio"] {
display: none; }
.customize-control-kirki-palette input[type="radio"]:checked + label {
border: 3px solid rgba(0, 0, 0, 0.4); }
.customize-control-kirki-palette label {
background: none;
padding: 0;
border-top: 3px solid transparent;
border-bottom: 3px solid transparent;
margin-bottom: 5px;
display: flex;
}
display: flex; }
.customize-control-kirki-palette label span {
padding: 10px 0;
flex-grow: 1;
@ -320,27 +250,22 @@
-o-transition: all 200ms ease-in-out;
transition: all 200ms ease-in-out;
border-top: 1px solid rgba(0, 0, 0, 0.1);
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
border-bottom: 1px solid rgba(0, 0, 0, 0.1); }
.customize-control-kirki-palette label span:first-child {
border-left: 1px solid rgba(0, 0, 0, 0.1);
}
border-left: 1px solid rgba(0, 0, 0, 0.1); }
.customize-control-kirki-palette label span:last-child {
border-right: 1px solid rgba(0, 0, 0, 0.1);
}
border-right: 1px solid rgba(0, 0, 0, 0.1); }
.customize-control-kirki-palette label span:hover {
padding: 10px;
flex-grow: 3;
min-width: 60px;
font-size: 10px;
line-height: 10px;
color: #000;
}
color: #000; }
.customize-control-kirki-radio-buttonset .buttonset {
display: flex;
flex-wrap: wrap;
}
flex-wrap: wrap; }
.customize-control-kirki-radio-buttonset .buttonset .switch-label {
background: rgba(0, 0, 0, 0.1);
border: 1px rgba(0, 0, 0, 0.1);
@ -348,21 +273,17 @@
margin: 0;
text-align: center;
padding: 0.5em 1em;
flex-grow: 1;
}
flex-grow: 1; }
.customize-control-kirki-radio-buttonset .buttonset .switch-input:checked + .switch-label {
background-color: #00a0d2;
color: rgba(255, 255, 255, 0.8);
}
color: rgba(255, 255, 255, 0.8); }
.customize-control-kirki-radio-image > .image {
display: flex;
flex-wrap: wrap;
}
flex-wrap: wrap; }
.customize-control-kirki-radio-image label {
position: relative;
display: inline-block;
}
display: inline-block; }
.customize-control-kirki-radio-image label .image-label {
display: none;
position: absolute;
@ -371,29 +292,23 @@
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.7);
font-weight: bold;
}
font-weight: bold; }
.customize-control-kirki-radio-image label .image-label .inner {
width: 100%;
height: 100%;
text-align: center;
padding: 0.5em;
vertical-align: middle;
}
vertical-align: middle; }
.customize-control-kirki-radio-image label:hover .image-label {
display: block;
}
display: block; }
.customize-control-kirki-radio-image input {
display: none;
}
display: none; }
.customize-control-kirki-radio-image input img {
border: 1px solid transparent;
}
border: 1px solid transparent; }
.customize-control-kirki-radio-image input:checked + label img {
-webkit-box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.25);
box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.25);
border: 1px solid #3498DB;
}
border: 1px solid #3498DB; }
.customize-control-kirki-radio-image input + label .image-clickable {
position: absolute;
top: 0;
@ -401,114 +316,87 @@
left: 0;
right: 0;
width: 100%;
height: 100%;
}
height: 100%; }
.customize-control-kirki-radio {
position: relative;
}
position: relative; }
.customize-control-kirki-radio input[type=radio] {
width: 18px;
height: 18px;
}
height: 18px; }
.customize-control-kirki-radio input[type=radio]:checked:before {
width: 10px;
height: 10px;
margin: 3px;
}
margin: 3px; }
.customize-control-kirki-radio label {
display: list-item;
margin-bottom: 7px;
}
margin-bottom: 7px; }
.customize-control-kirki-radio label .option-description {
display: block;
color: rgba(0, 0, 0, 0.35);
font-size: 0.9em;
padding-left: 25px;
}
padding-left: 25px; }
.customize-control-repeater {
position: relative;
}
position: relative; }
.customize-control-repeater .repeater-fields .repeater-row {
border: 1px solid #e5e5e5;
margin-top: 0.5rem;
background: #eee;
position: relative;
}
position: relative; }
.customize-control-repeater .repeater-fields .repeater-row.minimized {
border: 1px solid #dfdfdf;
padding: 0;
}
padding: 0; }
.customize-control-repeater .repeater-fields .repeater-row.minimized:hover {
border: 1px solid #e5e5e5;
}
border: 1px solid #e5e5e5; }
.customize-control-repeater .repeater-fields .repeater-row.minimized .repeater-row-content {
display: none;
}
display: none; }
.customize-control-repeater .repeater-fields .repeater-row label {
margin-bottom: 12px;
clear: both;
}
clear: both; }
.customize-control-repeater .repeater-fields .repeater-row .repeater-field.repeater-field- {
display: none;
}
display: none; }
.customize-control-repeater .repeater-fields .repeater-row .repeater-field.repeater-field-radio-image input {
display: none;
}
display: none; }
.customize-control-repeater .repeater-fields .repeater-row .repeater-field.repeater-field-radio-image input img {
border: 1px solid transparent;
}
border: 1px solid transparent; }
.customize-control-repeater .repeater-fields .repeater-row .repeater-field.repeater-field-radio-image input:checked + label img {
-webkit-box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.25);
box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.25);
border: 1px solid #3498DB;
}
border: 1px solid #3498DB; }
.customize-control-repeater .repeater-fields .repeater-row .repeater-field:last-child {
border-bottom: none;
padding-bottom: 0;
}
padding-bottom: 0; }
.customize-control-repeater button.repeater-add {
margin-top: 1rem;
}
margin-top: 1rem; }
.customize-control-repeater .repeater-row-content {
padding: 10px 15px;
background: #fff;
}
background: #fff; }
.customize-control-repeater .repeater-field {
margin-bottom: 12px;
width: 100%;
clear: both;
padding-bottom: 12px;
border-bottom: 1px dotted #CCC;
}
border-bottom: 1px dotted #CCC; }
.customize-control-repeater .repeater-field .customize-control-title {
font-size: 13px;
line-height: initial;
}
line-height: initial; }
.customize-control-repeater .repeater-field .customize-control-description {
font-size: 13px;
line-height: initial;
}
line-height: initial; }
.customize-control-repeater .repeater-field.repeater-field-hidden {
margin: 0;
padding: 0;
border: 0;
}
border: 0; }
.customize-control-repeater .repeater-field-select select {
margin-left: 0;
}
margin-left: 0; }
.customize-control-repeater .repeater-field-checkbox label {
line-height: 28px;
}
line-height: 28px; }
.customize-control-repeater .repeater-field-checkbox input {
line-height: 28px;
margin-right: 5px;
}
margin-right: 5px; }
.customize-control-repeater .repeater-field-textarea textarea {
width: 100%;
resize: vertical;
}
resize: vertical; }
.customize-control-repeater .repeater-row-header {
background: white;
border-bottom: 1px solid #dfdfdf;
@ -518,18 +406,15 @@
min-height: 20px;
line-height: 30px;
overflow: hidden;
word-wrap: break-word;
}
word-wrap: break-word; }
.customize-control-repeater .repeater-row-header:hover {
cursor: move;
}
cursor: move; }
.customize-control-repeater .repeater-row-header .dashicons {
font-size: 18px;
position: absolute;
right: 12px;
top: 2px;
color: #a0a5aa;
}
color: #a0a5aa; }
.customize-control-repeater .repeater-row-label {
font-size: 13px;
font-weight: 600;
@ -537,71 +422,57 @@
display: block;
width: 90%;
overflow: hidden;
height: 18px;
}
height: 18px; }
.customize-control-repeater .repeater-row-remove {
color: #a00;
}
color: #a00; }
.customize-control-repeater .repeater-row-remove:hover {
color: #f00;
}
color: #f00; }
.customize-control-repeater .repeater-minimize {
line-height: 36px;
}
line-height: 36px; }
.customize-control-repeater .remove-button,
.customize-control-repeater .upload-button {
width: 48%;
}
width: 48%; }
.kirki-image-attachment {
margin: 0;
text-align: center;
margin-bottom: 10px;
}
margin-bottom: 10px; }
.kirki-image-attachment img {
display: inline-block;
}
display: inline-block; }
.kirki-file-attachment {
margin: 0;
text-align: center;
margin-bottom: 10px;
}
margin-bottom: 10px; }
.kirki-file-attachment .file {
display: block;
padding: 10px 5px;
border: 1px dotted #c3c3c3;
background: #f9f9f9;
}
background: #f9f9f9; }
.limit {
padding: 3px;
border-radius: 3px;
}
border-radius: 3px; }
.limit.highlight {
background: #D32F2F;
color: #fff;
}
color: #fff; }
.customize-control-kirki-slider .wrapper {
display: flex;
align-items: center;
padding: 15px 0 7px;
position: relative;
}
position: relative; }
.customize-control-kirki-slider .wrapper .slider-reset {
position: absolute;
top: 0;
right: 0;
font-size: 12px;
transition: 0.3s ease-in-out;
color: rgba(0, 0, 0, 0.3);
}
color: rgba(0, 0, 0, 0.3); }
.customize-control-kirki-slider .wrapper .slider-reset:hover {
transform: scale(1.3);
color: #DC3232;
}
.customize-control-kirki-slider .wrapper input[type=range] {
color: #DC3232; }
.customize-control-kirki-slider .wrapper input[type="range"] {
display: block;
-webkit-appearance: none;
background-color: #bdc3c7;
@ -609,9 +480,8 @@
height: 5px;
border-radius: 5px;
margin: 0 auto;
outline: 0;
}
.customize-control-kirki-slider .wrapper input[type=range]::-webkit-slider-thumb {
outline: 0; }
.customize-control-kirki-slider .wrapper input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
background-color: #0085ba;
width: 17px;
@ -619,73 +489,58 @@
border-radius: 50%;
border: 1px solid #006799;
cursor: pointer;
transition: 0.3s ease-in-out;
}
.customize-control-kirki-slider .wrapper input[type=range]::-webkit-slider-thumb:hover {
transition: 0.3s ease-in-out; }
.customize-control-kirki-slider .wrapper input[type="range"]::-webkit-slider-thumb:hover {
background-color: #006799;
border: 2px solid #0085ba;
}
.customize-control-kirki-slider .wrapper input[type=range]::-webkit-slider-thumb:active {
transform: scale(1.2);
}
.customize-control-kirki-slider .wrapper input[type=text] {
border: 2px solid #0085ba; }
.customize-control-kirki-slider .wrapper input[type="range"]::-webkit-slider-thumb:active {
transform: scale(1.2); }
.customize-control-kirki-slider .wrapper input[type="text"] {
font-size: 13px;
background: transparent;
border: none;
box-shadow: none;
text-align: right;
padding: 0;
width: 40px;
}
width: 40px; }
.customize-control-kirki-slider .wrapper .value {
display: flex;
align-items: baseline;
}
align-items: baseline; }
.customize-control-kirki-sortable ul.ui-sortable li {
padding: 5px 10px;
border: 1px solid #333;
background: #fff;
}
background: #fff; }
.customize-control-kirki-sortable ul.ui-sortable li .dashicons.dashicons-menu {
float: right;
}
float: right; }
.customize-control-kirki-sortable ul.ui-sortable li .dashicons.visibility {
margin-right: 10px;
}
margin-right: 10px; }
.customize-control-kirki-sortable ul.ui-sortable li.invisible {
color: #aaa;
border: 1px dashed #aaa;
}
border: 1px dashed #aaa; }
.customize-control-kirki-sortable ul.ui-sortable li.invisible .dashicons.visibility {
color: #aaa;
}
color: #aaa; }
.customize-control-kirki-switch {
position: relative;
}
position: relative; }
.customize-control-kirki-switch .switch-off,
.customize-control-kirki-switch .switch-on {
opacity: 1;
padding: 8px;
font-size: 14px;
line-height: 18px;
}
line-height: 18px; }
.customize-control-kirki-switch .switch-on {
color: #fff;
opacity: 0;
}
opacity: 0; }
.customize-control-kirki-switch .switch-off {
color: #777;
}
color: #777; }
.customize-control-kirki-switch .switch {
border: none;
margin-bottom: 1.5rem;
outline: 0;
padding: 0;
user-select: none;
border-radius: 3rem;
}
border-radius: 3rem; }
.customize-control-kirki-switch label {
background: #b4b9be;
float: left;
@ -695,8 +550,7 @@
margin-bottom: 1rem;
position: relative;
transition: left 0.15s ease-out;
border-radius: 3rem;
}
border-radius: 3rem; }
.customize-control-kirki-switch label:after {
background: #FFFFFF;
content: "";
@ -707,40 +561,30 @@
width: calc(.85rem + 10px);
height: calc(.85rem + 10px);
transition: all 0.25s ease-in-out;
border-radius: 3rem;
}
border-radius: 3rem; }
.customize-control-kirki-switch input + label {
margin-left: 0;
margin-right: 0;
}
margin-right: 0; }
.customize-control-kirki-switch input:checked + label {
background: #0073aa;
}
background: #0073aa; }
.customize-control-kirki-switch input:checked + label:after {
left: auto;
right: 5px;
background: #ffffff;
}
background: #ffffff; }
.customize-control-kirki-switch input:checked + label .switch-on {
opacity: 1;
}
opacity: 1; }
.customize-control-kirki-switch input:checked + label .switch-off {
opacity: 0;
}
opacity: 0; }
.customize-control-kirki-toggle {
position: relative;
}
position: relative; }
.customize-control-kirki-toggle label {
display: flex;
flex-wrap: wrap;
}
flex-wrap: wrap; }
.customize-control-kirki-toggle label .customize-control-title {
width: calc(100% - 55px);
}
width: calc(100% - 55px); }
.customize-control-kirki-toggle label .description {
order: 99;
}
order: 99; }
.customize-control-kirki-toggle .switch {
border: 1px solid #b4b9be;
display: inline-block;
@ -753,8 +597,7 @@
top: 4px;
cursor: pointer;
user-select: none;
transition: background 350ms ease;
}
transition: background 350ms ease; }
.customize-control-kirki-toggle .switch:after, .customize-control-kirki-toggle .switch:before {
content: "";
display: block;
@ -764,46 +607,36 @@
position: absolute;
top: 50%;
left: -3px;
transition: all 350ms cubic-bezier(0, 0.95, 0.38, 0.98), background 150ms ease;
}
transition: all 350ms cubic-bezier(0, 0.95, 0.38, 0.98), background 150ms ease; }
.customize-control-kirki-toggle .switch:before {
background: rgba(0, 0, 0, 0.2);
transform: translate3d(0, -50%, 0) scale(0);
}
transform: translate3d(0, -50%, 0) scale(0); }
.customize-control-kirki-toggle .switch:after {
background: #999;
border: 1px solid rgba(0, 0, 0, 0.1);
transform: translate3d(0, -50%, 0);
}
transform: translate3d(0, -50%, 0); }
.customize-control-kirki-toggle .switch:active:before {
transform: translate3d(0, -50%, 0) scale(3);
}
transform: translate3d(0, -50%, 0) scale(3); }
.customize-control-kirki-toggle input:checked + .switch:before {
background: rgba(0, 115, 170, 0.075);
transform: translate3d(100%, -50%, 0) scale(1);
}
transform: translate3d(100%, -50%, 0) scale(1); }
.customize-control-kirki-toggle input:checked + .switch:after {
background: #0073aa;
transform: translate3d(100%, -50%, 0);
}
transform: translate3d(100%, -50%, 0); }
.customize-control-kirki-toggle input:checked + .switch:active:before {
background: rgba(0, 115, 170, 0.075);
transform: translate3d(100%, -50%, 0) scale(3);
}
transform: translate3d(100%, -50%, 0) scale(3); }
.customize-control-kirki-typography {
position: relative;
}
position: relative; }
.customize-control-kirki-typography .wrapper {
padding: 10px;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
border: 1px solid rgba(0, 0, 0, 0.1);
}
border: 1px solid rgba(0, 0, 0, 0.1); }
.customize-control-kirki-typography .wrapper h5 {
margin: 0.67em 0 0;
}
margin: 0.67em 0 0; }
.customize-control-kirki-typography .wrapper .color,
.customize-control-kirki-typography .wrapper .font-backup,
.customize-control-kirki-typography .wrapper .font-family,
@ -817,33 +650,26 @@
.customize-control-kirki-typography .wrapper .variant {
width: 100%;
float: none;
clear: both;
}
clear: both; }
.customize-control-kirki-typography .wrapper .font-size,
.customize-control-kirki-typography .wrapper .letter-spacing,
.customize-control-kirki-typography .wrapper .line-height,
.customize-control-kirki-typography .wrapper .margin-bottom,
.customize-control-kirki-typography .wrapper .margin-top,
.customize-control-kirki-typography .wrapper .text-transform {
width: 48%;
}
width: 48%; }
.customize-control-kirki-typography .wrapper .text-align .text-align-choices {
display: flex;
}
display: flex; }
.customize-control-kirki-typography .wrapper .text-align .text-align-choices label {
width: 100%;
padding: 5px;
text-align: center;
border: 1px solid rgba(255, 255, 255, 0);
}
border: 1px solid rgba(255, 255, 255, 0); }
.customize-control-kirki-typography .wrapper .text-align .text-align-choices input {
display: none;
}
display: none; }
.customize-control-kirki-typography .wrapper .text-align .text-align-choices input:checked + label {
border-color: #0085ba;
}
border-color: #0085ba; }
.customize-control-kirki-typography .wrapper .color {
width: auto;
}
width: auto; }
/*# sourceMappingURL=styles.css.map */

File diff suppressed because one or more lines are too long

View file

@ -355,7 +355,7 @@ class Kirki_Field {
// Take care of common typos.
if ( 'theme_mods' === $this->option_type ) {
/* translators: %1$s represents the field ID where the error occurs. */
_doing_it_wrong( __METHOD__, sprintf( esc_html( 'Typo found in field %s - "theme_mods" vs "theme_mod"', 'kirki' ), esc_html( $this->settings ) ), '3.0.10' );
_doing_it_wrong( __METHOD__, sprintf( esc_html__( 'Typo found in field %s - "theme_mods" vs "theme_mod"', 'kirki' ), esc_html( $this->settings ) ), '3.0.10' );
$this->option_type = 'theme_mod';
}
}

View file

@ -60,11 +60,9 @@ class Kirki_Modules {
array(
'css' => 'Kirki_Modules_CSS',
'css-vars' => 'Kirki_Modules_CSS_Vars',
'customizer-styling' => 'Kirki_Modules_Customizer_Styling',
'icons' => 'Kirki_Modules_Icons',
'loading' => 'Kirki_Modules_Loading',
'tooltips' => 'Kirki_Modules_Tooltips',
'branding' => 'Kirki_Modules_Customizer_Branding',
'postMessage' => 'Kirki_Modules_PostMessage',
'selective-refresh' => 'Kirki_Modules_Selective_Refresh',
'field-dependencies' => 'Kirki_Modules_Field_Dependencies',
@ -73,7 +71,6 @@ class Kirki_Modules {
'webfont-loader' => 'Kirki_Modules_Webfont_Loader',
'preset' => 'Kirki_Modules_Preset',
'gutenberg' => 'Kirki_Modules_Gutenberg',
'telemetry' => 'Kirki_Modules_Telemetry',
)
);
}

View file

@ -5,7 +5,7 @@
* Description: The Ultimate WordPress Customizer Framework
* Author: Ari Stathopoulos (@aristath)
* Author URI: https://aristath.github.io
* Version: 3.0.45
* Version: 3.1.0
* Text Domain: kirki
* Requires WP: 4.9
* Requires PHP: 5.3
@ -40,7 +40,7 @@ if ( ! defined( 'KIRKI_PLUGIN_FILE' ) ) {
// Define the KIRKI_VERSION constant.
if ( ! defined( 'KIRKI_VERSION' ) ) {
define( 'KIRKI_VERSION', '3.0.45' );
define( 'KIRKI_VERSION', '3.1.0' );
}
// Make sure the path is properly set.

View file

@ -1,29 +1,22 @@
#customize-theme-controls .control-section-kirki-expanded .accordion-section-title {
display: none;
}
display: none; }
#customize-theme-controls .control-section-kirki-expanded .customize-section-back {
display: none;
}
display: none; }
#customize-theme-controls .customize-pane-child.control-section-kirki-expanded {
position: relative;
visibility: visible;
height: auto;
margin-left: -100%;
}
margin-left: -100%; }
#customize-theme-controls .customize-pane-child.control-section-kirki-expanded h3 .customize-action {
display: none;
}
display: none; }
#customize-theme-controls .control-section-kirki-link .button {
margin-top: -3px;
}
margin-top: -3px; }
#customize-theme-controls .customize-pane-child.current-section-parent,
.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel-parent {
transform: translateX(-100%);
}
transform: translateX(-100%); }
.control-section-kirki-nested {
margin: 0 -12px;
}
margin: 0 -12px; }
/*# sourceMappingURL=sections.css.map */

View file

@ -1,14 +0,0 @@
/* global kirkiBranding */
jQuery( document ).ready( function() {
'use strict';
if ( '' !== kirkiBranding.logoImage ) {
jQuery( 'div#customize-info .preview-notice' ).replaceWith( '<img src="' + kirkiBranding.logoImage + '">' );
}
if ( '' !== kirkiBranding.description ) {
jQuery( 'div#customize-info > .customize-panel-description' ).replaceWith( '<div class="customize-panel-description">' + kirkiBranding.description + '</div>' );
}
} );

View file

@ -1,88 +0,0 @@
<?php
/**
* Changes the customizer's branding.
* For documentation please see
* https://github.com/aristath/kirki/wiki/Styling-the-Customizer
*
* @package Kirki
* @category Modules
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 3.0.0
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Adds styles to the customizer.
*/
class Kirki_Modules_Customizer_Branding {
/**
* The object instance.
*
* @static
* @access private
* @since 3.0.0
* @var object
*/
private static $instance;
/**
* Constructor.
*
* @access protected
* @since 3.0.0
*/
protected function __construct() {
add_action( 'customize_controls_print_scripts', array( $this, 'customize_controls_print_scripts' ) );
}
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 3.0.0
* @return object
*/
public static function get_instance() {
if ( ! self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Enqueues the script responsible for branding the customizer
* and also adds variables to it using the wp_localize_script function.
* The actual branding is handled via JS.
*
* @access public
* @since 3.0.0
*/
public function customize_controls_print_scripts() {
$config = apply_filters( 'kirki_config', array() );
$vars = array(
'logoImage' => '',
'description' => '',
);
if ( isset( $config['logo_image'] ) && '' !== $config['logo_image'] ) {
$vars['logoImage'] = esc_url_raw( $config['logo_image'] );
}
if ( isset( $config['description'] ) && '' !== $config['description'] ) {
$vars['description'] = esc_textarea( $config['description'] );
}
if ( ! empty( $vars['logoImage'] ) || ! empty( $vars['description'] ) ) {
wp_register_script( 'kirki-branding', Kirki::$url . '/modules/customizer-branding/branding.js', array(), KIRKI_VERSION, false );
wp_localize_script( 'kirki-branding', 'kirkiBranding', $vars );
wp_enqueue_script( 'kirki-branding' );
}
}
}

View file

@ -1,422 +0,0 @@
<?php
/**
* Changes the styling of the customizer
* based on the settings set using the kirki_config filter.
* For documentation please see
* https://github.com/aristath/kirki/wiki/Styling-the-Customizer
*
* @package Kirki
* @category Modules
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 3.0.0
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Adds styles to the customizer.
*/
class Kirki_Modules_Customizer_Styling {
/**
* The object instance.
*
* @static
* @access private
* @since 3.0.0
* @var object
*/
private static $instance;
/**
* Constructor.
*
* @access protected
*/
protected function __construct() {
add_action( 'customize_controls_print_styles', array( $this, 'custom_css' ), 99 );
}
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 3.0.0
* @return object
*/
public static function get_instance() {
if ( ! self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Add custom CSS rules to the head, applying our custom styles.
*
* @access public
*/
public function custom_css() {
$config = apply_filters( 'kirki_config', array() );
if ( ! isset( $config['color_accent'] ) && ! isset( $config['color_back'] ) ) {
return;
}
$back = isset( $config['color_back'] ) ? $config['color_back'] : false;
$text_on_back = '';
$border_on_back = '';
$back_on_back = '';
$hover_on_back = '';
$arrows_on_back = '';
$text_on_accent = '';
$border_on_accent = '';
$accent_disabled_obj = '';
$accent_disabled = '';
$text_on_accent_disabled = '';
$border_on_accent_disabled = '';
if ( $back ) {
$back_obj = ariColor::newColor( $back );
$text_on_back = ( 60 > $back_obj->lightness ) ? $back_obj->getNew( 'lightness', $back_obj->lightness + 60 )->toCSS( $back_obj->mode ) : $back_obj->getNew( 'lightness', $back_obj->lightness - 60 )->toCSS( $back_obj->mode );
$border_on_back = ( 80 < $back_obj->lightness ) ? $back_obj->getNew( 'lightness', $back_obj->lightness - 13 )->toCSS( $back_obj->mode ) : $back_obj->getNew( 'lightness', $back_obj->lightness + 13 )->toCSS( $back_obj->mode );
$back_on_back = ( 90 < $back_obj->lightness ) ? $back_obj->getNew( 'lightness', $back_obj->lightness - 6 )->toCSS( $back_obj->mode ) : $back_obj->getNew( 'lightness', $back_obj->lightness + 11 )->toCSS( $back_obj->mode );
$hover_on_back = ( 90 < $back_obj->lightness ) ? $back_obj->getNew( 'lightness', $back_obj->lightness - 3 )->toCSS( $back_obj->mode ) : $back_obj->getNew( 'lightness', $back_obj->lightness + 3 )->toCSS( $back_obj->mode );
$arrows_on_back = ( 50 > $back_obj->lightness ) ? $back_obj->getNew( 'lightness', $back_obj->lightness + 30 )->toCSS( $back_obj->mode ) : $back_obj->getNew( 'lightness', $back_obj->lightness - 30 )->toCSS( $back_obj->mode );
}
$accent = ( isset( $config['color_accent'] ) ) ? $config['color_accent'] : false;
if ( $accent ) {
$accent_obj = ariColor::newColor( $accent );
$text_on_accent = ( 60 > $accent_obj->lightness ) ? $accent_obj->getNew( 'lightness', $accent_obj->lightness + 60 )->toCSS( $accent_obj->mode ) : $accent_obj->getNew( 'lightness', $accent_obj->lightness - 60 )->toCSS( $accent_obj->mode );
$border_on_accent = ( 50 < $accent_obj->lightness ) ? $accent_obj->getNew( 'lightness', $accent_obj->lightness - 4 )->toCSS( $accent_obj->mode ) : $accent_obj->getNew( 'lightness', $accent_obj->lightness + 4 )->toCSS( $accent_obj->mode );
$accent_disabled_obj = ( 35 < $accent_obj->lightness ) ? $accent_obj->getNew( 'lightness', $accent_obj->lightness - 30 ) : $accent_obj->getNew( 'lightness', $accent_obj->lightness + 30 );
$accent_disabled = $accent_disabled_obj->toCSS( $accent_disabled_obj->mode );
$text_on_accent_disabled = ( 60 > $accent_disabled_obj->lightness ) ? $accent_disabled_obj->getNew( 'lightness', $accent_disabled_obj->lightness + 60 )->toCSS( $accent_disabled_obj->mode ) : $accent_disabled_obj->getNew( 'lightness', $accent_disabled_obj->lightness - 60 )->toCSS( $accent_disabled_obj->mode );
$border_on_accent_disabled = ( 50 < $accent_disabled_obj->lightness ) ? $accent_disabled_obj->getNew( 'lightness', $accent_disabled_obj->lightness - 4 )->toCSS( $accent_disabled_obj->mode ) : $accent_disabled_obj->getNew( 'lightness', $accent_disabled_obj->lightness + 4 )->toCSS( $accent_disabled_obj->mode );
}
?>
<style>
.wp-full-overlay-sidebar,
#customize-controls .customize-info .accordion-section-title,
#customize-controls .panel-meta.customize-info .accordion-section-title:hover,
#customize-theme-controls .accordion-section-title,
.customize-section-title,
#customize-theme-controls .control-section-themes .accordion-section-title,
#customize-theme-controls .control-section-themes .accordion-section-title,
#customize-theme-controls .control-section-themes .accordion-section-title:hover,
.outer-section-open #customize-controls .wp-full-overlay-sidebar-content,
#customize-sidebar-outer-content,
#customize-control-changeset_status .customize-inside-control-row,
#customize-control-changeset_preview_link input,
#customize-control-changeset_scheduled_date,
.wp-core-ui .wp-full-overlay .collapse-sidebar {
background: <?php echo esc_html( $back ); ?>;
background-color: <?php echo esc_html( $back ); ?>;
color: <?php echo esc_html( $text_on_back ); ?>;
}
<?php if ( $back ) : ?>
.media-widget-preview.media_image, .media-widget-preview.media_audio, .attachment-media-view {
background: none;
}
.wp-core-ui .button-link-delete {
color: <?php echo ( 90 > $back_obj->lightness ) ? '#FF8A80' : '#a00'; ?>;
}
.button.wp-color-result {
text-shadow: none !important;
}
<?php endif; ?>
#customize-sidebar-outer-content {
border-left-color: <?php echo esc_html( $border_on_back ); ?>;
border-right-color: <?php echo esc_html( $border_on_back ); ?>;
}
#customize-controls .customize-info .panel-title,
#customize-controls .customize-pane-child .customize-section-title h3,
#customize-controls .customize-pane-child h3.customize-section-title,
.customize-control,
#customize-controls .description {
color: <?php echo esc_html( $text_on_back ); ?>;
}
#customize-controls .customize-info,
#customize-header-actions,
.customize-section-title {
border-bottom-color: <?php echo esc_html( $border_on_back ); ?>;
}
.wp-full-overlay-sidebar .wp-full-overlay-header,
.customize-controls-close,
.expanded .wp-full-overlay-footer {
color: <?php echo esc_html( $text_on_back ); ?>;
background-color: <?php echo esc_html( $back_on_back ); ?>;
border-color: <?php echo esc_html( $border_on_back ); ?>;
}
.accordion-section,
#customize-theme-controls .customize-pane-child.accordion-section-content {
background: <?php echo esc_html( $back_on_back ); ?>;
}
#accordion-section-themes+.control-section,
#customize-theme-controls .control-section:last-of-type.open,
#customize-theme-controls .control-section:last-of-type > .accordion-section-title,
#customize-theme-controls .control-section.open {
border-bottom-color: <?php echo esc_html( $border_on_back ); ?>;
border-top-color: <?php echo esc_html( $border_on_back ); ?>;
}
#customize-theme-controls .accordion-section-title {
border-bottom-color: <?php echo esc_html( $border_on_back ); ?>;
border-left-color: <?php echo esc_html( $border_on_back ); ?>;
}
#customize-theme-controls .control-section-themes .accordion-section-title,
#customize-theme-controls .control-section-themes .accordion-section-title:hover {
border-bottom-color: <?php echo esc_html( $border_on_back ); ?>;
border-top-color: <?php echo esc_html( $border_on_back ); ?>;
border-bottom-color: <?php echo esc_html( $border_on_back ); ?>;
}
#customize-theme-controls .accordion-section-title:after {
color: <?php echo esc_html( $arrows_on_back ); ?>;
}
.wp-core-ui .button,
.wp-core-ui .button-secondary {
background-color: <?php echo esc_html( $back ); ?>;
border-color: <?php echo esc_html( $border_on_back ); ?>;
box-shadow: 0 1px 0 <?php echo esc_html( $border_on_back ); ?>;
-webkit-box-shadow: 0 1px 0 <?php echo esc_html( $border_on_back ); ?>;
text-shadow: 0 -1px 1px <?php echo esc_html( $border_on_back ); ?>, 1px 0 1px <?php echo esc_html( $border_on_back ); ?>, 0 1px 1px <?php echo esc_html( $border_on_back ); ?>, -1px 0 1px <?php echo esc_html( $border_on_back ); ?>;
color: <?php echo esc_html( $text_on_back ); ?>;
}
@media screen and (max-width: 640px) {
.customize-controls-preview-toggle{
background-color: <?php echo esc_html( $back ); ?>;
border-color: <?php echo esc_html( $border_on_back ); ?>;
box-shadow:0 1px 0 <?php echo esc_html( $border_on_back ); ?>;
-webkit-box-shadow:0 1px 0 <?php echo esc_html( $border_on_back ); ?>;
text-shadow:0 -1px 1px <?php echo esc_html( $border_on_back ); ?>, 1px 0 1px <?php echo esc_html( $border_on_back ); ?>, 0 1px 1px <?php echo esc_html( $border_on_back ); ?>, -1px 0 1px <?php echo esc_html( $border_on_back ); ?>;
color: <?php echo esc_html( $text_on_back ); ?>;
}
}
.wp-core-ui .button.focus,
.wp-core-ui .button.hover,
.wp-core-ui .button:focus,
.wp-core-ui .button:hover,
.wp-core-ui .button-secondary.focus,
.wp-core-ui .button-secondary.hover,
.wp-core-ui .button-secondary:focus,
.wp-core-ui .button-secondary:hover,
.customize-panel-back,
.customize-section-back {
background-color: <?php echo esc_html( $back_on_back ); ?>;
border-color: <?php echo esc_html( $border_on_back ); ?>;
box-shadow: 0 1px 0 <?php echo esc_html( $border_on_back ); ?>;
-webkit-box-shadow: 0 1px 0 <?php echo esc_html( $border_on_back ); ?>;
text-shadow: 0 -1px 1px <?php echo esc_html( $border_on_back ); ?>, 1px 0 1px <?php echo esc_html( $border_on_back ); ?>, 0 1px 1px <?php echo esc_html( $border_on_back ); ?>, -1px 0 1px <?php echo esc_html( $border_on_back ); ?>;
color: <?php echo esc_html( $text_on_back ); ?>;
}
@media screen and (max-width: 640px) {
.customize-controls-preview-toggle.focus,
.customize-controls-preview-toggle.hover,
.customize-controls-preview-toggle:focus,
.customize-controls-preview-toggle:hover {
background-color: <?php echo esc_html( $back_on_back ); ?>;
border-color: <?php echo esc_html( $border_on_back ); ?>;
box-shadow: 0 1px 0 <?php echo esc_html( $border_on_back ); ?>;
-webkit-box-shadow: 0 1px 0 <?php echo esc_html( $border_on_back ); ?>;
text-shadow: 0 -1px 1px <?php echo esc_html( $border_on_back ); ?>, 1px 0 1px <?php echo esc_html( $border_on_back ); ?>, 0 1px 1px <?php echo esc_html( $border_on_back ); ?>, -1px 0 1px <?php echo esc_html( $border_on_back ); ?>;
color:<?php echo esc_html( $text_on_back ); ?>;
}
}
.customize-control-kirki-background .background-attachment .buttonset .switch-label,
.customize-control-kirki-background .background-size .buttonset .switch-label,
.customize-control-kirki-radio-buttonset .buttonset .switch-label {
color: <?php echo esc_html( $text_on_back ); ?>;
}
.wp-color-result {
border-color: <?php echo esc_html( $border_on_back ); ?>;
-webkit-box-shadow: 0 1px 0 <?php echo esc_html( $border_on_back ); ?>;
box-shadow: 0 1px 0 <?php echo esc_html( $border_on_back ); ?>;
}
.wp-color-result:focus,
.wp-color-result:hover {
border-color: <?php echo esc_html( $border_on_back ); ?>;
background: <?php echo esc_html( $back_on_back ); ?>;
}
.wp-color-result:after {
border-color: <?php echo esc_html( $border_on_back ); ?>;
background: <?php echo esc_html( $back ); ?>;
color: <?php echo esc_html( $text_on_back ); ?>;
}
.wp-color-result:focus:after,
.wp-color-result:hover:after {
color: <?php echo esc_html( $text_on_back ); ?>;
}
.customize-control input[type=tel],
.customize-control input[type=url],
.customize-control input[type=text],
.customize-control input[type=password],
.customize-control input[type=email],
.customize-control input[type=number],
.customize-control input[type=search],
.customize-control input[type=radio],
.customize-control input[type=checkbox],
.customize-control select,
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
background: <?php echo esc_html( $back ); ?>;
border-color: <?php echo esc_html( $border_on_back ); ?>;
color: <?php echo esc_html( $text_on_back ); ?>;
}
.customize-control-kirki-slider input[type=range]::-webkit-slider-thumb {
background-color:<?php echo esc_html( $accent ); ?>;
}
.customize-control-kirki-slider input[type=range]::-moz-range-thumb {
background-color: <?php echo esc_html( $accent ); ?>;
}
.customize-control-kirki-slider input[type=range]::-ms-thumb {
background-color: <?php echo esc_html( $accent ); ?>;
}
.customize-control-kirki-slider input[type=range] {
background: <?php echo esc_html( $border_on_back ); ?>;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
color:<?php echo esc_html( $text_on_back ); ?>;
}
.wp-full-overlay-footer .devices {
background: none;
background: transparent;
box-shadow: none;
-webkit-box-shadow: none;
}
.kirki-reset-section .dashicons {
color: <?php echo esc_html( $back_on_back ); ?>;
}
#customize-controls .control-section .accordion-section-title:focus,
#customize-controls .control-section .accordion-section-title:hover,
#customize-controls .control-section.open .accordion-section-title,
#customize-controls .control-section:hover > .accordion-section-title,
.customize-panel-back:focus,
.customize-panel-back:hover,
.customize-section-back:focus,
.customize-section-back:hover {
background: <?php echo esc_html( $hover_on_back ); ?>;
color: <?php echo esc_html( $accent ); ?>;
border-left-color: <?php echo esc_html( $accent ); ?>;
}
.customize-controls-close:hover {
background-color: <?php echo esc_html( $back ); ?>;
color: <?php echo esc_html( $accent ); ?>;
border-color: <?php echo esc_html( $accent ); ?>;
}
#customize-theme-controls .control-section .accordion-section-title:focus:after,
#customize-theme-controls .control-section .accordion-section-title:hover:after,
#customize-theme-controls .control-section.open .accordion-section-title:after,
#customize-theme-controls .control-section:hover>.accordion-section-title:after {
color: <?php echo esc_html( $accent ); ?>;
}
.wp-core-ui .button.button-primary {
background-color: <?php echo esc_html( $accent ); ?>;
border-color: <?php echo esc_html( $border_on_accent ); ?>;
box-shadow: 0 1px 0 <?php echo esc_html( $border_on_accent ); ?>;
-webkit-box-shadow: 0 1px 0 <?php echo esc_html( $border_on_accent ); ?>;
text-shadow: 0 -1px 1px <?php echo esc_html( $border_on_accent ); ?>, 1px 0 1px <?php echo esc_html( $border_on_accent ); ?>, 0 1px 1px <?php echo esc_html( $border_on_accent ); ?>, -1px 0 1px <?php echo esc_html( $border_on_accent ); ?>;
color: <?php echo esc_html( $text_on_accent ); ?>;
}
.wp-core-ui .button.button-primary.focus,
.wp-core-ui .button.button-primary.hover,
.wp-core-ui .button.button-primary:focus,
.wp-core-ui .button.button-primary:hover {
background-color: <?php echo esc_html( $accent ); ?>;
border-color: <?php echo esc_html( $border_on_accent ); ?>;
box-shadow: 0 1px 0 <?php echo esc_html( $border_on_accent ); ?>;
-webkit-box-shadow: 0 1px 0 <?php echo esc_html( $border_on_accent ); ?>;
text-shadow: 0 -1px 1px <?php echo esc_html( $border_on_accent ); ?>, 1px 0 1px <?php echo esc_html( $border_on_accent ); ?>, 0 1px 1px <?php echo esc_html( $border_on_accent ); ?>, -1px 0 1px <?php echo esc_html( $border_on_accent ); ?>;
color: <?php echo esc_html( $text_on_accent ); ?>;
}
.wp-core-ui .button.button-primary-disabled,
.wp-core-ui .button.button-primary.disabled,
.wp-core-ui .button.button-primary:disabled,
.wp-core-ui .button.button-primary[disabled] {
background-color: <?php echo esc_html( $accent_disabled ); ?> !important;
border-color: <?php echo esc_html( $border_on_accent_disabled ); ?> !important;
box-shadow: 0 1px 0 <?php echo esc_html( $border_on_accent_disabled ); ?> !important;
-webkit-box-shadow: 0 1px 0 <?php echo esc_html( $border_on_accent_disabled ); ?> !important;
text-shadow: 0 -1px 1px <?php echo esc_html( $border_on_accent_disabled ); ?>, 1px 0 1px <?php echo esc_html( $border_on_accent_disabled ); ?>, 0 1px 1px <?php echo esc_html( $border_on_accent_disabled ); ?>, -1px 0 1px <?php echo esc_html( $border_on_accent_disabled ); ?> !important;
color: <?php echo esc_html( $text_on_accent_disabled ); ?> !important;
}
input[type=checkbox]:checked:before {
color: <?php echo esc_html( $accent ); ?>;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
background-color: <?php echo esc_html( $accent ); ?>;
color: <?php echo esc_html( $text_on_accent ); ?>;
}
.customize-control-kirki-radio-buttonset .buttonset .switch-input:checked + .switch-label,
.customize-control-kirki-background .background-attachment .buttonset .switch-input:checked + .switch-label,
.customize-control-kirki-background .background-size .buttonset .switch-input:checked + .switch-label {
background-color: <?php echo esc_html( $accent ); ?>;
border-color: <?php echo esc_html( $border_on_accent ); ?>;
color: <?php echo esc_html( $text_on_accent ); ?>;
}
.notice,
div.updated,
div.error {
color: #444 !important;
}
<?php if ( isset( $config['width'] ) ) : ?>
.wp-full-overlay-sidebar {
width: <?php echo esc_html( $config['width'] ); ?>;
}
.expanded .wp-full-overlay-footer {
width: <?php echo esc_html( $config['width'] ); ?>;
}
.wp-full-overlay.expanded {
margin-left: <?php echo esc_html( $config['width'] ); ?>;
}
.wp-full-overlay.collapsed .wp-full-overlay-sidebar {
margin-left: -<?php echo esc_html( $config['width'] ); ?>;
}
<?php endif; ?>
</style>
<?php
}
}

View file

@ -1,327 +0,0 @@
<?php
/**
* Telemetry implementation for Kirki.
*
* @package Kirki
* @category Core
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license http://opensource.org/licenses/https://opensource.org/licenses/MIT
* @since 3.0.36
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Telemetry implementation.
*/
final class Kirki_Modules_Telemetry {
/**
* The object instance.
*
* @static
* @access private
* @since 3.0.36
* @var object
*/
private static $instance;
/**
* Constructor.
*
* @access protected
* @since 3.0.36
*/
protected function __construct() {
// Early exit if telemetry is disabled.
if ( ! apply_filters( 'kirki_telemetry', true ) ) {
return;
}
add_action( 'init', array( $this, 'init' ) );
add_action( 'admin_notices', array( $this, 'admin_notice' ) );
}
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 3.0.36
* @return object
*/
public static function get_instance() {
if ( ! self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Additional actions that run on init.
*
* @access public
* @since 3.0.36
* @return void
*/
public function init() {
$this->dismiss_notice();
$this->consent();
// This is the last thing to run. No impact on performance or anything else.
add_action( 'wp_footer', array( $this, 'maybe_send_data' ), 99999 );
}
/**
* Maybe send data.
*
* @access public
* @since 3.0.36
* @return void
*/
public function maybe_send_data() {
// Check if the user has consented to the data sending.
if ( ! get_option( 'kirki_telemetry_optin' ) ) {
return;
}
// Only send data once/month. We use an option instead of a transient
// because transients in some managed hosting environments don't properly update
// due to their caching implementations.
$sent = get_option( 'kirki_telemetry_sent' );
if ( ! $sent || $sent < time() - MONTH_IN_SECONDS ) {
$this->send_data();
update_option( 'kirki_telemetry_sent', time() );
}
}
/**
* Sends data.
*
* @access private
* @since 3.0.36
* @return void
*/
private function send_data() {
// Ping remote server.
wp_remote_post(
'https://wplemon.com/?action=kirki-stats',
array(
'method' => 'POST',
'blocking' => false,
'body' => array_merge(
array(
'action' => 'kirki-stats',
),
$this->get_data()
),
)
);
}
/**
* The admin-notice.
*
* @access private
* @since 3.0.36
* @return void
*/
public function admin_notice() {
// Early exit if the user has dismissed the consent, or if they have opted-in.
if ( get_option( 'kirki_telemetry_no_consent' ) || get_option( 'kirki_telemetry_optin' ) ) {
return;
}
$data = $this->get_data();
?>
<div class="notice notice-info kirki-telemetry">
<h3><strong><?php esc_html_e( 'Help us improve Kirki.', 'kirki' ); ?></strong></h3>
<p style="max-width: 76em;"><?php _e( 'Help us begin a dialogue with theme developers, collaborate and improve both the theme you are using and the Kirki framework by agreeing to send anonymous data. <strong>The data is completely anonymous and we will never collect any identifyable information about you or your website.</strong>', 'kirki' ); // phpcs:ignore WordPress.Security.EscapeOutput ?></p>
<table class="data-to-send hidden">
<thead>
<tr>
<th colspan="2"><?php esc_html_e( 'Data that will be sent', 'kirki' ); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td style="min-width: 200px;"><?php esc_html_e( 'PHP Version', 'kirki' ); ?></td>
<td><code><?php echo esc_html( $data['phpVer'] ); ?></code></td>
</tr>
<tr>
<td><?php esc_html_e( 'Theme Name', 'kirki' ); ?></td>
<td><code><?php echo esc_html( $data['themeName'] ); ?></code></td>
</tr>
<tr>
<td><?php esc_html_e( 'Theme Author', 'kirki' ); ?></td>
<td><code><?php echo esc_html( $data['themeAuthor'] ); ?></code></td>
</tr>
<tr>
<td><?php esc_html_e( 'Theme URI', 'kirki' ); ?></td>
<td><code><?php echo esc_html( $data['themeURI'] ); ?></code></td>
</tr>
<tr>
<td><?php esc_html_e( 'Field Types Used', 'kirki' ); ?></td>
<td><code><?php echo esc_html( implode( ',', $data['fieldTypes'] ) ); ?></code></td>
</tr>
</tbody>
<tfoot>
<tr>
<th colspan="2">
<?php
printf(
/* translators: %1$s: URL to the server plugin code. %2$s: URL to the stats page. */
__( 'We believe in complete transparency. You can see the code used on our server <a href="%1$s" rel="nofollow">here</a>, and the results of the statistics we\'re gathering on <a href="%2$s" rel="nofollow">this page</a>.', 'kirki' ), // phpcs:ignore WordPress.Security.EscapeOutput
'https://github.com/aristath/kirki-telemetry-server',
'https://wplemon.com/kirki-telemetry-statistics/'
);
?>
</th>
</tr>
</tfoot>
</table>
<p class="actions">
<a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'kirki-consent-notice', 'telemetry' ) ) ); ?>" class="button button-primary consent"><?php esc_html_e( 'I agree', 'kirki' ); ?></a>
<a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'kirki-hide-notice', 'telemetry' ) ) ); ?>" class="button button-secondary dismiss"><?php esc_html_e( 'No thanks', 'kirki' ); ?></a>
<a class="button button-link details details-show"><?php esc_html_e( 'Show me the data', 'kirki' ); ?></a>
<a class="button button-link details details-hide hidden"><?php esc_html_e( 'Collapse data', 'kirki' ); ?></a>
</p>
<script>
jQuery( '.kirki-telemetry a.details' ).on( 'click', function() {
jQuery( '.kirki-telemetry .data-to-send' ).toggleClass( 'hidden' );
jQuery( '.kirki-telemetry a.details-show' ).toggleClass( 'hidden' );
jQuery( '.kirki-telemetry a.details-hide' ).toggleClass( 'hidden' );
});
</script>
</div>
<?php
$this->table_styles();
}
/**
* Builds and returns the data or uses cached if data already exists.
*
* @access private
* @since 3.0.36
* @return array
*/
private function get_data() {
// Get the theme.
$theme = wp_get_theme();
// Format the PHP version.
$php_version = phpversion( 'tidy' );
if ( ! $php_version ) {
$php_version = array_merge( explode( '.', phpversion() ), array( 0, 0 ) );
$php_version = "{$php_version[0]}.{$php_version[1]}";
}
// Build data and return the array.
return array(
'phpVer' => $php_version,
'themeName' => $theme->get( 'Name' ),
'themeAuthor' => $theme->get( 'Author' ),
'themeURI' => $theme->get( 'ThemeURI' ),
'fieldTypes' => $this->get_field_types(),
);
}
/**
* Get the field-types used.
*
* @access private
* @since 3.0.36
* @return array
*/
public function get_field_types() {
$types = array();
foreach ( Kirki::$fields as $field ) {
if ( isset( $field['type'] ) ) {
$types[] = $field['type'];
}
}
return $types;
}
/**
* Dismisses the notice.
*
* @access private
* @since 3.0.36
* @return void
*/
private function dismiss_notice() {
// Check if this is the request we want.
if ( isset( $_GET['_wpnonce'] ) && isset( $_GET['kirki-hide-notice'] ) ) {
if ( 'telemetry' === sanitize_text_field( wp_unslash( $_GET['kirki-hide-notice'] ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification
// Check the wp-nonce.
if ( wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) ) ) {
// All good, we can save the option to dismiss this notice.
update_option( 'kirki_telemetry_no_consent', true );
}
}
}
}
/**
* Dismisses the notice.
*
* @access private
* @since 3.0.36
* @return void
*/
private function consent() {
// Check if this is the request we want.
if ( isset( $_GET['_wpnonce'] ) && isset( $_GET['kirki-consent-notice'] ) ) {
if ( 'telemetry' === sanitize_text_field( wp_unslash( $_GET['kirki-consent-notice'] ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification
// Check the wp-nonce.
if ( wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) ) ) {
// All good, we can save the option to dismiss this notice.
update_option( 'kirki_telemetry_optin', true );
}
}
}
}
/**
* Prints the table styles.
*
* Normally we'd just use the .widefat CSS class for the table,
* however apparently there's an obscure bug in WP causing this: https://github.com/aristath/kirki/issues/2067
* This CSS is a copy of some styles from common.css in wp-core.
*
* @access private
* @since 3.0.37
* @return void
*/
private function table_styles() {
?>
<style>
/* .widefat - main style for tables */
.data-to-send { border-spacing: 0; width: 100%; clear: both; }
.data-to-send * { word-wrap: break-word; }
.data-to-send a, .data-to-send button.button-link { text-decoration: none; }
.data-to-send td, .data-to-send th { padding: 8px 10px; }
.data-to-send thead th, .data-to-send thead td { border-bottom: 1px solid #e1e1e1; }
.data-to-send tfoot th, .data-to-send tfoot td { border-top: 1px solid #e1e1e1; border-bottom: none; }
.data-to-send .no-items td { border-bottom-width: 0; }
.data-to-send td { vertical-align: top; }
.data-to-send td, .data-to-send td p, .data-to-send td ol, .data-to-send td ul { font-size: 13px; line-height: 1.5em; }
.data-to-send th, .data-to-send thead td, .data-to-send tfoot td { text-align: left; line-height: 1.3em; font-size: 14px; }
.data-to-send th input, .updates-table td input, .data-to-send thead td input, .data-to-send tfoot td input { margin: 0 0 0 8px; padding: 0; vertical-align: text-top; }
</style>
<?php
}
}

View file

@ -1,12 +1,9 @@
@charset "UTF-8";
.tooltip-wrapper {
float: right;
position: relative;
}
position: relative; }
.tooltip-wrapper .tooltip-trigger {
text-decoration: none;
cursor: help;
}
cursor: help; }
.tooltip-wrapper .tooltip-content {
position: absolute;
width: 200px;
@ -18,19 +15,16 @@
padding: 10px;
z-index: 99999;
border-radius: 3px;
line-height: 1.4em;
}
line-height: 1.4em; }
.tooltip-wrapper .tooltip-content a {
color: #000;
}
color: #000; }
.tooltip-wrapper .tooltip-content:after {
content: "";
content: "\f139";
font-family: dashicons;
position: absolute;
right: -12px;
top: 11px;
color: #FFC107;
font-size: 20px;
}
font-size: 20px; }
/*# sourceMappingURL=tooltip.css.map */

View file

@ -0,0 +1,287 @@
<?php
/**
* Manage fonts downloading.
*
* @package Kirki
* @category Core
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 3.1.0
*/
/**
* Fonts-downloading manager.
*
* @since 3.1.0
*/
class Kirki_Fonts_Downloader {
/**
* Get styles from URL.
*
* @access public
* @since 3.1.0
* @param string $url The URL.
* @return string
*/
public function get_styles( $url ) {
$css = $this->get_cached_url_contents( $url );
return $this->get_local_font_styles( $css );
}
/**
* Get styles with fonts downloaded locally.
*
* @access protected
* @since 3.1.0
* @param string $css The styles.
* @return string
*/
protected function get_local_font_styles( $css ) {
$files = $this->get_local_files_from_css( $css );
// Convert paths to URLs.
foreach ( $files as $remote => $local ) {
$files[ $remote ] = str_replace( WP_CONTENT_DIR, content_url(), $local );
}
return str_replace(
array_keys( $files ),
array_values( $files ),
$css
);
}
/**
* Download files mentioned in our CSS locally.
*
* @access protected
* @since 3.1.0
* @param string $css The CSS we want to parse.
* @return array Returns an array of remote URLs and their local counterparts.
*/
protected function get_local_files_from_css( $css ) {
$font_files = $this->get_files_from_css( $css );
$stored = get_option( 'kirki_downloaded_font_files', array() );
$change = false; // If in the end this is true, we need to update the cache option.
// If the fonts folder don't exist, create it.
if ( ! file_exists( WP_CONTENT_DIR . '/fonts' ) ) {
$this->get_filesystem()->mkdir( WP_CONTENT_DIR . '/fonts', FS_CHMOD_DIR );
}
foreach ( $font_files as $font_family => $files ) {
// The folder path for this font-family.
$folder_path = WP_CONTENT_DIR . '/fonts/' . $font_family;
// If the folder doesn't exist, create it.
if ( ! file_exists( $folder_path ) ) {
$this->get_filesystem()->mkdir( $folder_path, FS_CHMOD_DIR );
}
foreach ( $files as $url ) {
// Get the filename.
$filename = basename( wp_parse_url( $url, PHP_URL_PATH ) );
$font_path = $folder_path . '/' . $filename;
if ( file_exists( $font_path ) ) {
// Skip if already cached.
if ( isset( $stored[ $url ] ) ) {
continue;
}
$stored[ $url ] = $font_path;
$change = true;
}
if ( ! function_exists( 'download_url' ) ) {
require_once wp_normalize_path( ABSPATH . '/wp-admin/includes/file.php' );
}
// Download file to temporary location.
$tmp_path = download_url( $url );
// Make sure there were no errors.
if ( is_wp_error( $tmp_path ) ) {
continue;
}
// Move temp file to final destination.
$success = $this->get_filesystem()->move( $tmp_path, $font_path, true );
if ( $success ) {
$stored[ $url ] = $font_path;
$change = true;
}
}
}
if ( $change ) {
update_option( 'kirki_downloaded_font_files', $stored );
}
return $stored;
}
/**
* Get cached url contents.
* If a cache doesn't already exist, get the URL contents from remote
* and cache the result.
*
* @access public
* @since 3.1.0
* @param string $url The URL we want to get the contents from.
* @param string $user_agent The user-agent to use for our request.
* @return string Returns the remote URL contents.
*/
public function get_cached_url_contents( $url = '', $user_agent = null ) {
// Try to retrieved cached response from the gfonts API.
$contents = false;
$cached_responses = get_transient( 'kirki_remote_url_contents' );
$cached_responses = ( $cached_responses && is_array( $cached_responses ) ) ? $cached_responses : array();
if ( isset( $cached_responses[ md5( $url . $user_agent ) ] ) ) {
return $cached_responses[ md5( $url . $user_agent ) ];
}
// Get the contents from remote.
$contents = $this->get_url_contents( $url, $user_agent );
// If we got the contents successfully, store them in a transient.
// We're using a transient and not an option because fonts get updated
// so we want to be able to get the latest version weekly.
if ( $contents ) {
$cached_responses[ md5( $url . $user_agent ) ] = $contents;
set_transient( 'kirki_remote_url_contents', $cached_responses, WEEK_IN_SECONDS );
}
return $contents;
}
/**
* Get remote file contents.
*
* @access public
* @since 3.1.0
* @param string $url The URL we want to get the contents from.
* @param string $user_agent The user-agent to use for our request.
* @return string Returns the remote URL contents.
*/
public function get_url_contents( $url = '', $user_agent = null ) {
if ( ! $user_agent ) {
/**
* The user-agent we want to use.
*
* For woff2 format, use'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0'.
* The default user-agent is the only one compatible with woff (not woff2)
* which also supports unicode ranges.
*/
$user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8';
}
// Get the response.
$response = wp_remote_get( $url, array( 'user-agent' => $user_agent ) );
// Early exit if there was an error.
if ( is_wp_error( $response ) ) {
return;
}
// Get the CSS from our response.
$contents = wp_remote_retrieve_body( $response );
// Early exit if there was an error.
if ( is_wp_error( $contents ) ) {
return;
}
return $contents;
}
/**
* Get font files from the CSS.
*
* @access public
* @since 3.1.0
* @param string $css The CSS we want to parse.
* @return array Returns an array of font-families and the font-files used.
*/
public function get_files_from_css( $css ) {
$font_faces = explode( '@font-face', $css );
$result = array();
// Loop all our font-face declarations.
foreach ( $font_faces as $font_face ) {
// Make sure we only process styles inside this declaration.
$style = explode( '}', $font_face )[0];
// Sanity check.
if ( false === strpos( $style, 'font-family' ) ) {
continue;
}
// Get an array of our font-families.
preg_match_all( '/font-family.*?\;/', $style, $matched_font_families );
// Get an array of our font-files.
preg_match_all( '/url\(.*?\)/i', $style, $matched_font_files );
// Get the font-family name.
$font_family = 'unknown';
if ( isset( $matched_font_families[0] ) && isset( $matched_font_families[0][0] ) ) {
$font_family = rtrim( ltrim( $matched_font_families[0][0], 'font-family:' ), ';' );
$font_family = trim( str_replace( array( "'", ';' ), '', $font_family ) );
$font_family = sanitize_key( strtolower( str_replace( ' ', '-', $font_family ) ) );
}
// Make sure the font-family is set in our array.
if ( ! isset( $result[ $font_family ] ) ) {
$result[ $font_family ] = array();
}
// Get files for this font-family and add them to the array.
foreach ( $matched_font_files as $match ) {
// Sanity check.
if ( ! isset( $match[0] ) ) {
continue;
}
// Add the file URL.
$result[ $font_family ][] = rtrim( ltrim( $match[0], 'url(' ), ')' );
}
// Make sure we have unique items.
// We're using array_flip here instead of array_unique for improved performance.
$result[ $font_family ] = array_flip( array_flip( $result[ $font_family ] ) );
}
return $result;
}
/**
* Get the filesystem.
*
* @access protected
* @since 3.1.0
* @return WP_Filesystem
*/
protected function get_filesystem() {
global $wp_filesystem;
if ( ! $wp_filesystem ) {
if ( ! function_exists( 'WP_Filesystem' ) ) {
require_once wp_normalize_path( ABSPATH . '/wp-admin/includes/file.php' );
}
WP_Filesystem();
}
return $wp_filesystem;
}
}

View file

@ -1,172 +0,0 @@
<?php
/**
* Helper methods for fonts.
*
* @package Kirki
* @category Core
* @author Ari Stathopoulos (@aristath)
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 3.0.36
*/
// Do not allow directly accessing this file.
if ( ! defined( 'ABSPATH' ) ) {
exit( 'Direct script access denied.' );
}
/**
* The Kirki_Fonts object.
*
* @since 3.0.28
*/
final class Kirki_Fonts_Helper {
/**
* Gets the remote URL contents.
*
* @static
* @access public
* @since 3.0.36
* @param string $url The URL we want to get.
* @param array $args An array of arguments for the wp_remote_retrieve_body() function.
* @return string The contents of the remote URL.
*/
public static function get_remote_url_contents( $url, $args = array() ) {
$response = wp_remote_get( $url, $args );
if ( is_wp_error( $response ) ) {
return array();
}
$html = wp_remote_retrieve_body( $response );
if ( is_wp_error( $html ) ) {
return;
}
return $html;
}
/**
* Gets the root fonts folder path.
* Other paths are built based on this.
*
* @static
* @since 3.0.36
* @access public
* @return string
*/
public static function get_root_path() {
// Get the upload directory for this site.
$upload_dir = wp_upload_dir();
$path = untrailingslashit( wp_normalize_path( $upload_dir['basedir'] ) ) . '/webfonts';
// If the folder doesn't exist, create it.
if ( ! file_exists( $path ) ) {
wp_mkdir_p( $path );
}
// Return the path.
return apply_filters( 'kirki_googlefonts_root_path', $path );
}
/**
* Gets the filename by breaking-down the URL parts.
*
* @static
* @access private
* @since 3.0.28
* @param string $url The URL.
* @return string The filename.
*/
private static function get_filename_from_url( $url ) {
$url_parts = explode( '/', $url );
$parts_count = count( $url_parts );
if ( 1 < $parts_count ) {
return $url_parts[ count( $url_parts ) - 1 ];
}
return $url;
}
/**
* Downloads a font-file and saves it locally.
*
* @access public
* @since 3.0.28
* @param string $url The URL of the file we want to get.
* @return bool
*/
public static function download_font_file( $url ) {
$saved_fonts = get_option( 'kirki_font_local_filenames', array() );
if ( isset( $saved_fonts[ $url ] ) && file_exists( $saved_fonts[ $url ]['file'] ) ) {
return $saved_fonts[ $url ]['url'];
}
// Gives us access to the download_url() and wp_handle_sideload() functions.
require_once ABSPATH . 'wp-admin/includes/file.php';
$timeout_seconds = 5;
// Download file to temp dir.
$temp_file = download_url( $url, $timeout_seconds );
if ( is_wp_error( $temp_file ) ) {
return false;
}
// Array based on $_FILE as seen in PHP file uploads.
$file = array(
'name' => basename( $url ),
'type' => 'font/woff',
'tmp_name' => $temp_file,
'error' => 0,
'size' => filesize( $temp_file ),
);
$overrides = array(
'test_type' => false,
'test_form' => false,
'test_size' => true,
);
// Move the temporary file into the uploads directory.
$results = wp_handle_sideload( $file, $overrides );
if ( empty( $results['error'] ) ) {
$saved_fonts[ $url ] = $results;
update_option( 'kirki_font_local_filenames', $saved_fonts );
return $results['url'];
}
return false;
}
/**
* Gets the root folder url.
* Other urls are built based on this.
*
* @static
* @since 3.0.36
* @access public
* @return string
*/
public static function get_root_url() {
// Get the upload directory for this site.
$upload_dir = wp_upload_dir();
// The URL.
$url = trailingslashit( $upload_dir['baseurl'] );
// Take care of domain mapping.
// When using domain mapping we have to make sure that the URL to the file
// does not include the original domain but instead the mapped domain.
if ( defined( 'DOMAIN_MAPPING' ) && DOMAIN_MAPPING ) {
if ( function_exists( 'domain_mapping_siteurl' ) && function_exists( 'get_original_url' ) ) {
$mapped_domain = domain_mapping_siteurl( false );
$original_domain = get_original_url( 'siteurl' );
$url = str_replace( $original_domain, $mapped_domain, $url );
}
}
$url = str_replace( array( 'https://', 'http://' ), '//', $url );
return apply_filters( 'kirki_googlefonts_root_url', untrailingslashit( esc_url_raw( $url ) ) . '/webfonts' );
}
}

View file

@ -148,65 +148,12 @@ final class Kirki_Modules_Webfonts_Embed {
$transient_id = 'kirki_gfonts_' . md5( $url );
$contents = get_transient( $transient_id );
/**
* Reset the cache if we're using action=kirki-reset-cache in the URL.
*
* Note to code reviewers:
* There's no need to check nonces or anything else, this is a simple true/false evaluation.
*/
if ( ! empty( $_GET['action'] ) && 'kirki-reset-cache' === $_GET['action'] ) { // phpcs:ignore WordPress.Security.NonceVerification
$contents = false;
if ( ! class_exists( 'Kirki_Fonts_Downloader' ) ) {
include_once wp_normalize_path( dirname( __FILE__ ) . '/class-kirki-fonts-downloader.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
}
if ( ! $contents ) {
$downloader = new Kirki_Fonts_Downloader();
$contents = $downloader->get_styles( $url );
// Get the contents of the remote URL.
$contents = Kirki_Fonts_Helper::get_remote_url_contents(
$url,
array(
'headers' => array(
/**
* Set user-agent to firefox so that we get woff files.
* If we want woff2, use this instead: 'Mozilla/5.0 (X11; Linux i686; rv:64.0) Gecko/20100101 Firefox/64.0'
*/
'user-agent' => 'Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0',
),
)
);
/**
* Allow filtering the font-display property.
*/
$font_display = apply_filters( 'kirki_googlefonts_font_display', 'swap' );
if ( $contents ) {
// Add font-display:swap to improve rendering speed.
$contents = str_replace( '@font-face {', '@font-face{', $contents );
$contents = str_replace( '@font-face{', '@font-face{font-display:' . $font_display . ';', $contents );
// Remove blank lines and extra spaces.
$contents = str_replace(
array( ': ', '; ', '; ', ' ' ),
array( ':', ';', ';', ' ' ),
preg_replace( "/\r|\n/", '', $contents )
);
// Use local fonts.
if ( apply_filters( 'kirki_use_local_fonts', true ) ) {
$contents = $this->use_local_files( $contents );
}
// Remove protocol to fix http/https issues.
$contents = str_replace(
array( 'http://', 'https://' ),
array( '//', '//' ),
$contents
);
// Set the transient for a day.
set_transient( $transient_id, $contents, DAY_IN_SECONDS );
}
}
if ( $contents ) {
/**
* Note to code reviewers:
@ -221,29 +168,4 @@ final class Kirki_Modules_Webfonts_Embed {
}
}
}
/**
* Downloads font-files locally and uses the local files instead of the ones from Google's servers.
* This addresses any and all GDPR concerns, as well as firewalls that exist in some parts of the world.
*
* @access private
* @since 3.0.36
* @param string $css The CSS with original URLs.
* @return string The CSS with local URLs.
*/
private function use_local_files( $css ) {
preg_match_all( '/https\:.*?\.woff/', $css, $matches );
$matches = array_shift( $matches );
foreach ( $matches as $match ) {
if ( 0 === strpos( $match, 'https://fonts.gstatic.com' ) ) {
$new_url = Kirki_Fonts_Helper::download_font_file( $match );
if ( $new_url ) {
$css = str_replace( $match, $new_url, $css );
}
}
}
return $css;
}
}

View file

@ -47,7 +47,6 @@ class Kirki_Modules_Webfonts {
*/
protected function __construct() {
include_once wp_normalize_path( dirname( __FILE__ ) . '/class-kirki-fonts-helper.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
include_once wp_normalize_path( dirname( __FILE__ ) . '/class-kirki-fonts.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
include_once wp_normalize_path( dirname( __FILE__ ) . '/class-kirki-fonts-google.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -3,8 +3,8 @@ Contributors: aristath, dannycooper, wplemon, igmoweb
Tags: customizer, options framework, theme, mods, toolkit, gutenberg
Donate link: https://aristath.github.io/donate
Requires at least: 4.9
Tested up to: 5.2
Stable tag: 3.0.45
Tested up to: 5.3
Stable tag: 3.1.0
License: MIT
License URI: https://opensource.org/licenses/MIT
@ -75,20 +75,15 @@ If you want to integrate Kirki in your theme or plugin, please read the instruct
== Changelog ==
= 3.0.45 - 2019-09-01 =
### Fixed
* Compatibility with the latest Gutenberg plugin versions.
* Styles for normal font-weights in typography controls (`regular` to `400` conversion).
= 3.1.0 - 2020-03-01 =
### Changed
* Completely refactored the google-fonts downloader. Fonts now get stored in `wp-content/fonts/{font-family}/{file}`.
* Updated Google-Fonts lists.
### Removed
* Backup fonts are no longer needed since google-fonts are no longer loaded from the google CDN.
### Deprecated
* `kirki_fonts_backup_fonts` filter.
* `Kirki_Fonts::get_backup_fonts()` method.
* Removed the `branding` module.
* Removed the `styling` module.
* Removed the `telemetry` module.
[See the previous changelogs here](https://github.com/aristath/kirki/blob/master/CHANGELOG.md).