diff --git a/functions/kirki/LICENSE b/functions/kirki/LICENSE index a13701d..141f91f 100644 --- a/functions/kirki/LICENSE +++ b/functions/kirki/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2017 Aristeides Stathopoulos +Copyright (c) 2019 Ari Stathopoulos (@aristath) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/functions/kirki/assets/css/kirki-styles.css b/functions/kirki/assets/css/kirki-styles.css deleted file mode 100644 index e69de29..0000000 diff --git a/functions/kirki/assets/vendor/selectWoo/kirki.css b/functions/kirki/assets/vendor/selectWoo/kirki.css index 273c216..94090fd 100644 --- a/functions/kirki/assets/vendor/selectWoo/kirki.css +++ b/functions/kirki/assets/vendor/selectWoo/kirki.css @@ -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; -} -.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; -} + 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; -} + z-index: 8 !important; } + .wp-customizer .select2-container.select2-container--open { + z-index: 999999 !important; } /*# sourceMappingURL=kirki.css.map */ diff --git a/functions/kirki/assets/vendor/selectWoo/kirki.css.map b/functions/kirki/assets/vendor/selectWoo/kirki.css.map deleted file mode 100644 index 738c86a..0000000 --- a/functions/kirki/assets/vendor/selectWoo/kirki.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sourceRoot":"","sources":["kirki.scss"],"names":[],"mappings":"AAAA;EACE;EACA;;;AAGF;EACE;EACA;;AAGE;AAAA;EAEE;EACA;;AAMA;EACE;;AAKF;EAEE;EACA;;AAIA;EACE;EACA;EACA;EACA;;;AAOV;EACE;;AAGE;EAEE","file":"kirki.css"} \ No newline at end of file diff --git a/functions/kirki/assets/vendor/selectWoo/kirki.scss b/functions/kirki/assets/vendor/selectWoo/kirki.scss deleted file mode 100644 index 39ee9ae..0000000 --- a/functions/kirki/assets/vendor/selectWoo/kirki.scss +++ /dev/null @@ -1,53 +0,0 @@ -.select2-dropdown { - border-color: rgba(0,0,0,.1); - border-radius: 0; -} - -.select2-container { - min-width: 100px; - width: 100% !important; - - &--open { - .select2-dropdown--above, - .select2-dropdown--below { - z-index: 9999999; - min-width: 100px; - } - } - - &--default { - .select2-search--dropdown { - .select2-search__field { - border-color: rgba(0,0,0,.1); - } - } - - .select2-selection { - &--multiple, - &--single { - border-color: rgba(0,0,0,.1); - border-radius: 0; - } - - &--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; - - &.select2-container { - &--open { - // @See https://github.com/aristath/kirki/issues/1418 - z-index: 999999 !important; - } - } -} diff --git a/functions/kirki/class-kirki-autoload.php b/functions/kirki/class-kirki-autoload.php index 4d0ed06..b522a21 100644 --- a/functions/kirki/class-kirki-autoload.php +++ b/functions/kirki/class-kirki-autoload.php @@ -5,8 +5,8 @@ * * @package Kirki * @category Core - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ @@ -55,7 +55,7 @@ class Kirki_Autoload { // Check if we've got it cached and ready. if ( isset( $this->cached_paths[ $class_name ] ) && file_exists( $this->cached_paths[ $class_name ] ) ) { - include_once $this->cached_paths[ $class_name ]; + include_once $this->cached_paths[ $class_name ]; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude return; } @@ -65,7 +65,7 @@ class Kirki_Autoload { $path = wp_normalize_path( $path ); if ( file_exists( $path ) ) { $this->cached_paths[ $class_name ] = $path; - include_once $path; + include_once $path; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude return; } } diff --git a/functions/kirki/controls/class-kirki-controls.php b/functions/kirki/controls/class-kirki-controls.php index 7503f99..f3e3cfb 100644 --- a/functions/kirki/controls/class-kirki-controls.php +++ b/functions/kirki/controls/class-kirki-controls.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 3.0.17 */ @@ -64,7 +64,7 @@ class Kirki_Controls { foreach ( $this->templates as $template ) { if ( file_exists( $this->views_path . $template . '.php' ) ) { echo ''; } } diff --git a/functions/kirki/controls/css/styles.css b/functions/kirki/controls/css/styles.css index 822ef61..9026d42 100644 --- a/functions/kirki/controls/css/styles.css +++ b/functions/kirki/controls/css/styles.css @@ -1,826 +1,658 @@ @charset "UTF-8"; .customize-control-kirki-background { - 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; -} -.customize-control-kirki-background .background-attachment .buttonset, -.customize-control-kirki-background .background-size .buttonset { - display: flex; - 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); - border: 1px solid rgba(0, 0, 0, 0.1); - color: #555; - padding: 0.5em 1em; - margin: 0; - text-align: center; - 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; -} + 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; } + .customize-control-kirki-background .background-attachment .buttonset, + .customize-control-kirki-background .background-size .buttonset { + display: flex; + 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); + border: 1px solid rgba(0, 0, 0, 0.1); + color: #555; + padding: 0.5em 1em; + margin: 0; + text-align: center; + 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; } .customize-control-kirki-code textarea { width: 100%; - min-height: 200px; -} + min-height: 200px; } .customize-control-kirki-color-palette { - position: relative; -} -.customize-control-kirki-color-palette label { - position: relative; - display: inline-block; - padding: 0; - margin: 0; -} -.customize-control-kirki-color-palette .colors-wrapper { - max-height: 300px; - overflow-y: auto; - padding: 10px; - display: flex; - 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); -} -.customize-control-kirki-color-palette .colors-wrapper.round label { - padding: 3px; -} -.customize-control-kirki-color-palette .colors-wrapper.round .color-palette-color { - 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); -} -.customize-control-kirki-color-palette .colors-wrapper input:checked + label .color-palette-color { - border: 0; - width: 150%; - height: 150%; - position: relative; - left: -25%; - top: -25%; - z-index: 1; -} -.customize-control-kirki-color-palette .colors-wrapper.with-margin label { - margin: 3px; -} -.customize-control-kirki-color-palette .colors-wrapper input { - 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); -} + position: relative; } + .customize-control-kirki-color-palette label { + position: relative; + display: inline-block; + padding: 0; + margin: 0; } + .customize-control-kirki-color-palette .colors-wrapper { + max-height: 300px; + overflow-y: auto; + padding: 10px; + display: flex; + 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); } + .customize-control-kirki-color-palette .colors-wrapper.round label { + padding: 3px; } + .customize-control-kirki-color-palette .colors-wrapper.round .color-palette-color { + 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); } + .customize-control-kirki-color-palette .colors-wrapper input:checked + label .color-palette-color { + border: 0; + width: 150%; + height: 150%; + position: relative; + left: -25%; + top: -25%; + z-index: 1; } + .customize-control-kirki-color-palette .colors-wrapper.with-margin label { + margin: 3px; } + .customize-control-kirki-color-palette .colors-wrapper input { + 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); } -.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; -} +.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; } .customize-control-kirki-color .iris-picker .iris-square-handle { - z-index: 8; -} + z-index: 8; } .customize-control-kirki-dashicons { - position: relative; -} -.customize-control-kirki-dashicons label { - position: relative; - display: inline-block; -} -.customize-control-kirki-dashicons .icons-wrapper { - max-height: 300px; - overflow-y: scroll; -} -.customize-control-kirki-dashicons .icons-wrapper h4 { - font-weight: 300; - margin: 0.7em 0; -} -.customize-control-kirki-dashicons .icons-wrapper .dashicons { - padding: 3px; - font-size: 25px; - width: 25px; - height: 25px; - border: 1px solid transparent; -} -.customize-control-kirki-dashicons .icons-wrapper input { - display: none; -} -.customize-control-kirki-dashicons .icons-wrapper input:checked + label .dashicons { - border: 1px solid #3498DB; - color: #000; -} + position: relative; } + .customize-control-kirki-dashicons label { + position: relative; + display: inline-block; } + .customize-control-kirki-dashicons .icons-wrapper { + max-height: 300px; + overflow-y: scroll; } + .customize-control-kirki-dashicons .icons-wrapper h4 { + font-weight: 300; + margin: 0.7em 0; } + .customize-control-kirki-dashicons .icons-wrapper .dashicons { + padding: 3px; + font-size: 25px; + width: 25px; + height: 25px; + border: 1px solid transparent; } + .customize-control-kirki-dashicons .icons-wrapper input { + display: none; } + .customize-control-kirki-dashicons .icons-wrapper input:checked + label .dashicons { + border: 1px solid #3498DB; + color: #000; } .wp-customizer div.ui-datepicker { z-index: 500001 !important; width: 255px; background: #fff; - border: 1px solid #dedede; -} -.wp-customizer div.ui-datepicker .ui-datepicker-header { - padding: 10px; - background: #e5e5e5; - 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; -} -.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; -} -.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; -} -.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; -} -.wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-prev { - left: 10px; -} -.wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-prev:before { - content: ""; -} -.wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-next { - right: 10px; -} -.wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-next:after { - content: ""; -} -.wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-title { - text-align: center; -} -.wp-customizer div.ui-datepicker .ui-datepicker-calendar { - border-collapse: collapse; - width: 100%; -} -.wp-customizer div.ui-datepicker .ui-datepicker-calendar thead { - background: #e5e5e5; - padding: 5px; -} -.wp-customizer div.ui-datepicker .ui-datepicker-calendar tr td { - text-align: center; -} -.wp-customizer div.ui-datepicker .ui-datepicker-calendar tr td a { - display: block; - padding: 5px; - color: #333; - 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; -} -.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; -} + border: 1px solid #dedede; } + .wp-customizer div.ui-datepicker .ui-datepicker-header { + padding: 10px; + background: #e5e5e5; + 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; } + .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; } + .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; } + .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; } + .wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-prev { + left: 10px; } + .wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-prev:before { + content: "\f341"; } + .wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-next { + right: 10px; } + .wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-next:after { + content: "\f345"; } + .wp-customizer div.ui-datepicker .ui-datepicker-header .ui-datepicker-title { + text-align: center; } + .wp-customizer div.ui-datepicker .ui-datepicker-calendar { + border-collapse: collapse; + width: 100%; } + .wp-customizer div.ui-datepicker .ui-datepicker-calendar thead { + background: #e5e5e5; + padding: 5px; } + .wp-customizer div.ui-datepicker .ui-datepicker-calendar tr td { + text-align: center; } + .wp-customizer div.ui-datepicker .ui-datepicker-calendar tr td a { + display: block; + padding: 5px; + color: #333; + 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; } + .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; } .customize-control-kirki-dimensions { - position: relative; -} -.customize-control-kirki-dimensions .wrapper { - border: 1px solid rgba(0, 0, 0, 0.1); - padding: 10px; -} -.customize-control-kirki-dimensions .wrapper .control { - display: flex; - flex-wrap: wrap; - justify-content: space-between; -} -.customize-control-kirki-dimensions .wrapper .control > div { - width: 48%; -} -.customize-control-kirki-dimensions .wrapper .control > div h5 { - margin: 10px 0 7px; -} -.customize-control-kirki-dimensions .wrapper .control > div .inner { - display: flex; -} + position: relative; } + .customize-control-kirki-dimensions .wrapper { + border: 1px solid rgba(0, 0, 0, 0.1); + padding: 10px; } + .customize-control-kirki-dimensions .wrapper .control { + display: flex; + flex-wrap: wrap; + justify-content: space-between; } + .customize-control-kirki-dimensions .wrapper .control > div { + width: 48%; } + .customize-control-kirki-dimensions .wrapper .control > div h5 { + margin: 10px 0 7px; } + .customize-control-kirki-dimensions .wrapper .control > div .inner { + 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%; -} -.customize-control-kirki-multicolor .wp-picker-container > .wp-color-result { - width: 100%; -} -.customize-control-kirki-multicolor .wp-picker-container.wp-picker-active + .multicolor-single-label { - display: none; -} + width: 100%; } + .customize-control-kirki-multicolor .wp-picker-container > .wp-color-result { + width: 100%; } + .customize-control-kirki-multicolor .wp-picker-container.wp-picker-active + .multicolor-single-label { + display: none; } .customize-control-kirki-number .customize-control-content { display: flex; - align-items: stretch; -} -.customize-control-kirki-number .customize-control-content input { - width: 100%; - -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; -} -.customize-control-kirki-number .customize-control-content .quantity { - min-width: 2rem; - max-width: 2rem; - text-align: center; - line-height: 24px; -} + align-items: stretch; } + .customize-control-kirki-number .customize-control-content input { + width: 100%; + -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; } + .customize-control-kirki-number .customize-control-content .quantity { + min-width: 2rem; + max-width: 2rem; + text-align: center; + 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); -} -.customize-control-kirki-palette label { - background: none; - padding: 0; - border-top: 3px solid transparent; - border-bottom: 3px solid transparent; - margin-bottom: 5px; - display: flex; -} -.customize-control-kirki-palette label span { - padding: 10px 0; - flex-grow: 1; - font-size: 0; - line-height: 10px; - color: rgba(0, 0, 0, 0); - -webkit-transition: all 200ms ease-in-out; - -moz-transition: all 200ms ease-in-out; - -ms-transition: all 200ms ease-in-out; - -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); -} -.customize-control-kirki-palette label span:first-child { - 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); -} -.customize-control-kirki-palette label span:hover { - padding: 10px; - flex-grow: 3; - min-width: 60px; - font-size: 10px; - line-height: 10px; - color: #000; -} + 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; } + .customize-control-kirki-palette label span { + padding: 10px 0; + flex-grow: 1; + font-size: 0; + line-height: 10px; + color: rgba(0, 0, 0, 0); + -webkit-transition: all 200ms ease-in-out; + -moz-transition: all 200ms ease-in-out; + -ms-transition: all 200ms ease-in-out; + -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); } + .customize-control-kirki-palette label span:first-child { + 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); } + .customize-control-kirki-palette label span:hover { + padding: 10px; + flex-grow: 3; + min-width: 60px; + font-size: 10px; + line-height: 10px; + color: #000; } .customize-control-kirki-radio-buttonset .buttonset { display: flex; - 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); - color: #555d66; - margin: 0; - text-align: center; - padding: 0.5em 1em; - flex-grow: 1; -} -.customize-control-kirki-radio-buttonset .buttonset .switch-input:checked + .switch-label { - background-color: #00a0d2; - color: rgba(255, 255, 255, 0.8); -} + 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); + color: #555d66; + margin: 0; + text-align: center; + padding: 0.5em 1em; + flex-grow: 1; } + .customize-control-kirki-radio-buttonset .buttonset .switch-input:checked + .switch-label { + background-color: #00a0d2; + 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; -} -.customize-control-kirki-radio-image label .image-label { - display: none; - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - background: rgba(255, 255, 255, 0.7); - 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; -} -.customize-control-kirki-radio-image label:hover .image-label { - display: block; -} + display: inline-block; } + .customize-control-kirki-radio-image label .image-label { + display: none; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(255, 255, 255, 0.7); + 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; } + .customize-control-kirki-radio-image label:hover .image-label { + display: block; } .customize-control-kirki-radio-image input { - display: none; -} -.customize-control-kirki-radio-image input img { - 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; -} -.customize-control-kirki-radio-image input + label .image-clickable { - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - width: 100%; - height: 100%; -} + display: none; } + .customize-control-kirki-radio-image input img { + 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; } + .customize-control-kirki-radio-image input + label .image-clickable { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + width: 100%; + height: 100%; } .customize-control-kirki-radio { - position: relative; -} -.customize-control-kirki-radio input[type=radio] { - width: 18px; - height: 18px; -} -.customize-control-kirki-radio input[type=radio]:checked:before { - width: 10px; - height: 10px; - margin: 3px; -} -.customize-control-kirki-radio label { - display: list-item; - 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; -} + position: relative; } + .customize-control-kirki-radio input[type=radio] { + width: 18px; + height: 18px; } + .customize-control-kirki-radio input[type=radio]:checked:before { + width: 10px; + height: 10px; + margin: 3px; } + .customize-control-kirki-radio label { + display: list-item; + 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; } .customize-control-repeater { - position: relative; -} -.customize-control-repeater .repeater-fields .repeater-row { - border: 1px solid #e5e5e5; - margin-top: 0.5rem; - background: #eee; - position: relative; -} -.customize-control-repeater .repeater-fields .repeater-row.minimized { - border: 1px solid #dfdfdf; - padding: 0; -} -.customize-control-repeater .repeater-fields .repeater-row.minimized:hover { - border: 1px solid #e5e5e5; -} -.customize-control-repeater .repeater-fields .repeater-row.minimized .repeater-row-content { - display: none; -} -.customize-control-repeater .repeater-fields .repeater-row label { - margin-bottom: 12px; - clear: both; -} -.customize-control-repeater .repeater-fields .repeater-row .repeater-field.repeater-field- { - display: none; -} -.customize-control-repeater .repeater-fields .repeater-row .repeater-field.repeater-field-radio-image input { - display: none; -} -.customize-control-repeater .repeater-fields .repeater-row .repeater-field.repeater-field-radio-image input img { - 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; -} -.customize-control-repeater .repeater-fields .repeater-row .repeater-field:last-child { - border-bottom: none; - padding-bottom: 0; -} -.customize-control-repeater button.repeater-add { - margin-top: 1rem; -} -.customize-control-repeater .repeater-row-content { - padding: 10px 15px; - background: #fff; -} -.customize-control-repeater .repeater-field { - margin-bottom: 12px; - width: 100%; - clear: both; - padding-bottom: 12px; - border-bottom: 1px dotted #CCC; -} -.customize-control-repeater .repeater-field .customize-control-title { - font-size: 13px; - line-height: initial; -} -.customize-control-repeater .repeater-field .customize-control-description { - font-size: 13px; - line-height: initial; -} -.customize-control-repeater .repeater-field.repeater-field-hidden { - margin: 0; - padding: 0; - border: 0; -} -.customize-control-repeater .repeater-field-select select { - margin-left: 0; -} -.customize-control-repeater .repeater-field-checkbox label { - line-height: 28px; -} -.customize-control-repeater .repeater-field-checkbox input { - line-height: 28px; - margin-right: 5px; -} -.customize-control-repeater .repeater-field-textarea textarea { - width: 100%; - resize: vertical; -} -.customize-control-repeater .repeater-row-header { - background: white; - border-bottom: 1px solid #dfdfdf; - position: relative; - padding: 10px 15px; - height: auto; - min-height: 20px; - line-height: 30px; - overflow: hidden; - word-wrap: break-word; -} -.customize-control-repeater .repeater-row-header:hover { - cursor: move; -} -.customize-control-repeater .repeater-row-header .dashicons { - font-size: 18px; - position: absolute; - right: 12px; - top: 2px; - color: #a0a5aa; -} -.customize-control-repeater .repeater-row-label { - font-size: 13px; - font-weight: 600; - line-height: 20px; - display: block; - width: 90%; - overflow: hidden; - height: 18px; -} -.customize-control-repeater .repeater-row-remove { - color: #a00; -} -.customize-control-repeater .repeater-row-remove:hover { - color: #f00; -} -.customize-control-repeater .repeater-minimize { - line-height: 36px; -} -.customize-control-repeater .remove-button, -.customize-control-repeater .upload-button { - width: 48%; -} + position: relative; } + .customize-control-repeater .repeater-fields .repeater-row { + border: 1px solid #e5e5e5; + margin-top: 0.5rem; + background: #eee; + position: relative; } + .customize-control-repeater .repeater-fields .repeater-row.minimized { + border: 1px solid #dfdfdf; + padding: 0; } + .customize-control-repeater .repeater-fields .repeater-row.minimized:hover { + border: 1px solid #e5e5e5; } + .customize-control-repeater .repeater-fields .repeater-row.minimized .repeater-row-content { + display: none; } + .customize-control-repeater .repeater-fields .repeater-row label { + margin-bottom: 12px; + clear: both; } + .customize-control-repeater .repeater-fields .repeater-row .repeater-field.repeater-field- { + display: none; } + .customize-control-repeater .repeater-fields .repeater-row .repeater-field.repeater-field-radio-image input { + display: none; } + .customize-control-repeater .repeater-fields .repeater-row .repeater-field.repeater-field-radio-image input img { + 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; } + .customize-control-repeater .repeater-fields .repeater-row .repeater-field:last-child { + border-bottom: none; + padding-bottom: 0; } + .customize-control-repeater button.repeater-add { + margin-top: 1rem; } + .customize-control-repeater .repeater-row-content { + padding: 10px 15px; + background: #fff; } + .customize-control-repeater .repeater-field { + margin-bottom: 12px; + width: 100%; + clear: both; + padding-bottom: 12px; + border-bottom: 1px dotted #CCC; } + .customize-control-repeater .repeater-field .customize-control-title { + font-size: 13px; + line-height: initial; } + .customize-control-repeater .repeater-field .customize-control-description { + font-size: 13px; + line-height: initial; } + .customize-control-repeater .repeater-field.repeater-field-hidden { + margin: 0; + padding: 0; + border: 0; } + .customize-control-repeater .repeater-field-select select { + margin-left: 0; } + .customize-control-repeater .repeater-field-checkbox label { + line-height: 28px; } + .customize-control-repeater .repeater-field-checkbox input { + line-height: 28px; + margin-right: 5px; } + .customize-control-repeater .repeater-field-textarea textarea { + width: 100%; + resize: vertical; } + .customize-control-repeater .repeater-row-header { + background: white; + border-bottom: 1px solid #dfdfdf; + position: relative; + padding: 10px 15px; + height: auto; + min-height: 20px; + line-height: 30px; + overflow: hidden; + word-wrap: break-word; } + .customize-control-repeater .repeater-row-header:hover { + cursor: move; } + .customize-control-repeater .repeater-row-header .dashicons { + font-size: 18px; + position: absolute; + right: 12px; + top: 2px; + color: #a0a5aa; } + .customize-control-repeater .repeater-row-label { + font-size: 13px; + font-weight: 600; + line-height: 20px; + display: block; + width: 90%; + overflow: hidden; + height: 18px; } + .customize-control-repeater .repeater-row-remove { + color: #a00; } + .customize-control-repeater .repeater-row-remove:hover { + color: #f00; } + .customize-control-repeater .repeater-minimize { + line-height: 36px; } + .customize-control-repeater .remove-button, + .customize-control-repeater .upload-button { + width: 48%; } .kirki-image-attachment { margin: 0; text-align: center; - margin-bottom: 10px; -} -.kirki-image-attachment img { - display: inline-block; -} + margin-bottom: 10px; } + .kirki-image-attachment img { + display: inline-block; } .kirki-file-attachment { margin: 0; text-align: center; - margin-bottom: 10px; -} -.kirki-file-attachment .file { - display: block; - padding: 10px 5px; - border: 1px dotted #c3c3c3; - background: #f9f9f9; -} + margin-bottom: 10px; } + .kirki-file-attachment .file { + display: block; + padding: 10px 5px; + border: 1px dotted #c3c3c3; + background: #f9f9f9; } .limit { padding: 3px; - border-radius: 3px; -} -.limit.highlight { - background: #D32F2F; - color: #fff; -} + border-radius: 3px; } + .limit.highlight { + background: #D32F2F; + color: #fff; } .customize-control-kirki-slider .wrapper { display: flex; align-items: center; padding: 15px 0 7px; - 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); -} -.customize-control-kirki-slider .wrapper .slider-reset:hover { - transform: scale(1.3); - color: #DC3232; -} -.customize-control-kirki-slider .wrapper input[type=range] { - display: block; - -webkit-appearance: none; - background-color: #bdc3c7; - width: 100%; - height: 5px; - border-radius: 5px; - margin: 0 auto; - outline: 0; -} -.customize-control-kirki-slider .wrapper input[type=range]::-webkit-slider-thumb { - -webkit-appearance: none; - background-color: #0085ba; - width: 17px; - height: 17px; - 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 { - 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] { - font-size: 13px; - background: transparent; - border: none; - box-shadow: none; - text-align: right; - padding: 0; - width: 40px; -} -.customize-control-kirki-slider .wrapper .value { - display: flex; - align-items: baseline; -} + 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); } + .customize-control-kirki-slider .wrapper .slider-reset:hover { + transform: scale(1.3); + color: #DC3232; } + .customize-control-kirki-slider .wrapper input[type="range"] { + display: block; + -webkit-appearance: none; + background-color: #bdc3c7; + width: 100%; + height: 5px; + border-radius: 5px; + margin: 0 auto; + outline: 0; } + .customize-control-kirki-slider .wrapper input[type="range"]::-webkit-slider-thumb { + -webkit-appearance: none; + background-color: #0085ba; + width: 17px; + height: 17px; + 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 { + 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"] { + font-size: 13px; + background: transparent; + border: none; + box-shadow: none; + text-align: right; + padding: 0; + width: 40px; } + .customize-control-kirki-slider .wrapper .value { + display: flex; + align-items: baseline; } .customize-control-kirki-sortable ul.ui-sortable li { padding: 5px 10px; border: 1px solid #333; - background: #fff; -} -.customize-control-kirki-sortable ul.ui-sortable li .dashicons.dashicons-menu { - float: right; -} -.customize-control-kirki-sortable ul.ui-sortable li .dashicons.visibility { - margin-right: 10px; -} -.customize-control-kirki-sortable ul.ui-sortable li.invisible { - color: #aaa; - border: 1px dashed #aaa; -} -.customize-control-kirki-sortable ul.ui-sortable li.invisible .dashicons.visibility { - color: #aaa; -} + background: #fff; } + .customize-control-kirki-sortable ul.ui-sortable li .dashicons.dashicons-menu { + float: right; } + .customize-control-kirki-sortable ul.ui-sortable li .dashicons.visibility { + margin-right: 10px; } + .customize-control-kirki-sortable ul.ui-sortable li.invisible { + color: #aaa; + border: 1px dashed #aaa; } + .customize-control-kirki-sortable ul.ui-sortable li.invisible .dashicons.visibility { + color: #aaa; } .customize-control-kirki-switch { - position: relative; -} -.customize-control-kirki-switch .switch-off, -.customize-control-kirki-switch .switch-on { - opacity: 1; - padding: 8px; - font-size: 14px; - line-height: 18px; -} -.customize-control-kirki-switch .switch-on { - color: #fff; - opacity: 0; -} -.customize-control-kirki-switch .switch-off { - color: #777; -} -.customize-control-kirki-switch .switch { - border: none; - margin-bottom: 1.5rem; - outline: 0; - padding: 0; - user-select: none; - border-radius: 3rem; -} -.customize-control-kirki-switch label { - background: #b4b9be; - float: left; - cursor: pointer; - display: flex; - justify-content: space-between; - margin-bottom: 1rem; - position: relative; - transition: left 0.15s ease-out; - border-radius: 3rem; -} -.customize-control-kirki-switch label:after { - background: #FFFFFF; - content: ""; - display: block; - position: absolute; - left: 5px; - top: 5px; - width: calc(.85rem + 10px); - height: calc(.85rem + 10px); - transition: all 0.25s ease-in-out; - border-radius: 3rem; -} -.customize-control-kirki-switch input + label { - margin-left: 0; - margin-right: 0; -} -.customize-control-kirki-switch input:checked + label { - background: #0073aa; -} -.customize-control-kirki-switch input:checked + label:after { - left: auto; - right: 5px; - background: #ffffff; -} -.customize-control-kirki-switch input:checked + label .switch-on { - opacity: 1; -} -.customize-control-kirki-switch input:checked + label .switch-off { - opacity: 0; -} + position: relative; } + .customize-control-kirki-switch .switch-off, + .customize-control-kirki-switch .switch-on { + opacity: 1; + padding: 8px; + font-size: 14px; + line-height: 18px; } + .customize-control-kirki-switch .switch-on { + color: #fff; + opacity: 0; } + .customize-control-kirki-switch .switch-off { + color: #777; } + .customize-control-kirki-switch .switch { + border: none; + margin-bottom: 1.5rem; + outline: 0; + padding: 0; + user-select: none; + border-radius: 3rem; } + .customize-control-kirki-switch label { + background: #b4b9be; + float: left; + cursor: pointer; + display: flex; + justify-content: space-between; + margin-bottom: 1rem; + position: relative; + transition: left 0.15s ease-out; + border-radius: 3rem; } + .customize-control-kirki-switch label:after { + background: #FFFFFF; + content: ""; + display: block; + position: absolute; + left: 5px; + top: 5px; + width: calc(.85rem + 10px); + height: calc(.85rem + 10px); + transition: all 0.25s ease-in-out; + border-radius: 3rem; } + .customize-control-kirki-switch input + label { + margin-left: 0; + margin-right: 0; } + .customize-control-kirki-switch input:checked + label { + background: #0073aa; } + .customize-control-kirki-switch input:checked + label:after { + left: auto; + right: 5px; + background: #ffffff; } + .customize-control-kirki-switch input:checked + label .switch-on { + opacity: 1; } + .customize-control-kirki-switch input:checked + label .switch-off { + opacity: 0; } .customize-control-kirki-toggle { - position: relative; -} -.customize-control-kirki-toggle label { - display: flex; - flex-wrap: wrap; -} -.customize-control-kirki-toggle label .customize-control-title { - width: calc(100% - 55px); -} -.customize-control-kirki-toggle label .description { - order: 99; -} -.customize-control-kirki-toggle .switch { - border: 1px solid #b4b9be; - display: inline-block; - width: 35px; - height: 12px; - border-radius: 8px; - background: #b4b9be; - vertical-align: middle; - position: relative; - top: 4px; - cursor: pointer; - user-select: none; - transition: background 350ms ease; -} -.customize-control-kirki-toggle .switch:after, .customize-control-kirki-toggle .switch:before { - content: ""; - display: block; - width: 20px; - height: 20px; - border-radius: 50%; - position: absolute; - top: 50%; - left: -3px; - 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); -} -.customize-control-kirki-toggle .switch:after { - background: #999; - border: 1px solid rgba(0, 0, 0, 0.1); - transform: translate3d(0, -50%, 0); -} -.customize-control-kirki-toggle .switch:active:before { - 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); -} -.customize-control-kirki-toggle input:checked + .switch:after { - background: #0073aa; - 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); -} + position: relative; } + .customize-control-kirki-toggle label { + display: flex; + flex-wrap: wrap; } + .customize-control-kirki-toggle label .customize-control-title { + width: calc(100% - 55px); } + .customize-control-kirki-toggle label .description { + order: 99; } + .customize-control-kirki-toggle .switch { + border: 1px solid #b4b9be; + display: inline-block; + width: 35px; + height: 12px; + border-radius: 8px; + background: #b4b9be; + vertical-align: middle; + position: relative; + top: 4px; + cursor: pointer; + user-select: none; + transition: background 350ms ease; } + .customize-control-kirki-toggle .switch:after, .customize-control-kirki-toggle .switch:before { + content: ""; + display: block; + width: 20px; + height: 20px; + border-radius: 50%; + position: absolute; + top: 50%; + left: -3px; + 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); } + .customize-control-kirki-toggle .switch:after { + background: #999; + border: 1px solid rgba(0, 0, 0, 0.1); + transform: translate3d(0, -50%, 0); } + .customize-control-kirki-toggle .switch:active:before { + 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); } + .customize-control-kirki-toggle input:checked + .switch:after { + background: #0073aa; + 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); } .customize-control-kirki-typography { - 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); -} -.customize-control-kirki-typography .wrapper h5 { - 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, -.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-align, -.customize-control-kirki-typography .wrapper .text-transform, -.customize-control-kirki-typography .wrapper .variant { - width: 100%; - float: none; - 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%; -} -.customize-control-kirki-typography .wrapper .text-align .text-align-choices { - 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); -} -.customize-control-kirki-typography .wrapper .text-align .text-align-choices input { - display: none; -} -.customize-control-kirki-typography .wrapper .text-align .text-align-choices input:checked + label { - border-color: #0085ba; -} -.customize-control-kirki-typography .wrapper .color { - width: auto; -} + 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); } + .customize-control-kirki-typography .wrapper h5 { + 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, + .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-align, + .customize-control-kirki-typography .wrapper .text-transform, + .customize-control-kirki-typography .wrapper .variant { + width: 100%; + float: none; + 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%; } + .customize-control-kirki-typography .wrapper .text-align .text-align-choices { + 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); } + .customize-control-kirki-typography .wrapper .text-align .text-align-choices input { + display: none; } + .customize-control-kirki-typography .wrapper .text-align .text-align-choices input:checked + label { + border-color: #0085ba; } + .customize-control-kirki-typography .wrapper .color { + width: auto; } /*# sourceMappingURL=styles.css.map */ diff --git a/functions/kirki/controls/js/script.js b/functions/kirki/controls/js/script.js index b8c3a11..0dff05d 100644 --- a/functions/kirki/controls/js/script.js +++ b/functions/kirki/controls/js/script.js @@ -830,7 +830,13 @@ kirki = jQuery.extend( kirki, { } ); element.on( 'change keyup paste click', function() { - kirki.setting.set( control.id, jQuery( this ).val() ); + var val = jQuery( this ).val(); + if ( isNaN( val ) ) { + val = parseFloat( val, 10 ); + val = ( isNaN( val ) ) ? 0 : val; + jQuery( this ).attr( 'value', val ); + } + kirki.setting.set( control.id, val ); } ); } @@ -899,7 +905,7 @@ kirki = jQuery.extend( kirki, { previewImage = jsonImg.url; if ( ! _.isUndefined( jsonImg.sizes ) ) { - previewImg = jsonImg.sizes.full.url; + previewImage = jsonImg.sizes.full.url; if ( ! _.isUndefined( jsonImg.sizes.medium ) ) { previewImage = jsonImg.sizes.medium.url; } else if ( ! _.isUndefined( jsonImg.sizes.thumbnail ) ) { @@ -3170,7 +3176,6 @@ wp.customize.controlConstructor['kirki-typography'] = wp.customize.kirkiDynamicC control.renderFontSelector(); control.renderBackupFontSelector(); control.renderVariantSelector(); - control.localFontsCheckbox(); // Font-size. if ( 'undefined' !== typeof control.params.default['font-size'] ) { @@ -3568,22 +3573,6 @@ wp.customize.controlConstructor['kirki-typography'] = wp.customize.kirkiDynamicC }; }, - localFontsCheckbox: function() { - var control = this, - checkboxContainer = control.container.find( '.kirki-host-font-locally' ), - checkbox = control.container.find( '.kirki-host-font-locally input' ), - checked = jQuery( checkbox ).is( ':checked' ); - - if ( control.setting._value && control.setting._value.downloadFont ) { - jQuery( checkbox ).attr( 'checked', 'checked' ); - } - - jQuery( checkbox ).on( 'change', function() { - checked = jQuery( checkbox ).is( ':checked' ); - control.saveValue( 'downloadFont', checked ); - } ); - }, - /** * Saves the value. */ diff --git a/functions/kirki/controls/js/script.min.js b/functions/kirki/controls/js/script.min.js index 56c9b80..e6ad642 100644 --- a/functions/kirki/controls/js/script.min.js +++ b/functions/kirki/controls/js/script.min.js @@ -1 +1 @@ -if(_.isUndefined(window.kirkiSetSettingValue))var kirkiSetSettingValue={set:function(i,n){var e,a=this,t=wp.customize.settings.controls[i];if(_.isUndefined(t))return!0;switch(a.setValue(i,n),t.type){case"kirki-background":_.isUndefined(n["background-color"])||a.setColorPicker(a.findElement(i,".kirki-color-control"),n["background-color"]),a.findElement(i,".placeholder, .thumbnail").removeClass().addClass("placeholder").html("No file selected"),_.each(["background-repeat","background-position"],function(e){_.isUndefined(n[e])||a.setSelectWoo(a.findElement(i,"."+e+" select"),n[e])}),_.each(["background-size","background-attachment"],function(e){jQuery(a.findElement(i,"."+e+' input[value="'+n+'"]')).prop("checked",!0)}),e=JSON.stringify(n).replace(/'/g,"'"),jQuery(a.findElement(i,".background-hidden-value").attr("value",e)).trigger("change");break;case"kirki-code":jQuery(a.findElement(i,".CodeMirror"))[0].CodeMirror.setValue(n);break;case"checkbox":case"kirki-switch":case"kirki-toggle":n=1===n||"1"===n||!0===n,jQuery(a.findElement(i,"input")).prop("checked",n),wp.customize.instance(i).set(n);break;case"kirki-select":case"kirki-fontawesome":a.setSelectWoo(a.findElement(i,"select"),n);break;case"kirki-slider":jQuery(a.findElement(i,"input")).prop("value",n),jQuery(a.findElement(i,".kirki_range_value .value")).html(n);break;case"kirki-generic":(_.isUndefined(t.choices)||_.isUndefined(t.choices.element))&&(t.choices.element="input"),jQuery(a.findElement(i,t.choices.element)).prop("value",n);break;case"kirki-color":a.setColorPicker(a.findElement(i,".kirki-color-control"),n);break;case"kirki-multicheck":a.findElement(i,"input").each(function(){jQuery(this).prop("checked",!1)}),_.each(n,function(e,t){jQuery(a.findElement(i,'input[value="'+n[t]+'"]')).prop("checked",!0)});break;case"kirki-multicolor":_.each(n,function(e,t){a.setColorPicker(a.findElement(i,".multicolor-index-"+t),e)});break;case"kirki-radio-buttonset":case"kirki-radio-image":case"kirki-radio":case"kirki-dashicons":case"kirki-color-palette":case"kirki-palette":jQuery(a.findElement(i,'input[value="'+n+'"]')).prop("checked",!0);break;case"kirki-typography":_.each(["font-family","variant"],function(e){_.isUndefined(n[e])||a.setSelectWoo(a.findElement(i,"."+e+" select"),n[e])}),_.each(["font-size","line-height","letter-spacing","word-spacing"],function(e){_.isUndefined(n[e])||jQuery(a.findElement(i,"."+e+" input")).prop("value",n[e])}),_.isUndefined(n.color)||a.setColorPicker(a.findElement(i,".kirki-color-control"),n.color),e=JSON.stringify(n).replace(/'/g,"'"),jQuery(a.findElement(i,".typography-hidden-value").attr("value",e)).trigger("change");break;case"kirki-dimensions":_.each(n,function(e,t){jQuery(a.findElement(i,"."+t+" input")).prop("value",e)});break;case"kirki-repeater":case"kirki-custom":break;default:jQuery(a.findElement(i,"input")).prop("value",n)}},setColorPicker:function(e,t){e.attr("data-default-color",t).data("default-color",t).wpColorPicker("color",t)},setSelectWoo:function(e,t){jQuery(e).selectWoo().val(t).trigger("change")},setTextarea:function(e,t){jQuery(e).prop("value",t)},findElement:function(e,t){return wp.customize.control(e).container.find(t)},setValue:function(e,t,i){i=_.isUndefined(i)?100:parseInt(i,10),wp.customize.instance(e).set({}),setTimeout(function(){wp.customize.instance(e).set(t)},i)}};(kirki={initialized:!1,initialize:function(){this.initialized||(setTimeout(function(){kirki.util.webfonts.standard.initialize(),kirki.util.webfonts.google.initialize()},150),this.initialized=!0)}}).initialize();var kirki=kirki||{};kirki=(kirki=jQuery.extend(kirki,{control:{"kirki-radio":{init:function(e){this.template(e),kirki.input.radio.init(e)},template:function(e){var t=wp.template("kirki-input-radio");e.container.html(t({label:e.params.label,description:e.params.description,"data-id":e.id,inputAttrs:e.params.inputAttrs,default:e.params.default,value:kirki.setting.get(e.id),choices:e.params.choices}))}},"kirki-color":{init:function(e){this.template(e),kirki.input.color.init(e)},template:function(e){var t=wp.template("kirki-input-color");e.container.html(t({label:e.params.label,description:e.params.description,"data-id":e.id,mode:e.params.mode,inputAttrs:e.params.inputAttrs,"data-palette":e.params.palette,"data-default-color":e.params.default,"data-alpha":e.params.choices.alpha,value:kirki.setting.get(e.id)}))}},"kirki-generic":{init:function(e){this.template(e),_.isUndefined(e.params)||_.isUndefined(e.params.choices)||_.isUndefined(e.params.choices.element)||"textarea"!==e.params.choices.element?kirki.input.genericInput.init(e):kirki.input.textarea.init(e)},template:function(e){var t,i={label:e.params.label,description:e.params.description,"data-id":e.id,inputAttrs:e.params.inputAttrs,choices:e.params.choices,value:kirki.setting.get(e.id)};if(!_.isUndefined(e.params)&&!_.isUndefined(e.params.choices)&&!_.isUndefined(e.params.choices.element)&&"textarea"===e.params.choices.element)return t=wp.template("kirki-input-textarea"),void e.container.html(t(i));t=wp.template("kirki-input-generic"),e.container.html(t(i))}},"kirki-number":{init:function(e){this.template(e),kirki.input.number.init(e)},template:function(e){var t=wp.template("kirki-input-number");e.container.html(t(args={label:e.params.label,description:e.params.description,"data-id":e.id,inputAttrs:e.params.inputAttrs,choices:e.params.choices,value:kirki.setting.get(e.id)}))}},"kirki-image":{init:function(e){this.template(e),kirki.input.image.init(e)},template:function(e){var t=wp.template("kirki-input-image");e.container.html(t(args={label:e.params.label,description:e.params.description,"data-id":e.id,inputAttrs:e.params.inputAttrs,choices:e.params.choices,value:kirki.setting.get(e.id)}))}},"kirki-select":{init:function(e){this.template(e),kirki.input.select.init(e)},template:function(e){var t=wp.template("kirki-input-select");e.container.html(t({label:e.params.label,description:e.params.description,"data-id":e.id,inputAttrs:e.params.inputAttrs,choices:e.params.choices,value:kirki.setting.get(e.id),multiple:e.params.multiple||1,placeholder:e.params.placeholder}))}}}}))||{},kirki=(kirki=jQuery.extend(kirki,{input:{radio:{init:function(e){jQuery('input[data-id="'+e.id+'"]').on("change keyup paste click",function(){kirki.setting.set(e.id,jQuery(this).val())})}},color:{init:function(e){var t,i=jQuery('.kirki-color-control[data-id="'+e.id+'"]');e.choices=e.choices||{},_.isEmpty(e.choices)&&e.params.choices&&(e.choices=e.params.choices),_.isEmpty(e.choices)||i.wpColorPicker(e.choices),setTimeout(function(){(t=jQuery('.kirki-input-container[data-id="'+e.id+'"] .wp-picker-clear')).length&&t.click(function(){kirki.setting.set(e.id,"")})},200),i.wpColorPicker({change:function(){setTimeout(function(){kirki.setting.set(e.id,i.val())},20)}})}},genericInput:{init:function(e){jQuery('input[data-id="'+e.id+'"]').on("change keyup paste click",function(){kirki.setting.set(e.id,jQuery(this).val())})}},textarea:{init:function(e){jQuery('textarea[data-id="'+e.id+'"]').on("change keyup paste click",function(){kirki.setting.set(e.id,jQuery(this).val())})}},select:{init:function(e){var t,i=jQuery('select[data-id="'+e.id+'"]'),n=parseInt(i.data("multiple"),10),a={escapeMarkup:function(e){return e}};e.params.placeholder&&(a.placeholder=e.params.placeholder,a.allowClear=!0),1=i.params.choices.max?t:t+i.params.choices.step,n.val(e),n.trigger("change")}),t.click(function(){var e,t=parseFloat(n.val());e=t<=i.params.choices.min?t:t-i.params.choices.step,n.val(e),n.trigger("change")}),n.on("change keyup paste click",function(){kirki.setting.set(i.id,jQuery(this).val())})}},image:{init:function(a){var t=kirki.setting.get(a.id),n=_.isUndefined(a.params.choices)||_.isUndefined(a.params.choices.save_as)?"url":a.params.choices.save_as,r=a.container.find(".placeholder, .thumbnail"),e="array"===n?t.url:t,o=a.container.find(".image-upload-remove-button"),s=a.container.find(".image-default-button");t="array"===n&&_.isString(t)?{url:t}:t,"id"!==n&&"ID"!==n||""===t||wp.media.attachment(t).fetch().then(function(){setTimeout(function(){var e=wp.media.attachment(t).get("url");r.removeClass().addClass("thumbnail thumbnail-image").html('')},700)}),("url"===n&&""!==t||"array"===n&&!_.isUndefined(t.url)&&""!==t.url)&&a.container.find("image-default-button").hide(),("url"===n&&""===t||"array"===n&&(_.isUndefined(t.url)||""===t.url))&&o.hide(),t===a.params.default&&a.container.find("image-default-button").hide(),""!==e&&r.removeClass().addClass("thumbnail thumbnail-image").html(''),a.container.on("click",".image-upload-button",function(e){var i=wp.media({multiple:!1}).open().on("select",function(){var e=i.state().get("selection").first().toJSON(),t=e.url;_.isUndefined(e.sizes)||(previewImg=e.sizes.full.url,_.isUndefined(e.sizes.medium)?_.isUndefined(e.sizes.thumbnail)||(t=e.sizes.thumbnail.url):t=e.sizes.medium.url),"array"===n?kirki.setting.set(a.id,{id:e.id,url:e.sizes.full.url,width:e.width,height:e.height}):"id"===n?kirki.setting.set(a.id,e.id):kirki.setting.set(a.id,_.isUndefined(e.sizes)?e.url:e.sizes.full.url),r.length&&r.removeClass().addClass("thumbnail thumbnail-image").html(''),o.length&&(o.show(),s.hide())});e.preventDefault()}),a.container.on("click",".image-upload-remove-button",function(e){var t,i,n;e.preventDefault(),kirki.setting.set(a.id,""),t=a.container.find(".placeholder, .thumbnail"),i=a.container.find(".image-upload-remove-button"),n=a.container.find(".image-default-button"),t.length&&t.removeClass().addClass("placeholder").html(kirkiL10n.noFileSelected),i.length&&(i.hide(),jQuery(n).hasClass("button")&&n.show())}),a.container.on("click",".image-default-button",function(e){var t,i,n;e.preventDefault(),kirki.setting.set(a.id,a.params.default),t=a.container.find(".placeholder, .thumbnail"),i=a.container.find(".image-upload-remove-button"),n=a.container.find(".image-default-button"),t.length&&t.removeClass().addClass("thumbnail thumbnail-image").html(''),i.length&&(i.show(),n.hide())})}}}}))||{},kirki=(kirki=jQuery.extend(kirki,{setting:{get:function(e){var t=e.split("["),i="",n=0,a="";return _.each(t,function(e,t){e=e.replace("]",""),0===t?i=e:i+="["+e+"]",_.isUndefined(wp.customize.instance(i))||(a=wp.customize.instance(i).get(),n=t),n"+e,"text/html").body.textContent}}}),function(){"use strict";wp.customize.kirkiDynamicControl=wp.customize.Control.extend({initialize:function(e,t){var i=t||{};i.params=i.params||{},i.params.type||(i.params.type="kirki-generic"),i.params.content||(i.params.content=jQuery(""),i.params.content.attr("id","customize-control-"+e.replace(/]/g,"").replace(/\[/g,"-")),i.params.content.attr("class","customize-control customize-control-"+i.params.type)),this.propertyElements=[],wp.customize.Control.prototype.initialize.call(this,e,i)},_setUpSettingRootLinks:function(){var n=this;n.container.find("[data-customize-setting-link]").each(function(){var i=jQuery(this);wp.customize(i.data("customizeSettingLink"),function(e){var t=new wp.customize.Element(i);n.elements.push(t),t.sync(e),t.set(e())})})},_setUpSettingPropertyLinks:function(){var n=this;n.setting&&n.container.find("[data-customize-setting-property-link]").each(function(){var t,e=jQuery(this),i=e.data("customizeSettingPropertyLink");t=new wp.customize.Element(e),n.propertyElements.push(t),t.set(n.setting()[i]),t.bind(function(e){var t=n.setting();e!==t[i]&&((t=_.clone(t))[i]=e,n.setting.set(t))}),n.setting.bind(function(e){e[i]!==t.get()&&t.set(e[i])})})},ready:function(){var e=this;e._setUpSettingRootLinks(),e._setUpSettingPropertyLinks(),wp.customize.Control.prototype.ready.call(e),e.deferred.embedded.done(function(){e.initKirkiControl(e)})},embed:function(){var t=this,e=t.section();e&&wp.customize.section(e,function(e){"kirki-expanded"===e.params.type||e.expanded()||wp.customize.settings.autofocus.control===t.id?t.actuallyEmbed():e.expanded.bind(function(e){e&&t.actuallyEmbed()})})},actuallyEmbed:function(){"resolved"!==this.deferred.embedded.state()&&(this.renderContent(),this.deferred.embedded.resolve())},focus:function(e){this.actuallyEmbed(),wp.customize.Control.prototype.focus.call(this,e)},initKirkiControl:function(e){void 0===kirki.control[e.params.type]?this.container.on("change keyup paste click","input",function(){e.setting.set(jQuery(this).val())}):kirki.control[e.params.type].init(e)}})}(),_.each(kirki.control,function(e,t){wp.customize.controlConstructor[t]=wp.customize.kirkiDynamicControl.extend({})}),wp.customize.controlConstructor["kirki-background"]=wp.customize.Control.extend({ready:function(){"use strict";!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(this):this.initKirkiControl()},initKirkiControl:function(){var o=this,e=o.setting._value,t=o.container.find(".kirki-color-control");(_.isUndefined(e["background-image"])||""===e["background-image"])&&(o.container.find(".background-wrapper > .background-repeat").hide(),o.container.find(".background-wrapper > .background-position").hide(),o.container.find(".background-wrapper > .background-size").hide(),o.container.find(".background-wrapper > .background-attachment").hide()),t.wpColorPicker({change:function(){setTimeout(function(){o.saveValue("background-color",t.val())},100)}}),o.container.on("change",".background-repeat select",function(){o.saveValue("background-repeat",jQuery(this).val())}),o.container.on("change click",".background-size input",function(){o.saveValue("background-size",jQuery(this).val())}),o.container.on("change",".background-position select",function(){o.saveValue("background-position",jQuery(this).val())}),o.container.on("change click",".background-attachment input",function(){o.saveValue("background-attachment",jQuery(this).val())}),o.container.on("click",".background-image-upload-button",function(e){var r=wp.media({multiple:!1}).open().on("select",function(){var e,t,i,n=r.state().get("selection").first(),a=n.toJSON().sizes.full.url;_.isUndefined(n.toJSON().sizes.medium)?_.isUndefined(n.toJSON().sizes.thumbnail)||(a=n.toJSON().sizes.thumbnail.url):a=n.toJSON().sizes.medium.url,e=n.toJSON().sizes.full.url,n.toJSON().id,n.toJSON().width,n.toJSON().height,""!==e&&o.container.find(".background-wrapper > .background-repeat, .background-wrapper > .background-position, .background-wrapper > .background-size, .background-wrapper > .background-attachment").show(),o.saveValue("background-image",e),t=o.container.find(".placeholder, .thumbnail"),i=o.container.find(".background-image-upload-remove-button"),t.length&&t.removeClass().addClass("thumbnail thumbnail-image").html(''),i.length&&i.show()});e.preventDefault()}),o.container.on("click",".background-image-upload-remove-button",function(e){var t,i;e.preventDefault(),o.saveValue("background-image",""),t=o.container.find(".placeholder, .thumbnail"),i=o.container.find(".background-image-upload-remove-button"),o.container.find(".background-wrapper > .background-repeat").hide(),o.container.find(".background-wrapper > .background-position").hide(),o.container.find(".background-wrapper > .background-size").hide(),o.container.find(".background-wrapper > .background-attachment").hide(),t.length&&t.removeClass().addClass("placeholder").html("No file selected"),i.length&&i.hide()})},saveValue:function(e,t){var i=jQuery("#customize-control-"+this.id.replace("[","-").replace("]","")+" .background-hidden-value"),n=this.setting._value;n[e]=t,jQuery(i).attr("value",JSON.stringify(n)).trigger("change"),this.setting.set(n)}}),wp.customize.controlConstructor["kirki-color-palette"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-dashicons"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-date"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this,t=e.selector+" input.datepicker";jQuery(t).datepicker({dateFormat:"yy-mm-dd"}),this.container.on("change keyup paste","input.datepicker",function(){e.setting.set(jQuery(this).val())})}}),wp.customize.controlConstructor["kirki-dimension"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this;t.kirkiNotifications(),this.container.on("change keyup paste","input",function(){e=jQuery(this).val(),t.setting.set(e)})},kirkiNotifications:function(){var n=void 0!==this.params.choices&&void 0!==this.params.choices.accept_unitless&&!0===this.params.choices.accept_unitless;wp.customize(this.id,function(i){i.bind(function(e){var t="long_title";!1!==kirki.util.validate.cssValue(e)||n&&!isNaN(e)?i.notifications.remove(t):i.notifications.add(t,new wp.customize.Notification(t,{type:"warning",message:dimensionkirkiL10n["invalid-value"]}))})})}}),wp.customize.controlConstructor["kirki-dimensions"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this.params.choices.controls,i={},n=[];for(_.each(t,function(e,t){!0===e&&n.push(t)}),e=0;e '+e.text},templateSelection:function(e){return' '+e.text}};_.each(a.icons,function(e){r.data.push({id:e.id,text:e.name})}),(t=jQuery(n).selectWoo(r)).on("change",function(){e=jQuery(this).val(),i.setting.set(e)}),t.val(i.setting._value).trigger("change")}}),wp.customize.controlConstructor["kirki-multicheck"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var n=this;n.container.on("change","input",function(){var t=[],i=0;jQuery.each(n.params.choices,function(e){n.container.find('input[value="'+e+'"]').is(":checked")?(n.container.find('input[value="'+e+'"]').parent().addClass("checked"),t[i]=e,i++):n.container.find('input[value="'+e+'"]').parent().removeClass("checked")}),n.setting.set(t)})}}),wp.customize.controlConstructor["kirki-multicolor"]=wp.customize.Control.extend({ready:function(){"use strict";!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(this):this.initKirkiControl()},initKirkiControl:function(){"use strict";var r=this.params.choices,e=Object.keys(r),t=(this.params.value,0);function i(e,t,i){var n=e.container.find(".multicolor-index-"+i),a={change:function(){setTimeout(function(){e.saveValue(i,n.val()),e.container.find(".multicolor-index-"+i).trigger("change")},100)}};_.isObject(r.irisArgs)&&_.each(r.irisArgs,function(e,t){a[t]=e}),n.wpColorPicker(a)}for(;t/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g,variable:"data"};return function(e){return _.template(n.container.find(".customize-control-repeater-content").first().html(),null,t)(e)}}),e.length&&_.each(e,function(e){i=n.addRow(e),n.initColorPicker(),n.initSelect(i,e)}),this.setValue(e,!0,!0),this.repeaterFieldsContainer.sortable({handle:".repeater-row-header",update:function(){n.sort()}})},openFrame:function(e){"use strict";wp.customize.utils.isKeydownButNotEnterEvent(e)||(this.$thisButton.closest(".repeater-field").hasClass("repeater-field-cropped_image")?this.initCropperFrame():this.initFrame(),this.frame.open())},initFrame:function(){"use strict";var e=this.getMimeType();this.frame=wp.media({states:[new wp.media.controller.Library({library:wp.media.query({type:e}),multiple:!1,date:!1})]}),this.frame.on("select",this.onSelect,this)},initCropperFrame:function(){"use strict";var t=this.$thisButton.siblings("input.hidden-field").attr("data-field"),e=this.getMimeType();_.isString(t)&&""!==t&&_.isObject(this.params.fields[t])&&"cropped_image"===this.params.fields[t].type&&["width","height","flex_width","flex_height"].forEach(function(e){_.isUndefined(this.params.fields[t][e])||(this.params[e]=this.params.fields[t][e])}.bind(this)),this.frame=wp.media({button:{text:"Select and Crop",close:!1},states:[new wp.media.controller.Library({library:wp.media.query({type:e}),multiple:!1,date:!1,suggestedWidth:this.params.width,suggestedHeight:this.params.height}),new wp.media.controller.CustomizeImageCropper({imgSelectOptions:this.calculateImageSelectOptions,control:this})]}),this.frame.on("select",this.onSelectForCrop,this),this.frame.on("cropped",this.onCropped,this),this.frame.on("skippedcrop",this.onSkippedCrop,this)},onSelect:function(){"use strict";var e=this.frame.state().get("selection").first().toJSON();this.$thisButton.closest(".repeater-field").hasClass("repeater-field-upload")?this.setFileInRepeaterField(e):this.setImageInRepeaterField(e)},onSelectForCrop:function(){"use strict";var e=this.frame.state().get("selection").first().toJSON();this.params.width!==e.width||this.params.height!==e.height||this.params.flex_width||this.params.flex_height?this.frame.setState("cropper"):this.setImageInRepeaterField(e)},onCropped:function(e){"use strict";this.setImageInRepeaterField(e)},calculateImageSelectOptions:function(e,t){"use strict";var i,n,a,r=t.get("control"),o=!!parseInt(r.params.flex_width,10),s=!!parseInt(r.params.flex_height,10),c=e.get("width"),l=e.get("height"),u=parseInt(r.params.width,10),d=parseInt(r.params.height,10),p=u/d,h=c,f=l;return t.set("canSkipCrop",!r.mustBeCropped(o,s,u,d,c,l)),p').hide().slideDown("slow"),t.find(".hidden-field").val(e.id),this.$thisButton.text(this.$thisButton.data("alt-label")),t.find(".remove-button").show(),t.find("input, textarea, select").trigger("change"),this.frame.close()},setFileInRepeaterField:function(e){"use strict";var t=this.$thisButton.closest(".repeater-field-upload");t.find(".kirki-file-attachment").html(' '+e.filename+"").hide().slideDown("slow"),t.find(".hidden-field").val(e.id),this.$thisButton.text(this.$thisButton.data("alt-label")),t.find(".upload-button").show(),t.find(".remove-button").show(),t.find("input, textarea, select").trigger("change"),this.frame.close()},getMimeType:function(){"use strict";var e=this.$thisButton.siblings("input.hidden-field").attr("data-field");return _.isString(e)&&""!==e&&_.isObject(this.params.fields[e])&&"upload"===this.params.fields[e].type&&!_.isUndefined(this.params.fields[e].mime_type)?this.params.fields[e].mime_type:"image"},removeImage:function(e){"use strict";var t,i;wp.customize.utils.isKeydownButNotEnterEvent(e)||(i=(t=this.$thisButton.closest(".repeater-field-image,.repeater-field-cropped_image,.repeater-field-upload")).find(".upload-button"),t.find(".kirki-image-attachment").slideUp("fast",function(){jQuery(this).show().html(jQuery(this).data("placeholder"))}),t.find(".hidden-field").val(""),i.text(i.data("label")),this.$thisButton.hide(),t.find("input, textarea, select").trigger("change"))},removeFile:function(e){"use strict";var t,i;wp.customize.utils.isKeydownButNotEnterEvent(e)||(i=(t=this.$thisButton.closest(".repeater-field-upload")).find(".upload-button"),t.find(".kirki-file-attachment").slideUp("fast",function(){jQuery(this).show().html(jQuery(this).data("placeholder"))}),t.find(".hidden-field").val(""),i.text(i.data("label")),this.$thisButton.hide(),t.find("input, textarea, select").trigger("change"))},getValue:function(){"use strict";return JSON.parse(decodeURI(this.setting.get()))},setValue:function(e,t,i){"use strict";var a=e,r=[];i&&(jQuery.each(this.params.fields,function(e,t){"image"!==t.type&&"cropped_image"!==t.type&&"upload"!==t.type||r.push(e)}),jQuery.each(e,function(i,n){jQuery.each(r,function(e,t){_.isUndefined(n[t])||_.isUndefined(n[t].id)||(a[i][t]=n[t].id)})})),this.setting.set(encodeURI(JSON.stringify(a))),t&&this.settingField.trigger("change")},addRow:function(e){"use strict";var t,a,i,r=this,n=r.repeaterTemplate(),o=this.getValue(),s={};if(n){if(t=jQuery.extend(!0,{},r.params.fields),e)for(i in e)e.hasOwnProperty(i)&&t.hasOwnProperty(i)&&(t[i].default=e[i]);for(i in t.index=this.currentIndex,n=n(t),(a=new RepeaterRow(r.currentIndex,jQuery(n).appendTo(r.repeaterFieldsContainer),r.params.row_label,r)).container.on("row:remove",function(e,t){r.deleteRow(t)}),a.container.on("row:update",function(e,t,i,n){r.updateField.call(r,e,t,i,n),a.updateLabel()}),this.rows[this.currentIndex]=a,t)t.hasOwnProperty(i)&&(s[i]=t[i].default);return o[this.currentIndex]=s,this.setValue(o,!0),this.currentIndex++,a}},sort:function(){"use strict";var i=this,e=this.repeaterFieldsContainer.find(".repeater-row"),n=[],a=i.getValue(),r=[],o=[];e.each(function(e,t){n.push(jQuery(t).data("row"))}),jQuery.each(n,function(e,t){r[e]=i.rows[t],r[e].setRowIndex(e),o[e]=a[t]}),i.rows=r,i.setValue(o)},deleteRow:function(e){"use strict";var t,i=this.getValue();for(t in i[e]&&this.rows[e]&&(delete i[e],delete this.rows[e],this.setValue(i,!0)),1,this.rows)this.rows.hasOwnProperty(t)&&this.rows[t]&&(this.rows[t].updateLabel(),0)},updateField:function(e,t,i,n){"use strict";var a,r,o;this.rows[t]&&this.params.fields[i]&&(a=this.params.fields[i].type,r=this.rows[t],o=this.getValue(),n=jQuery(n),_.isUndefined(o[r.rowIndex][i])||(o[r.rowIndex][i]="checkbox"===a?n.is(":checked"):n.val(),this.setValue(o,!0)))},initColorPicker:function(){"use strict";var r=this,e=r.container.find(".color-picker-hex"),t={},i=e.data("field");_.isUndefined(i)||_.isUndefined(r.params.fields[i])||_.isUndefined(r.params.fields[i].palettes)||!_.isObject(r.params.fields[i].palettes)||(t.palettes=r.params.fields[i].palettes),t.change=function(e,t){var i=jQuery(e.target),n=i.closest(".repeater-row").data("row"),a=r.getValue();a[n][i.data("field")]=t.color.toString(),r.setValue(a,!0)},0!==e.length&&e.wpColorPicker(t)},initSelect:function(e,t){"use strict";var i,n,a=this,r=e.container.find(".repeater-field select"),o={};0!==r.length&&(i=r.data("field"),"undefed"!==(n=jQuery(r).data("multiple"))&&jQuery.isNumeric(n)&&1<(n=parseInt(n,10))&&(o.maximumSelectionLength=n),(t=t||{})[i]=t[i]||"",jQuery(r).selectWoo(o).val(t[i]||jQuery(r).val()),this.container.on("change",".repeater-field select",function(e){var t=jQuery(e.target),i=t.closest(".repeater-row").data("row"),n=a.getValue();n[i][t.data("field")]=jQuery(this).val(),a.setValue(n)}))}}),wp.customize.controlConstructor["kirki-slider"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this,t="postMessage"===e.setting.transport?"mousemove change":"change",i=e.container.find('input[type="range"]'),n=e.container.find('input[type="text"]'),a=e.setting._value;n.attr("value",a),i.on("mousemove change",function(){n.attr("value",i.val())}),i.on(t,function(){e.setting.set(i.val())}),n.on("input paste change",function(){i.attr("value",n.val()),e.setting.set(n.val())}),e.container.find(".slider-reset").on("click",function(){n.attr("value",e.params.default),i.attr("value",e.params.default),e.setting.set(n.val())})}}),wp.customize.controlConstructor["kirki-sortable"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;jQuery(e.container.find("ul.sortable").first()).sortable({update:function(){e.setting.set(e.getNewVal())}}).disableSelection().find("li").each(function(){jQuery(this).find("i.visibility").click(function(){jQuery(this).toggleClass("dashicons-visibility-faint").parents("li:eq(0)").toggleClass("invisible")})}).click(function(){e.setting.set(e.getNewVal())})},getNewVal:function(){var e=jQuery(this.container.find("li")),t=[];return _.each(e,function(e){jQuery(e).hasClass("invisible")||t.push(jQuery(e).data("value"))}),t}}),wp.customize.controlConstructor["kirki-switch"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){"use strict";var e=this,t=e.setting._value;this.container.on("change","input",function(){t=!!jQuery(this).is(":checked"),e.setting.set(t)})}}),wp.customize.controlConstructor["kirki-toggle"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this,t=e.setting._value;this.container.on("change","input",function(){t=!!jQuery(this).is(":checked"),e.setting.set(t)})}}),wp.customize.controlConstructor["kirki-typography"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){"use strict";var e,t=this,i=t.setting._value;t.renderFontSelector(),t.renderBackupFontSelector(),t.renderVariantSelector(),t.localFontsCheckbox(),void 0!==t.params.default["font-size"]&&this.container.on("change keyup paste",".font-size input",function(){t.saveValue("font-size",jQuery(this).val())}),void 0!==t.params.default["line-height"]&&this.container.on("change keyup paste",".line-height input",function(){t.saveValue("line-height",jQuery(this).val())}),void 0!==t.params.default["margin-top"]&&this.container.on("change keyup paste",".margin-top input",function(){t.saveValue("margin-top",jQuery(this).val())}),void 0!==t.params.default["margin-bottom"]&&this.container.on("change keyup paste",".margin-bottom input",function(){t.saveValue("margin-bottom",jQuery(this).val())}),void 0!==t.params.default["letter-spacing"]&&(i["letter-spacing"]=jQuery.isNumeric(i["letter-spacing"])?i["letter-spacing"]+"px":i["letter-spacing"],this.container.on("change keyup paste",".letter-spacing input",function(){i["letter-spacing"]=jQuery.isNumeric(jQuery(this).val())?jQuery(this).val()+"px":jQuery(this).val(),t.saveValue("letter-spacing",i["letter-spacing"])})),void 0!==t.params.default["word-spacing"]&&this.container.on("change keyup paste",".word-spacing input",function(){t.saveValue("word-spacing",jQuery(this).val())}),void 0!==t.params.default["text-align"]&&this.container.on("change",".text-align input",function(){t.saveValue("text-align",jQuery(this).val())}),void 0!==t.params.default["text-transform"]&&jQuery(t.selector+" .text-transform select").selectWoo().on("change",function(){t.saveValue("text-transform",jQuery(this).val())}),void 0!==t.params.default["text-decoration"]&&jQuery(t.selector+" .text-decoration select").selectWoo().on("change",function(){t.saveValue("text-decoration",jQuery(this).val())}),void 0!==t.params.default.color&&(e=this.container.find(".kirki-color-control")).wpColorPicker({change:function(){setTimeout(function(){t.saveValue("color",e.val())},100)}})},renderFontSelector:function(){var e,t,i=this,n=i.selector+" .font-family select",a=[],r=[],o=[],s=i.setting._value,c=i.getFonts();_.isUndefined(c.standard)||_.each(c.standard,function(e){r.push({id:e.family.replace(/"/g,"'"),text:e.label})}),_.isUndefined(c.google)||_.each(c.google,function(e){o.push({id:e.family,text:e.family})}),t={},_.isUndefined(i.params)||_.isUndefined(i.params.choices)||_.isUndefined(i.params.choices.fonts)||_.isUndefined(i.params.choices.fonts.families)||(t=i.params.choices.fonts.families),a=jQuery.extend({},t,{default:{text:kirkiL10n.defaultCSSValues,children:[{id:"",text:kirkiL10n.defaultBrowserFamily},{id:"initial",text:"initial"},{id:"inherit",text:"inherit"}]},standard:{text:kirkiL10n.standardFonts,children:r},google:{text:kirkiL10n.googleFonts,children:o}}),kirkiL10n.isScriptDebug&&(console.info('Kirki Debug: Font families for control "'+i.id+'":'),console.info(a)),a=_.values(a),e=jQuery(n).selectWoo({data:a}),(s["font-family"]||""===s["font-family"])&&(s["font-family"]=kirki.util.parseHtmlEntities(s["font-family"].replace(/'/g,'"')),e.val(s["font-family"]).trigger("change")),e.on("change",function(){i.saveValue("font-family",jQuery(this).val()),i.renderBackupFontSelector(),i.renderVariantSelector()})},renderBackupFontSelector:function(){var e,t=this,i=t.selector+" .font-backup select",n=[],a=t.setting._value,r=a["font-family"],o=t.getFonts();(_.isUndefined(a["font-backup"])||null===a["font-backup"])&&(a["font-backup"]=""),"inherit"!==r&&"initial"!==r&&"google"===kirki.util.webfonts.getFontType(r)?(jQuery(t.selector+" .font-backup").show(),_.isUndefined(o.standard)||_.each(o.standard,function(e){n.push({id:e.family.replace(/"/g,"'"),text:e.label})}),e=jQuery(i).selectWoo({data:n}),void 0!==a["font-backup"]&&e.val(a["font-backup"].replace(/'/g,'"')).trigger("change"),e.on("change",function(){t.saveValue("font-backup",jQuery(this).val())})):jQuery(t.selector+" .font-backup").hide()},renderVariantSelector:function(){var e,t,i,n=this,a=n.setting._value,r=a["font-family"],o=n.selector+" .variant select",s=[],c=!1,l=kirki.util.webfonts.getFontType(r),u=["","regular","italic","700","700italic"];if("google"===l&&(u=kirki.util.webfonts.google.getVariants(r)),_.isUndefined(n.params)||_.isUndefined(n.params.choices)||_.isUndefined(n.params.choices.fonts)||_.isUndefined(n.params.choices.fonts.variants)||_.isUndefined(n.params.choices.fonts.variants[r])||(u=n.params.choices.fonts.variants[r]),kirkiL10n.isScriptDebug&&(console.info('Kirki Debug: Font variants for font-family "'+r+'":'),console.info(u)),"inherit"!==r&&"initial"!==r&&""!==r||(a.variant="inherit",u=[""],jQuery(n.selector+" .variant").hide()),u.length<=1)return jQuery(n.selector+" .variant").hide(),a.variant=u[0],n.saveValue("variant",a.variant),i=""!==a.variant&&a.variant?(e=_.isString(a.variant)?a.variant.match(/\d/g):"400",e=_.isObject(e)?e.join(""):"400",a.variant&&-1!==a.variant.indexOf("italic")?"italic":"normal"):e="",n.saveValue("font-weight",e),void n.saveValue("font-style",i);jQuery(n.selector+" .font-backup").show(),jQuery(n.selector+" .variant").show(),_.each(u,function(e){a.variant===e&&(c=!0),s.push({id:e,text:e})}),c||(a.variant="regular"),jQuery(o).hasClass("select2-hidden-accessible")&&(jQuery(o).selectWoo("destroy"),jQuery(o).empty()),(t=jQuery(o).selectWoo({data:s})).val(a.variant).trigger("change"),t.on("change",function(){n.saveValue("variant",jQuery(this).val()),"string"!=typeof a.variant&&(a.variant=u[0]),e=_.isString(a.variant)?a.variant.match(/\d/g):"400",e=_.isObject(e)?e.join(""):"400",i=-1!==a.variant.indexOf("italic")?"italic":"normal",n.saveValue("font-weight",e),n.saveValue("font-style",i)})},getFonts:function(){var e=this,t=kirki.util.webfonts.google.getFonts(),i={},n="alpha",a=0,r={};return _.isEmpty(e.params.choices.fonts.google)?i=kirki.util.webfonts.google.getFonts(n,"",a):"alpha"===e.params.choices.fonts.google[0]||"popularity"===e.params.choices.fonts.google[0]||"trending"===e.params.choices.fonts.google[0]?(n=e.params.choices.fonts.google[0],isNaN(e.params.choices.fonts.google[1])||(a=parseInt(e.params.choices.fonts.google[1],10)),i=kirki.util.webfonts.google.getFonts(n,"",a)):_.each(e.params.choices.fonts.google,function(e){void 0===t[e]||_.isEmpty(t[e])||(i[e]=t[e])}),_.isEmpty(e.params.choices.fonts.standard)?_.each(kirki.util.webfonts.standard.fonts,function(e,t){r[t]={family:e.stack,label:e.label}}):_.each(e.params.choices.fonts.standard,function(e){void 0===kirki.util.webfonts.standard.fonts[e]||_.isEmpty(kirki.util.webfonts.standard.fonts[e])?r[e]={family:e,label:e}:(r[e]={},"undefined"===kirki.util.webfonts.standard.fonts[e].stack||_.isEmpty(kirki.util.webfonts.standard.fonts[e].stack)?r[e].family=i[e]:r[e].family=kirki.util.webfonts.standard.fonts[e].stack,"undefined"===kirki.util.webfonts.standard.fonts[e].label||_.isEmpty(kirki.util.webfonts.standard.fonts[e].label)?_.isEmpty(r[e])||(r[e].label=r[e]):r[e].label=kirki.util.webfonts.standard.fonts[e].label)}),{google:i,standard:r}},localFontsCheckbox:function(){var e=this,t=(e.container.find(".kirki-host-font-locally"),e.container.find(".kirki-host-font-locally input")),i=jQuery(t).is(":checked");e.setting._value&&e.setting._value.downloadFont&&jQuery(t).attr("checked","checked"),jQuery(t).on("change",function(){i=jQuery(t).is(":checked"),e.saveValue("downloadFont",i)})},saveValue:function(e,t){var i=this.container.find(".typography-hidden-value"),n=this.setting._value;n[e]=t,jQuery(i).attr("value",JSON.stringify(n)).trigger("change"),this.setting.set(n)}}); \ No newline at end of file +if(_.isUndefined(window.kirkiSetSettingValue))var kirkiSetSettingValue={set:function(i,n){var e,a=this,t=wp.customize.settings.controls[i];if(_.isUndefined(t))return!0;switch(a.setValue(i,n),t.type){case"kirki-background":_.isUndefined(n["background-color"])||a.setColorPicker(a.findElement(i,".kirki-color-control"),n["background-color"]),a.findElement(i,".placeholder, .thumbnail").removeClass().addClass("placeholder").html("No file selected"),_.each(["background-repeat","background-position"],function(e){_.isUndefined(n[e])||a.setSelectWoo(a.findElement(i,"."+e+" select"),n[e])}),_.each(["background-size","background-attachment"],function(e){jQuery(a.findElement(i,"."+e+' input[value="'+n+'"]')).prop("checked",!0)}),e=JSON.stringify(n).replace(/'/g,"'"),jQuery(a.findElement(i,".background-hidden-value").attr("value",e)).trigger("change");break;case"kirki-code":jQuery(a.findElement(i,".CodeMirror"))[0].CodeMirror.setValue(n);break;case"checkbox":case"kirki-switch":case"kirki-toggle":n=1===n||"1"===n||!0===n,jQuery(a.findElement(i,"input")).prop("checked",n),wp.customize.instance(i).set(n);break;case"kirki-select":case"kirki-fontawesome":a.setSelectWoo(a.findElement(i,"select"),n);break;case"kirki-slider":jQuery(a.findElement(i,"input")).prop("value",n),jQuery(a.findElement(i,".kirki_range_value .value")).html(n);break;case"kirki-generic":(_.isUndefined(t.choices)||_.isUndefined(t.choices.element))&&(t.choices.element="input"),jQuery(a.findElement(i,t.choices.element)).prop("value",n);break;case"kirki-color":a.setColorPicker(a.findElement(i,".kirki-color-control"),n);break;case"kirki-multicheck":a.findElement(i,"input").each(function(){jQuery(this).prop("checked",!1)}),_.each(n,function(e,t){jQuery(a.findElement(i,'input[value="'+n[t]+'"]')).prop("checked",!0)});break;case"kirki-multicolor":_.each(n,function(e,t){a.setColorPicker(a.findElement(i,".multicolor-index-"+t),e)});break;case"kirki-radio-buttonset":case"kirki-radio-image":case"kirki-radio":case"kirki-dashicons":case"kirki-color-palette":case"kirki-palette":jQuery(a.findElement(i,'input[value="'+n+'"]')).prop("checked",!0);break;case"kirki-typography":_.each(["font-family","variant"],function(e){_.isUndefined(n[e])||a.setSelectWoo(a.findElement(i,"."+e+" select"),n[e])}),_.each(["font-size","line-height","letter-spacing","word-spacing"],function(e){_.isUndefined(n[e])||jQuery(a.findElement(i,"."+e+" input")).prop("value",n[e])}),_.isUndefined(n.color)||a.setColorPicker(a.findElement(i,".kirki-color-control"),n.color),e=JSON.stringify(n).replace(/'/g,"'"),jQuery(a.findElement(i,".typography-hidden-value").attr("value",e)).trigger("change");break;case"kirki-dimensions":_.each(n,function(e,t){jQuery(a.findElement(i,"."+t+" input")).prop("value",e)});break;case"kirki-repeater":case"kirki-custom":break;default:jQuery(a.findElement(i,"input")).prop("value",n)}},setColorPicker:function(e,t){e.attr("data-default-color",t).data("default-color",t).wpColorPicker("color",t)},setSelectWoo:function(e,t){jQuery(e).selectWoo().val(t).trigger("change")},setTextarea:function(e,t){jQuery(e).prop("value",t)},findElement:function(e,t){return wp.customize.control(e).container.find(t)},setValue:function(e,t,i){i=_.isUndefined(i)?100:parseInt(i,10),wp.customize.instance(e).set({}),setTimeout(function(){wp.customize.instance(e).set(t)},i)}};(kirki={initialized:!1,initialize:function(){this.initialized||(setTimeout(function(){kirki.util.webfonts.standard.initialize(),kirki.util.webfonts.google.initialize()},150),this.initialized=!0)}}).initialize();var kirki=kirki||{};kirki=(kirki=jQuery.extend(kirki,{control:{"kirki-radio":{init:function(e){this.template(e),kirki.input.radio.init(e)},template:function(e){var t=wp.template("kirki-input-radio");e.container.html(t({label:e.params.label,description:e.params.description,"data-id":e.id,inputAttrs:e.params.inputAttrs,default:e.params.default,value:kirki.setting.get(e.id),choices:e.params.choices}))}},"kirki-color":{init:function(e){this.template(e),kirki.input.color.init(e)},template:function(e){var t=wp.template("kirki-input-color");e.container.html(t({label:e.params.label,description:e.params.description,"data-id":e.id,mode:e.params.mode,inputAttrs:e.params.inputAttrs,"data-palette":e.params.palette,"data-default-color":e.params.default,"data-alpha":e.params.choices.alpha,value:kirki.setting.get(e.id)}))}},"kirki-generic":{init:function(e){this.template(e),_.isUndefined(e.params)||_.isUndefined(e.params.choices)||_.isUndefined(e.params.choices.element)||"textarea"!==e.params.choices.element?kirki.input.genericInput.init(e):kirki.input.textarea.init(e)},template:function(e){var t,i={label:e.params.label,description:e.params.description,"data-id":e.id,inputAttrs:e.params.inputAttrs,choices:e.params.choices,value:kirki.setting.get(e.id)};if(!_.isUndefined(e.params)&&!_.isUndefined(e.params.choices)&&!_.isUndefined(e.params.choices.element)&&"textarea"===e.params.choices.element)return t=wp.template("kirki-input-textarea"),void e.container.html(t(i));t=wp.template("kirki-input-generic"),e.container.html(t(i))}},"kirki-number":{init:function(e){this.template(e),kirki.input.number.init(e)},template:function(e){var t=wp.template("kirki-input-number");e.container.html(t(args={label:e.params.label,description:e.params.description,"data-id":e.id,inputAttrs:e.params.inputAttrs,choices:e.params.choices,value:kirki.setting.get(e.id)}))}},"kirki-image":{init:function(e){this.template(e),kirki.input.image.init(e)},template:function(e){var t=wp.template("kirki-input-image");e.container.html(t(args={label:e.params.label,description:e.params.description,"data-id":e.id,inputAttrs:e.params.inputAttrs,choices:e.params.choices,value:kirki.setting.get(e.id)}))}},"kirki-select":{init:function(e){this.template(e),kirki.input.select.init(e)},template:function(e){var t=wp.template("kirki-input-select");e.container.html(t({label:e.params.label,description:e.params.description,"data-id":e.id,inputAttrs:e.params.inputAttrs,choices:e.params.choices,value:kirki.setting.get(e.id),multiple:e.params.multiple||1,placeholder:e.params.placeholder}))}}}}))||{},kirki=(kirki=jQuery.extend(kirki,{input:{radio:{init:function(e){jQuery('input[data-id="'+e.id+'"]').on("change keyup paste click",function(){kirki.setting.set(e.id,jQuery(this).val())})}},color:{init:function(e){var t,i=jQuery('.kirki-color-control[data-id="'+e.id+'"]');e.choices=e.choices||{},_.isEmpty(e.choices)&&e.params.choices&&(e.choices=e.params.choices),_.isEmpty(e.choices)||i.wpColorPicker(e.choices),setTimeout(function(){(t=jQuery('.kirki-input-container[data-id="'+e.id+'"] .wp-picker-clear')).length&&t.click(function(){kirki.setting.set(e.id,"")})},200),i.wpColorPicker({change:function(){setTimeout(function(){kirki.setting.set(e.id,i.val())},20)}})}},genericInput:{init:function(e){jQuery('input[data-id="'+e.id+'"]').on("change keyup paste click",function(){kirki.setting.set(e.id,jQuery(this).val())})}},textarea:{init:function(e){jQuery('textarea[data-id="'+e.id+'"]').on("change keyup paste click",function(){kirki.setting.set(e.id,jQuery(this).val())})}},select:{init:function(e){var t,i=jQuery('select[data-id="'+e.id+'"]'),n=parseInt(i.data("multiple"),10),a={escapeMarkup:function(e){return e}};e.params.placeholder&&(a.placeholder=e.params.placeholder,a.allowClear=!0),1=i.params.choices.max?t:t+i.params.choices.step,n.val(e),n.trigger("change")}),t.click(function(){var e,t=parseFloat(n.val());e=t<=i.params.choices.min?t:t-i.params.choices.step,n.val(e),n.trigger("change")}),n.on("change keyup paste click",function(){var e=jQuery(this).val();isNaN(e)&&(e=parseFloat(e,10),e=isNaN(e)?0:e,jQuery(this).attr("value",e)),kirki.setting.set(i.id,e)})}},image:{init:function(a){var t=kirki.setting.get(a.id),n=_.isUndefined(a.params.choices)||_.isUndefined(a.params.choices.save_as)?"url":a.params.choices.save_as,r=a.container.find(".placeholder, .thumbnail"),e="array"===n?t.url:t,s=a.container.find(".image-upload-remove-button"),o=a.container.find(".image-default-button");t="array"===n&&_.isString(t)?{url:t}:t,"id"!==n&&"ID"!==n||""===t||wp.media.attachment(t).fetch().then(function(){setTimeout(function(){var e=wp.media.attachment(t).get("url");r.removeClass().addClass("thumbnail thumbnail-image").html('')},700)}),("url"===n&&""!==t||"array"===n&&!_.isUndefined(t.url)&&""!==t.url)&&a.container.find("image-default-button").hide(),("url"===n&&""===t||"array"===n&&(_.isUndefined(t.url)||""===t.url))&&s.hide(),t===a.params.default&&a.container.find("image-default-button").hide(),""!==e&&r.removeClass().addClass("thumbnail thumbnail-image").html(''),a.container.on("click",".image-upload-button",function(e){var i=wp.media({multiple:!1}).open().on("select",function(){var e=i.state().get("selection").first().toJSON(),t=e.url;_.isUndefined(e.sizes)||(t=e.sizes.full.url,_.isUndefined(e.sizes.medium)?_.isUndefined(e.sizes.thumbnail)||(t=e.sizes.thumbnail.url):t=e.sizes.medium.url),"array"===n?kirki.setting.set(a.id,{id:e.id,url:e.sizes.full.url,width:e.width,height:e.height}):"id"===n?kirki.setting.set(a.id,e.id):kirki.setting.set(a.id,_.isUndefined(e.sizes)?e.url:e.sizes.full.url),r.length&&r.removeClass().addClass("thumbnail thumbnail-image").html(''),s.length&&(s.show(),o.hide())});e.preventDefault()}),a.container.on("click",".image-upload-remove-button",function(e){var t,i,n;e.preventDefault(),kirki.setting.set(a.id,""),t=a.container.find(".placeholder, .thumbnail"),i=a.container.find(".image-upload-remove-button"),n=a.container.find(".image-default-button"),t.length&&t.removeClass().addClass("placeholder").html(kirkiL10n.noFileSelected),i.length&&(i.hide(),jQuery(n).hasClass("button")&&n.show())}),a.container.on("click",".image-default-button",function(e){var t,i,n;e.preventDefault(),kirki.setting.set(a.id,a.params.default),t=a.container.find(".placeholder, .thumbnail"),i=a.container.find(".image-upload-remove-button"),n=a.container.find(".image-default-button"),t.length&&t.removeClass().addClass("thumbnail thumbnail-image").html(''),i.length&&(i.show(),n.hide())})}}}}))||{},kirki=(kirki=jQuery.extend(kirki,{setting:{get:function(e){var t=e.split("["),i="",n=0,a="";return _.each(t,function(e,t){e=e.replace("]",""),0===t?i=e:i+="["+e+"]",_.isUndefined(wp.customize.instance(i))||(a=wp.customize.instance(i).get(),n=t),n"+e,"text/html").body.textContent}}}),function(){"use strict";wp.customize.kirkiDynamicControl=wp.customize.Control.extend({initialize:function(e,t){var i=t||{};i.params=i.params||{},i.params.type||(i.params.type="kirki-generic"),i.params.content||(i.params.content=jQuery(""),i.params.content.attr("id","customize-control-"+e.replace(/]/g,"").replace(/\[/g,"-")),i.params.content.attr("class","customize-control customize-control-"+i.params.type)),this.propertyElements=[],wp.customize.Control.prototype.initialize.call(this,e,i)},_setUpSettingRootLinks:function(){var n=this;n.container.find("[data-customize-setting-link]").each(function(){var i=jQuery(this);wp.customize(i.data("customizeSettingLink"),function(e){var t=new wp.customize.Element(i);n.elements.push(t),t.sync(e),t.set(e())})})},_setUpSettingPropertyLinks:function(){var n=this;n.setting&&n.container.find("[data-customize-setting-property-link]").each(function(){var t,e=jQuery(this),i=e.data("customizeSettingPropertyLink");t=new wp.customize.Element(e),n.propertyElements.push(t),t.set(n.setting()[i]),t.bind(function(e){var t=n.setting();e!==t[i]&&((t=_.clone(t))[i]=e,n.setting.set(t))}),n.setting.bind(function(e){e[i]!==t.get()&&t.set(e[i])})})},ready:function(){var e=this;e._setUpSettingRootLinks(),e._setUpSettingPropertyLinks(),wp.customize.Control.prototype.ready.call(e),e.deferred.embedded.done(function(){e.initKirkiControl(e)})},embed:function(){var t=this,e=t.section();e&&wp.customize.section(e,function(e){"kirki-expanded"===e.params.type||e.expanded()||wp.customize.settings.autofocus.control===t.id?t.actuallyEmbed():e.expanded.bind(function(e){e&&t.actuallyEmbed()})})},actuallyEmbed:function(){"resolved"!==this.deferred.embedded.state()&&(this.renderContent(),this.deferred.embedded.resolve())},focus:function(e){this.actuallyEmbed(),wp.customize.Control.prototype.focus.call(this,e)},initKirkiControl:function(e){void 0===kirki.control[e.params.type]?this.container.on("change keyup paste click","input",function(){e.setting.set(jQuery(this).val())}):kirki.control[e.params.type].init(e)}})}(),_.each(kirki.control,function(e,t){wp.customize.controlConstructor[t]=wp.customize.kirkiDynamicControl.extend({})}),wp.customize.controlConstructor["kirki-background"]=wp.customize.Control.extend({ready:function(){"use strict";!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(this):this.initKirkiControl()},initKirkiControl:function(){var s=this,e=s.setting._value,t=s.container.find(".kirki-color-control");(_.isUndefined(e["background-image"])||""===e["background-image"])&&(s.container.find(".background-wrapper > .background-repeat").hide(),s.container.find(".background-wrapper > .background-position").hide(),s.container.find(".background-wrapper > .background-size").hide(),s.container.find(".background-wrapper > .background-attachment").hide()),t.wpColorPicker({change:function(){setTimeout(function(){s.saveValue("background-color",t.val())},100)}}),s.container.on("change",".background-repeat select",function(){s.saveValue("background-repeat",jQuery(this).val())}),s.container.on("change click",".background-size input",function(){s.saveValue("background-size",jQuery(this).val())}),s.container.on("change",".background-position select",function(){s.saveValue("background-position",jQuery(this).val())}),s.container.on("change click",".background-attachment input",function(){s.saveValue("background-attachment",jQuery(this).val())}),s.container.on("click",".background-image-upload-button",function(e){var r=wp.media({multiple:!1}).open().on("select",function(){var e,t,i,n=r.state().get("selection").first(),a=n.toJSON().sizes.full.url;_.isUndefined(n.toJSON().sizes.medium)?_.isUndefined(n.toJSON().sizes.thumbnail)||(a=n.toJSON().sizes.thumbnail.url):a=n.toJSON().sizes.medium.url,e=n.toJSON().sizes.full.url,n.toJSON().id,n.toJSON().width,n.toJSON().height,""!==e&&s.container.find(".background-wrapper > .background-repeat, .background-wrapper > .background-position, .background-wrapper > .background-size, .background-wrapper > .background-attachment").show(),s.saveValue("background-image",e),t=s.container.find(".placeholder, .thumbnail"),i=s.container.find(".background-image-upload-remove-button"),t.length&&t.removeClass().addClass("thumbnail thumbnail-image").html(''),i.length&&i.show()});e.preventDefault()}),s.container.on("click",".background-image-upload-remove-button",function(e){var t,i;e.preventDefault(),s.saveValue("background-image",""),t=s.container.find(".placeholder, .thumbnail"),i=s.container.find(".background-image-upload-remove-button"),s.container.find(".background-wrapper > .background-repeat").hide(),s.container.find(".background-wrapper > .background-position").hide(),s.container.find(".background-wrapper > .background-size").hide(),s.container.find(".background-wrapper > .background-attachment").hide(),t.length&&t.removeClass().addClass("placeholder").html("No file selected"),i.length&&i.hide()})},saveValue:function(e,t){var i=jQuery("#customize-control-"+this.id.replace("[","-").replace("]","")+" .background-hidden-value"),n=this.setting._value;n[e]=t,jQuery(i).attr("value",JSON.stringify(n)).trigger("change"),this.setting.set(n)}}),wp.customize.controlConstructor["kirki-color-palette"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-dashicons"]=wp.customize.kirkiDynamicControl.extend({}),wp.customize.controlConstructor["kirki-date"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this,t=e.selector+" input.datepicker";jQuery(t).datepicker({dateFormat:"yy-mm-dd"}),this.container.on("change keyup paste","input.datepicker",function(){e.setting.set(jQuery(this).val())})}}),wp.customize.controlConstructor["kirki-dimension"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this;t.kirkiNotifications(),this.container.on("change keyup paste","input",function(){e=jQuery(this).val(),t.setting.set(e)})},kirkiNotifications:function(){var n=void 0!==this.params.choices&&void 0!==this.params.choices.accept_unitless&&!0===this.params.choices.accept_unitless;wp.customize(this.id,function(i){i.bind(function(e){var t="long_title";!1!==kirki.util.validate.cssValue(e)||n&&!isNaN(e)?i.notifications.remove(t):i.notifications.add(t,new wp.customize.Notification(t,{type:"warning",message:dimensionkirkiL10n["invalid-value"]}))})})}}),wp.customize.controlConstructor["kirki-dimensions"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e,t=this.params.choices.controls,i={},n=[];for(_.each(t,function(e,t){!0===e&&n.push(t)}),e=0;e '+e.text},templateSelection:function(e){return' '+e.text}};_.each(a.icons,function(e){r.data.push({id:e.id,text:e.name})}),(t=jQuery(n).selectWoo(r)).on("change",function(){e=jQuery(this).val(),i.setting.set(e)}),t.val(i.setting._value).trigger("change")}}),wp.customize.controlConstructor["kirki-multicheck"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var n=this;n.container.on("change","input",function(){var t=[],i=0;jQuery.each(n.params.choices,function(e){n.container.find('input[value="'+e+'"]').is(":checked")?(n.container.find('input[value="'+e+'"]').parent().addClass("checked"),t[i]=e,i++):n.container.find('input[value="'+e+'"]').parent().removeClass("checked")}),n.setting.set(t)})}}),wp.customize.controlConstructor["kirki-multicolor"]=wp.customize.Control.extend({ready:function(){"use strict";!_.isUndefined(window.kirkiControlLoader)&&_.isFunction(kirkiControlLoader)?kirkiControlLoader(this):this.initKirkiControl()},initKirkiControl:function(){"use strict";var r=this.params.choices,e=Object.keys(r),t=(this.params.value,0);function i(e,t,i){var n=e.container.find(".multicolor-index-"+i),a={change:function(){setTimeout(function(){e.saveValue(i,n.val()),e.container.find(".multicolor-index-"+i).trigger("change")},100)}};_.isObject(r.irisArgs)&&_.each(r.irisArgs,function(e,t){a[t]=e}),n.wpColorPicker(a)}for(;t/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g,variable:"data"};return function(e){return _.template(n.container.find(".customize-control-repeater-content").first().html(),null,t)(e)}}),e.length&&_.each(e,function(e){i=n.addRow(e),n.initColorPicker(),n.initSelect(i,e)}),this.setValue(e,!0,!0),this.repeaterFieldsContainer.sortable({handle:".repeater-row-header",update:function(){n.sort()}})},openFrame:function(e){"use strict";wp.customize.utils.isKeydownButNotEnterEvent(e)||(this.$thisButton.closest(".repeater-field").hasClass("repeater-field-cropped_image")?this.initCropperFrame():this.initFrame(),this.frame.open())},initFrame:function(){"use strict";var e=this.getMimeType();this.frame=wp.media({states:[new wp.media.controller.Library({library:wp.media.query({type:e}),multiple:!1,date:!1})]}),this.frame.on("select",this.onSelect,this)},initCropperFrame:function(){"use strict";var t=this.$thisButton.siblings("input.hidden-field").attr("data-field"),e=this.getMimeType();_.isString(t)&&""!==t&&_.isObject(this.params.fields[t])&&"cropped_image"===this.params.fields[t].type&&["width","height","flex_width","flex_height"].forEach(function(e){_.isUndefined(this.params.fields[t][e])||(this.params[e]=this.params.fields[t][e])}.bind(this)),this.frame=wp.media({button:{text:"Select and Crop",close:!1},states:[new wp.media.controller.Library({library:wp.media.query({type:e}),multiple:!1,date:!1,suggestedWidth:this.params.width,suggestedHeight:this.params.height}),new wp.media.controller.CustomizeImageCropper({imgSelectOptions:this.calculateImageSelectOptions,control:this})]}),this.frame.on("select",this.onSelectForCrop,this),this.frame.on("cropped",this.onCropped,this),this.frame.on("skippedcrop",this.onSkippedCrop,this)},onSelect:function(){"use strict";var e=this.frame.state().get("selection").first().toJSON();this.$thisButton.closest(".repeater-field").hasClass("repeater-field-upload")?this.setFileInRepeaterField(e):this.setImageInRepeaterField(e)},onSelectForCrop:function(){"use strict";var e=this.frame.state().get("selection").first().toJSON();this.params.width!==e.width||this.params.height!==e.height||this.params.flex_width||this.params.flex_height?this.frame.setState("cropper"):this.setImageInRepeaterField(e)},onCropped:function(e){"use strict";this.setImageInRepeaterField(e)},calculateImageSelectOptions:function(e,t){"use strict";var i,n,a,r=t.get("control"),s=!!parseInt(r.params.flex_width,10),o=!!parseInt(r.params.flex_height,10),c=e.get("width"),l=e.get("height"),u=parseInt(r.params.width,10),d=parseInt(r.params.height,10),p=u/d,h=c,f=l;return t.set("canSkipCrop",!r.mustBeCropped(s,o,u,d,c,l)),p').hide().slideDown("slow"),t.find(".hidden-field").val(e.id),this.$thisButton.text(this.$thisButton.data("alt-label")),t.find(".remove-button").show(),t.find("input, textarea, select").trigger("change"),this.frame.close()},setFileInRepeaterField:function(e){"use strict";var t=this.$thisButton.closest(".repeater-field-upload");t.find(".kirki-file-attachment").html(' '+e.filename+"").hide().slideDown("slow"),t.find(".hidden-field").val(e.id),this.$thisButton.text(this.$thisButton.data("alt-label")),t.find(".upload-button").show(),t.find(".remove-button").show(),t.find("input, textarea, select").trigger("change"),this.frame.close()},getMimeType:function(){"use strict";var e=this.$thisButton.siblings("input.hidden-field").attr("data-field");return _.isString(e)&&""!==e&&_.isObject(this.params.fields[e])&&"upload"===this.params.fields[e].type&&!_.isUndefined(this.params.fields[e].mime_type)?this.params.fields[e].mime_type:"image"},removeImage:function(e){"use strict";var t,i;wp.customize.utils.isKeydownButNotEnterEvent(e)||(i=(t=this.$thisButton.closest(".repeater-field-image,.repeater-field-cropped_image,.repeater-field-upload")).find(".upload-button"),t.find(".kirki-image-attachment").slideUp("fast",function(){jQuery(this).show().html(jQuery(this).data("placeholder"))}),t.find(".hidden-field").val(""),i.text(i.data("label")),this.$thisButton.hide(),t.find("input, textarea, select").trigger("change"))},removeFile:function(e){"use strict";var t,i;wp.customize.utils.isKeydownButNotEnterEvent(e)||(i=(t=this.$thisButton.closest(".repeater-field-upload")).find(".upload-button"),t.find(".kirki-file-attachment").slideUp("fast",function(){jQuery(this).show().html(jQuery(this).data("placeholder"))}),t.find(".hidden-field").val(""),i.text(i.data("label")),this.$thisButton.hide(),t.find("input, textarea, select").trigger("change"))},getValue:function(){"use strict";return JSON.parse(decodeURI(this.setting.get()))},setValue:function(e,t,i){"use strict";var a=e,r=[];i&&(jQuery.each(this.params.fields,function(e,t){"image"!==t.type&&"cropped_image"!==t.type&&"upload"!==t.type||r.push(e)}),jQuery.each(e,function(i,n){jQuery.each(r,function(e,t){_.isUndefined(n[t])||_.isUndefined(n[t].id)||(a[i][t]=n[t].id)})})),this.setting.set(encodeURI(JSON.stringify(a))),t&&this.settingField.trigger("change")},addRow:function(e){"use strict";var t,a,i,r=this,n=r.repeaterTemplate(),s=this.getValue(),o={};if(n){if(t=jQuery.extend(!0,{},r.params.fields),e)for(i in e)e.hasOwnProperty(i)&&t.hasOwnProperty(i)&&(t[i].default=e[i]);for(i in t.index=this.currentIndex,n=n(t),(a=new RepeaterRow(r.currentIndex,jQuery(n).appendTo(r.repeaterFieldsContainer),r.params.row_label,r)).container.on("row:remove",function(e,t){r.deleteRow(t)}),a.container.on("row:update",function(e,t,i,n){r.updateField.call(r,e,t,i,n),a.updateLabel()}),this.rows[this.currentIndex]=a,t)t.hasOwnProperty(i)&&(o[i]=t[i].default);return s[this.currentIndex]=o,this.setValue(s,!0),this.currentIndex++,a}},sort:function(){"use strict";var i=this,e=this.repeaterFieldsContainer.find(".repeater-row"),n=[],a=i.getValue(),r=[],s=[];e.each(function(e,t){n.push(jQuery(t).data("row"))}),jQuery.each(n,function(e,t){r[e]=i.rows[t],r[e].setRowIndex(e),s[e]=a[t]}),i.rows=r,i.setValue(s)},deleteRow:function(e){"use strict";var t,i=this.getValue();for(t in i[e]&&this.rows[e]&&(delete i[e],delete this.rows[e],this.setValue(i,!0)),1,this.rows)this.rows.hasOwnProperty(t)&&this.rows[t]&&(this.rows[t].updateLabel(),0)},updateField:function(e,t,i,n){"use strict";var a,r,s;this.rows[t]&&this.params.fields[i]&&(a=this.params.fields[i].type,r=this.rows[t],s=this.getValue(),n=jQuery(n),_.isUndefined(s[r.rowIndex][i])||(s[r.rowIndex][i]="checkbox"===a?n.is(":checked"):n.val(),this.setValue(s,!0)))},initColorPicker:function(){"use strict";var r=this,e=r.container.find(".color-picker-hex"),t={},i=e.data("field");_.isUndefined(i)||_.isUndefined(r.params.fields[i])||_.isUndefined(r.params.fields[i].palettes)||!_.isObject(r.params.fields[i].palettes)||(t.palettes=r.params.fields[i].palettes),t.change=function(e,t){var i=jQuery(e.target),n=i.closest(".repeater-row").data("row"),a=r.getValue();a[n][i.data("field")]=t.color.toString(),r.setValue(a,!0)},0!==e.length&&e.wpColorPicker(t)},initSelect:function(e,t){"use strict";var i,n,a=this,r=e.container.find(".repeater-field select"),s={};0!==r.length&&(i=r.data("field"),"undefed"!==(n=jQuery(r).data("multiple"))&&jQuery.isNumeric(n)&&1<(n=parseInt(n,10))&&(s.maximumSelectionLength=n),(t=t||{})[i]=t[i]||"",jQuery(r).selectWoo(s).val(t[i]||jQuery(r).val()),this.container.on("change",".repeater-field select",function(e){var t=jQuery(e.target),i=t.closest(".repeater-row").data("row"),n=a.getValue();n[i][t.data("field")]=jQuery(this).val(),a.setValue(n)}))}}),wp.customize.controlConstructor["kirki-slider"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this,t="postMessage"===e.setting.transport?"mousemove change":"change",i=e.container.find('input[type="range"]'),n=e.container.find('input[type="text"]'),a=e.setting._value;n.attr("value",a),i.on("mousemove change",function(){n.attr("value",i.val())}),i.on(t,function(){e.setting.set(i.val())}),n.on("input paste change",function(){i.attr("value",n.val()),e.setting.set(n.val())}),e.container.find(".slider-reset").on("click",function(){n.attr("value",e.params.default),i.attr("value",e.params.default),e.setting.set(n.val())})}}),wp.customize.controlConstructor["kirki-sortable"]=wp.customize.Control.extend({ready:function(){"use strict";var e=this;jQuery(e.container.find("ul.sortable").first()).sortable({update:function(){e.setting.set(e.getNewVal())}}).disableSelection().find("li").each(function(){jQuery(this).find("i.visibility").click(function(){jQuery(this).toggleClass("dashicons-visibility-faint").parents("li:eq(0)").toggleClass("invisible")})}).click(function(){e.setting.set(e.getNewVal())})},getNewVal:function(){var e=jQuery(this.container.find("li")),t=[];return _.each(e,function(e){jQuery(e).hasClass("invisible")||t.push(jQuery(e).data("value"))}),t}}),wp.customize.controlConstructor["kirki-switch"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){"use strict";var e=this,t=e.setting._value;this.container.on("change","input",function(){t=!!jQuery(this).is(":checked"),e.setting.set(t)})}}),wp.customize.controlConstructor["kirki-toggle"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){var e=this,t=e.setting._value;this.container.on("change","input",function(){t=!!jQuery(this).is(":checked"),e.setting.set(t)})}}),wp.customize.controlConstructor["kirki-typography"]=wp.customize.kirkiDynamicControl.extend({initKirkiControl:function(){"use strict";var e,t=this,i=t.setting._value;t.renderFontSelector(),t.renderBackupFontSelector(),t.renderVariantSelector(),void 0!==t.params.default["font-size"]&&this.container.on("change keyup paste",".font-size input",function(){t.saveValue("font-size",jQuery(this).val())}),void 0!==t.params.default["line-height"]&&this.container.on("change keyup paste",".line-height input",function(){t.saveValue("line-height",jQuery(this).val())}),void 0!==t.params.default["margin-top"]&&this.container.on("change keyup paste",".margin-top input",function(){t.saveValue("margin-top",jQuery(this).val())}),void 0!==t.params.default["margin-bottom"]&&this.container.on("change keyup paste",".margin-bottom input",function(){t.saveValue("margin-bottom",jQuery(this).val())}),void 0!==t.params.default["letter-spacing"]&&(i["letter-spacing"]=jQuery.isNumeric(i["letter-spacing"])?i["letter-spacing"]+"px":i["letter-spacing"],this.container.on("change keyup paste",".letter-spacing input",function(){i["letter-spacing"]=jQuery.isNumeric(jQuery(this).val())?jQuery(this).val()+"px":jQuery(this).val(),t.saveValue("letter-spacing",i["letter-spacing"])})),void 0!==t.params.default["word-spacing"]&&this.container.on("change keyup paste",".word-spacing input",function(){t.saveValue("word-spacing",jQuery(this).val())}),void 0!==t.params.default["text-align"]&&this.container.on("change",".text-align input",function(){t.saveValue("text-align",jQuery(this).val())}),void 0!==t.params.default["text-transform"]&&jQuery(t.selector+" .text-transform select").selectWoo().on("change",function(){t.saveValue("text-transform",jQuery(this).val())}),void 0!==t.params.default["text-decoration"]&&jQuery(t.selector+" .text-decoration select").selectWoo().on("change",function(){t.saveValue("text-decoration",jQuery(this).val())}),void 0!==t.params.default.color&&(e=this.container.find(".kirki-color-control")).wpColorPicker({change:function(){setTimeout(function(){t.saveValue("color",e.val())},100)}})},renderFontSelector:function(){var e,t,i=this,n=i.selector+" .font-family select",a=[],r=[],s=[],o=i.setting._value,c=i.getFonts();_.isUndefined(c.standard)||_.each(c.standard,function(e){r.push({id:e.family.replace(/"/g,"'"),text:e.label})}),_.isUndefined(c.google)||_.each(c.google,function(e){s.push({id:e.family,text:e.family})}),t={},_.isUndefined(i.params)||_.isUndefined(i.params.choices)||_.isUndefined(i.params.choices.fonts)||_.isUndefined(i.params.choices.fonts.families)||(t=i.params.choices.fonts.families),a=jQuery.extend({},t,{default:{text:kirkiL10n.defaultCSSValues,children:[{id:"",text:kirkiL10n.defaultBrowserFamily},{id:"initial",text:"initial"},{id:"inherit",text:"inherit"}]},standard:{text:kirkiL10n.standardFonts,children:r},google:{text:kirkiL10n.googleFonts,children:s}}),kirkiL10n.isScriptDebug&&(console.info('Kirki Debug: Font families for control "'+i.id+'":'),console.info(a)),a=_.values(a),e=jQuery(n).selectWoo({data:a}),(o["font-family"]||""===o["font-family"])&&(o["font-family"]=kirki.util.parseHtmlEntities(o["font-family"].replace(/'/g,'"')),e.val(o["font-family"]).trigger("change")),e.on("change",function(){i.saveValue("font-family",jQuery(this).val()),i.renderBackupFontSelector(),i.renderVariantSelector()})},renderBackupFontSelector:function(){var e,t=this,i=t.selector+" .font-backup select",n=[],a=t.setting._value,r=a["font-family"],s=t.getFonts();(_.isUndefined(a["font-backup"])||null===a["font-backup"])&&(a["font-backup"]=""),"inherit"!==r&&"initial"!==r&&"google"===kirki.util.webfonts.getFontType(r)?(jQuery(t.selector+" .font-backup").show(),_.isUndefined(s.standard)||_.each(s.standard,function(e){n.push({id:e.family.replace(/"/g,"'"),text:e.label})}),e=jQuery(i).selectWoo({data:n}),void 0!==a["font-backup"]&&e.val(a["font-backup"].replace(/'/g,'"')).trigger("change"),e.on("change",function(){t.saveValue("font-backup",jQuery(this).val())})):jQuery(t.selector+" .font-backup").hide()},renderVariantSelector:function(){var e,t,i,n=this,a=n.setting._value,r=a["font-family"],s=n.selector+" .variant select",o=[],c=!1,l=kirki.util.webfonts.getFontType(r),u=["","regular","italic","700","700italic"];if("google"===l&&(u=kirki.util.webfonts.google.getVariants(r)),_.isUndefined(n.params)||_.isUndefined(n.params.choices)||_.isUndefined(n.params.choices.fonts)||_.isUndefined(n.params.choices.fonts.variants)||_.isUndefined(n.params.choices.fonts.variants[r])||(u=n.params.choices.fonts.variants[r]),kirkiL10n.isScriptDebug&&(console.info('Kirki Debug: Font variants for font-family "'+r+'":'),console.info(u)),"inherit"!==r&&"initial"!==r&&""!==r||(a.variant="inherit",u=[""],jQuery(n.selector+" .variant").hide()),u.length<=1)return jQuery(n.selector+" .variant").hide(),a.variant=u[0],n.saveValue("variant",a.variant),i=""!==a.variant&&a.variant?(e=_.isString(a.variant)?a.variant.match(/\d/g):"400",e=_.isObject(e)?e.join(""):"400",a.variant&&-1!==a.variant.indexOf("italic")?"italic":"normal"):e="",n.saveValue("font-weight",e),void n.saveValue("font-style",i);jQuery(n.selector+" .font-backup").show(),jQuery(n.selector+" .variant").show(),_.each(u,function(e){a.variant===e&&(c=!0),o.push({id:e,text:e})}),c||(a.variant="regular"),jQuery(s).hasClass("select2-hidden-accessible")&&(jQuery(s).selectWoo("destroy"),jQuery(s).empty()),(t=jQuery(s).selectWoo({data:o})).val(a.variant).trigger("change"),t.on("change",function(){n.saveValue("variant",jQuery(this).val()),"string"!=typeof a.variant&&(a.variant=u[0]),e=_.isString(a.variant)?a.variant.match(/\d/g):"400",e=_.isObject(e)?e.join(""):"400",i=-1!==a.variant.indexOf("italic")?"italic":"normal",n.saveValue("font-weight",e),n.saveValue("font-style",i)})},getFonts:function(){var e=this,t=kirki.util.webfonts.google.getFonts(),i={},n="alpha",a=0,r={};return _.isEmpty(e.params.choices.fonts.google)?i=kirki.util.webfonts.google.getFonts(n,"",a):"alpha"===e.params.choices.fonts.google[0]||"popularity"===e.params.choices.fonts.google[0]||"trending"===e.params.choices.fonts.google[0]?(n=e.params.choices.fonts.google[0],isNaN(e.params.choices.fonts.google[1])||(a=parseInt(e.params.choices.fonts.google[1],10)),i=kirki.util.webfonts.google.getFonts(n,"",a)):_.each(e.params.choices.fonts.google,function(e){void 0===t[e]||_.isEmpty(t[e])||(i[e]=t[e])}),_.isEmpty(e.params.choices.fonts.standard)?_.each(kirki.util.webfonts.standard.fonts,function(e,t){r[t]={family:e.stack,label:e.label}}):_.each(e.params.choices.fonts.standard,function(e){void 0===kirki.util.webfonts.standard.fonts[e]||_.isEmpty(kirki.util.webfonts.standard.fonts[e])?r[e]={family:e,label:e}:(r[e]={},"undefined"===kirki.util.webfonts.standard.fonts[e].stack||_.isEmpty(kirki.util.webfonts.standard.fonts[e].stack)?r[e].family=i[e]:r[e].family=kirki.util.webfonts.standard.fonts[e].stack,"undefined"===kirki.util.webfonts.standard.fonts[e].label||_.isEmpty(kirki.util.webfonts.standard.fonts[e].label)?_.isEmpty(r[e])||(r[e].label=r[e]):r[e].label=kirki.util.webfonts.standard.fonts[e].label)}),{google:i,standard:r}},saveValue:function(e,t){var i=this.container.find(".typography-hidden-value"),n=this.setting._value;n[e]=t,jQuery(i).attr("value",JSON.stringify(n)).trigger("change"),this.setting.set(n)}}); \ No newline at end of file diff --git a/functions/kirki/controls/php/class-kirki-control-background.php b/functions/kirki/controls/php/class-kirki-control-background.php index af04807..6fcb312 100644 --- a/functions/kirki/controls/php/class-kirki-control-background.php +++ b/functions/kirki/controls/php/class-kirki-control-background.php @@ -7,7 +7,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ diff --git a/functions/kirki/controls/php/class-kirki-control-base.php b/functions/kirki/controls/php/class-kirki-control-base.php index 6e36852..e66b366 100644 --- a/functions/kirki/controls/php/class-kirki-control-base.php +++ b/functions/kirki/controls/php/class-kirki-control-base.php @@ -6,7 +6,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 3.0.12 */ @@ -218,9 +218,6 @@ class Kirki_Control_Base extends WP_Customize_Control { * * Allows the content to be overridden without having to rewrite the wrapper in `$this::render()`. * - * Supports basic input types `text`, `checkbox`, `textarea`, `radio`, `select` and `dropdown-pages`. - * Additional input types such as `email`, `url`, `number`, `hidden` and `date` are supported implicitly. - * * Control content can alternately be rendered in JS. See WP_Customize_Control::print_template(). * * @since 3.4.0 diff --git a/functions/kirki/controls/php/class-kirki-control-checkbox.php b/functions/kirki/controls/php/class-kirki-control-checkbox.php index e66ff45..c15a664 100644 --- a/functions/kirki/controls/php/class-kirki-control-checkbox.php +++ b/functions/kirki/controls/php/class-kirki-control-checkbox.php @@ -7,7 +7,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 3.0.26 */ diff --git a/functions/kirki/controls/php/class-kirki-control-code.php b/functions/kirki/controls/php/class-kirki-control-code.php index 8799ebd..863ff67 100644 --- a/functions/kirki/controls/php/class-kirki-control-code.php +++ b/functions/kirki/controls/php/class-kirki-control-code.php @@ -5,70 +5,43 @@ * Creates a new custom control. * Custom controls accept raw HTML/JS. * - * @package Kirki - * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @package Kirki + * @subpackage Controls + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT - * @since 1.0 + * @since 1.0 */ -// @codingStandardsIgnoreFile Generic.Files.OneClassPerFile.MultipleFound Generic.Classes.DuplicateClassName.Found - // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** - * Show warning if old WordPress. + * Adds a "code" control, alias of the WP_Customize_Code_Editor_Control class. */ -if ( ! class_exists( 'WP_Customize_Code_Editor_Control' ) ) { - /** - * Adds a warning message instead of the control. - */ - class Kirki_Control_Code extends Kirki_Control_Base { - - /** - * The message. - * - * @since 3.0.21 - */ - protected function content_template() { - ?> - - - - json['required'] = $this->required; - } + // Required. + $this->json['required'] = $this->required; } } diff --git a/functions/kirki/controls/php/class-kirki-control-color-palette.php b/functions/kirki/controls/php/class-kirki-control-color-palette.php index 29f823e..71825b5 100644 --- a/functions/kirki/controls/php/class-kirki-control-color-palette.php +++ b/functions/kirki/controls/php/class-kirki-control-color-palette.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.6 */ diff --git a/functions/kirki/controls/php/class-kirki-control-color.php b/functions/kirki/controls/php/class-kirki-control-color.php index b8a7721..211fc9b 100644 --- a/functions/kirki/controls/php/class-kirki-control-color.php +++ b/functions/kirki/controls/php/class-kirki-control-color.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ diff --git a/functions/kirki/controls/php/class-kirki-control-cropped-image.php b/functions/kirki/controls/php/class-kirki-control-cropped-image.php index 29603be..c80c6ed 100644 --- a/functions/kirki/controls/php/class-kirki-control-cropped-image.php +++ b/functions/kirki/controls/php/class-kirki-control-cropped-image.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 3.0.23 */ diff --git a/functions/kirki/controls/php/class-kirki-control-custom.php b/functions/kirki/controls/php/class-kirki-control-custom.php index 68a168e..0640d47 100644 --- a/functions/kirki/controls/php/class-kirki-control-custom.php +++ b/functions/kirki/controls/php/class-kirki-control-custom.php @@ -7,7 +7,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ diff --git a/functions/kirki/controls/php/class-kirki-control-dashicons.php b/functions/kirki/controls/php/class-kirki-control-dashicons.php index 85f46e2..ffaff92 100644 --- a/functions/kirki/controls/php/class-kirki-control-dashicons.php +++ b/functions/kirki/controls/php/class-kirki-control-dashicons.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.4 */ diff --git a/functions/kirki/controls/php/class-kirki-control-date.php b/functions/kirki/controls/php/class-kirki-control-date.php index 4d1e8e4..ccd7eb4 100644 --- a/functions/kirki/controls/php/class-kirki-control-date.php +++ b/functions/kirki/controls/php/class-kirki-control-date.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2 */ diff --git a/functions/kirki/controls/php/class-kirki-control-dimension.php b/functions/kirki/controls/php/class-kirki-control-dimension.php index 6d5f826..6cf5bfd 100644 --- a/functions/kirki/controls/php/class-kirki-control-dimension.php +++ b/functions/kirki/controls/php/class-kirki-control-dimension.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.0 */ @@ -35,7 +35,9 @@ class Kirki_Control_Dimension extends Kirki_Control_Base { public function enqueue() { parent::enqueue(); wp_localize_script( - 'kirki-script', 'dimensionkirkiL10n', array( + 'kirki-script', + 'dimensionkirkiL10n', + array( 'invalid-value' => esc_html__( 'Invalid Value', 'kirki' ), ) ); diff --git a/functions/kirki/controls/php/class-kirki-control-dimensions.php b/functions/kirki/controls/php/class-kirki-control-dimensions.php index 9274bb9..e6afc2c 100644 --- a/functions/kirki/controls/php/class-kirki-control-dimensions.php +++ b/functions/kirki/controls/php/class-kirki-control-dimensions.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.1 */ diff --git a/functions/kirki/controls/php/class-kirki-control-editor.php b/functions/kirki/controls/php/class-kirki-control-editor.php index a947692..dcf2dcb 100644 --- a/functions/kirki/controls/php/class-kirki-control-editor.php +++ b/functions/kirki/controls/php/class-kirki-control-editor.php @@ -6,7 +6,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ diff --git a/functions/kirki/controls/php/class-kirki-control-fontawesome.php b/functions/kirki/controls/php/class-kirki-control-fontawesome.php index 04cc038..786c4cd 100644 --- a/functions/kirki/controls/php/class-kirki-control-fontawesome.php +++ b/functions/kirki/controls/php/class-kirki-control-fontawesome.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ @@ -39,7 +39,7 @@ class Kirki_Control_FontAwesome extends Kirki_Control_Base { ob_start(); $json_path = wp_normalize_path( Kirki::$path . '/assets/vendor/fontawesome/fontawesome.json' ); - include $json_path; + include $json_path; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude $font_awesome_json = ob_get_clean(); wp_localize_script( 'kirki-script', 'fontAwesomeJSON', $font_awesome_json ); diff --git a/functions/kirki/controls/php/class-kirki-control-generic.php b/functions/kirki/controls/php/class-kirki-control-generic.php index b26620a..4736747 100644 --- a/functions/kirki/controls/php/class-kirki-control-generic.php +++ b/functions/kirki/controls/php/class-kirki-control-generic.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.0 */ diff --git a/functions/kirki/controls/php/class-kirki-control-image.php b/functions/kirki/controls/php/class-kirki-control-image.php index 6051e86..6c51930 100644 --- a/functions/kirki/controls/php/class-kirki-control-image.php +++ b/functions/kirki/controls/php/class-kirki-control-image.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 3.0.0 */ diff --git a/functions/kirki/controls/php/class-kirki-control-multicheck.php b/functions/kirki/controls/php/class-kirki-control-multicheck.php index 32593ac..e49735a 100644 --- a/functions/kirki/controls/php/class-kirki-control-multicheck.php +++ b/functions/kirki/controls/php/class-kirki-control-multicheck.php @@ -7,7 +7,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ diff --git a/functions/kirki/controls/php/class-kirki-control-multicolor.php b/functions/kirki/controls/php/class-kirki-control-multicolor.php index 351bc00..fd0ea5a 100644 --- a/functions/kirki/controls/php/class-kirki-control-multicolor.php +++ b/functions/kirki/controls/php/class-kirki-control-multicolor.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/controls/php/class-kirki-control-number.php b/functions/kirki/controls/php/class-kirki-control-number.php index 137f85c..f7c1c58 100644 --- a/functions/kirki/controls/php/class-kirki-control-number.php +++ b/functions/kirki/controls/php/class-kirki-control-number.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ diff --git a/functions/kirki/controls/php/class-kirki-control-palette.php b/functions/kirki/controls/php/class-kirki-control-palette.php index dfafc4e..7f6ad65 100644 --- a/functions/kirki/controls/php/class-kirki-control-palette.php +++ b/functions/kirki/controls/php/class-kirki-control-palette.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ diff --git a/functions/kirki/controls/php/class-kirki-control-radio-buttonset.php b/functions/kirki/controls/php/class-kirki-control-radio-buttonset.php index eca4e06..8a29399 100644 --- a/functions/kirki/controls/php/class-kirki-control-radio-buttonset.php +++ b/functions/kirki/controls/php/class-kirki-control-radio-buttonset.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ diff --git a/functions/kirki/controls/php/class-kirki-control-radio-image.php b/functions/kirki/controls/php/class-kirki-control-radio-image.php index c6a9f3e..baac56d 100644 --- a/functions/kirki/controls/php/class-kirki-control-radio-image.php +++ b/functions/kirki/controls/php/class-kirki-control-radio-image.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ diff --git a/functions/kirki/controls/php/class-kirki-control-radio.php b/functions/kirki/controls/php/class-kirki-control-radio.php index 2ee1203..fd7a986 100644 --- a/functions/kirki/controls/php/class-kirki-control-radio.php +++ b/functions/kirki/controls/php/class-kirki-control-radio.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ diff --git a/functions/kirki/controls/php/class-kirki-control-repeater.php b/functions/kirki/controls/php/class-kirki-control-repeater.php index c8f4865..d482b75 100644 --- a/functions/kirki/controls/php/class-kirki-control-repeater.php +++ b/functions/kirki/controls/php/class-kirki-control-repeater.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.0 */ @@ -108,13 +108,11 @@ class Kirki_Control_Repeater extends Kirki_Control_Base { case 'image': case 'cropped_image': case 'upload': - // We add it to the list of fields that need some extra filtering/processing. $media_fields_to_filter[ $key ] = true; break; case 'dropdown-pages': - // If the field is a dropdown-pages field then add it to args. $dropdown = wp_dropdown_pages( array( @@ -127,7 +125,7 @@ class Kirki_Control_Repeater extends Kirki_Control_Base { ); // Hackily add in the data link parameter. - $dropdown = str_replace( 'get_link(), $dropdown ); // phpcs:ignore Generic.Formatting.MultipleStatementAlignment.NotSameWarning + $dropdown = str_replace( 'get_link(), $dropdown ); // phpcs:ignore Generic.Formatting.MultipleStatementAlignment $args['fields'][ $key ]['dropdown'] = $dropdown; break; } @@ -417,7 +415,7 @@ class Kirki_Control_Repeater extends Kirki_Control_Base { - + <# if ( field.default ) { #> diff --git a/functions/kirki/controls/php/class-kirki-control-select.php b/functions/kirki/controls/php/class-kirki-control-select.php index b4181e4..1c0132a 100644 --- a/functions/kirki/controls/php/class-kirki-control-select.php +++ b/functions/kirki/controls/php/class-kirki-control-select.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ diff --git a/functions/kirki/controls/php/class-kirki-control-slider.php b/functions/kirki/controls/php/class-kirki-control-slider.php index c94bfa4..234c6de 100644 --- a/functions/kirki/controls/php/class-kirki-control-slider.php +++ b/functions/kirki/controls/php/class-kirki-control-slider.php @@ -6,7 +6,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ @@ -37,7 +37,8 @@ class Kirki_Control_Slider extends Kirki_Control_Base { public function to_json() { parent::to_json(); $this->json['choices'] = wp_parse_args( - $this->json['choices'], array( + $this->json['choices'], + array( 'min' => '0', 'max' => '100', 'step' => '1', diff --git a/functions/kirki/controls/php/class-kirki-control-sortable.php b/functions/kirki/controls/php/class-kirki-control-sortable.php index c328a16..de26203 100644 --- a/functions/kirki/controls/php/class-kirki-control-sortable.php +++ b/functions/kirki/controls/php/class-kirki-control-sortable.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ diff --git a/functions/kirki/controls/php/class-kirki-control-switch.php b/functions/kirki/controls/php/class-kirki-control-switch.php index f04ebc2..eaa0aa1 100644 --- a/functions/kirki/controls/php/class-kirki-control-switch.php +++ b/functions/kirki/controls/php/class-kirki-control-switch.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ diff --git a/functions/kirki/controls/php/class-kirki-control-toggle.php b/functions/kirki/controls/php/class-kirki-control-toggle.php index d755c9c..9751d0b 100644 --- a/functions/kirki/controls/php/class-kirki-control-toggle.php +++ b/functions/kirki/controls/php/class-kirki-control-toggle.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ diff --git a/functions/kirki/controls/php/class-kirki-control-typography.php b/functions/kirki/controls/php/class-kirki-control-typography.php index 4786c4f..58d600e 100644 --- a/functions/kirki/controls/php/class-kirki-control-typography.php +++ b/functions/kirki/controls/php/class-kirki-control-typography.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.0 */ @@ -94,12 +94,6 @@ class Kirki_Control_Typography extends Kirki_Control_Base { <# } #> - - - - - - <# } #> <# if ( ! _.isUndefined( data.default['font-size'] ) ) { #> diff --git a/functions/kirki/controls/php/class-kirki-control-upload.php b/functions/kirki/controls/php/class-kirki-control-upload.php index 365bf69..4c72a4b 100644 --- a/functions/kirki/controls/php/class-kirki-control-upload.php +++ b/functions/kirki/controls/php/class-kirki-control-upload.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 3.0.23 */ diff --git a/functions/kirki/controls/php/class-kirki-settings-repeater-setting.php b/functions/kirki/controls/php/class-kirki-settings-repeater-setting.php index 69eccea..0c9b55d 100644 --- a/functions/kirki/controls/php/class-kirki-settings-repeater-setting.php +++ b/functions/kirki/controls/php/class-kirki-settings-repeater-setting.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.0 */ diff --git a/functions/kirki/controls/views/code.php b/functions/kirki/controls/views/code.php index cb51c1e..e8531ea 100644 --- a/functions/kirki/controls/views/code.php +++ b/functions/kirki/controls/views/code.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 3.0.17 */ diff --git a/functions/kirki/controls/views/color.php b/functions/kirki/controls/views/color.php index 75dec2f..97afa9d 100644 --- a/functions/kirki/controls/views/color.php +++ b/functions/kirki/controls/views/color.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 3.0.17 */ diff --git a/functions/kirki/controls/views/generic.php b/functions/kirki/controls/views/generic.php index 38a224d..da51083 100644 --- a/functions/kirki/controls/views/generic.php +++ b/functions/kirki/controls/views/generic.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 3.0.17 */ diff --git a/functions/kirki/controls/views/image.php b/functions/kirki/controls/views/image.php index b440116..5c0a5a7 100644 --- a/functions/kirki/controls/views/image.php +++ b/functions/kirki/controls/views/image.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 3.0.34 */ diff --git a/functions/kirki/controls/views/number.php b/functions/kirki/controls/views/number.php index bb238ef..e37188d 100644 --- a/functions/kirki/controls/views/number.php +++ b/functions/kirki/controls/views/number.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 3.0.27 */ diff --git a/functions/kirki/controls/views/radio.php b/functions/kirki/controls/views/radio.php index 59c9699..a3a8a76 100644 --- a/functions/kirki/controls/views/radio.php +++ b/functions/kirki/controls/views/radio.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 3.0.17 */ diff --git a/functions/kirki/controls/views/select.php b/functions/kirki/controls/views/select.php index 96269e7..d2ddf96 100644 --- a/functions/kirki/controls/views/select.php +++ b/functions/kirki/controls/views/select.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 3.0.17 */ diff --git a/functions/kirki/controls/views/textarea.php b/functions/kirki/controls/views/textarea.php index 30f19db..f2808b0 100644 --- a/functions/kirki/controls/views/textarea.php +++ b/functions/kirki/controls/views/textarea.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 3.0.17 */ diff --git a/functions/kirki/core/class-kirki-config.php b/functions/kirki/core/class-kirki-config.php index 3c93e84..7147337 100644 --- a/functions/kirki/core/class-kirki-config.php +++ b/functions/kirki/core/class-kirki-config.php @@ -4,8 +4,8 @@ * * @package Kirki * @category Core - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT */ diff --git a/functions/kirki/core/class-kirki-control.php b/functions/kirki/core/class-kirki-control.php index ccf36b8..1a33746 100644 --- a/functions/kirki/core/class-kirki-control.php +++ b/functions/kirki/core/class-kirki-control.php @@ -4,8 +4,8 @@ * * @package Kirki * @category Core - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT */ diff --git a/functions/kirki/core/class-kirki-field.php b/functions/kirki/core/class-kirki-field.php index 68cde8f..b5b9621 100644 --- a/functions/kirki/core/class-kirki-field.php +++ b/functions/kirki/core/class-kirki-field.php @@ -4,8 +4,8 @@ * * @package Kirki * @category Core - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ diff --git a/functions/kirki/core/class-kirki-helper.php b/functions/kirki/core/class-kirki-helper.php index 7fa43db..b71ae4b 100644 --- a/functions/kirki/core/class-kirki-helper.php +++ b/functions/kirki/core/class-kirki-helper.php @@ -4,8 +4,8 @@ * * @package Kirki * @category Core - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ @@ -34,8 +34,16 @@ class Kirki_Helper { return array_replace_recursive( $array, $array1 ); } - // Handle the arguments, merge one by one. - $args = func_get_args(); + /** + * Handle the arguments, merge one by one. + * + * In PHP 7 func_get_args() changed the way it behaves but this doesn't mean anything in this case + * sinc ethis method is only used when the array_replace_recursive() function doesn't exist + * and that was introduced in PHP v5.3. + * + * Once WordPress-Core raises its minimum requirements we''' be able to remove this fallback completely. + */ + $args = func_get_args(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue $array = $args[0]; if ( ! is_array( $array ) ) { return $array; @@ -121,7 +129,7 @@ class Kirki_Helper { global $wp_filesystem; if ( empty( $wp_filesystem ) ) { - require_once wp_normalize_path( ABSPATH . '/wp-admin/includes/file.php' ); + require_once wp_normalize_path( ABSPATH . '/wp-admin/includes/file.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude WP_Filesystem( $credentials ); } @@ -247,7 +255,8 @@ class Kirki_Helper { $post_types = get_post_types( array( 'public' => true, - ), 'objects' + ), + 'objects' ); // Build the array. @@ -411,7 +420,7 @@ class Kirki_Helper { return $value1 !== $value2; } if ( ( '!=' === $operator || 'not equal' === $operator ) ) { - return $value1 != $value2; // WPCS: loose comparison ok. + return $value1 != $value2; // phpcs:ignore WordPress.PHP.StrictComparisons } if ( ( '>=' === $operator || 'greater or equal' === $operator || 'equal or greater' === $operator ) ) { return $value2 >= $value1; @@ -428,20 +437,20 @@ class Kirki_Helper { 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.MissingTrueStrict + 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.MissingTrueStrict + 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.MissingTrueStrict + return in_array( $value1, $value2 ); // phpcs:ignore WordPress.PHP.StrictInArray } return ( false !== strrpos( $value1, $value2 ) || false !== strpos( $value2, $value1 ) ); } - return $value1 == $value2; // WPCS: loose comparison ok. + return $value1 == $value2; // phpcs:ignore WordPress.PHP.StrictComparisons } } diff --git a/functions/kirki/core/class-kirki-init.php b/functions/kirki/core/class-kirki-init.php index 212aabb..af31f83 100644 --- a/functions/kirki/core/class-kirki-init.php +++ b/functions/kirki/core/class-kirki-init.php @@ -4,8 +4,8 @@ * * @package Kirki * @category Core - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ @@ -147,7 +147,8 @@ class Kirki_Init { } $skip_control_types = apply_filters( - 'kirki_control_types_exclude', array( + 'kirki_control_types_exclude', + array( 'Kirki_Control_Repeater', 'WP_Customize_Control', ) diff --git a/functions/kirki/core/class-kirki-l10n.php b/functions/kirki/core/class-kirki-l10n.php index 6dd0c05..652b917 100644 --- a/functions/kirki/core/class-kirki-l10n.php +++ b/functions/kirki/core/class-kirki-l10n.php @@ -4,8 +4,8 @@ * * @package Kirki * @category Core - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ @@ -110,7 +110,7 @@ class Kirki_L10n { public function override_load_textdomain( $override, $domain, $mofile ) { global $l10n; if ( isset( $l10n[ $this->get_theme_textdomain() ] ) ) { - $l10n['kirki'] = $l10n[ $this->get_theme_textdomain() ]; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited + $l10n['kirki'] = $l10n[ $this->get_theme_textdomain() ]; // phpcs:ignore WordPress.WP.GlobalVariablesOverride } // Check if the domain is "kirki". diff --git a/functions/kirki/core/class-kirki-modules.php b/functions/kirki/core/class-kirki-modules.php index c9a61c6..ff90240 100644 --- a/functions/kirki/core/class-kirki-modules.php +++ b/functions/kirki/core/class-kirki-modules.php @@ -4,8 +4,8 @@ * * @package Kirki * @category Core - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 3.0.0 */ @@ -56,7 +56,8 @@ class Kirki_Modules { */ public function setup_default_modules() { self::$modules = apply_filters( - 'kirki_modules', array( + 'kirki_modules', + array( 'css' => 'Kirki_Modules_CSS', 'css-vars' => 'Kirki_Modules_CSS_Vars', 'customizer-styling' => 'Kirki_Modules_Customizer_Styling', @@ -72,6 +73,7 @@ class Kirki_Modules { 'webfont-loader' => 'Kirki_Modules_Webfont_Loader', 'preset' => 'Kirki_Modules_Preset', 'gutenberg' => 'Kirki_Modules_Gutenberg', + 'telemetry' => 'Kirki_Modules_Telemetry', ) ); } diff --git a/functions/kirki/core/class-kirki-panel.php b/functions/kirki/core/class-kirki-panel.php index 72c1714..d78428a 100644 --- a/functions/kirki/core/class-kirki-panel.php +++ b/functions/kirki/core/class-kirki-panel.php @@ -4,8 +4,8 @@ * * @package Kirki * @category Core - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ diff --git a/functions/kirki/core/class-kirki-sanitize-values.php b/functions/kirki/core/class-kirki-sanitize-values.php index de114c0..1a74b5c 100644 --- a/functions/kirki/core/class-kirki-sanitize-values.php +++ b/functions/kirki/core/class-kirki-sanitize-values.php @@ -5,8 +5,8 @@ * * @package Kirki * @category Core - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ diff --git a/functions/kirki/core/class-kirki-section.php b/functions/kirki/core/class-kirki-section.php index f723de4..8ebf3fc 100644 --- a/functions/kirki/core/class-kirki-section.php +++ b/functions/kirki/core/class-kirki-section.php @@ -4,8 +4,8 @@ * * @package Kirki * @category Core - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ diff --git a/functions/kirki/core/class-kirki-sections.php b/functions/kirki/core/class-kirki-sections.php index e073452..44b041a 100644 --- a/functions/kirki/core/class-kirki-sections.php +++ b/functions/kirki/core/class-kirki-sections.php @@ -4,8 +4,8 @@ * * @package Kirki * @category Core - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 3.0.17 */ diff --git a/functions/kirki/core/class-kirki-settings.php b/functions/kirki/core/class-kirki-settings.php index cae5909..daf0560 100644 --- a/functions/kirki/core/class-kirki-settings.php +++ b/functions/kirki/core/class-kirki-settings.php @@ -4,8 +4,8 @@ * * @package Kirki * @category Core - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ @@ -110,7 +110,9 @@ class Kirki_Settings { $this->wp_customize->add_setting( new $classname( - $this->wp_customize, $setting, array( + $this->wp_customize, + $setting, + array( 'default' => $default, 'type' => $type, 'capability' => $capability, @@ -132,7 +134,8 @@ class Kirki_Settings { // Apply the kirki_setting_types filter. $this->setting_types = apply_filters( - 'kirki_setting_types', array( + 'kirki_setting_types', + array( 'default' => 'WP_Customize_Setting', 'repeater' => 'Kirki_Settings_Repeater_Setting', 'user_meta' => 'Kirki_Setting_User_Meta', diff --git a/functions/kirki/core/class-kirki-toolkit.php b/functions/kirki/core/class-kirki-toolkit.php index 3a45fa6..f60e475 100644 --- a/functions/kirki/core/class-kirki-toolkit.php +++ b/functions/kirki/core/class-kirki-toolkit.php @@ -4,8 +4,8 @@ * * @package Kirki * @category Core - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ diff --git a/functions/kirki/core/class-kirki-util.php b/functions/kirki/core/class-kirki-util.php index 4fd41d3..a988a35 100644 --- a/functions/kirki/core/class-kirki-util.php +++ b/functions/kirki/core/class-kirki-util.php @@ -4,8 +4,8 @@ * * @package Kirki * @category Core - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 3.0.9 */ @@ -36,7 +36,7 @@ class Kirki_Util { public static function is_plugin() { $is_plugin = false; if ( ! function_exists( 'get_plugins' ) ) { - require_once ABSPATH . 'wp-admin/includes/plugin.php'; + require_once ABSPATH . 'wp-admin/includes/plugin.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude } // Get all plugins. @@ -55,7 +55,7 @@ class Kirki_Util { } // Make sure the is_plugins_loaded function is loaded. - include_once ABSPATH . 'wp-admin/includes/plugin.php'; + include_once ABSPATH . 'wp-admin/includes/plugin.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude // Extra logic in case the plugin is installed but not activated. if ( $_plugin && is_plugin_inactive( $_plugin ) ) { diff --git a/functions/kirki/core/class-kirki-values.php b/functions/kirki/core/class-kirki-values.php index b94e347..280ca7e 100644 --- a/functions/kirki/core/class-kirki-values.php +++ b/functions/kirki/core/class-kirki-values.php @@ -7,8 +7,8 @@ * * @package Kirki * @category Core - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ diff --git a/functions/kirki/core/class-kirki.php b/functions/kirki/core/class-kirki.php index bda269e..e205beb 100644 --- a/functions/kirki/core/class-kirki.php +++ b/functions/kirki/core/class-kirki.php @@ -6,8 +6,8 @@ * * @package Kirki * @category Core - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ diff --git a/functions/kirki/core/dynamic-css.php b/functions/kirki/core/dynamic-css.php deleted file mode 100644 index 6e6f254..0000000 --- a/functions/kirki/core/dynamic-css.php +++ /dev/null @@ -1,39 +0,0 @@ - $args ) { - if ( true === $args['disable_output'] ) { - continue; - } - - $styles = Kirki_Modules_CSS::loop_controls( $config_id ); - $styles = apply_filters( "kirki_{$config_id}_dynamic_css", $styles ); - - // Some people put weird stuff in their CSS, KSES tends to be greedy. - $styles = str_replace( '<=', '<=', $styles ); - - $styles = wp_kses_post( $styles ); - - // Why both KSES and strip_tags? Because we just added some '>'. - // kses replaces lone '>' with >. - // @codingStandardsIgnoreLine WordPress.WP.AlternativeFunctions.strip_tags_strip_tags WordPress.Security.EscapeOutput.OutputNotEscaped - echo strip_tags( str_replace( '>', '>', $styles ) ); -} diff --git a/functions/kirki/deprecated/classes.php b/functions/kirki/deprecated/classes.php index abfd7a7..6bd6e64 100644 --- a/functions/kirki/deprecated/classes.php +++ b/functions/kirki/deprecated/classes.php @@ -1,5 +1,5 @@ choices[ $page->ID ] = $page->post_title; + } + } +} diff --git a/functions/kirki/field/class-kirki-field-editor.php b/functions/kirki/field/class-kirki-field-editor.php index c8a42ce..47e0404 100644 --- a/functions/kirki/field/class-kirki-field-editor.php +++ b/functions/kirki/field/class-kirki-field-editor.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-fontawesome.php b/functions/kirki/field/class-kirki-field-fontawesome.php index dca4aec..4236401 100644 --- a/functions/kirki/field/class-kirki-field-fontawesome.php +++ b/functions/kirki/field/class-kirki-field-fontawesome.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 3.0.0 */ diff --git a/functions/kirki/field/class-kirki-field-generic.php b/functions/kirki/field/class-kirki-field-generic.php index 8e7d85d..bec2172 100644 --- a/functions/kirki/field/class-kirki-field-generic.php +++ b/functions/kirki/field/class-kirki-field-generic.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.3.2 */ diff --git a/functions/kirki/field/class-kirki-field-group-title.php b/functions/kirki/field/class-kirki-field-group-title.php index f00aa67..9b2d81f 100644 --- a/functions/kirki/field/class-kirki-field-group-title.php +++ b/functions/kirki/field/class-kirki-field-group-title.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-image.php b/functions/kirki/field/class-kirki-field-image.php index a26741f..3fb8a6e 100644 --- a/functions/kirki/field/class-kirki-field-image.php +++ b/functions/kirki/field/class-kirki-field-image.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-kirki-generic.php b/functions/kirki/field/class-kirki-field-kirki-generic.php index 2f684ee..4089d91 100644 --- a/functions/kirki/field/class-kirki-field-kirki-generic.php +++ b/functions/kirki/field/class-kirki-field-kirki-generic.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-link.php b/functions/kirki/field/class-kirki-field-link.php index 65c807e..d2a6044 100644 --- a/functions/kirki/field/class-kirki-field-link.php +++ b/functions/kirki/field/class-kirki-field-link.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-multicheck.php b/functions/kirki/field/class-kirki-field-multicheck.php index e5a236b..bfd7db8 100644 --- a/functions/kirki/field/class-kirki-field-multicheck.php +++ b/functions/kirki/field/class-kirki-field-multicheck.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-multicolor.php b/functions/kirki/field/class-kirki-field-multicolor.php index 80a15d1..582c1e4 100644 --- a/functions/kirki/field/class-kirki-field-multicolor.php +++ b/functions/kirki/field/class-kirki-field-multicolor.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-number.php b/functions/kirki/field/class-kirki-field-number.php index 792d2c9..80e00c6 100644 --- a/functions/kirki/field/class-kirki-field-number.php +++ b/functions/kirki/field/class-kirki-field-number.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-palette.php b/functions/kirki/field/class-kirki-field-palette.php index 423fa3a..6fd51ac 100644 --- a/functions/kirki/field/class-kirki-field-palette.php +++ b/functions/kirki/field/class-kirki-field-palette.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-preset.php b/functions/kirki/field/class-kirki-field-preset.php index 020d43b..f577908 100644 --- a/functions/kirki/field/class-kirki-field-preset.php +++ b/functions/kirki/field/class-kirki-field-preset.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-radio-buttonset.php b/functions/kirki/field/class-kirki-field-radio-buttonset.php index eb6c7e4..1b8683d 100644 --- a/functions/kirki/field/class-kirki-field-radio-buttonset.php +++ b/functions/kirki/field/class-kirki-field-radio-buttonset.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-radio-image.php b/functions/kirki/field/class-kirki-field-radio-image.php index 3926a2f..43c9939 100644 --- a/functions/kirki/field/class-kirki-field-radio-image.php +++ b/functions/kirki/field/class-kirki-field-radio-image.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-radio.php b/functions/kirki/field/class-kirki-field-radio.php index 887aa6d..673696e 100644 --- a/functions/kirki/field/class-kirki-field-radio.php +++ b/functions/kirki/field/class-kirki-field-radio.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-repeater.php b/functions/kirki/field/class-kirki-field-repeater.php index ec109cc..7336642 100644 --- a/functions/kirki/field/class-kirki-field-repeater.php +++ b/functions/kirki/field/class-kirki-field-repeater.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-select.php b/functions/kirki/field/class-kirki-field-select.php index 3057f61..91f034b 100644 --- a/functions/kirki/field/class-kirki-field-select.php +++ b/functions/kirki/field/class-kirki-field-select.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-select2-multiple.php b/functions/kirki/field/class-kirki-field-select2-multiple.php index a36c29e..9db03df 100644 --- a/functions/kirki/field/class-kirki-field-select2-multiple.php +++ b/functions/kirki/field/class-kirki-field-select2-multiple.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-select2.php b/functions/kirki/field/class-kirki-field-select2.php index 989d600..950b417 100644 --- a/functions/kirki/field/class-kirki-field-select2.php +++ b/functions/kirki/field/class-kirki-field-select2.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-slider.php b/functions/kirki/field/class-kirki-field-slider.php index 74b6d9d..810f4e8 100644 --- a/functions/kirki/field/class-kirki-field-slider.php +++ b/functions/kirki/field/class-kirki-field-slider.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-sortable.php b/functions/kirki/field/class-kirki-field-sortable.php index fccd333..d4612fc 100644 --- a/functions/kirki/field/class-kirki-field-sortable.php +++ b/functions/kirki/field/class-kirki-field-sortable.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.3.2 */ diff --git a/functions/kirki/field/class-kirki-field-spacing.php b/functions/kirki/field/class-kirki-field-spacing.php index e2614a3..4062163 100644 --- a/functions/kirki/field/class-kirki-field-spacing.php +++ b/functions/kirki/field/class-kirki-field-spacing.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-switch.php b/functions/kirki/field/class-kirki-field-switch.php index 1b14742..868aa2f 100644 --- a/functions/kirki/field/class-kirki-field-switch.php +++ b/functions/kirki/field/class-kirki-field-switch.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-text.php b/functions/kirki/field/class-kirki-field-text.php index e4de399..3714bae 100644 --- a/functions/kirki/field/class-kirki-field-text.php +++ b/functions/kirki/field/class-kirki-field-text.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-textarea.php b/functions/kirki/field/class-kirki-field-textarea.php index fc94107..3f462cb 100644 --- a/functions/kirki/field/class-kirki-field-textarea.php +++ b/functions/kirki/field/class-kirki-field-textarea.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-toggle.php b/functions/kirki/field/class-kirki-field-toggle.php index 4cdb9f8..dd84c2b 100644 --- a/functions/kirki/field/class-kirki-field-toggle.php +++ b/functions/kirki/field/class-kirki-field-toggle.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-typography.php b/functions/kirki/field/class-kirki-field-typography.php index e976351..aa64bfb 100644 --- a/functions/kirki/field/class-kirki-field-typography.php +++ b/functions/kirki/field/class-kirki-field-typography.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ @@ -151,7 +151,6 @@ class Kirki_Field_Typography extends Kirki_Field { } break; case 'variant': - // Use 'regular' instead of 400 for font-variant. $value['variant'] = ( 400 === $val || '400' === $val ) ? 'regular' : $val; @@ -205,7 +204,8 @@ class Kirki_Field_Typography extends Kirki_Field { $this->choices = array(); } $this->choices = wp_parse_args( - $this->choices, array( + $this->choices, + array( 'variant' => array(), 'fonts' => array( 'standard' => array(), diff --git a/functions/kirki/field/class-kirki-field-upload.php b/functions/kirki/field/class-kirki-field-upload.php index f8a1860..2f7d72f 100644 --- a/functions/kirki/field/class-kirki-field-upload.php +++ b/functions/kirki/field/class-kirki-field-upload.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/field/class-kirki-field-url.php b/functions/kirki/field/class-kirki-field-url.php index f3f7464..cb9e940 100644 --- a/functions/kirki/field/class-kirki-field-url.php +++ b/functions/kirki/field/class-kirki-field-url.php @@ -4,7 +4,7 @@ * * @package Kirki * @subpackage Controls - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 2.2.7 */ diff --git a/functions/kirki/kirki.php b/functions/kirki/kirki.php index ded38a5..84a8689 100644 --- a/functions/kirki/kirki.php +++ b/functions/kirki/kirki.php @@ -3,18 +3,19 @@ * Plugin Name: Kirki Toolkit * Plugin URI: http://aristath.github.io/kirki * Description: The ultimate WordPress Customizer Toolkit - * Author: Aristeides Stathopoulos + * Author: Ari Stathopoulos (@aristath) * Author URI: http://aristath.github.io - * Version: 3.0.35.3 + * Version: 3.0.36 * Text Domain: kirki - * + * Requires WP: 4.9 + * Requires PHP: 5.3 * GitHub Plugin URI: aristath/kirki * GitHub Plugin URI: https://github.com/aristath/kirki * * @package Kirki * @category Core - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ @@ -30,7 +31,7 @@ if ( class_exists( 'Kirki' ) ) { } // Include the autoloader. -require_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'class-kirki-autoload.php'; +require_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'class-kirki-autoload.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude new Kirki_Autoload(); if ( ! defined( 'KIRKI_PLUGIN_FILE' ) ) { @@ -40,7 +41,7 @@ if ( ! defined( 'KIRKI_PLUGIN_FILE' ) ) { // Define the KIRKI_VERSION constant. if ( ! defined( 'KIRKI_VERSION' ) ) { if ( ! function_exists( 'get_plugin_data' ) ) { - include_once ABSPATH . 'wp-admin/includes/plugin.php'; + include_once ABSPATH . 'wp-admin/includes/plugin.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude } $data = get_plugin_data( KIRKI_PLUGIN_FILE ); $version = ( isset( $data['Version'] ) ) ? $data['Version'] : false; @@ -48,7 +49,7 @@ if ( ! defined( 'KIRKI_VERSION' ) ) { } // Make sure the path is properly set. -Kirki::$path = wp_normalize_path( dirname( __FILE__ ) ); +Kirki::$path = wp_normalize_path( dirname( __FILE__ ) ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride Kirki_Init::set_url(); new Kirki_Controls(); @@ -77,10 +78,10 @@ new Kirki(); new Kirki_L10n(); // Include deprecated functions & methods. -require_once wp_normalize_path( dirname( __FILE__ ) . '/deprecated/deprecated.php' ); +require_once wp_normalize_path( dirname( __FILE__ ) . '/deprecated/deprecated.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude // Include the ariColor library. -require_once wp_normalize_path( dirname( __FILE__ ) . '/lib/class-aricolor.php' ); +require_once wp_normalize_path( dirname( __FILE__ ) . '/lib/class-aricolor.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude // Add an empty config for global fields. Kirki::add_config( '' ); @@ -88,11 +89,11 @@ Kirki::add_config( '' ); $custom_config_path = dirname( __FILE__ ) . '/custom-config.php'; $custom_config_path = wp_normalize_path( $custom_config_path ); if ( file_exists( $custom_config_path ) ) { - require_once $custom_config_path; + require_once $custom_config_path; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude } // Add upgrade notifications. -require_once wp_normalize_path( dirname( __FILE__ ) . '/upgrade-notifications.php' ); +require_once wp_normalize_path( dirname( __FILE__ ) . '/upgrade-notifications.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude /** * To enable tests, add this line to your wp-config.php file (or anywhere alse): @@ -102,5 +103,5 @@ require_once wp_normalize_path( dirname( __FILE__ ) . '/upgrade-notifications.ph * and will only be included in dev versions of the plugin in the github repository. */ if ( defined( 'KIRKI_TEST' ) && true === KIRKI_TEST && file_exists( dirname( __FILE__ ) . '/example.php' ) ) { - include_once dirname( __FILE__ ) . '/example.php'; + include_once dirname( __FILE__ ) . '/example.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude } diff --git a/functions/kirki/lib/class-aricolor.php b/functions/kirki/lib/class-aricolor.php index 714fa57..32191b7 100644 --- a/functions/kirki/lib/class-aricolor.php +++ b/functions/kirki/lib/class-aricolor.php @@ -1,5 +1,5 @@ get_path( 'file' ) ) ) { - - // If the file-write fails, fallback to inline - // and cache the failure so we don't try again immediately. - $this->write_file(); - } - add_action( 'customize_save_after', array( $this, 'write_file' ) ); - } - - /** - * Gets the path of the CSS file and folder in the filesystem. - * - * @access protected - * @since 3.0.0 - * @param string $context Can be "file" or "folder". If empty, returns both as array. - * @return string|array - */ - protected function get_path( $context = '' ) { - $upload_dir = wp_upload_dir(); - $paths = array( - 'file' => wp_normalize_path( $upload_dir['basedir'] . '/kirki-css/styles.css' ), - 'folder' => wp_normalize_path( $upload_dir['basedir'] . '/kirki-css' ), - ); - - if ( 'file' === $context ) { - return $paths['file']; - } - if ( 'folder' === $context ) { - return $paths['folder']; - } - return $paths; - } - - /** - * Gets the URL of the CSS file in the filesystem. - * - * @access public - * @since 3.0.0 - * @return string - */ - public function get_url() { - $upload_dir = wp_upload_dir(); - return esc_url_raw( $upload_dir['baseurl'] . '/kirki-css/styles.css' ); - } - - /** - * Gets the timestamp of the file. - * This will be used as "version" for cache-busting purposes. - * - * @access public - * @since 3.0.0 - * @return integer|false - */ - public function get_timestamp() { - if ( file_exists( $this->get_path( 'file' ) ) ) { - return filemtime( $this->get_path( 'file' ) ); - } - return false; - } - - /** - * Writes the file to disk. - * - * @access public - * @since 3.0.0 - * @return bool - */ - public function write_file() { - $css = array(); - $configs = Kirki::$config; - foreach ( $configs as $config_id => $args ) { - // Get the CSS we want to write. - $css[ $config_id ] = apply_filters( "kirki_{$config_id}_dynamic_css", Kirki_Modules_CSS::loop_controls( $config_id ) ); - } - $css = implode( $css, '' ); - - // If the folder doesn't exist, create it. - if ( ! file_exists( $this->get_path( 'folder' ) ) ) { - wp_mkdir_p( $this->get_path( 'folder' ) ); - } - - $filesystem = $this->get_filesystem(); - $write_file = (bool) $filesystem->put_contents( $this->get_path( 'file' ), $css ); - if ( ! $write_file ) { - $this->fallback = true; - set_transient( 'kirki_css_write_to_file_failed', true, HOUR_IN_SECONDS ); - } - return $write_file; - } - - /** - * Gets the WP_Filesystem object. - * - * @access protected - * @since 3.0.0 - * @return object - */ - protected function get_filesystem() { - - // The WordPress filesystem. - global $wp_filesystem; - - if ( empty( $wp_filesystem ) ) { - require_once wp_normalize_path( ABSPATH . '/wp-admin/includes/file.php' ); - WP_Filesystem(); - } - return $wp_filesystem; - } -} diff --git a/functions/kirki/modules/css/class-kirki-modules-css-generator.php b/functions/kirki/modules/css/class-kirki-modules-css-generator.php index c4fce0d..08fa87f 100644 --- a/functions/kirki/modules/css/class-kirki-modules-css-generator.php +++ b/functions/kirki/modules/css/class-kirki-modules-css-generator.php @@ -5,8 +5,8 @@ * * @package Kirki * @category Core - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ @@ -164,15 +164,15 @@ final class Kirki_Modules_CSS_Generator { // Find the class that will handle the outpout for this field. $classname = 'Kirki_Output'; - $field_output_classes = apply_filters( - "kirki_{$field['kirki_config']}_output_control_classnames", array( - 'kirki-background' => 'Kirki_Output_Field_Background', - 'kirki-dimensions' => 'Kirki_Output_Field_Dimensions', - 'kirki-image' => 'Kirki_Output_Field_Image', - 'kirki-typography' => 'Kirki_Output_Field_Typography', - 'kirki-multicolor' => 'Kirki_Output_Field_Multicolor', - ) + $default_classnames = array( + 'kirki-background' => 'Kirki_Output_Field_Background', + 'kirki-dimensions' => 'Kirki_Output_Field_Dimensions', + 'kirki-image' => 'Kirki_Output_Field_Image', + 'kirki-typography' => 'Kirki_Output_Field_Typography', + 'kirki-multicolor' => 'Kirki_Output_Field_Multicolor', ); + $field_output_classes = apply_filters( 'kirki_output_control_classnames', $default_classnames ); + $field_output_classes = apply_filters( "kirki_{$field['kirki_config']}_output_control_classnames", $field_output_classes ); if ( array_key_exists( self::$field_type, $field_output_classes ) ) { $classname = $field_output_classes[ self::$field_type ]; } @@ -238,7 +238,8 @@ final class Kirki_Modules_CSS_Generator { // Add -webkit-* and -moz-*. if ( is_string( $property ) && in_array( - $property, array( + $property, + array( 'border-radius', 'box-shadow', 'box-sizing', @@ -247,7 +248,8 @@ final class Kirki_Modules_CSS_Generator { 'background-size', 'transition', 'transition-property', - ), true + ), + true ) ) { unset( $css[ $media_query ][ $element ][ $property ] ); $css[ $media_query ][ $element ][ '-webkit-' . $property ] = $value; @@ -257,12 +259,14 @@ final class Kirki_Modules_CSS_Generator { // Add -ms-* and -o-*. if ( is_string( $property ) && in_array( - $property, array( + $property, + array( 'transform', 'background-size', 'transition', 'transition-property', - ), true + ), + true ) ) { unset( $css[ $media_query ][ $element ][ $property ] ); $css[ $media_query ][ $element ][ '-ms-' . $property ] = $value; diff --git a/functions/kirki/modules/css/class-kirki-modules-css.php b/functions/kirki/modules/css/class-kirki-modules-css.php index 903c245..74e6c06 100644 --- a/functions/kirki/modules/css/class-kirki-modules-css.php +++ b/functions/kirki/modules/css/class-kirki-modules-css.php @@ -4,8 +4,8 @@ * * @package Kirki * @category Modules - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 3.0.0 */ @@ -25,14 +25,6 @@ class Kirki_Modules_CSS { */ private static $instance; - /** - * Whether we've already processed this or not. - * - * @access public - * @var bool - */ - public $processed = false; - /** * The CSS array * @@ -41,23 +33,6 @@ class Kirki_Modules_CSS { */ public static $css_array = array(); - /** - * Set to true if you want to use the AJAX method. - * - * @access public - * @var bool - */ - public static $ajax = false; - - /** - * The Kirki_CSS_To_File object. - * - * @access protected - * @since 3.0.0 - * @var object - */ - protected $css_to_file; - /** * Should we enqueue font-awesome? * @@ -75,7 +50,6 @@ class Kirki_Modules_CSS { */ protected function __construct() { $class_files = array( - 'Kirki_CSS_To_File' => '/class-kirki-css-to-file.php', 'Kirki_Modules_CSS_Generator' => '/class-kirki-modules-css-generator.php', 'Kirki_Output' => '/class-kirki-output.php', 'Kirki_Output_Field_Background' => '/field/class-kirki-output-field-background.php', @@ -91,7 +65,7 @@ class Kirki_Modules_CSS { foreach ( $class_files as $class_name => $file ) { if ( ! class_exists( $class_name ) ) { - include_once wp_normalize_path( dirname( __FILE__ ) . $file ); + include_once wp_normalize_path( dirname( __FILE__ ) . $file ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude } } add_action( 'init', array( $this, 'init' ) ); @@ -119,125 +93,128 @@ class Kirki_Modules_CSS { * @access public */ public function init() { - global $wp_customize; Kirki_Modules_Webfonts::get_instance(); - $config = apply_filters( 'kirki_config', array() ); - $priority = 999; - if ( isset( $config['styles_priority'] ) ) { - $priority = absint( $config['styles_priority'] ); - } - // Allow completely disabling Kirki CSS output. if ( ( defined( 'KIRKI_NO_OUTPUT' ) && true === KIRKI_NO_OUTPUT ) || ( isset( $config['disable_output'] ) && true === $config['disable_output'] ) ) { return; } - $method = apply_filters( 'kirki_dynamic_css_method', 'inline' ); - if ( $wp_customize ) { + // Admin styles, adds compatibility with the new WordPress editor (Gutenberg). + add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_styles' ), 100 ); - // If we're in the customizer, load inline no matter what. - add_action( 'wp_enqueue_scripts', array( $this, 'inline_dynamic_css' ), $priority ); - add_action( 'enqueue_block_editor_assets', array( $this, 'inline_dynamic_css' ), $priority ); - - // If we're using file method, on save write the new styles. - if ( 'file' === $method ) { - $this->css_to_file = new Kirki_CSS_To_File(); - add_action( 'customize_save_after', array( $this->css_to_file, 'write_file' ) ); + if ( ! apply_filters( 'kirki_output_inline_styles', true ) ) { + $config = apply_filters( 'kirki_config', array() ); + $priority = 999; + if ( isset( $config['styles_priority'] ) ) { + $priority = absint( $config['styles_priority'] ); } + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ), $priority ); + + // Prints the styles. + add_action( 'wp', array( $this, 'print_styles_action' ) ); return; } - if ( 'file' === $method ) { - - // Attempt to write the CSS to file. - $this->css_to_file = new Kirki_CSS_To_File(); - - // If we succesd, load this file. - $failed = get_transient( 'kirki_css_write_to_file_failed' ); - - // If writing CSS to file hasn't failed, just enqueue this file. - if ( ! $failed ) { - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_compiled_file' ), $priority ); - return; - } - } - - // If we are in the customizer, load CSS using inline-styles. - // If we are in the frontend AND self::$ajax is true, then load dynamic CSS using AJAX. - if ( ( true === self::$ajax ) || ( isset( $config['inline_css'] ) && false === $config['inline_css'] ) ) { - add_action( 'wp_enqueue_scripts', array( $this, 'frontend_styles' ), $priority ); - add_action( 'wp_ajax_kirki_dynamic_css', array( $this, 'ajax_dynamic_css' ) ); - add_action( 'wp_ajax_nopriv_kirki_dynamic_css', array( $this, 'ajax_dynamic_css' ) ); - return; - } - - // If we got this far then add styles inline. - add_action( 'wp_enqueue_scripts', array( $this, 'inline_dynamic_css' ), $priority ); - - // Admin styles, adds Gutenberg compatibility. - add_action( 'admin_enqueue_scripts', array( $this, 'inline_dynamic_css' ), $priority ); + add_action( 'wp_head', array( $this, 'print_styles_inline' ), 999 ); } /** - * Enqueues compiled CSS file. + * Print styles inline. * * @access public - * @since 3.0.0 + * @since 3.0.36 + * @return void */ - public function enqueue_compiled_file() { - wp_enqueue_style( 'kirki-styles', $this->css_to_file->get_url(), array(), $this->css_to_file->get_timestamp() ); + public function print_styles_inline() { + echo ''; } + /** - * Adds inline styles. + * Enqueue the styles. * * @access public + * @since 3.0.36 + * @return void */ - public function inline_dynamic_css() { - $configs = Kirki::$config; - if ( ! $this->processed ) { - foreach ( $configs as $config_id => $args ) { - if ( isset( $args['disable_output'] ) && true === $args['disable_output'] ) { - continue; - } - $styles = self::loop_controls( $config_id ); - $styles = apply_filters( "kirki_{$config_id}_dynamic_css", $styles ); - if ( ! empty( $styles ) ) { - $stylesheet = apply_filters( "kirki_{$config_id}_stylesheet", false ); - if ( $stylesheet ) { - wp_add_inline_style( $stylesheet, $styles ); - continue; - } - wp_enqueue_style( 'kirki-styles-' . $config_id, trailingslashit( Kirki::$url ) . 'assets/css/kirki-styles.css', array(), KIRKI_VERSION ); - wp_add_inline_style( 'kirki-styles-' . $config_id, $styles ); - } - } - $this->processed = true; - } + public function enqueue_styles() { + // Enqueue the dynamic stylesheet. + wp_enqueue_style( + 'kirki-styles', + add_query_arg( + 'action', + apply_filters( 'kirki_styles_action_handle', 'kirki-styles' ), + site_url() + ), + array(), + KIRKI_VERSION + ); + + // Enqueue FA if needed (I hope not, this FA version is pretty old, only kept here for backwards-compatibility purposes). if ( self::$enqueue_fa && apply_filters( 'kirki_load_fontawesome', true ) ) { wp_enqueue_script( 'kirki-fontawesome-font', 'https://use.fontawesome.com/30858dc40a.js', array(), '4.0.7', true ); } } /** - * Get the dynamic-css.php file + * Prints the styles as an enqueued file. * * @access public + * @since 3.0.36 + * @return void */ - public function ajax_dynamic_css() { - require wp_normalize_path( Kirki::$path . '/modules/css/dynamic-css.php' ); + public function print_styles_action() { + /** + * Note to code reviewers: + * There is no need for a nonce check here, we're only checking if this is a valid request or not. + */ + if ( empty( $_GET['action'] ) || apply_filters( 'kirki_styles_action_handle', 'kirki-styles' ) !== $_GET['action'] ) { // phpcs:ignore WordPress.Security.NonceVerification + return; + } + + // This is a stylesheet. + header( 'Content-type: text/css' ); + $this->print_styles(); exit; } /** - * Enqueues the ajax stylesheet. + * Prints the styles. * * @access public */ - public function frontend_styles() { - wp_enqueue_style( 'kirki-styles-php', admin_url( 'admin-ajax.php' ) . '?action=kirki_dynamic_css', array(), KIRKI_VERSION ); + public function print_styles() { + + // Go through all configs. + $configs = Kirki::$config; + foreach ( $configs as $config_id => $args ) { + if ( isset( $args['disable_output'] ) && true === $args['disable_output'] ) { + continue; + } + $styles = self::loop_controls( $config_id ); + $styles = apply_filters( "kirki_{$config_id}_dynamic_css", $styles ); + if ( ! empty( $styles ) ) { + /** + * Note to code reviewers: + * + * Though all output should be run through an escaping function, this is pure CSS. + * + * When used in the print_styles_action() method the PHP header() call makes the browser interpret it as such. + * No code, script or anything else can be executed from inside a stylesheet. + * + * When using in the print_styles_inline() method the wp_strip_all_tags call we use below + * strips anything that has the possibility to be malicious, and since this is inslide a \');}'; - } - - // Add anything we need before the main script. - $script .= $this->before_script( $args ); - - $field = array( - 'scripts' => array(), - ); - - // Loop through the js_vars and generate the script. - foreach ( $args['js_vars'] as $key => $js_var ) { - - // Skip styles if "exclude" is defined and value is excluded. - if ( isset( $js_var['exclude'] ) ) { - $js_var['exclude'] = (array) $js_var['exclude']; - $script .= 'exclude=false;'; - foreach ( $js_var['exclude'] as $exclussion ) { - $script .= "if(newval=='{$exclussion}'||(''==='{$exclussion}'&&_.isObject(newval)&&_.isEmpty(newval))){exclude=true;}"; - } - } - if ( isset( $js_var['element'] ) ) { - - // Array to string. - if ( is_array( $js_var['element'] ) ) { - $js_var['element'] = implode( ',', $js_var['element'] ); - } - - // Replace single quotes with double quotes to avoid issues with the compiled JS. - $js_var['element'] = str_replace( '\'', '"', $js_var['element'] ); - } - if ( isset( $js_var['function'] ) && 'html' === $js_var['function'] ) { - $script .= $this->script_html_var( $js_var ); - continue; - } - $js_var['index_key'] = $key; - $callback = $this->get_callback( $args ); - if ( is_callable( $callback ) ) { - $field['scripts'][ $key ] = call_user_func_array( $callback, array( $js_var, $args ) ); - continue; - } - $field['scripts'][ $key ] = $this->script_var( $js_var ); - } - $combo_extra_script = ''; - $combo_css_script = ''; - foreach ( $field['scripts'] as $script_array ) { - $combo_extra_script .= $script_array['script']; - $combo_css_script .= ( 'css' !== $combo_css_script ) ? $script_array['css'] : ''; - } - $text = ( 'css' === $combo_css_script ) ? 'css' : '\'' . $combo_css_script . '\''; - - $script .= $combo_extra_script . "var cssContent={$text};"; - if ( isset( $js_var['exclude'] ) ) { - $script .= 'if(true===exclude){cssContent="";}'; - } - if ( $add_css ) { - $script .= "jQuery('#{$style_id}').text(cssContent);jQuery('#{$style_id}').appendTo('head');"; - } - $script .= '});});'; - return $script; - } - - /** - * Generates script for a single js_var when using "html" as function. - * - * @access protected - * @since 3.0.0 - * @param array $args The arguments for this js_var. - */ - protected function script_html_var( $args ) { - $script = ( isset( $args['choice'] ) ) ? "newval=newval['{$args['choice']}'];" : ''; - - // Apply the value_pattern. - if ( isset( $args['value_pattern'] ) && '' !== $args['value_pattern'] ) { - $script .= $this->value_pattern_replacements( 'newval', $args ); - } - - if ( isset( $args['attr'] ) ) { - $script .= "jQuery('{$args['element']}').attr('{$args['attr']}',newval);"; - return $script; - } - $script .= "jQuery('{$args['element']}').html(newval);"; - return $script; - } - - /** - * Generates script for a single js_var. - * - * @access protected - * @since 3.0.0 - * @param array $args The arguments for this js_var. - */ - protected function script_var( $args ) { - $script = ''; - $property_script = ''; - - $value_key = 'newval' . $args['index_key']; - $property_script .= $value_key . '=newval;'; - - $args = $this->get_args( $args ); - - // Apply callback to the value if a callback is defined. - if ( ! empty( $args['js_callback'] ) && is_array( $args['js_callback'] ) && isset( $args['js_callback'][0] ) && ! empty( $args['js_callback'][0] ) ) { - $script .= $value_key . '=' . $args['js_callback'][0] . '(' . $value_key . ',' . $args['js_callback'][1] . ');'; - } - - // Apply the value_pattern. - if ( '' !== $args['value_pattern'] ) { - $script .= $this->value_pattern_replacements( $value_key, $args ); - } - - // Tweak to add url() for background-images. - if ( 'background-image' === $args['property'] && ( ! isset( $args['value_pattern'] ) || false === strpos( $args['value_pattern'], 'gradient' ) ) ) { - $script .= 'if(-1===' . $value_key . '.indexOf(\'url(\')){' . $value_key . '=\'url("\'+' . $value_key . '+\'")\';}'; - } - - // Apply prefix. - $value = $value_key; - if ( '' !== $args['prefix'] ) { - $value = "'" . $args['prefix'] . "'+" . $value_key; - } - $css = $args['element'] . '{' . $args['property'] . ':\'+' . $value . '+\'' . $args['units'] . $args['suffix'] . ';}'; - if ( isset( $args['media_query'] ) ) { - $css = $args['media_query'] . '{' . $css . '}'; - } - return array( - 'script' => $property_script . $script, - 'css' => $css, - ); - } - - /** - * Processes script generation for fields that save an array. - * - * @access protected - * @since 3.0.0 - * @param array $args The arguments for this js_var. - */ - protected function script_var_array( $args ) { - $script = ( 0 === $args['index_key'] ) ? 'css=\'\';' : ''; - $property_script = ''; - - // Define choice. - $choice = ( isset( $args['choice'] ) && '' !== $args['choice'] ) ? $args['choice'] : ''; - - $value_key = 'newval' . $args['index_key']; - $property_script .= $value_key . '=newval;'; - - $args = $this->get_args( $args ); - - // Apply callback to the value if a callback is defined. - if ( ! empty( $args['js_callback'] ) && is_array( $args['js_callback'] ) && isset( $args['js_callback'][0] ) && ! empty( $args['js_callback'][0] ) ) { - $script .= $value_key . '=' . $args['js_callback'][0] . '(' . $value_key . ',' . $args['js_callback'][1] . ');'; - } - $script .= '_.each(' . $value_key . ', function(subValue,subKey){'; - - // Apply the value_pattern. - if ( '' !== $args['value_pattern'] ) { - $script .= $this->value_pattern_replacements( 'subValue', $args ); - } - - // Tweak to add url() for background-images. - if ( '' === $choice || 'background-image' === $choice ) { - $script .= 'if(\'background-image\'===\'' . $args['property'] . '\'||\'background-image\'===subKey){if(-1===subValue.indexOf(\'url(\')){subValue=\'url("\'+subValue+\'")\';}}'; - } - - // Apply prefix. - $value = $value_key; - if ( '' !== $args['prefix'] ) { - $value = '\'' . $args['prefix'] . '\'+subValue'; - } - - // Mostly used for padding, margin & position properties. - $direction_script = 'if(_.contains([\'top\',\'bottom\',\'left\',\'right\'],subKey)){'; - $direction_script .= 'css+=\'' . $args['element'] . '{' . $args['property'] . '-\'+subKey+\':\'+subValue+\'' . $args['units'] . $args['suffix'] . ';}\';}'; - - // Allows us to apply this just for a specific choice in the array of the values. - if ( '' !== $choice ) { - $choice_is_direction = ( false !== strpos( $choice, 'top' ) || false !== strpos( $choice, 'bottom' ) || false !== strpos( $choice, 'left' ) || false !== strpos( $choice, 'right' ) ); - - // The script. - $script .= 'if(\'' . $choice . '\'===subKey){'; - $script .= ( $choice_is_direction ) ? $direction_script . 'else{' : ''; - $script .= 'css+=\'' . $args['element'] . '{' . $args['property'] . ':\'+subValue+\';}\';'; - $script .= ( $choice_is_direction ) ? '}' : ''; - $script .= '}'; - } else { - - // This is where most object-based fields will go. - $script .= $direction_script . 'else{css+=\'' . $args['element'] . '{\'+subKey+\':\'+subValue+\'' . $args['units'] . $args['suffix'] . ';}\';}'; - } - $script .= '});'; - - if ( isset( $args['media_query'] ) ) { - $script .= 'css=\'' . $args['media_query'] . '{\'+css+\'}\';'; - } - - return array( - 'script' => $property_script . $script, - 'css' => 'css', - ); - } - - /** - * Processes script generation for typography fields. - * - * @access protected - * @since 3.0.0 - * @param array $args The arguments for this js_var. - * @param array $field The field arguments. - */ - protected function script_var_typography( $args, $field ) { - $args = $this->get_args( $args ); - - $script = ''; - $css = ''; - - // Load the font using WenFontloader. - // This is a bit ugly because wp_add_inline_script doesn't allow adding + + $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 ); + } + } + } + } +} diff --git a/functions/kirki/modules/tooltips/class-kirki-modules-tooltips.php b/functions/kirki/modules/tooltips/class-kirki-modules-tooltips.php index b0d4eb6..2d6502b 100644 --- a/functions/kirki/modules/tooltips/class-kirki-modules-tooltips.php +++ b/functions/kirki/modules/tooltips/class-kirki-modules-tooltips.php @@ -4,8 +4,8 @@ * * @package Kirki * @category Modules - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 3.0.0 */ diff --git a/functions/kirki/modules/tooltips/tooltip.css b/functions/kirki/modules/tooltips/tooltip.css index bd533ec..84ea886 100644 --- a/functions/kirki/modules/tooltips/tooltip.css +++ b/functions/kirki/modules/tooltips/tooltip.css @@ -1,36 +1,30 @@ -@charset "UTF-8"; .tooltip-wrapper { float: right; - position: relative; -} -.tooltip-wrapper .tooltip-trigger { - text-decoration: none; - cursor: help; -} -.tooltip-wrapper .tooltip-content { - position: absolute; - width: 200px; - height: auto; - top: -10px; - left: -225px; - background: #FFC107; - color: #000; - padding: 10px; - z-index: 99999; - border-radius: 3px; - line-height: 1.4em; -} -.tooltip-wrapper .tooltip-content a { - color: #000; -} -.tooltip-wrapper .tooltip-content:after { - content: ""; - font-family: dashicons; - position: absolute; - right: -12px; - top: 11px; - color: #FFC107; - font-size: 20px; -} + position: relative; } + .tooltip-wrapper .tooltip-trigger { + text-decoration: none; + cursor: help; } + .tooltip-wrapper .tooltip-content { + position: absolute; + width: 200px; + height: auto; + top: -10px; + left: -225px; + background: #FFC107; + color: #000; + padding: 10px; + z-index: 99999; + border-radius: 3px; + line-height: 1.4em; } + .tooltip-wrapper .tooltip-content a { + color: #000; } + .tooltip-wrapper .tooltip-content:after { + content: "\f139"; + font-family: dashicons; + position: absolute; + right: -12px; + top: 11px; + color: #FFC107; + font-size: 20px; } /*# sourceMappingURL=tooltip.css.map */ diff --git a/functions/kirki/modules/webfont-loader/class-kirki-modules-webfont-loader.php b/functions/kirki/modules/webfont-loader/class-kirki-modules-webfont-loader.php index 96b622d..ea79ee2 100644 --- a/functions/kirki/modules/webfont-loader/class-kirki-modules-webfont-loader.php +++ b/functions/kirki/modules/webfont-loader/class-kirki-modules-webfont-loader.php @@ -5,8 +5,8 @@ * @see https://github.com/typekit/webfontloader * @package Kirki * @category Modules - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 3.0.26 */ diff --git a/functions/kirki/modules/webfonts/class-kirki-fonts-google-local.php b/functions/kirki/modules/webfonts/class-kirki-fonts-google-local.php deleted file mode 100644 index dd9163c..0000000 --- a/functions/kirki/modules/webfonts/class-kirki-fonts-google-local.php +++ /dev/null @@ -1,483 +0,0 @@ -family = $family; - $key = sanitize_key( $this->family ); - $this->folder_path = $this->get_root_path() . "/$key"; - $this->folder_url = $this->get_root_url() . "/$key"; - $this->files = $this->get_font_family(); - } - - /** - * Gets the @font-face CSS. - * - * @access public - * @since 3.0.28 - * @param array $variants The variants we want to get. - * @return string - */ - public function get_css( $variants = array() ) { - if ( ! $this->files ) { - return; - } - $key = md5( wp_json_encode( $this->files ) ); - $cached = get_transient( $key ); - if ( $cached ) { - return $cached; - } - $css = ''; - - // If $variants is empty then use all variants available. - if ( empty( $variants ) ) { - $variants = array_keys( $this->files ); - } - - // Download files. - $this->download_font_family( $variants ); - - // Create the @font-face CSS. - foreach ( $variants as $variant ) { - $css .= $this->get_variant_fontface_css( $variant ); - } - set_transient( $key, $css, DAY_IN_SECONDS ); - return $css; - } - - /** - * Get the @font-face CSS for a specific variant. - * - * @access public - * @since 3.0.28 - * @param string $variant The variant. - * @return string - */ - public function get_variant_fontface_css( $variant ) { - $font_face = "@font-face{font-family:'{$this->family}';"; - - // Get the font-style. - $font_style = ( false !== strpos( $variant, 'italic' ) ) ? 'italic' : 'normal'; - $font_face .= "font-style:{$font_style};"; - - // Get the font-weight. - $font_weight = '400'; - $font_weight = str_replace( 'italic', '', $variant ); - $font_weight = ( ! $font_weight || 'regular' === $font_weight ) ? '400' : $font_weight; - $font_face .= "font-weight:{$font_weight};"; - - // Get the font-names. - $font_name_0 = $this->get_local_font_name( $variant, false ); - $font_name_1 = $this->get_local_font_name( $variant, true ); - $font_face .= "src:local('{$font_name_0}'),"; - if ( $font_name_0 !== $font_name_1 ) { - $font_face .= "local('{$font_name_1}'),"; - } - - // Get the font-url. - $font_url = $this->get_variant_local_url( $variant ); - $paths = $this->get_font_files_paths(); - if ( ! file_exists( $paths[ $variant ] ) ) { - $font_url = $this->files[ $variant ]; - } - - // Get the font-format. - $font_format = ( strpos( $font_url, '.woff2' ) ) ? 'woff2' : 'truetype'; - $font_format = ( strpos( $font_url, '.woff' ) && ! strpos( $font_url, '.woff2' ) ) ? 'woff' : $font_format; - $font_face .= "url({$font_url}) format('{$font_format}');}"; - - return $font_face; - } - - /** - * Gets the local URL for a variant. - * - * @access public - * @since 3.0.28 - * @param string $variant The variant. - * @return string The URL. - */ - public function get_variant_local_url( $variant ) { - $local_urls = $this->get_font_files_urls_local(); - - if ( empty( $local_urls ) ) { - return; - } - - // Return the specific variant if we can find it. - if ( isset( $local_urls[ $variant ] ) ) { - return $local_urls[ $variant ]; - } - - // Return regular if the one we want could not be found. - if ( isset( $local_urls['regular'] ) ) { - return $local_urls['regular']; - } - - // Return the first available if all else failed. - $vals = array_values( $local_urls ); - return $vals[0]; - } - - /** - * Get the name of the font-family. - * This is used by @font-face in case the user already has the font downloaded locally. - * - * @access public - * @since 3.0.28 - * @param string $variant The variant. - * @param bool $compact Whether we want the compact formatting or not. - * @return string - */ - public function get_local_font_name( $variant, $compact = false ) { - $variant_names = array( - '100' => 'Thin', - '100i' => 'Thin Italic', - '100italic' => 'Thin Italic', - '200' => 'Extra-Light', - '200i' => 'Extra-Light Italic', - '200italic' => 'Extra-Light Italic', - '300' => 'Light', - '300i' => 'Light Italic', - '300italic' => 'Light Italic', - '400' => 'Regular', - 'regular' => 'Regular', - '400i' => 'Regular Italic', - 'italic' => 'Italic', - '400italic' => 'Regular Italic', - '500' => 'Medium', - '500i' => 'Medium Italic', - '500italic' => 'Medium Italic', - '600' => 'Semi-Bold', - '600i' => 'Semi-Bold Italic', - '600italic' => 'Semi-Bold Italic', - '700' => 'Bold', - '700i' => 'Bold Italic', - '700italic' => 'Bold Italic', - '800' => 'Extra-Bold', - '800i' => 'Extra-Bold Italic', - '800italic' => 'Extra-Bold Italic', - '900' => 'Black', - '900i' => 'Black Italic', - '900italic' => 'Black Italic', - ); - - $variant = (string) $variant; - if ( $compact ) { - if ( isset( $variant_names[ $variant ] ) ) { - return str_replace( array( ' ', '-' ), '', $this->family ) . '-' . str_replace( array( ' ', '-' ), '', $variant_names[ $variant ] ); - } - return str_replace( array( ' ', '-' ), '', $this->family ); - } - - if ( isset( $variant_names[ $variant ] ) ) { - return $this->family . ' ' . $variant_names[ $variant ]; - } - return $this->family; - } - - /** - * Get an array of font-files. - * Only contains the filenames. - * - * @access public - * @since 3.0.28 - * @return array - */ - public function get_font_files() { - $files = array(); - foreach ( $this->files as $key => $url ) { - $files[ $key ] = $this->get_filename_from_url( $url ); - } - return $files; - } - - /** - * Get an array of local file URLs. - * - * @access public - * @since 3.0.28 - * @return array - */ - public function get_font_files_urls_local() { - $urls = array(); - $files = $this->get_font_files(); - foreach ( $files as $key => $file ) { - $urls[ $key ] = $this->folder_url . '/' . $file; - } - return $urls; - } - - /** - * Get an array of local file paths. - * - * @access public - * @since 3.0.28 - * @return array - */ - public function get_font_files_paths() { - $paths = array(); - $files = $this->get_font_files(); - foreach ( $files as $key => $file ) { - $paths[ $key ] = $this->folder_path . '/' . $file; - } - return $paths; - } - - /** - * Downloads a font-file and saves it locally. - * - * @access private - * @since 3.0.28 - * @param string $url The URL of the file we want to get. - * @return bool - */ - private function download_font_file( $url ) { - $contents = $this->get_remote_url_contents( $url ); - $path = $this->folder_path . '/' . $this->get_filename_from_url( $url ); - - // If the folder doesn't exist, create it. - if ( ! file_exists( $this->folder_path ) ) { - wp_mkdir_p( $this->folder_path ); - } - // If the file exists no reason to do anything. - if ( file_exists( $path ) ) { - return true; - } - - // Write file. - return Kirki_Helper::init_filesystem()->put_contents( $path, $contents, FS_CHMOD_FILE ); - } - - /** - * Get a font-family from the array of google-fonts. - * - * @access public - * @since 3.0.28 - * @return array - */ - public function get_font_family() { - - // Get the fonts array. - $fonts = $this->get_fonts(); - if ( isset( $fonts[ $this->family ] ) ) { - return $fonts[ $this->family ]; - } - return array(); - } - - /** - * Gets the filename by breaking-down the URL parts. - * - * @access private - * @since 3.0.28 - * @param string $url The URL. - * @return string The filename. - */ - private 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; - } - - /** - * Get the font defined in the google-fonts API. - * - * @access private - * @since 3.0.28 - * @return array - */ - private function get_fonts() { - ob_start(); - include wp_normalize_path( dirname( __FILE__ ) . '/webfont-files.json' ); - $json = ob_get_clean(); - return json_decode( $json, true ); - } - - /** - * Gets the root fonts folder path. - * Other paths are built based on this. - * - * @since 1.5 - * @access public - * @return string - */ - public 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 root folder url. - * Other urls are built based on this. - * - * @since 1.5 - * @access public - * @return string - */ - public 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' ); - } - - /** - * Download font-family files. - * - * @access public - * @since 3.0.28 - * @param array $variants An array of variants to download. Leave empty to download all. - * @return void - */ - public function download_font_family( $variants = array() ) { - if ( empty( $variants ) ) { - $variants = array_keys( $this->files ); - } - foreach ( $this->files as $variant => $file ) { - if ( in_array( $variant, $variants ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict - $this->download_font_file( $file ); - } - } - } - - /** - * Gets the remote URL contents. - * - * @access private - * @since 3.0.28 - * @param string $url The URL we want to get. - * @return string The contents of the remote URL. - */ - public function get_remote_url_contents( $url ) { - $response = wp_remote_get( $url ); - if ( is_wp_error( $response ) ) { - return array(); - } - $html = wp_remote_retrieve_body( $response ); - if ( is_wp_error( $html ) ) { - return; - } - return $html; - } -} diff --git a/functions/kirki/modules/webfonts/class-kirki-fonts-google.php b/functions/kirki/modules/webfonts/class-kirki-fonts-google.php index 035672c..b2b5ffe 100644 --- a/functions/kirki/modules/webfonts/class-kirki-fonts-google.php +++ b/functions/kirki/modules/webfonts/class-kirki-fonts-google.php @@ -5,8 +5,8 @@ * * @package Kirki * @category Core - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ @@ -110,7 +110,6 @@ final class Kirki_Fonts_Google { * @param array $args The field arguments. */ public function generate_google_font( $args ) { - global $wp_customize; // Process typography fields. if ( isset( $args['type'] ) && 'kirki-typography' === $args['type'] ) { @@ -118,12 +117,8 @@ final class Kirki_Fonts_Google { // Get the value. $value = Kirki_Values::get_sanitized_field_value( $args ); - if ( isset( $value['downloadFont'] ) && $value['downloadFont'] ) { - $this->hosted_fonts[] = $value['font-family']; - } - // If we don't have a font-family then we can skip this. - if ( ! $wp_customize && ( ! isset( $value['font-family'] ) || in_array( $value['font-family'], $this->hosted_fonts, true ) ) ) { + if ( ! isset( $value['font-family'] ) || in_array( $value['font-family'], $this->hosted_fonts, true ) ) { return; } @@ -234,7 +229,7 @@ final class Kirki_Fonts_Google { * @return void */ public function get_googlefonts_json() { - include wp_normalize_path( dirname( __FILE__ ) . '/webfonts.json' ); + include wp_normalize_path( dirname( __FILE__ ) . '/webfonts.json' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude wp_die(); } @@ -248,15 +243,4 @@ final class Kirki_Fonts_Google { echo wp_json_encode( Kirki_Fonts::get_standard_fonts() ); wp_die(); } - - /** - * Gets $this->hosted_fonts. - * - * @access public - * @since 3.0.32 - * @return array - */ - public function get_hosted_fonts() { - return $this->hosted_fonts; - } } diff --git a/functions/kirki/modules/webfonts/class-kirki-fonts-helper.php b/functions/kirki/modules/webfonts/class-kirki-fonts-helper.php new file mode 100644 index 0000000..14a4ca9 --- /dev/null +++ b/functions/kirki/modules/webfonts/class-kirki-fonts-helper.php @@ -0,0 +1,164 @@ + basename( $url ), + 'type' => 'font/woff', + 'tmp_name' => $temp_file, + 'error' => 0, + 'size' => filesize( $temp_file ), + ); + + $overrides = array( + 'test_form' => false, + 'test_size' => true, + ); + + // Move the temporary file into the uploads directory. + $results = wp_handle_sideload( $file, $overrides ); + + if ( empty( $results['error'] ) ) { + 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' ); + } +} diff --git a/functions/kirki/modules/webfonts/class-kirki-fonts.php b/functions/kirki/modules/webfonts/class-kirki-fonts.php index 15f64d2..071bf63 100644 --- a/functions/kirki/modules/webfonts/class-kirki-fonts.php +++ b/functions/kirki/modules/webfonts/class-kirki-fonts.php @@ -4,8 +4,8 @@ * * @package Kirki * @category Core - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 1.0 */ @@ -134,7 +134,7 @@ final class Kirki_Fonts { // If we got this far, cache was empty so we need to get from JSON. ob_start(); - include wp_normalize_path( dirname( __FILE__ ) . '/webfonts.json' ); + include wp_normalize_path( dirname( __FILE__ ) . '/webfonts.json' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude $fonts_json = ob_get_clean(); $fonts = json_decode( $fonts_json, true ); diff --git a/functions/kirki/modules/webfonts/class-kirki-modules-webfonts-async.php b/functions/kirki/modules/webfonts/class-kirki-modules-webfonts-async.php index ec7f624..c1d8136 100644 --- a/functions/kirki/modules/webfonts/class-kirki-modules-webfonts-async.php +++ b/functions/kirki/modules/webfonts/class-kirki-modules-webfonts-async.php @@ -4,8 +4,8 @@ * * @package Kirki * @category Core - * @author Aristeides Stathopoulos - * @copyright Copyright (c) 2017, Aristeides Stathopoulos + * @author Ari Stathopoulos (@aristath) + * @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath) * @license https://opensource.org/licenses/MIT * @since 3.0 */ diff --git a/functions/kirki/modules/webfonts/class-kirki-modules-webfonts-embed.php b/functions/kirki/modules/webfonts/class-kirki-modules-webfonts-embed.php new file mode 100644 index 0000000..1113743 --- /dev/null +++ b/functions/kirki/modules/webfonts/class-kirki-modules-webfonts-embed.php @@ -0,0 +1,236 @@ +config_id = $config_id; + $this->webfonts = $webfonts; + $this->googlefonts = $googlefonts; + + add_action( 'wp', array( $this, 'init' ), 9 ); + add_filter( 'wp_resource_hints', array( $this, 'resource_hints' ), 10, 2 ); + } + + /** + * Init. + * + * @access public + * @since 3.0.36 + * @return void + */ + public function init() { + $this->populate_fonts(); + add_action( 'kirki_dynamic_css', array( $this, 'the_css' ) ); + } + + /** + * Add preconnect for Google Fonts. + * + * @access public + * @param array $urls URLs to print for resource hints. + * @param string $relation_type The relation type the URLs are printed. + * @return array $urls URLs to print for resource hints. + */ + public function resource_hints( $urls, $relation_type ) { + $fonts_to_load = $this->googlefonts->fonts; + + if ( ! empty( $fonts_to_load ) && 'preconnect' === $relation_type ) { + $urls[] = array( + 'href' => 'https://fonts.gstatic.com', + 'crossorigin', + ); + } + return $urls; + } + + /** + * Webfont Loader for Google Fonts. + * + * @access public + * @since 3.0.0 + */ + public function populate_fonts() { + + // Go through our fields and populate $this->fonts. + $this->webfonts->loop_fields( $this->config_id ); + + $this->googlefonts->fonts = apply_filters( 'kirki_enqueue_google_fonts', $this->googlefonts->fonts ); + + // Goes through $this->fonts and adds or removes things as needed. + $this->googlefonts->process_fonts(); + + foreach ( $this->googlefonts->fonts 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, + ); + } + } + + /** + * Webfont Loader script for Google Fonts. + * + * @access public + * @since 3.0.0 + */ + public function the_css() { + foreach ( $this->fonts_to_load as $font ) { + $family = str_replace( ' ', '+', trim( $font['family'] ) ); + $weights = join( ',', $font['weights'] ); + $url = "https://fonts.googleapis.com/css?family={$family}:{$weights}&subset=cyrillic,cyrillic-ext,devanagari,greek,greek-ext,khmer,latin,latin-ext,vietnamese,hebrew,arabic,bengali,gujarati,tamil,telugu,thai"; + + $transient_id = 'kirki_gfonts_' . md5( $url ); + $contents = get_site_transient( $transient_id ); + /** + * 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 ( ! $contents ) { + + // 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 ); + } + + // Set the transient for a week. + set_site_transient( $transient_id, $contents, WEEK_IN_SECONDS ); + } + } + if ( $contents ) { + /** + * Note to code reviewers: + * + * Though all output should be run through an escaping function, this is pure CSS + * and it is added on a call that has a PHP `header( 'Content-type: text/css' );`. + * No code, script or anything else can be executed from inside a stylesheet. + * For extra security we're using the wp_strip_all_tags() function here + * just to make sure there's no