first commit without licensingg

This commit is contained in:
kbe
2025-08-21 14:40:43 +02:00
commit fa8d4e58a4
130 changed files with 82163 additions and 0 deletions

View File

@@ -0,0 +1,361 @@
/**
* Heading
*/
.customize-control-heading {
margin-bottom: 0;
}
/**
* Description
*/
.customize-control-description {
overflow-wrap: break-word;
}
/**
* Checkbox
*/
.customize-control-checkbox + .customize-control-checkbox {
margin-top: -12px;
}
/**
* Radio
*/
.customize-control-radio .customize-inside-control-row {
padding-bottom: 0;
}
/**
* Divider
*/
.customizer-divider {
border-bottom: 1px dashed #dcdcde;
margin: 4px -12px;
}
/**
* Color
*/
.customize-control-color[id*=is_dark],
.customize-control-color-alpha[id*=is_dark] {
position: relative;
}
.customize-control-color[id*=is_dark] .expand-setting,
.customize-control-color-alpha[id*=is_dark] .expand-setting {
position: absolute;
top: -82px;
left: 0;
padding: 10px;
cursor: pointer;
opacity: 0.5;
transition: opacity 0.25s;
}
.customize-control-color[id*=is_dark] .expand-setting:before,
.customize-control-color-alpha[id*=is_dark] .expand-setting:before {
display: block;
background-image: url("data:image/svg+xml,%3Csvg width='14' height='15' viewBox='0 0 14 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.66536 4.16683C5.66523 5.09392 5.94124 6.00005 6.45818 6.76964C6.97513 7.53923 7.70959 8.1374 8.56788 8.48787C9.42618 8.83835 10.3694 8.92523 11.2773 8.73744C12.1852 8.54965 13.0165 8.09571 13.6654 7.4335V7.50016C13.6654 11.1822 10.6807 14.1668 6.9987 14.1668C3.3167 14.1668 0.332031 11.1822 0.332031 7.50016C0.332031 3.81816 3.3167 0.833496 6.9987 0.833496H7.06536C6.62139 1.26758 6.26879 1.78614 6.02835 2.35862C5.78791 2.93109 5.66449 3.54591 5.66536 4.16683ZM1.66536 7.50016C1.66488 8.69015 2.06238 9.84611 2.79463 10.7841C3.52687 11.7222 4.55179 12.3883 5.70631 12.6767C6.86082 12.9651 8.07862 12.859 9.16593 12.3755C10.2532 11.8919 11.1476 11.0586 11.7067 10.0082C10.7117 10.2426 9.67322 10.2189 8.68991 9.93931C7.7066 9.65973 6.81103 9.13355 6.08817 8.41069C5.36531 7.68783 4.83913 6.79226 4.55955 5.80895C4.27997 4.82564 4.25627 3.7872 4.4907 2.79216C3.63708 3.24692 2.92322 3.92527 2.42554 4.75459C1.92785 5.58391 1.66508 6.53297 1.66536 7.50016Z' fill='%23000000'/%3E%3C/svg%3E%0A");
background-size: contain;
width: 14px;
height: 15px;
content: "";
}
.customize-control-color[id*=is_dark] .expand-setting:hover,
.customize-control-color-alpha[id*=is_dark] .expand-setting:hover {
opacity: 1;
}
.customize-control-color[id*=is_dark].customize-control-color-open .expand-setting,
.customize-control-color-alpha[id*=is_dark].customize-control-color-open .expand-setting {
opacity: 1;
}
.customize-control-color[id*=is_dark]:not(.customize-control-color-open),
.customize-control-color-alpha[id*=is_dark]:not(.customize-control-color-open) {
margin-bottom: 0;
}
.customize-control-color[id*=is_dark]:not(.customize-control-color-open) .customize-control-title,
.customize-control-color-alpha[id*=is_dark]:not(.customize-control-color-open) .customize-control-title {
display: none;
}
.customize-control-color[id*=is_dark]:not(.customize-control-color-open) .customize-control-content,
.customize-control-color-alpha[id*=is_dark]:not(.customize-control-color-open) .customize-control-content {
display: none;
}
.customize-control-color[id*=is_dark]:not(.customize-control-color-open) .wp-picker-container,
.customize-control-color-alpha[id*=is_dark]:not(.customize-control-color-open) .wp-picker-container {
display: none;
}
/**
* Select2
*/
.select2-dropdown {
border-color: rgba(0, 0, 0, 0.1);
border-radius: 0;
}
.select2-container {
min-width: 100px;
width: 100% !important;
}
.select2-container--open .select2-dropdown--above,
.select2-container--open .select2-dropdown--below {
z-index: 9999999;
min-width: 100px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
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;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: rgba(255, 255, 255, 0);
background-color: transparent;
border: none;
border-radius: 0;
}
.wp-customizer .select2-container {
z-index: 8 !important;
}
.wp-customizer .select2-container.select2-container--open {
z-index: 999999 !important;
}
/**
* Collapsibles
*/
.customize-control-collapsible .customize-collapsible {
position: relative;
margin: 0 -12px;
border-top: 1px solid rgba(0, 0, 0, 0.05);
}
.customize-control-collapsible .customize-collapsible h3 {
display: block;
position: relative;
margin: 0;
padding: 10px 14px;
color: #555;
background: white;
line-height: 21px;
user-select: none;
cursor: pointer;
}
.customize-control-collapsible .customize-collapsible h3:after {
position: absolute;
top: 12px;
left: 14px;
color: #a0a5aa;
font: 400 20px/1 dashicons;
content: "\f343";
}
.customize-control-collapsible .customize-collapsible h3:hover {
color: #0073aa;
background: #f5f5f5;
}
.customize-control-collapsible .customize-collapsible h3:hover:after {
color: #0073aa;
}
.customize-control-collapsible.customize-control-collapsed {
margin-bottom: 0;
}
.customize-control-collapsible.customize-control-collapsed .customize-collapsible h3:after {
content: "\f347";
}
.customize-control-hidden {
height: 0 !important;
overflow: hidden !important;
visibility: hidden;
padding: 0;
}
/**
* Alpha Color Picker CSS
*/
.customize-control-color-alpha .wp-picker-container .iris-picker {
border-bottom: none;
}
.customize-control-color-alpha .wp-picker-container {
max-width: 257px;
}
.customize-control-color-alpha .wp-picker-open + .wp-picker-input-wrap {
width: 100%;
}
.customize-control-color-alpha .wp-picker-input-wrap input[type=text].wp-color-picker.color-alpha-control {
float: right;
width: 195px;
}
.customize-control-color-alpha .wp-picker-input-wrap .button {
margin-right: 0;
float: left;
}
.wp-picker-container .wp-picker-open ~ .wp-picker-holder .color-alpha-picker-container {
display: block;
}
.color-alpha-picker-container {
border: 1px solid #dfdfdf;
border-top: none;
display: none;
background: #FFF;
padding: 0 11px 10px;
position: relative;
}
.color-alpha-picker-container .ui-widget-content,
.color-alpha-picker-container .ui-widget-header,
.color-alpha-picker-wrap .ui-state-focus {
background: transparent;
border: none;
}
.color-alpha-picker-wrap a.iris-square-value:focus {
-webkit-box-shadow: none;
box-shadow: none;
}
.color-alpha-picker-container .ui-slider {
position: relative;
z-index: 1;
height: 24px;
text-align: center;
margin: 0 auto;
width: 88%;
width: calc(100% - 28px);
}
.color-alpha-picker-container .ui-slider-handle,
.color-alpha-picker-container .ui-widget-content .ui-state-default {
color: #777;
background-color: #FFF;
text-shadow: 0 1px 0 #FFF;
text-decoration: none;
position: absolute;
z-index: 2;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
border: 1px solid #aaa;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
margin-top: -2px;
top: 0;
height: 26px;
width: 26px;
cursor: ew-resize;
font-size: 0;
padding: 0;
line-height: 27px;
margin-right: -14px;
}
.color-alpha-picker-container .ui-slider-handle.alpha {
font-size: 12px;
}
.color-alpha-picker-container .click-zone {
width: 14px;
height: 24px;
display: block;
position: absolute;
right: 10px;
}
.color-alpha-picker-container .max-click-zone {
left: 10px;
right: auto;
}
.color-alpha-picker-container .transparency {
height: 24px;
width: 100%;
background-color: #FFF;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOkAAAAYCAYAAAAf+dpfAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MzY5NzJDNTEwNzA3MTFFNEExREREODYzQUFCRDhDREMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MzY5NzJDNTIwNzA3MTFFNEExREREODYzQUFCRDhDREMiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDozNjk3MkM0RjA3MDcxMUU0QTFEREQ4NjNBQUJEOENEQyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDozNjk3MkM1MDA3MDcxMUU0QTFEREQ4NjNBQUJEOENEQyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PndQ2kgAAAbKSURBVHjarFyLUexIDFS7LhfSIJuXEmRDGiTjPt7VwnnNSN2SvVUUsLbno9Gn1aMx3t7eGBF/f+Lx+/j3r98vLy883Pd9bY//P/vh/v3z8zMW93//vZ/+56L9cz/H787t/7p+GtN+an8/tX1+nl/tH+/dF+N4+u7R/l6M5+n+r/b3ZPz76rmv9s9t79X8zfEf5aPGs5/ks6/kkI1rIf9sTMf2M5n/Gk+iP3uiU8f1tX5O7Ve6fW6/ujcO7cf52vb4ApF/UHTy/R0W93PRLk7PVX2ePzTvW12H2Vd2H4vrSJzb+Xkac8dCplnfKL5n0jeScWAxxmq+2Tho6lE1LxprguTeWAQWxn2f41xhrLOSmdTh19dXbgulQbFwWAwQpqFhoTDKKFxjVIuuFIcNobqOhcmiIpk7DSWmMQYaBsMbZBcJ4opkfZnIm4neQfSZzZMNo2BDrtV9HAQO+7M1O1xNiqYnoeFxYXrXjiAx9JbRUNBK2ZRhZIoEsR4som6IthDzCMPCEZ3XoYN+uDDmEA6AhhFXbcF0Tiz0jMncXWcmnfFmCrETWbAwSscbZRMP8zn1DAvjh1ggmsbNgaJ3kAEXkQZDB4OGA8zmB8P5XHUEk3mhGO8EjZ31OtNT3uT8nv7fzBxwshBI8liYUZGDhXFyRzW/bt9d2WSOw83F3P5ULpdxDlleTCMXQ3O9OnwDzDkqp+3yE1W+qbgOp1+Fav67/+PjA5sB2zJv7ij/FEpOcqEzvMFwQVzIOEEYFfmAqFn2K1GKhUNzU4kOenLGQ5EzsuEMOwTllUiPApJn/WYcjoVkjsSRm78oGAFh0HeybhXscxcZSWRDQXYgehFjAqNh/M8EscCUr8qdHT6iA6FhOhEXhkLI2HXWE2fn6BwSh0vDEf60e4ykLvOpYA0bofwOwcFEAlM4iKZSsckeVhENwiAzj83IGeRsTEjyOYdkgeGcJulLV+5xozFeRXpuEIskJWQVSRUL5k6gMk5Hcacw9So0dPZ33VyaQ4fTjbQwmMNObu7kn47MVUSGiOhTp86LPEF3nbsRNks/Ul3YDMigJtGl2tU+mGovg63TvUxlaNU+HCPfcoCpZE4hiUvtwyArKgWBYYAwUARNHViNnw2dUGvYTUvY1J8rQSyMNU2JIzQHh+GE74AYNJ2IgiEdYWPA8rlEGIvcKowUwiWbYMgPppKh2T4M0sfpwyWNusZ6ldmHYSNqXD/j+At3/3nUCrp7YPGolY0i93x65lCLeB7cvhrdqX0pvK/2Hcbt55ox/qdnD7WaavMcj/Gz0T5P8lGKgEct60rR96T9VSFJFp2P8nHyaDxqfSsnuB/7WqxvVTn0XSueIZxKP63UYyH/Sod4qBW3qrqS9c10Foda3299XUZSZ5EmeH6a51XwSUHTKfEEERVcxhpGHuJUXykiR5FFmdOoSj4RNYvs5o0O29zdtlMIZsLEuwisI+PMobS22DbTILqQUW3exg3G5C5YNAXaLbTAQCEY/WJ0pzKq4ygR9TaGm5NW5ZiOQUviROjdlYMcnYDgOBwMZV+mT1vSQITebHYT4xARQU0KRj7qtMmmsbo5zaTMcepYHPaTpoOtTspEc70rA1f7mTTapCC2OoUOE+N0A9QE1ZUE358/f7gZiz4txuZFCOJs1VQM5WoP0knqV4o13VaZeNiOUlRQHYUHp2EgWa2qYwwYKGWVblSB48rxx0n6paqrspNiNGzh1/ze39/TnFQVEV9RTN7QRhSe1mEU3bFkJZAuPFYlbjSRh3veN9vaWBF3CF2kr1hWNCAojdSlUuiuE1fRthtk3O2lq5+nfqtIehWCOZUh3ShRGZFzTM1FBM4haYfU6NT4UsBFDmAcjFSme55yCscr54fwa8Mx1JkpSenowfTAA9113YQiTGCEs3E/OaHgRLku/HZPY6CAOs552m5hQNdYuvASFw2tuxeu3h6hrmUQ0zVIXtQpDudSOfeKo/i5lsFdDDxR5+A3DDIIgoHs5ItTQmRKLig2zy19c48PKjrfOWQ/UWYWhJVTtdUlZKpctdI1lXp1DBzRe/ODE0XLdPMId6tXeky8T7Ut43hDpYCriSI0ne8sQjTyqY7i0BhHZoQQnn16AFx5+G5UV0X7V+Coyrc7xngX6dctoe067WUkdZReecLulgQuCM+Bq07Ehzkf5308FIwljO9XyumOFw1ZQBjctMSzm8e7RftRIK2704Ru5J1uacmtKefNDKoouwuHuweEpzlqBy5NCZTq/KZzoFtFH+ccq6scCpJWkat684WKjAp9KIio0iOHQ2HcuyetonkVKR0U8LTW/wowAHlscs+3mD4sAAAAAElFTkSuQmCC");
box-shadow: 0 0 5px rgba(0, 0, 0, 0.4) inset;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
padding: 0;
margin-top: -24px;
}
@media only screen and (max-width: 782px) {
.customize-control-color-alpha .wp-picker-input-wrap input[type=text].wp-color-picker.color-alpha-control {
width: 184px;
}
}
@media only screen and (max-width: 640px) {
.customize-control-color-alpha .wp-picker-input-wrap input[type=text].wp-color-picker.color-alpha-control {
width: 172px;
height: 33px;
}
}
/**
* Typography
*/
.customize-control-typography {
position: relative;
}
.customize-control-typography .wrapper {
padding: 10px;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
border: 1px solid rgba(0, 0, 0, 0.1);
}
.customize-control-typography .wrapper h5 {
margin: 0.67em 0 0;
}
.customize-control-typography .wrapper .font-family,
.customize-control-typography .wrapper .font-size,
.customize-control-typography .wrapper .letter-spacing,
.customize-control-typography .wrapper .line-height,
.customize-control-typography .wrapper .text-align,
.customize-control-typography .wrapper .text-transform,
.customize-control-typography .wrapper .variant {
width: 100%;
float: none;
clear: both;
}
.customize-control-typography .wrapper .font-size,
.customize-control-typography .wrapper .letter-spacing,
.customize-control-typography .wrapper .line-height,
.customize-control-typography .wrapper .text-transform {
width: 48%;
}
.customize-control-typography .wrapper .text-align .text-align-choices {
display: flex;
}
.customize-control-typography .wrapper .text-align .text-align-choices label {
width: 100%;
padding: 5px;
text-align: center;
border: 1px solid rgba(255, 255, 255, 0);
}
.customize-control-typography .wrapper .text-align .text-align-choices input {
display: none;
}
.customize-control-typography .wrapper .text-align .text-align-choices input:checked + label {
border-color: #0085ba;
}
/*# sourceMappingURL=customizer.css.map */

View File

@@ -0,0 +1,361 @@
/**
* Heading
*/
.customize-control-heading {
margin-bottom: 0;
}
/**
* Description
*/
.customize-control-description {
overflow-wrap: break-word;
}
/**
* Checkbox
*/
.customize-control-checkbox + .customize-control-checkbox {
margin-top: -12px;
}
/**
* Radio
*/
.customize-control-radio .customize-inside-control-row {
padding-bottom: 0;
}
/**
* Divider
*/
.customizer-divider {
border-bottom: 1px dashed #dcdcde;
margin: 4px -12px;
}
/**
* Color
*/
.customize-control-color[id*=is_dark],
.customize-control-color-alpha[id*=is_dark] {
position: relative;
}
.customize-control-color[id*=is_dark] .expand-setting,
.customize-control-color-alpha[id*=is_dark] .expand-setting {
position: absolute;
top: -82px;
right: 0;
padding: 10px;
cursor: pointer;
opacity: 0.5;
transition: opacity 0.25s;
}
.customize-control-color[id*=is_dark] .expand-setting:before,
.customize-control-color-alpha[id*=is_dark] .expand-setting:before {
display: block;
background-image: url("data:image/svg+xml,%3Csvg width='14' height='15' viewBox='0 0 14 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.66536 4.16683C5.66523 5.09392 5.94124 6.00005 6.45818 6.76964C6.97513 7.53923 7.70959 8.1374 8.56788 8.48787C9.42618 8.83835 10.3694 8.92523 11.2773 8.73744C12.1852 8.54965 13.0165 8.09571 13.6654 7.4335V7.50016C13.6654 11.1822 10.6807 14.1668 6.9987 14.1668C3.3167 14.1668 0.332031 11.1822 0.332031 7.50016C0.332031 3.81816 3.3167 0.833496 6.9987 0.833496H7.06536C6.62139 1.26758 6.26879 1.78614 6.02835 2.35862C5.78791 2.93109 5.66449 3.54591 5.66536 4.16683ZM1.66536 7.50016C1.66488 8.69015 2.06238 9.84611 2.79463 10.7841C3.52687 11.7222 4.55179 12.3883 5.70631 12.6767C6.86082 12.9651 8.07862 12.859 9.16593 12.3755C10.2532 11.8919 11.1476 11.0586 11.7067 10.0082C10.7117 10.2426 9.67322 10.2189 8.68991 9.93931C7.7066 9.65973 6.81103 9.13355 6.08817 8.41069C5.36531 7.68783 4.83913 6.79226 4.55955 5.80895C4.27997 4.82564 4.25627 3.7872 4.4907 2.79216C3.63708 3.24692 2.92322 3.92527 2.42554 4.75459C1.92785 5.58391 1.66508 6.53297 1.66536 7.50016Z' fill='%23000000'/%3E%3C/svg%3E%0A");
background-size: contain;
width: 14px;
height: 15px;
content: "";
}
.customize-control-color[id*=is_dark] .expand-setting:hover,
.customize-control-color-alpha[id*=is_dark] .expand-setting:hover {
opacity: 1;
}
.customize-control-color[id*=is_dark].customize-control-color-open .expand-setting,
.customize-control-color-alpha[id*=is_dark].customize-control-color-open .expand-setting {
opacity: 1;
}
.customize-control-color[id*=is_dark]:not(.customize-control-color-open),
.customize-control-color-alpha[id*=is_dark]:not(.customize-control-color-open) {
margin-bottom: 0;
}
.customize-control-color[id*=is_dark]:not(.customize-control-color-open) .customize-control-title,
.customize-control-color-alpha[id*=is_dark]:not(.customize-control-color-open) .customize-control-title {
display: none;
}
.customize-control-color[id*=is_dark]:not(.customize-control-color-open) .customize-control-content,
.customize-control-color-alpha[id*=is_dark]:not(.customize-control-color-open) .customize-control-content {
display: none;
}
.customize-control-color[id*=is_dark]:not(.customize-control-color-open) .wp-picker-container,
.customize-control-color-alpha[id*=is_dark]:not(.customize-control-color-open) .wp-picker-container {
display: none;
}
/**
* Select2
*/
.select2-dropdown {
border-color: rgba(0, 0, 0, 0.1);
border-radius: 0;
}
.select2-container {
min-width: 100px;
width: 100% !important;
}
.select2-container--open .select2-dropdown--above,
.select2-container--open .select2-dropdown--below {
z-index: 9999999;
min-width: 100px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
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;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: rgba(255, 255, 255, 0);
background-color: transparent;
border: none;
border-radius: 0;
}
.wp-customizer .select2-container {
z-index: 8 !important;
}
.wp-customizer .select2-container.select2-container--open {
z-index: 999999 !important;
}
/**
* Collapsibles
*/
.customize-control-collapsible .customize-collapsible {
position: relative;
margin: 0 -12px;
border-top: 1px solid rgba(0, 0, 0, 0.05);
}
.customize-control-collapsible .customize-collapsible h3 {
display: block;
position: relative;
margin: 0;
padding: 10px 14px;
color: #555;
background: white;
line-height: 21px;
user-select: none;
cursor: pointer;
}
.customize-control-collapsible .customize-collapsible h3:after {
position: absolute;
top: 12px;
right: 14px;
color: #a0a5aa;
font: 400 20px/1 dashicons;
content: "\f343";
}
.customize-control-collapsible .customize-collapsible h3:hover {
color: #0073aa;
background: #f5f5f5;
}
.customize-control-collapsible .customize-collapsible h3:hover:after {
color: #0073aa;
}
.customize-control-collapsible.customize-control-collapsed {
margin-bottom: 0;
}
.customize-control-collapsible.customize-control-collapsed .customize-collapsible h3:after {
content: "\f347";
}
.customize-control-hidden {
height: 0 !important;
overflow: hidden !important;
visibility: hidden;
padding: 0;
}
/**
* Alpha Color Picker CSS
*/
.customize-control-color-alpha .wp-picker-container .iris-picker {
border-bottom: none;
}
.customize-control-color-alpha .wp-picker-container {
max-width: 257px;
}
.customize-control-color-alpha .wp-picker-open + .wp-picker-input-wrap {
width: 100%;
}
.customize-control-color-alpha .wp-picker-input-wrap input[type=text].wp-color-picker.color-alpha-control {
float: left;
width: 195px;
}
.customize-control-color-alpha .wp-picker-input-wrap .button {
margin-left: 0;
float: right;
}
.wp-picker-container .wp-picker-open ~ .wp-picker-holder .color-alpha-picker-container {
display: block;
}
.color-alpha-picker-container {
border: 1px solid #dfdfdf;
border-top: none;
display: none;
background: #FFF;
padding: 0 11px 10px;
position: relative;
}
.color-alpha-picker-container .ui-widget-content,
.color-alpha-picker-container .ui-widget-header,
.color-alpha-picker-wrap .ui-state-focus {
background: transparent;
border: none;
}
.color-alpha-picker-wrap a.iris-square-value:focus {
-webkit-box-shadow: none;
box-shadow: none;
}
.color-alpha-picker-container .ui-slider {
position: relative;
z-index: 1;
height: 24px;
text-align: center;
margin: 0 auto;
width: 88%;
width: calc(100% - 28px);
}
.color-alpha-picker-container .ui-slider-handle,
.color-alpha-picker-container .ui-widget-content .ui-state-default {
color: #777;
background-color: #FFF;
text-shadow: 0 1px 0 #FFF;
text-decoration: none;
position: absolute;
z-index: 2;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
border: 1px solid #aaa;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
margin-top: -2px;
top: 0;
height: 26px;
width: 26px;
cursor: ew-resize;
font-size: 0;
padding: 0;
line-height: 27px;
margin-left: -14px;
}
.color-alpha-picker-container .ui-slider-handle.alpha {
font-size: 12px;
}
.color-alpha-picker-container .click-zone {
width: 14px;
height: 24px;
display: block;
position: absolute;
left: 10px;
}
.color-alpha-picker-container .max-click-zone {
right: 10px;
left: auto;
}
.color-alpha-picker-container .transparency {
height: 24px;
width: 100%;
background-color: #FFF;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOkAAAAYCAYAAAAf+dpfAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MzY5NzJDNTEwNzA3MTFFNEExREREODYzQUFCRDhDREMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MzY5NzJDNTIwNzA3MTFFNEExREREODYzQUFCRDhDREMiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDozNjk3MkM0RjA3MDcxMUU0QTFEREQ4NjNBQUJEOENEQyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDozNjk3MkM1MDA3MDcxMUU0QTFEREQ4NjNBQUJEOENEQyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PndQ2kgAAAbKSURBVHjarFyLUexI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");
box-shadow: 0 0 5px rgba(0, 0, 0, 0.4) inset;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
padding: 0;
margin-top: -24px;
}
@media only screen and (max-width: 782px) {
.customize-control-color-alpha .wp-picker-input-wrap input[type=text].wp-color-picker.color-alpha-control {
width: 184px;
}
}
@media only screen and (max-width: 640px) {
.customize-control-color-alpha .wp-picker-input-wrap input[type=text].wp-color-picker.color-alpha-control {
width: 172px;
height: 33px;
}
}
/**
* Typography
*/
.customize-control-typography {
position: relative;
}
.customize-control-typography .wrapper {
padding: 10px;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
border: 1px solid rgba(0, 0, 0, 0.1);
}
.customize-control-typography .wrapper h5 {
margin: 0.67em 0 0;
}
.customize-control-typography .wrapper .font-family,
.customize-control-typography .wrapper .font-size,
.customize-control-typography .wrapper .letter-spacing,
.customize-control-typography .wrapper .line-height,
.customize-control-typography .wrapper .text-align,
.customize-control-typography .wrapper .text-transform,
.customize-control-typography .wrapper .variant {
width: 100%;
float: none;
clear: both;
}
.customize-control-typography .wrapper .font-size,
.customize-control-typography .wrapper .letter-spacing,
.customize-control-typography .wrapper .line-height,
.customize-control-typography .wrapper .text-transform {
width: 48%;
}
.customize-control-typography .wrapper .text-align .text-align-choices {
display: flex;
}
.customize-control-typography .wrapper .text-align .text-align-choices label {
width: 100%;
padding: 5px;
text-align: center;
border: 1px solid rgba(255, 255, 255, 0);
}
.customize-control-typography .wrapper .text-align .text-align-choices input {
display: none;
}
.customize-control-typography .wrapper .text-align .text-align-choices input:checked + label {
border-color: #0085ba;
}
/*# sourceMappingURL=customizer.css.map */

File diff suppressed because it is too large Load Diff

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

@@ -0,0 +1,324 @@
<?php
/**
* Customizer
*
* @package Revision
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'CSCO_Customizer' ) ) {
/**
* Class Theme Customizer
*/
class CSCO_Customizer {
/**
* A reference to an instance of this class.
*
* @var object
*/
private static $instance = null;
/**
* An array of all our panels.
*
* @var array
*/
public static $panels = array();
/**
* An array of all our sections.
*
* @var array
*/
public static $sections = array();
/**
* An array of all our fields.
*
* @var array
*/
public static $fields = array();
/**
* An array of field dependencies.
*
* @var array
*/
private static $dependencies = array();
/**
* Returns the instance.
*
* @return object
*/
public static function get_instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* The class constructor
*/
public function __construct() {
/** Include file helper */
require_once get_theme_file_path( '/core/customizer/class-helper.php' );
/** Include fonts modules */
require_once get_theme_file_path( '/core/customizer/modules/class-fonts.php' );
require_once get_theme_file_path( '/core/customizer/modules/class-fonts-google.php' );
require_once get_theme_file_path( '/core/customizer/modules/class-fonts-theme.php' );
require_once get_theme_file_path( '/core/customizer/modules/class-output-styles.php' );
/** Include files of controls */
if ( class_exists( 'WP_Customize_Control' ) ) {
require_once get_theme_file_path( '/core/customizer/controls/class-control-dimension.php' );
require_once get_theme_file_path( '/core/customizer/controls/class-control-divider.php' );
require_once get_theme_file_path( '/core/customizer/controls/class-control-heading.php' );
require_once get_theme_file_path( '/core/customizer/controls/class-control-multicheck.php' );
require_once get_theme_file_path( '/core/customizer/controls/class-control-collapsible.php' );
require_once get_theme_file_path( '/core/customizer/controls/class-control-color-alpha.php' );
require_once get_theme_file_path( '/core/customizer/controls/class-control-typography.php' );
}
/** Initialize actions */
add_action( 'customize_register', array( $this, 'customizer_register' ) );
add_action( 'customize_controls_enqueue_scripts', array( $this, 'customizer_controls_enqueue_scripts' ) );
add_filter( 'csco_customizer_field_add_setting_args', array( $this, 'field_add_setting_args' ) );
add_filter( 'csco_customizer_field_add_control_args', array( $this, 'field_add_control_args' ) );
}
/**
* Create a new panel.
*
* @param string $id The ID for this panel.
* @param array $args The panel arguments.
*
* @return void
*/
public static function add_panel( $id = '', $args = array() ) {
self::$panels[ $id ] = $args;
}
/**
* Create a new section.
*
* @param string $id The ID for this section.
* @param array $args The section arguments.
*
* @return void
*/
public static function add_section( $id, $args ) {
self::$sections[ $id ] = $args;
}
/**
* Create a new field
*
* @param array $args The field's arguments.
*
* @return void
*/
public static function add_field( $args ) {
if ( isset( $args['settings'] ) && isset( $args['type'] ) ) {
self::$fields[ $args['settings'] ] = $args;
}
}
/**
* Register new panels, sections and fields
*
* @param object $wp_customize The component name.
*
* @return void
*/
public function customizer_register( $wp_customize ) {
// Set panels.
foreach ( self::$panels as $panel_id => $panel_args ) {
$wp_customize->add_panel( $panel_id, $panel_args );
}
// Set sections.
foreach ( self::$sections as $section_id => $section_args ) {
$wp_customize->add_section( $section_id, $section_args );
}
// Register the custom control type.
$wp_customize->register_control_type( 'CSCO_Customize_Typography_Control' );
$wp_customize->register_control_type( 'CSCO_Customize_Multicheck_Control' );
// Set fields.
foreach ( self::$fields as $field_id => $field_args ) {
/**
* The csco_customizer_field_add_setting_args hook.
*
* @since 1.0.0
*/
$params = apply_filters( 'csco_customizer_field_add_setting_args', $field_args, $wp_customize );
call_user_func( array( $wp_customize, 'add_setting' ), $field_id, $params );
/**
* The csco_customizer_field_add_control_args hook.
*
* @since 1.0.0
*/
$args = apply_filters( 'csco_customizer_field_add_control_args', $field_args, $wp_customize );
switch ( $field_args['type'] ) {
case 'color':
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, $field_id, $args ) );
break;
case 'image':
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, $field_id, $args ) );
break;
case 'dimension':
$wp_customize->add_control( new CSCO_Customize_Dimension_Control( $wp_customize, $field_id, $args ) );
break;
case 'divider':
$wp_customize->add_control( new CSCO_Customize_Divider_Control( $wp_customize, $field_id, $args ) );
break;
case 'heading':
$wp_customize->add_control( new CSCO_Customize_Heading_Control( $wp_customize, $field_id, $args ) );
break;
case 'multicheck':
$wp_customize->add_control( new CSCO_Customize_Multicheck_Control( $wp_customize, $field_id, $args ) );
break;
case 'collapsible':
$wp_customize->add_control( new CSCO_Customize_Collapsible_Control( $wp_customize, $field_id, $args ) );
break;
case 'color-alpha':
$wp_customize->add_control( new CSCO_Customize_Color_Alpha_Control( $wp_customize, $field_id, $args ) );
break;
case 'typography':
$wp_customize->add_control( new CSCO_Customize_Typography_Control( $wp_customize, $field_id, $args ) );
break;
default:
$wp_customize->add_control( $field_id, $args );
break;
}
}
}
/**
* Filter setting arguments.
*
* @param array $args The field arguments.
*
* @return array
*/
public function field_add_setting_args( $args ) {
$args = array(
'type' => isset( $args['type_mod'] ) ? $args['type_mod'] : 'theme_mod',
'capability' => isset( $args['capability'] ) ? $args['capability'] : 'edit_theme_options',
'theme_supports' => isset( $args['theme_supports'] ) ? $args['theme_supports'] : '',
'default' => isset( $args['default'] ) ? $args['default'] : '',
'transport' => isset( $args['transport'] ) ? $args['transport'] : 'refresh',
'sanitize_callback' => isset( $args['sanitize_callback'] ) ? $args['sanitize_callback'] : '',
'sanitize_js_callback' => isset( $args['sanitize_js_callback'] ) ? $args['sanitize_js_callback'] : '',
);
return $args;
}
/**
* Filter control arguments.
*
* @param array $args The field arguments.
*
* @return array
*/
public function field_add_control_args( $args ) {
if ( isset( $args['active_callback'] ) ) {
if ( is_array( $args['active_callback'] ) ) {
if ( ! is_callable( $args['active_callback'] ) ) {
foreach ( $args['active_callback'] as $key => $val ) {
if ( is_callable( $val ) ) {
unset( $args['active_callback'][ $key ] );
}
}
if ( isset( $args['active_callback'][0] ) ) {
$args['required'] = $args['active_callback'];
}
}
}
if ( ! empty( $args['required'] ) ) {
self::$dependencies[ $args['settings'] ] = $args['required'];
$args['active_callback'] = '__return_true';
return $args;
}
// No need to proceed any further if we're using the default value.
if ( '__return_true' === $args['active_callback'] ) {
return $args;
}
// Make sure the function is callable, otherwise fallback to __return_true.
if ( ! is_callable( $args['active_callback'] ) ) {
$args['active_callback'] = '__return_true';
}
}
return $args;
}
/**
* Enqueue Customizer control scripts.
*
* @return void
*/
public function customizer_controls_enqueue_scripts() {
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_script( 'wp-color-picker' );
// Register customize selectWoo scripts.
wp_register_script( 'selectWoo', get_theme_file_uri( '/core/customizer/assets/selectWoo.full.min.js' ), array( 'jquery' ), filemtime( get_theme_file_path( '/core/customizer/assets/selectWoo.full.min.js' ) ), true );
// Register customize scripts.
wp_register_script( 'cs-customizer', get_theme_file_uri( '/core/customizer/assets/customizer.js' ), array( 'jquery', 'customize-controls', 'selectWoo' ), filemtime( get_theme_file_path( '/core/customizer/assets/customizer.js' ) ), true );
// Localize customize scripts.
wp_localize_script( 'cs-customizer', 'cscoCustomizerConfig', array(
'dependencies' => self::$dependencies,
'advanced_settings' => esc_html__( 'Advanced settings', 'revision' ),
'noFileSelected' => esc_html__( 'No File Selected', 'revision' ),
'remove' => esc_html__( 'Remove', 'revision' ),
'default' => esc_html__( 'Default', 'revision' ),
'selectFile' => esc_html__( 'Select File', 'revision' ),
'standardFonts' => esc_html__( 'Standard Fonts', 'revision' ),
'googleFonts' => esc_html__( 'Google Fonts', 'revision' ),
'defaultCSSValues' => esc_html__( 'CSS Defaults', 'revision' ),
'defaultBrowserFamily' => esc_html__( 'Default Browser Font-Family', 'revision' ),
) );
// Enqueue customize scripts.
wp_enqueue_script( 'cs-customizer' );
// Register customize select2 style.
wp_register_style( 'selectWoo', get_theme_file_uri( '/core/customizer/assets/selectWoo.min.css' ), array(), filemtime( get_theme_file_path( '/core/customizer/assets/selectWoo.min.css' ) ) );
// Register customize style.
wp_register_style( 'cs-customizer', get_theme_file_uri( '/core/customizer/assets/customizer.css' ), array( 'selectWoo' ), filemtime( get_theme_file_path( '/core/customizer/assets/customizer.css' ) ) );
// Enqueue customize style.
wp_enqueue_style( 'cs-customizer' );
}
}
if ( ! function_exists( 'csco_customizer' ) ) {
/**
* Returns instanse of the Theme Customizer class.
*
* @return object
*/
function csco_customizer() {
return CSCO_Customizer::get_instance();
}
}
csco_customizer();
}

View File

@@ -0,0 +1,199 @@
<?php
/**
* Helper methods
*
* @package Revision
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* A simple object containing static methods.
*/
class CSCO_Customizer_Helper {
/**
* Get the value of a field.
*
* @param string $field_id The field ID.
*/
public static function get_value( $field_id = '' ) {
// Make sure value is defined.
$value = __return_empty_string();
// We're using theme_mods so just get the value using get_theme_mod.
$default_value = __return_null();
if ( isset( CSCO_Customizer::$fields[ $field_id ] ) && isset( CSCO_Customizer::$fields[ $field_id ]['default'] ) ) {
$default_value = CSCO_Customizer::$fields[ $field_id ]['default'];
}
$value = get_theme_mod( $field_id, $default_value );
/**
* The csco_customizer_values_get_value hook.
*
* @since 1.0.0
*/
return apply_filters( 'csco_customizer_values_get_value', $value, $field_id );
}
/**
* Compares the 2 values given the condition
*
* @param mixed $value1 The 1st value in the comparison.
* @param mixed $value2 The 2nd value in the comparison.
* @param string $operator The operator we'll use for the comparison.
* @return boolean whether The comparison has succeded (true) or failed (false).
*/
public static function compare_values( $value1, $value2, $operator ) {
if ( '===' === $operator ) {
return $value1 === $value2;
}
if ( '!==' === $operator ) {
return $value1 !== $value2;
}
if ( ( '!=' === $operator || 'not equal' === $operator ) ) {
return $value1 != $value2; // phpcs:ignore WordPress.PHP.StrictComparisons
}
if ( ( '>=' === $operator || 'greater or equal' === $operator || 'equal or greater' === $operator ) ) {
return $value2 >= $value1;
}
if ( ( '<=' === $operator || 'smaller or equal' === $operator || 'equal or smaller' === $operator ) ) {
return $value2 <= $value1;
}
if ( ( '>' === $operator || 'greater' === $operator ) ) {
return $value2 > $value1;
}
if ( ( '<' === $operator || 'smaller' === $operator ) ) {
return $value2 < $value1;
}
if ( 'contains' === $operator || 'in' === $operator ) {
if ( is_array( $value1 ) && is_array( $value2 ) ) {
foreach ( $value2 as $val ) {
if ( in_array( $val, $value1 ) ) { // phpcs:ignore WordPress.PHP.StrictInArray
return true;
}
}
return false;
}
if ( is_array( $value1 ) && ! is_array( $value2 ) ) {
return in_array( $value2, $value1 ); // phpcs:ignore WordPress.PHP.StrictInArray
}
if ( is_array( $value2 ) && ! is_array( $value1 ) ) {
return in_array( $value1, $value2 ); // phpcs:ignore WordPress.PHP.StrictInArray
}
return ( false !== strrpos( $value1, $value2 ) || false !== strpos( $value2, $value1 ) );
}
return $value1 == $value2; // phpcs:ignore WordPress.PHP.StrictComparisons
}
/**
* Process the active_callback parameter.
*
* @param array $field The current field.
*/
public static function active_callback( $field ) {
if ( isset( $field['active_callback'] ) && is_array( $field['active_callback'] ) ) {
if ( ! is_callable( $field['active_callback'] ) ) {
foreach ( $field['active_callback'] as $key => $val ) {
if ( is_callable( $val ) ) {
unset( $field['active_callback'][ $key ] );
}
}
if ( isset( $field['active_callback'][0] ) ) {
$field['required'] = $field['active_callback'];
}
}
}
// Only continue if field dependencies are met.
if ( isset( $field['required'] ) && ! empty( $field['required'] ) ) {
$valid = true;
foreach ( $field['required'] as $requirement ) {
if ( isset( $requirement['setting'] ) && isset( $requirement['value'] ) && isset( $requirement['operator'] ) ) {
$controller_value = self::get_value( $requirement['setting'] );
if ( ! self::compare_values( $controller_value, $requirement['value'], $requirement['operator'] ) ) {
$valid = false;
}
}
}
if ( ! $valid ) {
return false;
}
}
return true;
}
/**
* Sanitizes typography controls
*
* @param array $value The value.
*/
public static function typography_sanitize( $value ) {
if ( ! is_array( $value ) ) {
return array();
}
foreach ( $value as $key => $val ) {
switch ( $key ) {
case 'font-family':
$value['font-family'] = sanitize_text_field( $val );
break;
case 'font-weight':
if ( isset( $value['variant'] ) ) {
break;
}
$value['variant'] = $val;
if ( isset( $value['font-style'] ) && 'italic' === $value['font-style'] ) {
$value['variant'] = ( '400' !== $val || 400 !== $val ) ? $value['variant'] . 'italic' : 'italic';
}
break;
case 'variant':
// Use 'regular' instead of 400 for font-variant.
$value['variant'] = ( 400 === $val || '400' === $val ) ? 'regular' : $val;
// Get font-weight from variant.
$value['font-weight'] = filter_var( $value['variant'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );
$value['font-weight'] = ( 'regular' === $value['variant'] || 'italic' === $value['variant'] ) ? 400 : absint( $value['font-weight'] );
// Get font-style from variant.
if ( ! isset( $value['font-style'] ) ) {
$value['font-style'] = ( false === strpos( $value['variant'], 'italic' ) ) ? 'normal' : 'italic';
}
break;
case 'font-size':
case 'letter-spacing':
case 'word-spacing':
case 'line-height':
$value[ $key ] = '' === trim( $value[ $key ] ) ? '' : sanitize_text_field( $val );
break;
case 'text-align':
if ( ! in_array( $val, array( '', 'inherit', 'left', 'center', 'right', 'justify' ), true ) ) {
$value['text-align'] = '';
}
break;
case 'text-transform':
if ( ! in_array( $val, array( '', 'none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit' ), true ) ) {
$value['text-transform'] = '';
}
break;
case 'text-decoration':
if ( ! in_array( $val, array( '', 'none', 'underline', 'overline', 'line-through', 'initial', 'inherit' ), true ) ) {
$value['text-transform'] = '';
}
break;
}
}
return $value;
}
}

View File

@@ -0,0 +1,40 @@
<?php
/**
* Customizer Collapsible
*
* @package Revision
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'CSCO_Customize_Collapsible_Control' ) ) {
/**
* Class Customize Collapsible
*/
class CSCO_Customize_Collapsible_Control extends WP_Customize_Control {
/**
* The field type.
*
* @var string
*/
public $type = 'collapsible';
/**
* Render the control content.
*/
protected function render_content() {
$collapsed_class = null;
if ( isset( $this->input_attrs['collapsed'] ) && $this->input_attrs['collapsed'] ) {
$collapsed_class = 'customize-collapsed';
}
?>
<div class="customize-collapsible <?php echo esc_attr( $collapsed_class ); ?>"><h3><?php echo esc_html( $this->label ); ?></h3></div>
<?php
}
}
}

View File

@@ -0,0 +1,72 @@
<?php
/**
* Customizer Color Alpha
*
* @package Revision
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'CSCO_Customize_Color_Alpha_Control' ) ) {
/**
* Class Customize Color Alpha
*/
class CSCO_Customize_Color_Alpha_Control extends WP_Customize_Control {
/**
* The field type.
*
* @var string
*/
public $type = 'color-alpha';
/**
* Add support for palettes to be passed in.
*
* Supported palette values are true, false, or an array of RGBa and Hex colors.
*
* @var bool
*/
public $palette;
/**
* Add support for showing the opacity value on the slider handle.
*
* @var bool
*/
public $alpha;
/**
* Render the control.
*/
public function render_content() {
if ( is_array( $this->palette ) ) {
$palette = implode( '|', $this->palette );
} else {
$palette = ( false === $this->palette || 'false' === $this->palette ) ? 'false' : 'true';
}
$alpha = ( false === $this->alpha || 'false' === $this->alpha ) ? 'false' : 'true';
?>
<label>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<?php
if ( isset( $this->description ) && $this->description ) {
?>
<span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
<?php
}
?>
</label>
<input class="color-alpha-control" type="text" data-alpha="<?php echo esc_attr( $alpha ); ?>" data-palette="<?php echo esc_attr( $palette ); ?>" data-default-color="<?php echo esc_attr( $this->settings['default']->default ); ?>" <?php $this->link(); ?> />
<?php
}
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
* Customizer Dimension
*
* @package Revision
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'CSCO_Customize_Dimension_Control' ) ) {
/**
* Class Customize Dimension
*/
class CSCO_Customize_Dimension_Control extends WP_Customize_Control {
/**
* The field type.
*
* @var string
*/
public $type = 'dimension';
/**
* Render the control content.
*/
protected function render_content() {
?>
<label>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<?php
if ( isset( $this->description ) && $this->description ) {
?>
<span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
<?php
}
?>
<input type="text" <?php $this->link(); ?> value="<?php echo esc_attr( $this->value() ); ?>"/>
</label>
<?php
}
}
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* Customizer Divider
*
* @package Revision
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'CSCO_Customize_Divider_Control' ) ) {
/**
* Class Customize Divider
*/
class CSCO_Customize_Divider_Control extends WP_Customize_Control {
/**
* The field type.
*
* @var string
*/
public $type = 'divider';
/**
* Render the control content.
*/
protected function render_content() {
?>
<div class="customizer-divider"></div>
<?php
}
}
}

View File

@@ -0,0 +1,45 @@
<?php
/**
* Customizer Heading
*
* @package Revision
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'CSCO_Customize_Heading_Control' ) ) {
/**
* Class Customize Heading
*/
class CSCO_Customize_Heading_Control extends WP_Customize_Control {
/**
* The field type.
*
* @var string
*/
public $type = 'heading';
/**
* Render the control content.
*/
protected function render_content() {
?>
<label>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<?php
if ( isset( $this->description ) && $this->description ) {
?>
<span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
<?php
}
?>
</label>
<?php
}
}
}

View File

@@ -0,0 +1,115 @@
<?php
/**
* Customizer Multicheck
*
* @package Revision
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'CSCO_Customize_Multicheck_Control' ) ) {
/**
* Class Customize Multicheck
*/
class CSCO_Customize_Multicheck_Control extends WP_Customize_Control {
/**
* The field type.
*
* @var string
*/
public $type = 'multicheck';
/**
* Constructor.
*
* @param WP_Customize_Manager $manager Customizer bootstrap instance.
* @param string $id Control ID.
* @param array $args The args.
*/
public function __construct( $manager, $id, $args = array() ) {
parent::__construct( $manager, $id, $args );
// Init choices.
if ( ! is_array( $this->choices ) ) {
$this->choices = array();
}
}
/**
* Render the control's content.
*/
protected function render_content() {}
/**
* Sets the $sanitize_callback
*/
protected function sanitize_callback() {
// If a custom sanitize_callback has been defined,
// then we don't need to proceed any further.
if ( ! empty( $this->sanitize_callback ) ) {
return;
}
$this->sanitize_callback = array( $this, 'sanitize' );
}
/**
* The sanitize method that will be used as a falback
*
* @param string|array $value The control's value.
*/
public function sanitize( $value ) {
$value = ( ! is_array( $value ) ) ? explode( ',', $value ) : $value;
return ( ! empty( $value ) ) ? array_map( 'sanitize_text_field', $value ) : array();
}
/**
* Refresh the parameters passed to the JavaScript via JSON.
*
* @see WP_Customize_Control::to_json()
*/
public function to_json() {
parent::to_json();
// Value.
$this->json['value'] = $this->value();
// The link.
$this->json['link'] = $this->get_link();
// Choices.
$this->json['choices'] = $this->choices;
// The ID.
$this->json['id'] = $this->id;
}
/**
* An Underscore (JS) template for this control's content (but not its container).
*
* Class variables for this control class are available in the `data` JS object;
* export custom variables by overriding {@see WP_Customize_Control::to_json()}.
*
* @see WP_Customize_Control::print_template()
*/
protected function content_template() {
?>
<# if ( ! data.choices ) { return; } #>
<# if ( data.label ) { #><span class="customize-control-title">{{{ data.label }}}</span><# } #>
<# if ( data.description ) { #><span class="description customize-control-description">{{{ data.description }}}</span><# } #>
<ul>
<# for ( key in data.choices ) { #>
<li><label<# if ( _.contains( data.value, key ) ) { #> class="checked"<# } #>><input {{{ data.inputAttrs }}} type="checkbox" value="{{ key }}"<# if ( _.contains( data.value, key ) ) { #> checked<# } #> />{{ data.choices[ key ] }}</label></li>
<# } #>
</ul>
<?php
}
}
}

View File

@@ -0,0 +1,278 @@
<?php
/**
* Customizer Typography
*
* @package Revision
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'CSCO_Customize_Typography_Control' ) ) {
/**
* Class Customize Typography
*/
class CSCO_Customize_Typography_Control extends WP_Customize_Control {
/**
* Control's Type.
*
* @var string
*/
public $type = 'typography';
/**
* Constructor.
*
* @param WP_Customize_Manager $manager Customizer bootstrap instance.
* @param string $id Control ID.
* @param array $args The args.
*/
public function __construct( $manager, $id, $args = array() ) {
parent::__construct( $manager, $id, $args );
// Init choices.
if ( ! is_array( $this->choices ) ) {
$this->choices = array();
}
/**
* The csco_customizer_fonts_choices hook.
*
* @since 1.0.0
*/
$this->choices = apply_filters( 'csco_customizer_fonts_choices', wp_parse_args(
$this->choices,
array(
'variant' => array(),
'fonts' => array(
'standard' => array(),
'google' => array(),
),
)
) );
}
/**
* Render the control's content.
*/
protected function render_content() {}
/**
* Refresh the parameters passed to the JavaScript via JSON.
*
* @see WP_Customize_Control::to_json()
*/
public function to_json() {
parent::to_json();
// Default value.
$this->json['default'] = $this->setting->default;
if ( isset( $this->default ) ) {
$this->json['default'] = $this->default;
}
// Value.
$this->json['value'] = $this->value();
// The link.
$this->json['link'] = $this->get_link();
// Choices.
$this->json['choices'] = $this->choices;
// The ID.
$this->json['id'] = $this->id;
// The filter value.
if ( is_array( $this->json['value'] ) ) {
foreach ( array_keys( $this->json['value'] ) as $key ) {
if ( ! in_array( $key, array( 'variant', 'font-weight', 'font-style' ), true ) && ! isset( $this->json['default'][ $key ] ) ) {
unset( $this->json['value'][ $key ] );
}
if ( ! isset( $this->json['default'][ $key ] ) ) {
unset( $this->json['value'][ $key ] );
}
if ( isset( $this->json['default'][ $key ] ) && false === $this->json['default'][ $key ] ) {
unset( $this->json['value'][ $key ] );
}
}
}
$this->json['show_variants'] = true;
}
/**
* An Underscore (JS) template for this control's content (but not its container).
*
* Class variables for this control class are available in the `data` JS object;
* export custom variables by overriding {@see WP_Customize_Control::to_json()}.
*
* @see WP_Customize_Control::print_template()
*/
protected function content_template() {
?>
<label class="customizer-text">
<# if ( data.label ) { #><span class="customize-control-title">{{{ data.label }}}</span><# } #>
<# if ( data.description ) { #><span class="description customize-control-description">{{{ data.description }}}</span><# } #>
</label>
<div class="wrapper">
<# if ( ! _.isUndefined( data.default['font-family'] ) ) { #>
<# data.value['font-family'] = data.value['font-family'] || data['default']['font-family']; #>
<# if ( data.choices['fonts'] ) { data.fonts = data.choices['fonts']; } #>
<div class="font-family">
<h5><?php esc_html_e( 'Font Family', 'revision' ); ?></h5>
<select {{{ data.inputAttrs }}} id="cs-typography-font-family-{{{ data.id }}}" placeholder="<?php esc_attr_e( 'Select Font Family', 'revision' ); ?>"></select>
</div>
<# if ( true === data.show_variants || false !== data.default.variant ) { #>
<div class="variant cs-variant-wrapper">
<h5><?php esc_html_e( 'Variant', 'revision' ); ?></h5>
<select {{{ data.inputAttrs }}} class="variant" id="cs-typography-variant-{{{ data.id }}}"></select>
</div>
<# } #>
<# } #>
<# if ( ! _.isUndefined( data.default['font-size'] ) ) { #>
<# data.value['font-size'] = data.value['font-size'] || data['default']['font-size']; #>
<div class="font-size">
<h5><?php esc_html_e( 'Font Size', 'revision' ); ?></h5>
<input {{{ data.inputAttrs }}} type="text" value="{{ data.value['font-size'] }}"/>
</div>
<# } #>
<# if ( ! _.isUndefined( data.default['line-height'] ) ) { #>
<# data.value['line-height'] = data.value['line-height'] || data['default']['line-height']; #>
<div class="line-height">
<h5><?php esc_html_e( 'Line Height', 'revision' ); ?></h5>
<input {{{ data.inputAttrs }}} type="text" value="{{ data.value['line-height'] }}"/>
</div>
<# } #>
<# if ( ! _.isUndefined( data.default['letter-spacing'] ) ) { #>
<# data.value['letter-spacing'] = data.value['letter-spacing'] || data['default']['letter-spacing']; #>
<div class="letter-spacing">
<h5><?php esc_html_e( 'Letter Spacing', 'revision' ); ?></h5>
<input {{{ data.inputAttrs }}} type="text" value="{{ data.value['letter-spacing'] }}"/>
</div>
<# } #>
<# if ( ! _.isUndefined( data.default['word-spacing'] ) ) { #>
<# data.value['word-spacing'] = data.value['word-spacing'] || data['default']['word-spacing']; #>
<div class="word-spacing">
<h5><?php esc_html_e( 'Word Spacing', 'revision' ); ?></h5>
<input {{{ data.inputAttrs }}} type="text" value="{{ data.value['word-spacing'] }}"/>
</div>
<# } #>
<# if ( ! _.isUndefined( data.default['text-align'] ) ) { #>
<# data.value['text-align'] = data.value['text-align'] || data['default']['text-align']; #>
<div class="text-align">
<h5><?php esc_html_e( 'Text Align', 'revision' ); ?></h5>
<div class="text-align-choices">
<input {{{ data.inputAttrs }}} type="radio" value="inherit" name="_customize-typography-text-align-radio-{{ data.id }}" id="{{ data.id }}-text-align-inherit" <# if ( data.value['text-align'] === 'inherit' ) { #> checked="checked"<# } #>>
<label for="{{ data.id }}-text-align-inherit">
<span class="dashicons dashicons-editor-removeformatting"></span>
<span class="screen-reader-text"><?php esc_html_e( 'Inherit', 'revision' ); ?></span>
</label>
</input>
<input {{{ data.inputAttrs }}} type="radio" value="left" name="_customize-typography-text-align-radio-{{ data.id }}" id="{{ data.id }}-text-align-left" <# if ( data.value['text-align'] === 'left' ) { #> checked="checked"<# } #>>
<label for="{{ data.id }}-text-align-left">
<span class="dashicons dashicons-editor-alignleft"></span>
<span class="screen-reader-text"><?php esc_html_e( 'Left', 'revision' ); ?></span>
</label>
</input>
<input {{{ data.inputAttrs }}} type="radio" value="center" name="_customize-typography-text-align-radio-{{ data.id }}" id="{{ data.id }}-text-align-center" <# if ( data.value['text-align'] === 'center' ) { #> checked="checked"<# } #>>
<label for="{{ data.id }}-text-align-center">
<span class="dashicons dashicons-editor-aligncenter"></span>
<span class="screen-reader-text"><?php esc_html_e( 'Center', 'revision' ); ?></span>
</label>
</input>
<input {{{ data.inputAttrs }}} type="radio" value="right" name="_customize-typography-text-align-radio-{{ data.id }}" id="{{ data.id }}-text-align-right" <# if ( data.value['text-align'] === 'right' ) { #> checked="checked"<# } #>>
<label for="{{ data.id }}-text-align-right">
<span class="dashicons dashicons-editor-alignright"></span>
<span class="screen-reader-text"><?php esc_html_e( 'Right', 'revision' ); ?></span>
</label>
</input>
<input {{{ data.inputAttrs }}} type="radio" value="justify" name="_customize-typography-text-align-radio-{{ data.id }}" id="{{ data.id }}-text-align-justify" <# if ( data.value['text-align'] === 'justify' ) { #> checked="checked"<# } #>>
<label for="{{ data.id }}-text-align-justify">
<span class="dashicons dashicons-editor-justify"></span>
<span class="screen-reader-text"><?php esc_html_e( 'Justify', 'revision' ); ?></span>
</label>
</input>
</div>
</div>
<# } #>
<# if ( ! _.isUndefined( data.default['text-transform'] ) ) { #>
<# data.value['text-transform'] = data.value['text-transform'] || data['default']['text-transform']; #>
<div class="text-transform">
<h5><?php esc_html_e( 'Text Transform', 'revision' ); ?></h5>
<select {{{ data.inputAttrs }}} id="cs-typography-text-transform-{{{ data.id }}}">
<option value=""<# if ( '' === data.value['text-transform'] ) { #>selected<# } #>></option>
<option value="none"<# if ( 'none' === data.value['text-transform'] ) { #>selected<# } #>><?php esc_html_e( 'None', 'revision' ); ?></option>
<option value="capitalize"<# if ( 'capitalize' === data.value['text-transform'] ) { #>selected<# } #>><?php esc_html_e( 'Capitalize', 'revision' ); ?></option>
<option value="uppercase"<# if ( 'uppercase' === data.value['text-transform'] ) { #>selected<# } #>><?php esc_html_e( 'Uppercase', 'revision' ); ?></option>
<option value="lowercase"<# if ( 'lowercase' === data.value['text-transform'] ) { #>selected<# } #>><?php esc_html_e( 'Lowercase', 'revision' ); ?></option>
<option value="initial"<# if ( 'initial' === data.value['text-transform'] ) { #>selected<# } #>><?php esc_html_e( 'Initial', 'revision' ); ?></option>
<option value="inherit"<# if ( 'inherit' === data.value['text-transform'] ) { #>selected<# } #>><?php esc_html_e( 'Inherit', 'revision' ); ?></option>
</select>
</div>
<# } #>
<# if ( ! _.isUndefined( data.default['text-decoration'] ) ) { #>
<# data.value['text-decoration'] = data.value['text-decoration'] || data['default']['text-decoration']; #>
<div class="text-decoration">
<h5><?php esc_html_e( 'Text Decoration', 'revision' ); ?></h5>
<select {{{ data.inputAttrs }}} id="cs-typography-text-decoration-{{{ data.id }}}">
<option value=""<# if ( '' === data.value['text-decoration'] ) { #>selected<# } #>></option>
<option value="none"<# if ( 'none' === data.value['text-decoration'] ) { #>selected<# } #>><?php esc_html_e( 'None', 'revision' ); ?></option>
<option value="underline"<# if ( 'underline' === data.value['text-decoration'] ) { #>selected<# } #>><?php esc_html_e( 'Underline', 'revision' ); ?></option>
<option value="overline"<# if ( 'overline' === data.value['text-decoration'] ) { #>selected<# } #>><?php esc_html_e( 'Overline', 'revision' ); ?></option>
<option value="line-through"<# if ( 'line-through' === data.value['text-decoration'] ) { #>selected<# } #>><?php esc_html_e( 'Line-Through', 'revision' ); ?></option>
<option value="initial"<# if ( 'initial' === data.value['text-decoration'] ) { #>selected<# } #>><?php esc_html_e( 'Initial', 'revision' ); ?></option>
<option value="inherit"<# if ( 'inherit' === data.value['text-decoration'] ) { #>selected<# } #>><?php esc_html_e( 'Inherit', 'revision' ); ?></option>
</select>
</div>
<# } #>
</div>
<input class="typography-hidden-value" type="hidden" {{{ data.link }}}>
<?php
}
/**
* Formats variants.
*
* @param array $variants The variants.
* @return array
*/
protected function format_variants_array( $variants ) {
$all_variants = CSCO_Customizer_Fonts::get_all_variants();
$final_variants = array();
foreach ( $variants as $variant ) {
if ( is_string( $variant ) ) {
$final_variants[] = array(
'id' => $variant,
'label' => isset( $all_variants[ $variant ] ) ? $all_variants[ $variant ] : $variant,
);
} elseif ( is_array( $variant ) && isset( $variant['id'] ) && isset( $variant['label'] ) ) {
$final_variants[] = $variant;
}
}
return $final_variants;
}
}
}

View File

@@ -0,0 +1,218 @@
<?php
/**
* Customizer Fonts Google
*
* @package Revision
*/
if ( ! class_exists( 'CSCO_Customizer_Fonts_Google' ) ) {
/**
* Customizer Fonts Google Class.
*/
final class CSCO_Customizer_Fonts_Google {
/**
* The array of fonts
*
* @var array
*/
public $fonts_output = array();
/**
* An array of all google fonts.
*
* @var array
*/
private $google_fonts = array();
/**
* Fonts to load.
*
* @var array
*/
protected $fonts_to_load = array();
/**
* The class constructor.
*/
public function __construct() {
$this->google_fonts = CSCO_Customizer_Fonts::get_google_fonts();
/** Initialize actions */
add_action( 'wp_loaded', array( $this, 'populate_fonts' ) );
add_filter( 'wp_resource_hints', array( $this, 'resource_hints' ), 10, 2 );
if ( ! is_admin() || is_customize_preview() ) {
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_google_fonts' ), 999 );
} else {
add_action( 'enqueue_block_assets', array( $this, 'enqueue_google_fonts' ), 999 );
}
}
/**
* Loader for Google Fonts.
*/
public function populate_fonts() {
// Go through our fields and populate $this->fonts_output.
$this->loop_fields();
// Goes through $this->fonts_output and adds or removes things as needed.
$this->process_fonts();
foreach ( $this->fonts_output as $font => $weights ) {
foreach ( $weights as $key => $value ) {
if ( 'italic' === $value ) {
$weights[ $key ] = '400i';
} else {
$weights[ $key ] = str_replace( array( 'regular', 'bold', 'italic' ), array( '400', '', 'i' ), $value );
}
}
$this->fonts_to_load[] = array(
'family' => $font,
'weights' => $weights,
);
}
}
/**
* Goes through all our fields and then populates the $this->fonts_output property.
*/
public function loop_fields() {
$fields = CSCO_Customizer::$fields;
if ( is_array( $fields ) && $fields ) {
foreach ( $fields as $field ) {
if ( ! isset( $field['type'] ) || false === strpos( $field['type'], 'typography' ) ) {
continue;
}
// Check active callback.
if ( ! CSCO_Customizer_Helper::active_callback( $field ) ) {
continue;
}
// Get the value.
$value = CSCO_Customizer_Helper::get_value( $field['settings'] );
// If we don't have a font-family then we can skip this.
if ( ! isset( $value['font-family'] ) ) {
continue;
}
// If not a google-font, then we can skip this.
if ( ! isset( $value['font-family'] ) || ! CSCO_Customizer_Fonts::is_google_font( $value['font-family'] ) ) {
continue;
}
// Set a default value for variants.
if ( ! isset( $value['variant'] ) ) {
$value['variant'] = 'regular';
}
// Add the requested google-font.
if ( ! isset( $this->fonts_output[ $value['font-family'] ] ) ) {
$this->fonts_output[ $value['font-family'] ] = array();
}
if ( ! in_array( $value['variant'], $this->fonts_output[ $value['font-family'] ], true ) ) {
$this->fonts_output[ $value['font-family'] ][] = $value['variant'];
}
if ( isset( $field['choices']['variant'] ) && is_array( $field['choices']['variant'] ) ) {
foreach ( $field['choices']['variant'] as $extra_variant ) {
if ( ! in_array( $extra_variant, $this->fonts_output[ $value['font-family'] ], true ) ) {
$this->fonts_output[ $value['font-family'] ][] = $extra_variant;
}
}
}
}
}
}
/**
* Determines the vbalidity of the selected font as well as its properties.
* This is vital to make sure that the google-font script that we'll generate later
* does not contain any invalid options.
*/
public function process_fonts() {
// Early exit if font-family is empty.
if ( empty( $this->fonts_output ) ) {
return;
}
foreach ( $this->fonts_output as $font => $variants ) {
// Determine if this is indeed a google font or not.
// If it's not, then just remove it from the array.
if ( ! array_key_exists( $font, $this->google_fonts ) ) {
unset( $this->fonts_output[ $font ] );
continue;
}
// Get all valid font variants for this font.
$font_variants = array();
if ( isset( $this->google_fonts[ $font ]['variants'] ) ) {
$font_variants = $this->google_fonts[ $font ]['variants'];
}
foreach ( $variants as $variant ) {
// If this is not a valid variant for this font-family
// then unset it and move on to the next one.
if ( ! in_array( strval( $variant ), $font_variants, true ) ) {
$variant_key = array_search( $variant, $this->fonts_output[ $font ], true );
unset( $this->fonts_output[ $font ][ $variant_key ] );
continue;
}
}
}
}
/**
* Add preconnect for Google Fonts.
*
* @param array $urls URLs to print for resource hints.
* @param string $relation_type The relation type the URLs are printed.
*/
public function resource_hints( $urls, $relation_type ) {
$fonts_to_load = $this->fonts_output;
if ( ! empty( $fonts_to_load ) && 'preconnect' === $relation_type ) {
$urls[] = array(
'href' => 'https://fonts.gstatic.com',
'crossorigin',
);
}
return $urls;
}
/**
* Enqueue Google fonts.
*/
public function enqueue_google_fonts() {
foreach ( $this->fonts_to_load as $font ) {
// Set family.
$family = str_replace( ' ', '+', trim( $font['family'] ) );
// Set weights.
$weights = join( ',', $font['weights'] );
/**
* The csco_customizer_google_fonts_subset hook.
*
* @since 1.0.0
*/
$subset = apply_filters( 'csco_customizer_google_fonts_subset', 'latin,latin-ext,cyrillic,cyrillic-ext,vietnamese' );
$url = "https://fonts.googleapis.com/css?family={$family}:{$weights}&subset={$subset}&display=swap";
wp_enqueue_style( md5( $url ), $url, array(), csco_get_theme_data( 'Version' ) );
}
}
}
new CSCO_Customizer_Fonts_Google();
}

View File

@@ -0,0 +1,250 @@
<?php
/**
* Customizer Theme Fonts Google
*
* @package Revision
*/
if ( ! class_exists( 'CSCO_Customizer_Fonts_Theme' ) ) {
/**
* Customizer Fonts Theme Class.
*/
final class CSCO_Customizer_Fonts_Theme {
/**
* The theme fonts.
*
* @var array
*/
public $fonts_output = array();
/**
* The theme all variants.
*
* @var array
*/
public $variants_output = array();
/**
* The class constructor
*/
public function __construct() {
/**
* The csco_theme_fonts hook.
*
* @since 1.0.0
*/
$this->fonts_output = apply_filters( 'csco_theme_fonts', array() );
/** Initialize actions */
add_action( 'wp', array( $this, 'process_fonts' ) );
add_filter( 'admin_init', array( $this, 'set_variants_output' ) );
add_filter( 'template_redirect', array( $this, 'set_variants_output' ) );
add_filter( 'csco_customizer_dynamic_css', array( $this, 'dynamic_css_fonts_stack' ) );
add_filter( 'csco_customizer_fonts_choices', array( $this, 'customizer_fonts_choices' ), 999 );
if ( ! is_admin() || is_customize_preview() ) {
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_theme_fonts' ), 999 );
} else {
add_action( 'enqueue_block_assets', array( $this, 'enqueue_theme_fonts' ), 999 );
}
}
/**
* Get stack the variants that are used in the theme.
*/
public function set_variants_output() {
$fields = CSCO_Customizer::$fields;
$extra_variants = array();
if ( is_array( $fields ) && $fields ) {
foreach ( $fields as $field ) {
if ( ! isset( $field['type'] ) || false === strpos( $field['type'], 'typography' ) ) {
continue;
}
// Check active callback.
if ( ! CSCO_Customizer_Helper::active_callback( $field ) ) {
continue;
}
$field_value = CSCO_Customizer_Helper::get_value( $field['settings'] );
if ( ! isset( $field_value['font-family'] ) || ! $field_value['font-family'] ) {
continue;
}
// Set font-family.
$font_family = $field_value['font-family'];
// Set font-weight.
$font_weight = ( isset( $field_value['font-weight'] ) && $field_value['font-weight'] ) ? $field_value['font-weight'] : 400;
$font_weight = ( 'regular' === $font_weight ) ? 400 : absint( $font_weight );
// Set font-style.
$font_style = ( isset( $field_value['font-style'] ) && $field_value['font-style'] ) ? $field_value['font-style'] : 'normal';
// Add hash.
array_push( $extra_variants, $font_family . $font_weight . $font_style );
if ( ! isset( $field['choices']['variant'] ) || ! $field['choices']['variant'] ) {
continue;
}
// Add all possible variations from choices.
foreach ( $field['choices']['variant'] as $variant ) {
// Get font-weight from variant.
$font_weight = $this->get_font_weight( $variant );
// Get font-style from variant.
$font_style = $this->get_font_style( $variant );
// Add hash of choices.
array_push( $extra_variants, $font_family . $font_weight . $font_style );
}
}
}
$this->variants_output = $extra_variants;
}
/**
* Process fonts
*/
public function process_fonts() {
foreach ( $this->fonts_output as $key => $font ) {
if ( ! isset( $font['name'] ) || ! isset( $font['variants'] ) ) {
unset( $this->fonts_output[ $key ] );
}
}
}
/**
* Add new fonts for choices
*
* @param array $fonts List fonts.
*/
public function customizer_fonts_choices( $fonts ) {
if ( is_customize_preview() ) {
// Add new section.
if ( $this->fonts_output ) {
$fonts['fonts']['families']['theme'] = array(
'text' => esc_html__( 'Theme Fonts', 'revision' ),
'children' => array(),
);
}
// Add new font.
foreach ( $this->fonts_output as $slug => $font ) {
$fonts['fonts']['families']['theme']['children'][] = array(
'text' => $font['name'],
'id' => $slug,
);
$fonts['fonts']['variants'][ $slug ] = $font['variants'];
}
}
return $fonts;
}
/**
* Extend font stack for dynamic styles
*
* @param string $style The dynamic css.
*/
public function dynamic_css_fonts_stack( $style ) {
foreach ( $this->fonts_output as $slug => $font ) {
$style = str_replace( sprintf( 'font-family:%s;', $slug ), sprintf( 'font-family:%s,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";', $slug ), $style );
}
return $style;
}
/**
* Get font-weight from variant.
*
* @param string $variant The variant of font.
*/
public function get_font_weight( $variant = 'regular' ) {
$font_weight = filter_var( $variant, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );
return ( 'regular' === $variant || 'italic' === $variant ) ? 400 : absint( $font_weight );
}
/**
* Get font-style from variant.
*
* @param string $variant The variant of font.
*/
public function get_font_style( $variant = 'regular' ) {
return ( false === strpos( $variant, 'italic' ) ) ? 'normal' : 'italic';
}
/**
* Gets all our styles and returns them as a string.
*
* @param string $method Webfonts Load Method.
*/
public function get_styles_theme_fonts( $method = null ) {
ob_start();
foreach ( $this->fonts_output as $slug => $font ) {
foreach ( $font['variants'] as $variant ) {
$font_family = $slug;
// Get font-weight from variant.
$font_weight = $this->get_font_weight( $variant );
// Get font-style from variant.
$font_style = $this->get_font_style( $variant );
// Get font path.
$font_path = get_theme_file_uri( sprintf( 'assets/static/fonts/%s-%s', $slug, $variant ) );
// Get hash from font.
$hash = $font_family . $font_weight . $font_style;
// Check whether the font is used in the theme.
if ( ! in_array( $hash, $this->variants_output, true ) ) {
continue;
}
?>
@font-face {
font-family: <?php echo esc_html( $slug ); ?>;
src: url('<?php echo esc_html( $font_path ); ?>.woff2') format('woff2'),
url('<?php echo esc_html( $font_path ); ?>.woff') format('woff');
font-weight: <?php echo esc_html( $font_weight ); ?>;
font-style: <?php echo esc_html( $font_style ); ?>;
font-display: swap;
}
<?php
}
}
$styles = ob_get_clean();
// Remove extra characters.
$styles = str_replace( array( "\t", "\r", "\n" ), '', $styles );
return $styles;
}
/**
* Enqueue theme fonts.
*/
public function enqueue_theme_fonts() {
wp_register_style( 'cs-theme-fonts', false, array(), csco_get_theme_data( 'Version' ) );
wp_enqueue_style( 'cs-theme-fonts' );
wp_add_inline_style( 'cs-theme-fonts', $this->get_styles_theme_fonts() );
}
}
new CSCO_Customizer_Fonts_Theme();
}

View File

@@ -0,0 +1,194 @@
<?php
/**
* Customizer Fonts
*
* @package Revision
*/
if ( ! class_exists( 'CSCO_Customizer_Fonts' ) ) {
/**
* Customizer Fonts Class.
*/
final class CSCO_Customizer_Fonts {
/**
* An array of our google fonts.
*
* @static
* @var null|object
*/
public static $google_fonts = null;
/**
* The class constructor.
*/
public function __construct() {
/** Initialize actions */
add_action( 'wp_ajax_csco_typography_fonts_google_all_get', array( $this, 'get_googlefonts_json' ) );
add_action( 'wp_ajax_nopriv_csco_typography_fonts_google_all_get', array( $this, 'get_googlefonts_json' ) );
add_action( 'wp_ajax_csco_typography_fonts_standard_all_get', array( $this, 'get_standardfonts_json' ) );
add_action( 'wp_ajax_nopriv_csco_typography_fonts_standard_all_get', array( $this, 'get_standardfonts_json' ) );
}
/**
* Gets the googlefonts JSON file.
*
* @return void
*/
public function get_googlefonts_json() {
require get_theme_file_path( '/core/customizer/assets/webfonts.json' ); // phpcs:ignore.
wp_die();
}
/**
* Get the standard fonts JSON.
*
* @return void
*/
public function get_standardfonts_json() {
echo wp_json_encode( self::get_standard_fonts() );
wp_die();
}
/**
* Returns an array of all available variants.
*
* @static
* @return array
*/
public static function get_all_variants() {
return array(
'100' => esc_html__( 'Ultra-Light 100', 'revision' ),
'100light' => esc_html__( 'Ultra-Light 100', 'revision' ),
'100italic' => esc_html__( 'Ultra-Light 100 Italic', 'revision' ),
'200' => esc_html__( 'Light 200', 'revision' ),
'200italic' => esc_html__( 'Light 200 Italic', 'revision' ),
'300' => esc_html__( 'Book 300', 'revision' ),
'300italic' => esc_html__( 'Book 300 Italic', 'revision' ),
'400' => esc_html__( 'Normal 400', 'revision' ),
'regular' => esc_html__( 'Normal 400', 'revision' ),
'italic' => esc_html__( 'Normal 400 Italic', 'revision' ),
'500' => esc_html__( 'Medium 500', 'revision' ),
'500italic' => esc_html__( 'Medium 500 Italic', 'revision' ),
'600' => esc_html__( 'Semi-Bold 600', 'revision' ),
'600bold' => esc_html__( 'Semi-Bold 600', 'revision' ),
'600italic' => esc_html__( 'Semi-Bold 600 Italic', 'revision' ),
'700' => esc_html__( 'Bold 700', 'revision' ),
'700italic' => esc_html__( 'Bold 700 Italic', 'revision' ),
'800' => esc_html__( 'Extra-Bold 800', 'revision' ),
'800bold' => esc_html__( 'Extra-Bold 800', 'revision' ),
'800italic' => esc_html__( 'Extra-Bold 800 Italic', 'revision' ),
'900' => esc_html__( 'Ultra-Bold 900', 'revision' ),
'900bold' => esc_html__( 'Ultra-Bold 900', 'revision' ),
'900italic' => esc_html__( 'Ultra-Bold 900 Italic', 'revision' ),
);
}
/**
* Return an array of standard websafe fonts.
*
* @return array Standard websafe fonts.
*/
public static function get_standard_fonts() {
$standard_fonts = array(
'serif' => array(
'label' => 'Serif',
'stack' => 'Georgia,Times,"Times New Roman",serif',
),
'sans-serif' => array(
'label' => 'Sans Serif',
'stack' => '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif',
),
'monospace' => array(
'label' => 'Monospace',
'stack' => 'Monaco,"Lucida Sans Typewriter","Lucida Typewriter","Courier New",Courier,monospace',
),
);
/**
* The csco_customizer_fonts_standard_fonts hook.
*
* @since 1.0.0
*/
return apply_filters( 'csco_customizer_fonts_standard_fonts', $standard_fonts );
}
/**
* Return an array of all available Google Fonts.
*
* @return array All Google Fonts.
*/
public static function get_google_fonts() {
// Get fonts from cache.
self::$google_fonts = get_site_transient( 'csco_customizer_googlefonts_cache' );
/**
* Reset the cache if we're using action=cs-googlefonts-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'] ) && 'cs-googlefonts-reset-cache' === $_GET['action'] ) { // phpcs:ignore WordPress.Security.NonceVerification
self::$google_fonts = false;
}
// If cache is populated, return cached fonts array.
if ( self::$google_fonts ) {
return self::$google_fonts;
}
// If we got this far, cache was empty so we need to get from JSON.
ob_start();
require get_theme_file_path( '/core/customizer/assets/webfonts.json' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
$fonts_json = ob_get_clean();
$fonts = json_decode( $fonts_json, true );
$google_fonts = array();
if ( is_array( $fonts ) ) {
foreach ( $fonts['items'] as $font ) {
$google_fonts[ $font['family'] ] = array(
'label' => $font['family'],
'variants' => $font['variants'],
'category' => $font['category'],
);
}
}
/**
* Apply the 'csco_customizer_fonts_google_fonts' filter
*
* The csco_customizer_fonts_google_fonts hook.
*
* @since 1.0.0
*/
self::$google_fonts = apply_filters( 'csco_customizer_fonts_google_fonts', $google_fonts );
/**
* Save the array in cache.
*
* The csco_customizer_googlefonts_transient_time hook.
*
* @since 1.0.0
*/
$cache_time = apply_filters( 'csco_customizer_googlefonts_transient_time', DAY_IN_SECONDS );
set_site_transient( 'csco_customizer_googlefonts_cache', self::$google_fonts, $cache_time );
return self::$google_fonts;
}
/**
* Determine if a font-name is a valid google font or not.
*
* @param string $fontname The name of the font we want to check.
* @return bool
*/
public static function is_google_font( $fontname ) {
return ( array_key_exists( $fontname, self::$google_fonts ) );
}
}
new CSCO_Customizer_Fonts();
}

View File

@@ -0,0 +1,240 @@
<?php
/**
* Theme Customizer Output Styles
*
* @package Revision
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'CSCO_Customizer_Output_Styles' ) ) {
/**
* Class Theme Customizer Output
*/
class CSCO_Customizer_Output_Styles {
/**
* The class constructor
*/
public function __construct() {
if ( ! is_admin() || is_customize_preview() ) {
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_output_styles' ), 999 );
} else {
add_action( 'enqueue_block_assets', array( $this, 'enqueue_output_styles' ), 999 );
}
}
/**
* Gets all our styles and returns them as a string.
*/
public function get_output_styles() {
$output_styles = __return_empty_string();
// Get an array of all our fields.
$fields = CSCO_Customizer::$fields;
// Check if we need to exit early.
if ( empty( $fields ) || ! is_array( $fields ) ) {
return;
}
// Initially we're going to format our styles as an array.
// This is going to make processing them a lot easier
// and make sure there are no duplicate styles etc.
$css = array();
// Start parsing our fields.
foreach ( $fields as $field ) {
// No need to process fields without an output, or an improperly-formatted output.
if ( ! isset( $field['output'] ) || empty( $field['output'] ) || ! is_array( $field['output'] ) ) {
continue;
}
// Get the value of this field.
$value = CSCO_Customizer_Helper::get_value( $field['settings'] );
// Check active callback.
if ( ! CSCO_Customizer_Helper::active_callback( $field ) ) {
continue;
}
// Start parsing the output arguments of the field.
foreach ( $field['output'] as $output ) {
if ( is_admin() && ! is_customize_preview() ) {
// Check if this is an admin style.
if ( ! isset( $output['context'] ) || ! in_array( 'editor', $output['context'], true ) ) {
continue;
}
} elseif ( isset( $output['context'] ) && ! in_array( 'front', $output['context'], true ) ) {
// Check if this is a frontend style.
continue;
}
$output = wp_parse_args(
$output, array(
'element' => '',
'property' => '',
'media_query' => 'global',
'prefix' => '',
'units' => '',
'suffix' => '',
'value_pattern' => '$',
'choice' => '',
'convert' => '',
)
);
// If element is an array, convert it to a string.
if ( is_array( $output['element'] ) ) {
$output['element'] = implode( ',', $output['element'] );
}
// Simple fields.
if ( ! is_array( $value ) ) {
$value_pattern = str_replace( '$', ( $value ? $value : '' ), $output['value_pattern'] );
if ( 'rgb' === $output['convert'] ) {
$value_pattern = csco_hex2rgba( $value_pattern, false );
}
if ( ! empty( $output['element'] ) && ! empty( $output['property'] ) && $value_pattern ) {
$css[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value_pattern . $output['units'] . $output['suffix'];
}
} else {
if ( 'typography' === $field['type'] ) {
$value = CSCO_Customizer_Helper::typography_sanitize( $value );
$properties = array(
'font-family',
'font-size',
'variant',
'font-weight',
'font-style',
'letter-spacing',
'word-spacing',
'line-height',
'text-align',
'text-transform',
'text-decoration',
'color',
);
foreach ( $properties as $property ) {
// Early exit if the value is not in the defaults.
if ( ! isset( $field['default'][ $property ] ) ) {
continue;
}
// Early exit if the value is not saved in the values.
if ( ! isset( $value[ $property ] ) || ! $value[ $property ] ) {
continue;
}
// Take care of variants.
if ( 'variant' === $property && isset( $value['variant'] ) && ! empty( $value['variant'] ) ) {
// Get the font_weight.
$font_weight = str_replace( 'italic', '', $value['variant'] );
$font_weight = in_array( $font_weight, array( '', 'regular' ), true ) ? '400' : $font_weight;
$css[ $output['media_query'] ][ $output['element'] ]['font-weight'] = $font_weight;
// Is this italic?
$is_italic = ( false !== strpos( $value['variant'], 'italic' ) );
if ( $is_italic ) {
$css[ $output['media_query'] ][ $output['element'] ]['font-style'] = 'italic';
}
continue;
}
$css[ $output['media_query'] ][ $output['element'] ][ $property ] = $output['prefix'] . $value[ $property ] . $output['suffix'];
}
} elseif ( 'multicolor' === $field['type'] ) {
if ( ! empty( $output['element'] ) && ! empty( $output['property'] ) && ! empty( $output['choice'] ) ) {
$css[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value[ $output['choice'] ] . $output['units'] . $output['suffix'];
}
} else {
foreach ( $value as $key => $subvalue ) {
$property = $key;
if ( false !== strpos( $output['property'], '%%' ) ) {
$property = str_replace( '%%', $key, $output['property'] );
} elseif ( ! empty( $output['property'] ) ) {
$output['property'] = $output['property'] . '-' . $key;
}
if ( 'background-image' === $output['property'] && false === strpos( $subvalue, 'url(' ) ) {
$subvalue = sprintf( 'url("%s")', set_url_scheme( $subvalue ) );
}
if ( $subvalue ) {
$css[ $output['media_query'] ][ $output['element'] ][ $property ] = $subvalue;
}
}
}
}
}
}
// Process the array of CSS properties and produce the final CSS.
if ( ! is_array( $css ) || empty( $css ) ) {
return null;
}
foreach ( $css as $media_query => $styles ) {
$output_styles .= ( 'global' !== $media_query ) ? $media_query . '{' : '';
foreach ( $styles as $style => $style_array ) {
$css_for_style = '';
foreach ( $style_array as $property => $value ) {
if ( is_string( $value ) && '' !== $value ) {
$css_for_style .= sprintf( '%s:%s;', $property, $value );
} elseif ( is_array( $value ) ) {
foreach ( $value as $subvalue ) {
if ( is_string( $subvalue ) && '' !== $subvalue ) {
$css_for_style .= sprintf( '%s:%s;', $property, $subvalue );
}
}
}
$value = ( is_string( $value ) ) ? $value : '';
}
if ( '' !== $css_for_style ) {
$output_styles .= $style . sprintf( '{%s}', $css_for_style );
}
}
$output_styles .= ( 'global' !== $media_query ) ? '}' : '';
}
/**
* The csco_customizer_output_styles hook.
*
* @since 1.0.0
*/
$output_styles = apply_filters( 'csco_customizer_output_styles', $output_styles );
return $output_styles;
}
/**
* Enqueue output styles.
*/
public function enqueue_output_styles() {
wp_register_style( 'cs-customizer-output-styles', false, array(), csco_get_theme_data( 'Version' ) );
wp_enqueue_style( 'cs-customizer-output-styles' );
wp_add_inline_style( 'cs-customizer-output-styles', $this->get_output_styles() );
}
}
new CSCO_Customizer_Output_Styles();
}