mirror of
https://ghproxy.net/https://github.com/AlxMedia/featureon.git
synced 2025-08-26 11:38:56 +08:00
Kirki 3.1.0
This commit is contained in:
parent
53841c831e
commit
9c731b4d7d
21 changed files with 963 additions and 1969 deletions
|
@ -1,3 +1,15 @@
|
|||
## 3.1.0 - 2020-03-01
|
||||
|
||||
### Changed
|
||||
* Completely refactored the google-fonts downloader. Fonts now get stored in `wp-content/fonts/{font-family}/{file}`.
|
||||
* Updated Google-Fonts lists.
|
||||
|
||||
### Removed
|
||||
* Removed the `branding` module.
|
||||
* Removed the `styling` module.
|
||||
* Removed the `telemetry` module.
|
||||
* Removed the `Kirki_Fonts_Helper` class.
|
||||
|
||||
## 3.0.45 - 2019-09-01
|
||||
|
||||
### Fixed
|
||||
|
|
|
@ -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 */
|
||||
|
|
File diff suppressed because it is too large
Load diff
2
functions/kirki/controls/js/script.min.js
vendored
2
functions/kirki/controls/js/script.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -355,7 +355,7 @@ class Kirki_Field {
|
|||
// Take care of common typos.
|
||||
if ( 'theme_mods' === $this->option_type ) {
|
||||
/* translators: %1$s represents the field ID where the error occurs. */
|
||||
_doing_it_wrong( __METHOD__, sprintf( esc_html( 'Typo found in field %s - "theme_mods" vs "theme_mod"', 'kirki' ), esc_html( $this->settings ) ), '3.0.10' );
|
||||
_doing_it_wrong( __METHOD__, sprintf( esc_html__( 'Typo found in field %s - "theme_mods" vs "theme_mod"', 'kirki' ), esc_html( $this->settings ) ), '3.0.10' );
|
||||
$this->option_type = 'theme_mod';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,11 +60,9 @@ class Kirki_Modules {
|
|||
array(
|
||||
'css' => 'Kirki_Modules_CSS',
|
||||
'css-vars' => 'Kirki_Modules_CSS_Vars',
|
||||
'customizer-styling' => 'Kirki_Modules_Customizer_Styling',
|
||||
'icons' => 'Kirki_Modules_Icons',
|
||||
'loading' => 'Kirki_Modules_Loading',
|
||||
'tooltips' => 'Kirki_Modules_Tooltips',
|
||||
'branding' => 'Kirki_Modules_Customizer_Branding',
|
||||
'postMessage' => 'Kirki_Modules_PostMessage',
|
||||
'selective-refresh' => 'Kirki_Modules_Selective_Refresh',
|
||||
'field-dependencies' => 'Kirki_Modules_Field_Dependencies',
|
||||
|
@ -73,7 +71,6 @@ class Kirki_Modules {
|
|||
'webfont-loader' => 'Kirki_Modules_Webfont_Loader',
|
||||
'preset' => 'Kirki_Modules_Preset',
|
||||
'gutenberg' => 'Kirki_Modules_Gutenberg',
|
||||
'telemetry' => 'Kirki_Modules_Telemetry',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* Description: The Ultimate WordPress Customizer Framework
|
||||
* Author: Ari Stathopoulos (@aristath)
|
||||
* Author URI: https://aristath.github.io
|
||||
* Version: 3.0.45
|
||||
* Version: 3.1.0
|
||||
* Text Domain: kirki
|
||||
* Requires WP: 4.9
|
||||
* Requires PHP: 5.3
|
||||
|
@ -40,7 +40,7 @@ if ( ! defined( 'KIRKI_PLUGIN_FILE' ) ) {
|
|||
|
||||
// Define the KIRKI_VERSION constant.
|
||||
if ( ! defined( 'KIRKI_VERSION' ) ) {
|
||||
define( 'KIRKI_VERSION', '3.0.45' );
|
||||
define( 'KIRKI_VERSION', '3.1.0' );
|
||||
}
|
||||
|
||||
// Make sure the path is properly set.
|
||||
|
|
|
@ -1,29 +1,22 @@
|
|||
#customize-theme-controls .control-section-kirki-expanded .accordion-section-title {
|
||||
display: none;
|
||||
}
|
||||
display: none; }
|
||||
#customize-theme-controls .control-section-kirki-expanded .customize-section-back {
|
||||
display: none;
|
||||
}
|
||||
display: none; }
|
||||
#customize-theme-controls .customize-pane-child.control-section-kirki-expanded {
|
||||
position: relative;
|
||||
visibility: visible;
|
||||
height: auto;
|
||||
margin-left: -100%;
|
||||
}
|
||||
#customize-theme-controls .customize-pane-child.control-section-kirki-expanded h3 .customize-action {
|
||||
display: none;
|
||||
}
|
||||
margin-left: -100%; }
|
||||
#customize-theme-controls .customize-pane-child.control-section-kirki-expanded h3 .customize-action {
|
||||
display: none; }
|
||||
#customize-theme-controls .control-section-kirki-link .button {
|
||||
margin-top: -3px;
|
||||
}
|
||||
margin-top: -3px; }
|
||||
|
||||
#customize-theme-controls .customize-pane-child.current-section-parent,
|
||||
.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel-parent {
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
transform: translateX(-100%); }
|
||||
|
||||
.control-section-kirki-nested {
|
||||
margin: 0 -12px;
|
||||
}
|
||||
margin: 0 -12px; }
|
||||
|
||||
/*# sourceMappingURL=sections.css.map */
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
/* global kirkiBranding */
|
||||
jQuery( document ).ready( function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
if ( '' !== kirkiBranding.logoImage ) {
|
||||
jQuery( 'div#customize-info .preview-notice' ).replaceWith( '<img src="' + kirkiBranding.logoImage + '">' );
|
||||
}
|
||||
|
||||
if ( '' !== kirkiBranding.description ) {
|
||||
jQuery( 'div#customize-info > .customize-panel-description' ).replaceWith( '<div class="customize-panel-description">' + kirkiBranding.description + '</div>' );
|
||||
}
|
||||
|
||||
} );
|
|
@ -1,88 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Changes the customizer's branding.
|
||||
* For documentation please see
|
||||
* https://github.com/aristath/kirki/wiki/Styling-the-Customizer
|
||||
*
|
||||
* @package Kirki
|
||||
* @category Modules
|
||||
* @author Ari Stathopoulos (@aristath)
|
||||
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 3.0.0
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds styles to the customizer.
|
||||
*/
|
||||
class Kirki_Modules_Customizer_Branding {
|
||||
|
||||
/**
|
||||
* The object instance.
|
||||
*
|
||||
* @static
|
||||
* @access private
|
||||
* @since 3.0.0
|
||||
* @var object
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @access protected
|
||||
* @since 3.0.0
|
||||
*/
|
||||
protected function __construct() {
|
||||
add_action( 'customize_controls_print_scripts', array( $this, 'customize_controls_print_scripts' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an instance of this object.
|
||||
* Prevents duplicate instances which avoid artefacts and improves performance.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @since 3.0.0
|
||||
* @return object
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! self::$instance ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues the script responsible for branding the customizer
|
||||
* and also adds variables to it using the wp_localize_script function.
|
||||
* The actual branding is handled via JS.
|
||||
*
|
||||
* @access public
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public function customize_controls_print_scripts() {
|
||||
$config = apply_filters( 'kirki_config', array() );
|
||||
$vars = array(
|
||||
'logoImage' => '',
|
||||
'description' => '',
|
||||
);
|
||||
if ( isset( $config['logo_image'] ) && '' !== $config['logo_image'] ) {
|
||||
$vars['logoImage'] = esc_url_raw( $config['logo_image'] );
|
||||
}
|
||||
if ( isset( $config['description'] ) && '' !== $config['description'] ) {
|
||||
$vars['description'] = esc_textarea( $config['description'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $vars['logoImage'] ) || ! empty( $vars['description'] ) ) {
|
||||
wp_register_script( 'kirki-branding', Kirki::$url . '/modules/customizer-branding/branding.js', array(), KIRKI_VERSION, false );
|
||||
wp_localize_script( 'kirki-branding', 'kirkiBranding', $vars );
|
||||
wp_enqueue_script( 'kirki-branding' );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,422 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Changes the styling of the customizer
|
||||
* based on the settings set using the kirki_config filter.
|
||||
* For documentation please see
|
||||
* https://github.com/aristath/kirki/wiki/Styling-the-Customizer
|
||||
*
|
||||
* @package Kirki
|
||||
* @category Modules
|
||||
* @author Ari Stathopoulos (@aristath)
|
||||
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 3.0.0
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds styles to the customizer.
|
||||
*/
|
||||
class Kirki_Modules_Customizer_Styling {
|
||||
|
||||
/**
|
||||
* The object instance.
|
||||
*
|
||||
* @static
|
||||
* @access private
|
||||
* @since 3.0.0
|
||||
* @var object
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function __construct() {
|
||||
add_action( 'customize_controls_print_styles', array( $this, 'custom_css' ), 99 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an instance of this object.
|
||||
* Prevents duplicate instances which avoid artefacts and improves performance.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @since 3.0.0
|
||||
* @return object
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! self::$instance ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add custom CSS rules to the head, applying our custom styles.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function custom_css() {
|
||||
$config = apply_filters( 'kirki_config', array() );
|
||||
if ( ! isset( $config['color_accent'] ) && ! isset( $config['color_back'] ) ) {
|
||||
return;
|
||||
}
|
||||
$back = isset( $config['color_back'] ) ? $config['color_back'] : false;
|
||||
|
||||
$text_on_back = '';
|
||||
$border_on_back = '';
|
||||
$back_on_back = '';
|
||||
$hover_on_back = '';
|
||||
$arrows_on_back = '';
|
||||
$text_on_accent = '';
|
||||
$border_on_accent = '';
|
||||
$accent_disabled_obj = '';
|
||||
$accent_disabled = '';
|
||||
$text_on_accent_disabled = '';
|
||||
$border_on_accent_disabled = '';
|
||||
|
||||
if ( $back ) {
|
||||
$back_obj = ariColor::newColor( $back );
|
||||
$text_on_back = ( 60 > $back_obj->lightness ) ? $back_obj->getNew( 'lightness', $back_obj->lightness + 60 )->toCSS( $back_obj->mode ) : $back_obj->getNew( 'lightness', $back_obj->lightness - 60 )->toCSS( $back_obj->mode );
|
||||
$border_on_back = ( 80 < $back_obj->lightness ) ? $back_obj->getNew( 'lightness', $back_obj->lightness - 13 )->toCSS( $back_obj->mode ) : $back_obj->getNew( 'lightness', $back_obj->lightness + 13 )->toCSS( $back_obj->mode );
|
||||
$back_on_back = ( 90 < $back_obj->lightness ) ? $back_obj->getNew( 'lightness', $back_obj->lightness - 6 )->toCSS( $back_obj->mode ) : $back_obj->getNew( 'lightness', $back_obj->lightness + 11 )->toCSS( $back_obj->mode );
|
||||
$hover_on_back = ( 90 < $back_obj->lightness ) ? $back_obj->getNew( 'lightness', $back_obj->lightness - 3 )->toCSS( $back_obj->mode ) : $back_obj->getNew( 'lightness', $back_obj->lightness + 3 )->toCSS( $back_obj->mode );
|
||||
$arrows_on_back = ( 50 > $back_obj->lightness ) ? $back_obj->getNew( 'lightness', $back_obj->lightness + 30 )->toCSS( $back_obj->mode ) : $back_obj->getNew( 'lightness', $back_obj->lightness - 30 )->toCSS( $back_obj->mode );
|
||||
}
|
||||
$accent = ( isset( $config['color_accent'] ) ) ? $config['color_accent'] : false;
|
||||
if ( $accent ) {
|
||||
$accent_obj = ariColor::newColor( $accent );
|
||||
$text_on_accent = ( 60 > $accent_obj->lightness ) ? $accent_obj->getNew( 'lightness', $accent_obj->lightness + 60 )->toCSS( $accent_obj->mode ) : $accent_obj->getNew( 'lightness', $accent_obj->lightness - 60 )->toCSS( $accent_obj->mode );
|
||||
$border_on_accent = ( 50 < $accent_obj->lightness ) ? $accent_obj->getNew( 'lightness', $accent_obj->lightness - 4 )->toCSS( $accent_obj->mode ) : $accent_obj->getNew( 'lightness', $accent_obj->lightness + 4 )->toCSS( $accent_obj->mode );
|
||||
$accent_disabled_obj = ( 35 < $accent_obj->lightness ) ? $accent_obj->getNew( 'lightness', $accent_obj->lightness - 30 ) : $accent_obj->getNew( 'lightness', $accent_obj->lightness + 30 );
|
||||
$accent_disabled = $accent_disabled_obj->toCSS( $accent_disabled_obj->mode );
|
||||
$text_on_accent_disabled = ( 60 > $accent_disabled_obj->lightness ) ? $accent_disabled_obj->getNew( 'lightness', $accent_disabled_obj->lightness + 60 )->toCSS( $accent_disabled_obj->mode ) : $accent_disabled_obj->getNew( 'lightness', $accent_disabled_obj->lightness - 60 )->toCSS( $accent_disabled_obj->mode );
|
||||
$border_on_accent_disabled = ( 50 < $accent_disabled_obj->lightness ) ? $accent_disabled_obj->getNew( 'lightness', $accent_disabled_obj->lightness - 4 )->toCSS( $accent_disabled_obj->mode ) : $accent_disabled_obj->getNew( 'lightness', $accent_disabled_obj->lightness + 4 )->toCSS( $accent_disabled_obj->mode );
|
||||
}
|
||||
?>
|
||||
<style>
|
||||
.wp-full-overlay-sidebar,
|
||||
#customize-controls .customize-info .accordion-section-title,
|
||||
#customize-controls .panel-meta.customize-info .accordion-section-title:hover,
|
||||
#customize-theme-controls .accordion-section-title,
|
||||
.customize-section-title,
|
||||
#customize-theme-controls .control-section-themes .accordion-section-title,
|
||||
#customize-theme-controls .control-section-themes .accordion-section-title,
|
||||
#customize-theme-controls .control-section-themes .accordion-section-title:hover,
|
||||
.outer-section-open #customize-controls .wp-full-overlay-sidebar-content,
|
||||
#customize-sidebar-outer-content,
|
||||
#customize-control-changeset_status .customize-inside-control-row,
|
||||
#customize-control-changeset_preview_link input,
|
||||
#customize-control-changeset_scheduled_date,
|
||||
.wp-core-ui .wp-full-overlay .collapse-sidebar {
|
||||
background: <?php echo esc_html( $back ); ?>;
|
||||
background-color: <?php echo esc_html( $back ); ?>;
|
||||
color: <?php echo esc_html( $text_on_back ); ?>;
|
||||
}
|
||||
|
||||
<?php if ( $back ) : ?>
|
||||
.media-widget-preview.media_image, .media-widget-preview.media_audio, .attachment-media-view {
|
||||
background: none;
|
||||
}
|
||||
.wp-core-ui .button-link-delete {
|
||||
color: <?php echo ( 90 > $back_obj->lightness ) ? '#FF8A80' : '#a00'; ?>;
|
||||
}
|
||||
.button.wp-color-result {
|
||||
text-shadow: none !important;
|
||||
}
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
#customize-sidebar-outer-content {
|
||||
border-left-color: <?php echo esc_html( $border_on_back ); ?>;
|
||||
border-right-color: <?php echo esc_html( $border_on_back ); ?>;
|
||||
}
|
||||
|
||||
#customize-controls .customize-info .panel-title,
|
||||
#customize-controls .customize-pane-child .customize-section-title h3,
|
||||
#customize-controls .customize-pane-child h3.customize-section-title,
|
||||
.customize-control,
|
||||
#customize-controls .description {
|
||||
color: <?php echo esc_html( $text_on_back ); ?>;
|
||||
}
|
||||
|
||||
#customize-controls .customize-info,
|
||||
#customize-header-actions,
|
||||
.customize-section-title {
|
||||
border-bottom-color: <?php echo esc_html( $border_on_back ); ?>;
|
||||
}
|
||||
|
||||
.wp-full-overlay-sidebar .wp-full-overlay-header,
|
||||
.customize-controls-close,
|
||||
.expanded .wp-full-overlay-footer {
|
||||
color: <?php echo esc_html( $text_on_back ); ?>;
|
||||
background-color: <?php echo esc_html( $back_on_back ); ?>;
|
||||
border-color: <?php echo esc_html( $border_on_back ); ?>;
|
||||
}
|
||||
|
||||
.accordion-section,
|
||||
#customize-theme-controls .customize-pane-child.accordion-section-content {
|
||||
background: <?php echo esc_html( $back_on_back ); ?>;
|
||||
}
|
||||
|
||||
#accordion-section-themes+.control-section,
|
||||
#customize-theme-controls .control-section:last-of-type.open,
|
||||
#customize-theme-controls .control-section:last-of-type > .accordion-section-title,
|
||||
#customize-theme-controls .control-section.open {
|
||||
border-bottom-color: <?php echo esc_html( $border_on_back ); ?>;
|
||||
border-top-color: <?php echo esc_html( $border_on_back ); ?>;
|
||||
}
|
||||
|
||||
#customize-theme-controls .accordion-section-title {
|
||||
border-bottom-color: <?php echo esc_html( $border_on_back ); ?>;
|
||||
border-left-color: <?php echo esc_html( $border_on_back ); ?>;
|
||||
}
|
||||
|
||||
#customize-theme-controls .control-section-themes .accordion-section-title,
|
||||
#customize-theme-controls .control-section-themes .accordion-section-title:hover {
|
||||
border-bottom-color: <?php echo esc_html( $border_on_back ); ?>;
|
||||
border-top-color: <?php echo esc_html( $border_on_back ); ?>;
|
||||
border-bottom-color: <?php echo esc_html( $border_on_back ); ?>;
|
||||
}
|
||||
|
||||
#customize-theme-controls .accordion-section-title:after {
|
||||
color: <?php echo esc_html( $arrows_on_back ); ?>;
|
||||
}
|
||||
|
||||
.wp-core-ui .button,
|
||||
.wp-core-ui .button-secondary {
|
||||
background-color: <?php echo esc_html( $back ); ?>;
|
||||
border-color: <?php echo esc_html( $border_on_back ); ?>;
|
||||
box-shadow: 0 1px 0 <?php echo esc_html( $border_on_back ); ?>;
|
||||
-webkit-box-shadow: 0 1px 0 <?php echo esc_html( $border_on_back ); ?>;
|
||||
text-shadow: 0 -1px 1px <?php echo esc_html( $border_on_back ); ?>, 1px 0 1px <?php echo esc_html( $border_on_back ); ?>, 0 1px 1px <?php echo esc_html( $border_on_back ); ?>, -1px 0 1px <?php echo esc_html( $border_on_back ); ?>;
|
||||
color: <?php echo esc_html( $text_on_back ); ?>;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 640px) {
|
||||
.customize-controls-preview-toggle{
|
||||
background-color: <?php echo esc_html( $back ); ?>;
|
||||
border-color: <?php echo esc_html( $border_on_back ); ?>;
|
||||
box-shadow:0 1px 0 <?php echo esc_html( $border_on_back ); ?>;
|
||||
-webkit-box-shadow:0 1px 0 <?php echo esc_html( $border_on_back ); ?>;
|
||||
text-shadow:0 -1px 1px <?php echo esc_html( $border_on_back ); ?>, 1px 0 1px <?php echo esc_html( $border_on_back ); ?>, 0 1px 1px <?php echo esc_html( $border_on_back ); ?>, -1px 0 1px <?php echo esc_html( $border_on_back ); ?>;
|
||||
color: <?php echo esc_html( $text_on_back ); ?>;
|
||||
}
|
||||
}
|
||||
|
||||
.wp-core-ui .button.focus,
|
||||
.wp-core-ui .button.hover,
|
||||
.wp-core-ui .button:focus,
|
||||
.wp-core-ui .button:hover,
|
||||
.wp-core-ui .button-secondary.focus,
|
||||
.wp-core-ui .button-secondary.hover,
|
||||
.wp-core-ui .button-secondary:focus,
|
||||
.wp-core-ui .button-secondary:hover,
|
||||
.customize-panel-back,
|
||||
.customize-section-back {
|
||||
background-color: <?php echo esc_html( $back_on_back ); ?>;
|
||||
border-color: <?php echo esc_html( $border_on_back ); ?>;
|
||||
box-shadow: 0 1px 0 <?php echo esc_html( $border_on_back ); ?>;
|
||||
-webkit-box-shadow: 0 1px 0 <?php echo esc_html( $border_on_back ); ?>;
|
||||
text-shadow: 0 -1px 1px <?php echo esc_html( $border_on_back ); ?>, 1px 0 1px <?php echo esc_html( $border_on_back ); ?>, 0 1px 1px <?php echo esc_html( $border_on_back ); ?>, -1px 0 1px <?php echo esc_html( $border_on_back ); ?>;
|
||||
color: <?php echo esc_html( $text_on_back ); ?>;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 640px) {
|
||||
.customize-controls-preview-toggle.focus,
|
||||
.customize-controls-preview-toggle.hover,
|
||||
.customize-controls-preview-toggle:focus,
|
||||
.customize-controls-preview-toggle:hover {
|
||||
background-color: <?php echo esc_html( $back_on_back ); ?>;
|
||||
border-color: <?php echo esc_html( $border_on_back ); ?>;
|
||||
box-shadow: 0 1px 0 <?php echo esc_html( $border_on_back ); ?>;
|
||||
-webkit-box-shadow: 0 1px 0 <?php echo esc_html( $border_on_back ); ?>;
|
||||
text-shadow: 0 -1px 1px <?php echo esc_html( $border_on_back ); ?>, 1px 0 1px <?php echo esc_html( $border_on_back ); ?>, 0 1px 1px <?php echo esc_html( $border_on_back ); ?>, -1px 0 1px <?php echo esc_html( $border_on_back ); ?>;
|
||||
color:<?php echo esc_html( $text_on_back ); ?>;
|
||||
}
|
||||
}
|
||||
|
||||
.customize-control-kirki-background .background-attachment .buttonset .switch-label,
|
||||
.customize-control-kirki-background .background-size .buttonset .switch-label,
|
||||
.customize-control-kirki-radio-buttonset .buttonset .switch-label {
|
||||
color: <?php echo esc_html( $text_on_back ); ?>;
|
||||
}
|
||||
|
||||
.wp-color-result {
|
||||
border-color: <?php echo esc_html( $border_on_back ); ?>;
|
||||
-webkit-box-shadow: 0 1px 0 <?php echo esc_html( $border_on_back ); ?>;
|
||||
box-shadow: 0 1px 0 <?php echo esc_html( $border_on_back ); ?>;
|
||||
}
|
||||
|
||||
.wp-color-result:focus,
|
||||
.wp-color-result:hover {
|
||||
border-color: <?php echo esc_html( $border_on_back ); ?>;
|
||||
background: <?php echo esc_html( $back_on_back ); ?>;
|
||||
}
|
||||
|
||||
.wp-color-result:after {
|
||||
border-color: <?php echo esc_html( $border_on_back ); ?>;
|
||||
background: <?php echo esc_html( $back ); ?>;
|
||||
color: <?php echo esc_html( $text_on_back ); ?>;
|
||||
}
|
||||
|
||||
.wp-color-result:focus:after,
|
||||
.wp-color-result:hover:after {
|
||||
color: <?php echo esc_html( $text_on_back ); ?>;
|
||||
}
|
||||
|
||||
.customize-control input[type=tel],
|
||||
.customize-control input[type=url],
|
||||
.customize-control input[type=text],
|
||||
.customize-control input[type=password],
|
||||
.customize-control input[type=email],
|
||||
.customize-control input[type=number],
|
||||
.customize-control input[type=search],
|
||||
.customize-control input[type=radio],
|
||||
.customize-control input[type=checkbox],
|
||||
.customize-control select,
|
||||
.select2-container--default .select2-selection--single,
|
||||
.select2-container--default .select2-selection--multiple {
|
||||
background: <?php echo esc_html( $back ); ?>;
|
||||
border-color: <?php echo esc_html( $border_on_back ); ?>;
|
||||
color: <?php echo esc_html( $text_on_back ); ?>;
|
||||
}
|
||||
|
||||
.customize-control-kirki-slider input[type=range]::-webkit-slider-thumb {
|
||||
background-color:<?php echo esc_html( $accent ); ?>;
|
||||
}
|
||||
|
||||
.customize-control-kirki-slider input[type=range]::-moz-range-thumb {
|
||||
background-color: <?php echo esc_html( $accent ); ?>;
|
||||
}
|
||||
|
||||
.customize-control-kirki-slider input[type=range]::-ms-thumb {
|
||||
background-color: <?php echo esc_html( $accent ); ?>;
|
||||
}
|
||||
|
||||
.customize-control-kirki-slider input[type=range] {
|
||||
background: <?php echo esc_html( $border_on_back ); ?>;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
||||
color:<?php echo esc_html( $text_on_back ); ?>;
|
||||
}
|
||||
|
||||
.wp-full-overlay-footer .devices {
|
||||
background: none;
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
-webkit-box-shadow: none;
|
||||
}
|
||||
|
||||
.kirki-reset-section .dashicons {
|
||||
color: <?php echo esc_html( $back_on_back ); ?>;
|
||||
}
|
||||
|
||||
#customize-controls .control-section .accordion-section-title:focus,
|
||||
#customize-controls .control-section .accordion-section-title:hover,
|
||||
#customize-controls .control-section.open .accordion-section-title,
|
||||
#customize-controls .control-section:hover > .accordion-section-title,
|
||||
.customize-panel-back:focus,
|
||||
.customize-panel-back:hover,
|
||||
.customize-section-back:focus,
|
||||
.customize-section-back:hover {
|
||||
background: <?php echo esc_html( $hover_on_back ); ?>;
|
||||
color: <?php echo esc_html( $accent ); ?>;
|
||||
border-left-color: <?php echo esc_html( $accent ); ?>;
|
||||
}
|
||||
|
||||
.customize-controls-close:hover {
|
||||
background-color: <?php echo esc_html( $back ); ?>;
|
||||
color: <?php echo esc_html( $accent ); ?>;
|
||||
border-color: <?php echo esc_html( $accent ); ?>;
|
||||
}
|
||||
|
||||
#customize-theme-controls .control-section .accordion-section-title:focus:after,
|
||||
#customize-theme-controls .control-section .accordion-section-title:hover:after,
|
||||
#customize-theme-controls .control-section.open .accordion-section-title:after,
|
||||
#customize-theme-controls .control-section:hover>.accordion-section-title:after {
|
||||
color: <?php echo esc_html( $accent ); ?>;
|
||||
}
|
||||
|
||||
.wp-core-ui .button.button-primary {
|
||||
background-color: <?php echo esc_html( $accent ); ?>;
|
||||
border-color: <?php echo esc_html( $border_on_accent ); ?>;
|
||||
box-shadow: 0 1px 0 <?php echo esc_html( $border_on_accent ); ?>;
|
||||
-webkit-box-shadow: 0 1px 0 <?php echo esc_html( $border_on_accent ); ?>;
|
||||
text-shadow: 0 -1px 1px <?php echo esc_html( $border_on_accent ); ?>, 1px 0 1px <?php echo esc_html( $border_on_accent ); ?>, 0 1px 1px <?php echo esc_html( $border_on_accent ); ?>, -1px 0 1px <?php echo esc_html( $border_on_accent ); ?>;
|
||||
color: <?php echo esc_html( $text_on_accent ); ?>;
|
||||
}
|
||||
|
||||
.wp-core-ui .button.button-primary.focus,
|
||||
.wp-core-ui .button.button-primary.hover,
|
||||
.wp-core-ui .button.button-primary:focus,
|
||||
.wp-core-ui .button.button-primary:hover {
|
||||
background-color: <?php echo esc_html( $accent ); ?>;
|
||||
border-color: <?php echo esc_html( $border_on_accent ); ?>;
|
||||
box-shadow: 0 1px 0 <?php echo esc_html( $border_on_accent ); ?>;
|
||||
-webkit-box-shadow: 0 1px 0 <?php echo esc_html( $border_on_accent ); ?>;
|
||||
text-shadow: 0 -1px 1px <?php echo esc_html( $border_on_accent ); ?>, 1px 0 1px <?php echo esc_html( $border_on_accent ); ?>, 0 1px 1px <?php echo esc_html( $border_on_accent ); ?>, -1px 0 1px <?php echo esc_html( $border_on_accent ); ?>;
|
||||
color: <?php echo esc_html( $text_on_accent ); ?>;
|
||||
}
|
||||
|
||||
.wp-core-ui .button.button-primary-disabled,
|
||||
.wp-core-ui .button.button-primary.disabled,
|
||||
.wp-core-ui .button.button-primary:disabled,
|
||||
.wp-core-ui .button.button-primary[disabled] {
|
||||
background-color: <?php echo esc_html( $accent_disabled ); ?> !important;
|
||||
border-color: <?php echo esc_html( $border_on_accent_disabled ); ?> !important;
|
||||
box-shadow: 0 1px 0 <?php echo esc_html( $border_on_accent_disabled ); ?> !important;
|
||||
-webkit-box-shadow: 0 1px 0 <?php echo esc_html( $border_on_accent_disabled ); ?> !important;
|
||||
text-shadow: 0 -1px 1px <?php echo esc_html( $border_on_accent_disabled ); ?>, 1px 0 1px <?php echo esc_html( $border_on_accent_disabled ); ?>, 0 1px 1px <?php echo esc_html( $border_on_accent_disabled ); ?>, -1px 0 1px <?php echo esc_html( $border_on_accent_disabled ); ?> !important;
|
||||
color: <?php echo esc_html( $text_on_accent_disabled ); ?> !important;
|
||||
}
|
||||
|
||||
input[type=checkbox]:checked:before {
|
||||
color: <?php echo esc_html( $accent ); ?>;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-results__option--highlighted[aria-selected] {
|
||||
background-color: <?php echo esc_html( $accent ); ?>;
|
||||
color: <?php echo esc_html( $text_on_accent ); ?>;
|
||||
}
|
||||
|
||||
.customize-control-kirki-radio-buttonset .buttonset .switch-input:checked + .switch-label,
|
||||
.customize-control-kirki-background .background-attachment .buttonset .switch-input:checked + .switch-label,
|
||||
.customize-control-kirki-background .background-size .buttonset .switch-input:checked + .switch-label {
|
||||
background-color: <?php echo esc_html( $accent ); ?>;
|
||||
border-color: <?php echo esc_html( $border_on_accent ); ?>;
|
||||
color: <?php echo esc_html( $text_on_accent ); ?>;
|
||||
}
|
||||
|
||||
.notice,
|
||||
div.updated,
|
||||
div.error {
|
||||
color: #444 !important;
|
||||
}
|
||||
|
||||
<?php if ( isset( $config['width'] ) ) : ?>
|
||||
.wp-full-overlay-sidebar {
|
||||
width: <?php echo esc_html( $config['width'] ); ?>;
|
||||
}
|
||||
.expanded .wp-full-overlay-footer {
|
||||
width: <?php echo esc_html( $config['width'] ); ?>;
|
||||
}
|
||||
.wp-full-overlay.expanded {
|
||||
margin-left: <?php echo esc_html( $config['width'] ); ?>;
|
||||
}
|
||||
.wp-full-overlay.collapsed .wp-full-overlay-sidebar {
|
||||
margin-left: -<?php echo esc_html( $config['width'] ); ?>;
|
||||
}
|
||||
<?php endif; ?>
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
}
|
|
@ -1,327 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Telemetry implementation for Kirki.
|
||||
*
|
||||
* @package Kirki
|
||||
* @category Core
|
||||
* @author Ari Stathopoulos (@aristath)
|
||||
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
|
||||
* @license http://opensource.org/licenses/https://opensource.org/licenses/MIT
|
||||
* @since 3.0.36
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Telemetry implementation.
|
||||
*/
|
||||
final class Kirki_Modules_Telemetry {
|
||||
|
||||
/**
|
||||
* The object instance.
|
||||
*
|
||||
* @static
|
||||
* @access private
|
||||
* @since 3.0.36
|
||||
* @var object
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @access protected
|
||||
* @since 3.0.36
|
||||
*/
|
||||
protected function __construct() {
|
||||
|
||||
// Early exit if telemetry is disabled.
|
||||
if ( ! apply_filters( 'kirki_telemetry', true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_action( 'init', array( $this, 'init' ) );
|
||||
add_action( 'admin_notices', array( $this, 'admin_notice' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an instance of this object.
|
||||
* Prevents duplicate instances which avoid artefacts and improves performance.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @since 3.0.36
|
||||
* @return object
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! self::$instance ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Additional actions that run on init.
|
||||
*
|
||||
* @access public
|
||||
* @since 3.0.36
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
$this->dismiss_notice();
|
||||
$this->consent();
|
||||
|
||||
// This is the last thing to run. No impact on performance or anything else.
|
||||
add_action( 'wp_footer', array( $this, 'maybe_send_data' ), 99999 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Maybe send data.
|
||||
*
|
||||
* @access public
|
||||
* @since 3.0.36
|
||||
* @return void
|
||||
*/
|
||||
public function maybe_send_data() {
|
||||
|
||||
// Check if the user has consented to the data sending.
|
||||
if ( ! get_option( 'kirki_telemetry_optin' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Only send data once/month. We use an option instead of a transient
|
||||
// because transients in some managed hosting environments don't properly update
|
||||
// due to their caching implementations.
|
||||
$sent = get_option( 'kirki_telemetry_sent' );
|
||||
if ( ! $sent || $sent < time() - MONTH_IN_SECONDS ) {
|
||||
$this->send_data();
|
||||
update_option( 'kirki_telemetry_sent', time() );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends data.
|
||||
*
|
||||
* @access private
|
||||
* @since 3.0.36
|
||||
* @return void
|
||||
*/
|
||||
private function send_data() {
|
||||
|
||||
// Ping remote server.
|
||||
wp_remote_post(
|
||||
'https://wplemon.com/?action=kirki-stats',
|
||||
array(
|
||||
'method' => 'POST',
|
||||
'blocking' => false,
|
||||
'body' => array_merge(
|
||||
array(
|
||||
'action' => 'kirki-stats',
|
||||
),
|
||||
$this->get_data()
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The admin-notice.
|
||||
*
|
||||
* @access private
|
||||
* @since 3.0.36
|
||||
* @return void
|
||||
*/
|
||||
public function admin_notice() {
|
||||
|
||||
// Early exit if the user has dismissed the consent, or if they have opted-in.
|
||||
if ( get_option( 'kirki_telemetry_no_consent' ) || get_option( 'kirki_telemetry_optin' ) ) {
|
||||
return;
|
||||
}
|
||||
$data = $this->get_data();
|
||||
?>
|
||||
<div class="notice notice-info kirki-telemetry">
|
||||
<h3><strong><?php esc_html_e( 'Help us improve Kirki.', 'kirki' ); ?></strong></h3>
|
||||
<p style="max-width: 76em;"><?php _e( 'Help us begin a dialogue with theme developers, collaborate and improve both the theme you are using and the Kirki framework by agreeing to send anonymous data. <strong>The data is completely anonymous and we will never collect any identifyable information about you or your website.</strong>', 'kirki' ); // phpcs:ignore WordPress.Security.EscapeOutput ?></p>
|
||||
<table class="data-to-send hidden">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?php esc_html_e( 'Data that will be sent', 'kirki' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="min-width: 200px;"><?php esc_html_e( 'PHP Version', 'kirki' ); ?></td>
|
||||
<td><code><?php echo esc_html( $data['phpVer'] ); ?></code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php esc_html_e( 'Theme Name', 'kirki' ); ?></td>
|
||||
<td><code><?php echo esc_html( $data['themeName'] ); ?></code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php esc_html_e( 'Theme Author', 'kirki' ); ?></td>
|
||||
<td><code><?php echo esc_html( $data['themeAuthor'] ); ?></code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php esc_html_e( 'Theme URI', 'kirki' ); ?></td>
|
||||
<td><code><?php echo esc_html( $data['themeURI'] ); ?></code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php esc_html_e( 'Field Types Used', 'kirki' ); ?></td>
|
||||
<td><code><?php echo esc_html( implode( ',', $data['fieldTypes'] ) ); ?></code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %1$s: URL to the server plugin code. %2$s: URL to the stats page. */
|
||||
__( 'We believe in complete transparency. You can see the code used on our server <a href="%1$s" rel="nofollow">here</a>, and the results of the statistics we\'re gathering on <a href="%2$s" rel="nofollow">this page</a>.', 'kirki' ), // phpcs:ignore WordPress.Security.EscapeOutput
|
||||
'https://github.com/aristath/kirki-telemetry-server',
|
||||
'https://wplemon.com/kirki-telemetry-statistics/'
|
||||
);
|
||||
?>
|
||||
</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<p class="actions">
|
||||
|
||||
<a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'kirki-consent-notice', 'telemetry' ) ) ); ?>" class="button button-primary consent"><?php esc_html_e( 'I agree', 'kirki' ); ?></a>
|
||||
<a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'kirki-hide-notice', 'telemetry' ) ) ); ?>" class="button button-secondary dismiss"><?php esc_html_e( 'No thanks', 'kirki' ); ?></a>
|
||||
<a class="button button-link details details-show"><?php esc_html_e( 'Show me the data', 'kirki' ); ?></a>
|
||||
<a class="button button-link details details-hide hidden"><?php esc_html_e( 'Collapse data', 'kirki' ); ?></a>
|
||||
</p>
|
||||
<script>
|
||||
jQuery( '.kirki-telemetry a.details' ).on( 'click', function() {
|
||||
jQuery( '.kirki-telemetry .data-to-send' ).toggleClass( 'hidden' );
|
||||
jQuery( '.kirki-telemetry a.details-show' ).toggleClass( 'hidden' );
|
||||
jQuery( '.kirki-telemetry a.details-hide' ).toggleClass( 'hidden' );
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
$this->table_styles();
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds and returns the data or uses cached if data already exists.
|
||||
*
|
||||
* @access private
|
||||
* @since 3.0.36
|
||||
* @return array
|
||||
*/
|
||||
private function get_data() {
|
||||
// Get the theme.
|
||||
$theme = wp_get_theme();
|
||||
|
||||
// Format the PHP version.
|
||||
$php_version = phpversion( 'tidy' );
|
||||
if ( ! $php_version ) {
|
||||
$php_version = array_merge( explode( '.', phpversion() ), array( 0, 0 ) );
|
||||
$php_version = "{$php_version[0]}.{$php_version[1]}";
|
||||
}
|
||||
|
||||
// Build data and return the array.
|
||||
return array(
|
||||
'phpVer' => $php_version,
|
||||
'themeName' => $theme->get( 'Name' ),
|
||||
'themeAuthor' => $theme->get( 'Author' ),
|
||||
'themeURI' => $theme->get( 'ThemeURI' ),
|
||||
'fieldTypes' => $this->get_field_types(),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the field-types used.
|
||||
*
|
||||
* @access private
|
||||
* @since 3.0.36
|
||||
* @return array
|
||||
*/
|
||||
public function get_field_types() {
|
||||
$types = array();
|
||||
foreach ( Kirki::$fields as $field ) {
|
||||
if ( isset( $field['type'] ) ) {
|
||||
$types[] = $field['type'];
|
||||
}
|
||||
}
|
||||
return $types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dismisses the notice.
|
||||
*
|
||||
* @access private
|
||||
* @since 3.0.36
|
||||
* @return void
|
||||
*/
|
||||
private function dismiss_notice() {
|
||||
|
||||
// Check if this is the request we want.
|
||||
if ( isset( $_GET['_wpnonce'] ) && isset( $_GET['kirki-hide-notice'] ) ) {
|
||||
if ( 'telemetry' === sanitize_text_field( wp_unslash( $_GET['kirki-hide-notice'] ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification
|
||||
// Check the wp-nonce.
|
||||
if ( wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) ) ) {
|
||||
// All good, we can save the option to dismiss this notice.
|
||||
update_option( 'kirki_telemetry_no_consent', true );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dismisses the notice.
|
||||
*
|
||||
* @access private
|
||||
* @since 3.0.36
|
||||
* @return void
|
||||
*/
|
||||
private function consent() {
|
||||
|
||||
// Check if this is the request we want.
|
||||
if ( isset( $_GET['_wpnonce'] ) && isset( $_GET['kirki-consent-notice'] ) ) {
|
||||
if ( 'telemetry' === sanitize_text_field( wp_unslash( $_GET['kirki-consent-notice'] ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification
|
||||
// Check the wp-nonce.
|
||||
if ( wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) ) ) {
|
||||
// All good, we can save the option to dismiss this notice.
|
||||
update_option( 'kirki_telemetry_optin', true );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the table styles.
|
||||
*
|
||||
* Normally we'd just use the .widefat CSS class for the table,
|
||||
* however apparently there's an obscure bug in WP causing this: https://github.com/aristath/kirki/issues/2067
|
||||
* This CSS is a copy of some styles from common.css in wp-core.
|
||||
*
|
||||
* @access private
|
||||
* @since 3.0.37
|
||||
* @return void
|
||||
*/
|
||||
private function table_styles() {
|
||||
?>
|
||||
<style>
|
||||
/* .widefat - main style for tables */
|
||||
.data-to-send { border-spacing: 0; width: 100%; clear: both; }
|
||||
.data-to-send * { word-wrap: break-word; }
|
||||
.data-to-send a, .data-to-send button.button-link { text-decoration: none; }
|
||||
.data-to-send td, .data-to-send th { padding: 8px 10px; }
|
||||
.data-to-send thead th, .data-to-send thead td { border-bottom: 1px solid #e1e1e1; }
|
||||
.data-to-send tfoot th, .data-to-send tfoot td { border-top: 1px solid #e1e1e1; border-bottom: none; }
|
||||
.data-to-send .no-items td { border-bottom-width: 0; }
|
||||
.data-to-send td { vertical-align: top; }
|
||||
.data-to-send td, .data-to-send td p, .data-to-send td ol, .data-to-send td ul { font-size: 13px; line-height: 1.5em; }
|
||||
.data-to-send th, .data-to-send thead td, .data-to-send tfoot td { text-align: left; line-height: 1.3em; font-size: 14px; }
|
||||
.data-to-send th input, .updates-table td input, .data-to-send thead td input, .data-to-send tfoot td input { margin: 0 0 0 8px; padding: 0; vertical-align: text-top; }
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
}
|
|
@ -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 */
|
||||
|
|
|
@ -0,0 +1,287 @@
|
|||
<?php
|
||||
/**
|
||||
* Manage fonts downloading.
|
||||
*
|
||||
* @package Kirki
|
||||
* @category Core
|
||||
* @author Ari Stathopoulos (@aristath)
|
||||
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 3.1.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fonts-downloading manager.
|
||||
*
|
||||
* @since 3.1.0
|
||||
*/
|
||||
class Kirki_Fonts_Downloader {
|
||||
|
||||
/**
|
||||
* Get styles from URL.
|
||||
*
|
||||
* @access public
|
||||
* @since 3.1.0
|
||||
* @param string $url The URL.
|
||||
* @return string
|
||||
*/
|
||||
public function get_styles( $url ) {
|
||||
$css = $this->get_cached_url_contents( $url );
|
||||
return $this->get_local_font_styles( $css );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get styles with fonts downloaded locally.
|
||||
*
|
||||
* @access protected
|
||||
* @since 3.1.0
|
||||
* @param string $css The styles.
|
||||
* @return string
|
||||
*/
|
||||
protected function get_local_font_styles( $css ) {
|
||||
$files = $this->get_local_files_from_css( $css );
|
||||
|
||||
// Convert paths to URLs.
|
||||
foreach ( $files as $remote => $local ) {
|
||||
$files[ $remote ] = str_replace( WP_CONTENT_DIR, content_url(), $local );
|
||||
}
|
||||
|
||||
return str_replace(
|
||||
array_keys( $files ),
|
||||
array_values( $files ),
|
||||
$css
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Download files mentioned in our CSS locally.
|
||||
*
|
||||
* @access protected
|
||||
* @since 3.1.0
|
||||
* @param string $css The CSS we want to parse.
|
||||
* @return array Returns an array of remote URLs and their local counterparts.
|
||||
*/
|
||||
protected function get_local_files_from_css( $css ) {
|
||||
$font_files = $this->get_files_from_css( $css );
|
||||
$stored = get_option( 'kirki_downloaded_font_files', array() );
|
||||
$change = false; // If in the end this is true, we need to update the cache option.
|
||||
|
||||
// If the fonts folder don't exist, create it.
|
||||
if ( ! file_exists( WP_CONTENT_DIR . '/fonts' ) ) {
|
||||
$this->get_filesystem()->mkdir( WP_CONTENT_DIR . '/fonts', FS_CHMOD_DIR );
|
||||
}
|
||||
|
||||
foreach ( $font_files as $font_family => $files ) {
|
||||
|
||||
// The folder path for this font-family.
|
||||
$folder_path = WP_CONTENT_DIR . '/fonts/' . $font_family;
|
||||
|
||||
// If the folder doesn't exist, create it.
|
||||
if ( ! file_exists( $folder_path ) ) {
|
||||
$this->get_filesystem()->mkdir( $folder_path, FS_CHMOD_DIR );
|
||||
}
|
||||
|
||||
foreach ( $files as $url ) {
|
||||
|
||||
// Get the filename.
|
||||
$filename = basename( wp_parse_url( $url, PHP_URL_PATH ) );
|
||||
$font_path = $folder_path . '/' . $filename;
|
||||
|
||||
if ( file_exists( $font_path ) ) {
|
||||
|
||||
// Skip if already cached.
|
||||
if ( isset( $stored[ $url ] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$stored[ $url ] = $font_path;
|
||||
$change = true;
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'download_url' ) ) {
|
||||
require_once wp_normalize_path( ABSPATH . '/wp-admin/includes/file.php' );
|
||||
}
|
||||
|
||||
// Download file to temporary location.
|
||||
$tmp_path = download_url( $url );
|
||||
|
||||
// Make sure there were no errors.
|
||||
if ( is_wp_error( $tmp_path ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Move temp file to final destination.
|
||||
$success = $this->get_filesystem()->move( $tmp_path, $font_path, true );
|
||||
if ( $success ) {
|
||||
$stored[ $url ] = $font_path;
|
||||
$change = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $change ) {
|
||||
update_option( 'kirki_downloaded_font_files', $stored );
|
||||
}
|
||||
|
||||
return $stored;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cached url contents.
|
||||
* If a cache doesn't already exist, get the URL contents from remote
|
||||
* and cache the result.
|
||||
*
|
||||
* @access public
|
||||
* @since 3.1.0
|
||||
* @param string $url The URL we want to get the contents from.
|
||||
* @param string $user_agent The user-agent to use for our request.
|
||||
* @return string Returns the remote URL contents.
|
||||
*/
|
||||
public function get_cached_url_contents( $url = '', $user_agent = null ) {
|
||||
|
||||
// Try to retrieved cached response from the gfonts API.
|
||||
$contents = false;
|
||||
$cached_responses = get_transient( 'kirki_remote_url_contents' );
|
||||
$cached_responses = ( $cached_responses && is_array( $cached_responses ) ) ? $cached_responses : array();
|
||||
if ( isset( $cached_responses[ md5( $url . $user_agent ) ] ) ) {
|
||||
return $cached_responses[ md5( $url . $user_agent ) ];
|
||||
}
|
||||
|
||||
// Get the contents from remote.
|
||||
$contents = $this->get_url_contents( $url, $user_agent );
|
||||
|
||||
// If we got the contents successfully, store them in a transient.
|
||||
// We're using a transient and not an option because fonts get updated
|
||||
// so we want to be able to get the latest version weekly.
|
||||
if ( $contents ) {
|
||||
$cached_responses[ md5( $url . $user_agent ) ] = $contents;
|
||||
set_transient( 'kirki_remote_url_contents', $cached_responses, WEEK_IN_SECONDS );
|
||||
}
|
||||
|
||||
return $contents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get remote file contents.
|
||||
*
|
||||
* @access public
|
||||
* @since 3.1.0
|
||||
* @param string $url The URL we want to get the contents from.
|
||||
* @param string $user_agent The user-agent to use for our request.
|
||||
* @return string Returns the remote URL contents.
|
||||
*/
|
||||
public function get_url_contents( $url = '', $user_agent = null ) {
|
||||
|
||||
if ( ! $user_agent ) {
|
||||
|
||||
/**
|
||||
* The user-agent we want to use.
|
||||
*
|
||||
* For woff2 format, use'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0'.
|
||||
* The default user-agent is the only one compatible with woff (not woff2)
|
||||
* which also supports unicode ranges.
|
||||
*/
|
||||
$user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8';
|
||||
}
|
||||
|
||||
// Get the response.
|
||||
$response = wp_remote_get( $url, array( 'user-agent' => $user_agent ) );
|
||||
|
||||
// Early exit if there was an error.
|
||||
if ( is_wp_error( $response ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the CSS from our response.
|
||||
$contents = wp_remote_retrieve_body( $response );
|
||||
|
||||
// Early exit if there was an error.
|
||||
if ( is_wp_error( $contents ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
return $contents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get font files from the CSS.
|
||||
*
|
||||
* @access public
|
||||
* @since 3.1.0
|
||||
* @param string $css The CSS we want to parse.
|
||||
* @return array Returns an array of font-families and the font-files used.
|
||||
*/
|
||||
public function get_files_from_css( $css ) {
|
||||
|
||||
$font_faces = explode( '@font-face', $css );
|
||||
|
||||
$result = array();
|
||||
|
||||
// Loop all our font-face declarations.
|
||||
foreach ( $font_faces as $font_face ) {
|
||||
|
||||
// Make sure we only process styles inside this declaration.
|
||||
$style = explode( '}', $font_face )[0];
|
||||
|
||||
// Sanity check.
|
||||
if ( false === strpos( $style, 'font-family' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get an array of our font-families.
|
||||
preg_match_all( '/font-family.*?\;/', $style, $matched_font_families );
|
||||
|
||||
// Get an array of our font-files.
|
||||
preg_match_all( '/url\(.*?\)/i', $style, $matched_font_files );
|
||||
|
||||
// Get the font-family name.
|
||||
$font_family = 'unknown';
|
||||
if ( isset( $matched_font_families[0] ) && isset( $matched_font_families[0][0] ) ) {
|
||||
$font_family = rtrim( ltrim( $matched_font_families[0][0], 'font-family:' ), ';' );
|
||||
$font_family = trim( str_replace( array( "'", ';' ), '', $font_family ) );
|
||||
$font_family = sanitize_key( strtolower( str_replace( ' ', '-', $font_family ) ) );
|
||||
}
|
||||
|
||||
// Make sure the font-family is set in our array.
|
||||
if ( ! isset( $result[ $font_family ] ) ) {
|
||||
$result[ $font_family ] = array();
|
||||
}
|
||||
|
||||
// Get files for this font-family and add them to the array.
|
||||
|
||||
foreach ( $matched_font_files as $match ) {
|
||||
|
||||
// Sanity check.
|
||||
if ( ! isset( $match[0] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add the file URL.
|
||||
$result[ $font_family ][] = rtrim( ltrim( $match[0], 'url(' ), ')' );
|
||||
}
|
||||
|
||||
// Make sure we have unique items.
|
||||
// We're using array_flip here instead of array_unique for improved performance.
|
||||
$result[ $font_family ] = array_flip( array_flip( $result[ $font_family ] ) );
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filesystem.
|
||||
*
|
||||
* @access protected
|
||||
* @since 3.1.0
|
||||
* @return WP_Filesystem
|
||||
*/
|
||||
protected function get_filesystem() {
|
||||
global $wp_filesystem;
|
||||
if ( ! $wp_filesystem ) {
|
||||
if ( ! function_exists( 'WP_Filesystem' ) ) {
|
||||
require_once wp_normalize_path( ABSPATH . '/wp-admin/includes/file.php' );
|
||||
}
|
||||
WP_Filesystem();
|
||||
}
|
||||
return $wp_filesystem;
|
||||
}
|
||||
}
|
|
@ -1,172 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Helper methods for fonts.
|
||||
*
|
||||
* @package Kirki
|
||||
* @category Core
|
||||
* @author Ari Stathopoulos (@aristath)
|
||||
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 3.0.36
|
||||
*/
|
||||
|
||||
// Do not allow directly accessing this file.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit( 'Direct script access denied.' );
|
||||
}
|
||||
|
||||
/**
|
||||
* The Kirki_Fonts object.
|
||||
*
|
||||
* @since 3.0.28
|
||||
*/
|
||||
final class Kirki_Fonts_Helper {
|
||||
|
||||
/**
|
||||
* Gets the remote URL contents.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @since 3.0.36
|
||||
* @param string $url The URL we want to get.
|
||||
* @param array $args An array of arguments for the wp_remote_retrieve_body() function.
|
||||
* @return string The contents of the remote URL.
|
||||
*/
|
||||
public static function get_remote_url_contents( $url, $args = array() ) {
|
||||
$response = wp_remote_get( $url, $args );
|
||||
if ( is_wp_error( $response ) ) {
|
||||
return array();
|
||||
}
|
||||
$html = wp_remote_retrieve_body( $response );
|
||||
if ( is_wp_error( $html ) ) {
|
||||
return;
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the root fonts folder path.
|
||||
* Other paths are built based on this.
|
||||
*
|
||||
* @static
|
||||
* @since 3.0.36
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public static function get_root_path() {
|
||||
|
||||
// Get the upload directory for this site.
|
||||
$upload_dir = wp_upload_dir();
|
||||
$path = untrailingslashit( wp_normalize_path( $upload_dir['basedir'] ) ) . '/webfonts';
|
||||
|
||||
// If the folder doesn't exist, create it.
|
||||
if ( ! file_exists( $path ) ) {
|
||||
wp_mkdir_p( $path );
|
||||
}
|
||||
|
||||
// Return the path.
|
||||
return apply_filters( 'kirki_googlefonts_root_path', $path );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the filename by breaking-down the URL parts.
|
||||
*
|
||||
* @static
|
||||
* @access private
|
||||
* @since 3.0.28
|
||||
* @param string $url The URL.
|
||||
* @return string The filename.
|
||||
*/
|
||||
private static function get_filename_from_url( $url ) {
|
||||
$url_parts = explode( '/', $url );
|
||||
$parts_count = count( $url_parts );
|
||||
if ( 1 < $parts_count ) {
|
||||
return $url_parts[ count( $url_parts ) - 1 ];
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads a font-file and saves it locally.
|
||||
*
|
||||
* @access public
|
||||
* @since 3.0.28
|
||||
* @param string $url The URL of the file we want to get.
|
||||
* @return bool
|
||||
*/
|
||||
public static function download_font_file( $url ) {
|
||||
|
||||
$saved_fonts = get_option( 'kirki_font_local_filenames', array() );
|
||||
if ( isset( $saved_fonts[ $url ] ) && file_exists( $saved_fonts[ $url ]['file'] ) ) {
|
||||
return $saved_fonts[ $url ]['url'];
|
||||
}
|
||||
|
||||
// Gives us access to the download_url() and wp_handle_sideload() functions.
|
||||
require_once ABSPATH . 'wp-admin/includes/file.php';
|
||||
|
||||
$timeout_seconds = 5;
|
||||
|
||||
// Download file to temp dir.
|
||||
$temp_file = download_url( $url, $timeout_seconds );
|
||||
|
||||
if ( is_wp_error( $temp_file ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Array based on $_FILE as seen in PHP file uploads.
|
||||
$file = array(
|
||||
'name' => basename( $url ),
|
||||
'type' => 'font/woff',
|
||||
'tmp_name' => $temp_file,
|
||||
'error' => 0,
|
||||
'size' => filesize( $temp_file ),
|
||||
);
|
||||
|
||||
$overrides = array(
|
||||
'test_type' => false,
|
||||
'test_form' => false,
|
||||
'test_size' => true,
|
||||
);
|
||||
|
||||
// Move the temporary file into the uploads directory.
|
||||
$results = wp_handle_sideload( $file, $overrides );
|
||||
|
||||
if ( empty( $results['error'] ) ) {
|
||||
$saved_fonts[ $url ] = $results;
|
||||
update_option( 'kirki_font_local_filenames', $saved_fonts );
|
||||
return $results['url'];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the root folder url.
|
||||
* Other urls are built based on this.
|
||||
*
|
||||
* @static
|
||||
* @since 3.0.36
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public static function get_root_url() {
|
||||
|
||||
// Get the upload directory for this site.
|
||||
$upload_dir = wp_upload_dir();
|
||||
|
||||
// The URL.
|
||||
$url = trailingslashit( $upload_dir['baseurl'] );
|
||||
|
||||
// Take care of domain mapping.
|
||||
// When using domain mapping we have to make sure that the URL to the file
|
||||
// does not include the original domain but instead the mapped domain.
|
||||
if ( defined( 'DOMAIN_MAPPING' ) && DOMAIN_MAPPING ) {
|
||||
if ( function_exists( 'domain_mapping_siteurl' ) && function_exists( 'get_original_url' ) ) {
|
||||
$mapped_domain = domain_mapping_siteurl( false );
|
||||
$original_domain = get_original_url( 'siteurl' );
|
||||
$url = str_replace( $original_domain, $mapped_domain, $url );
|
||||
}
|
||||
}
|
||||
$url = str_replace( array( 'https://', 'http://' ), '//', $url );
|
||||
return apply_filters( 'kirki_googlefonts_root_url', untrailingslashit( esc_url_raw( $url ) ) . '/webfonts' );
|
||||
}
|
||||
}
|
|
@ -148,65 +148,12 @@ final class Kirki_Modules_Webfonts_Embed {
|
|||
$transient_id = 'kirki_gfonts_' . md5( $url );
|
||||
$contents = get_transient( $transient_id );
|
||||
|
||||
/**
|
||||
* Reset the cache if we're using action=kirki-reset-cache in the URL.
|
||||
*
|
||||
* Note to code reviewers:
|
||||
* There's no need to check nonces or anything else, this is a simple true/false evaluation.
|
||||
*/
|
||||
if ( ! empty( $_GET['action'] ) && 'kirki-reset-cache' === $_GET['action'] ) { // phpcs:ignore WordPress.Security.NonceVerification
|
||||
$contents = false;
|
||||
if ( ! class_exists( 'Kirki_Fonts_Downloader' ) ) {
|
||||
include_once wp_normalize_path( dirname( __FILE__ ) . '/class-kirki-fonts-downloader.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
|
||||
}
|
||||
if ( ! $contents ) {
|
||||
$downloader = new Kirki_Fonts_Downloader();
|
||||
$contents = $downloader->get_styles( $url );
|
||||
|
||||
// Get the contents of the remote URL.
|
||||
$contents = Kirki_Fonts_Helper::get_remote_url_contents(
|
||||
$url,
|
||||
array(
|
||||
'headers' => array(
|
||||
/**
|
||||
* Set user-agent to firefox so that we get woff files.
|
||||
* If we want woff2, use this instead: 'Mozilla/5.0 (X11; Linux i686; rv:64.0) Gecko/20100101 Firefox/64.0'
|
||||
*/
|
||||
'user-agent' => 'Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Allow filtering the font-display property.
|
||||
*/
|
||||
$font_display = apply_filters( 'kirki_googlefonts_font_display', 'swap' );
|
||||
|
||||
if ( $contents ) {
|
||||
|
||||
// Add font-display:swap to improve rendering speed.
|
||||
$contents = str_replace( '@font-face {', '@font-face{', $contents );
|
||||
$contents = str_replace( '@font-face{', '@font-face{font-display:' . $font_display . ';', $contents );
|
||||
|
||||
// Remove blank lines and extra spaces.
|
||||
$contents = str_replace(
|
||||
array( ': ', '; ', '; ', ' ' ),
|
||||
array( ':', ';', ';', ' ' ),
|
||||
preg_replace( "/\r|\n/", '', $contents )
|
||||
);
|
||||
|
||||
// Use local fonts.
|
||||
if ( apply_filters( 'kirki_use_local_fonts', true ) ) {
|
||||
$contents = $this->use_local_files( $contents );
|
||||
}
|
||||
|
||||
// Remove protocol to fix http/https issues.
|
||||
$contents = str_replace(
|
||||
array( 'http://', 'https://' ),
|
||||
array( '//', '//' ),
|
||||
$contents
|
||||
);
|
||||
|
||||
// Set the transient for a day.
|
||||
set_transient( $transient_id, $contents, DAY_IN_SECONDS );
|
||||
}
|
||||
}
|
||||
if ( $contents ) {
|
||||
/**
|
||||
* Note to code reviewers:
|
||||
|
@ -221,29 +168,4 @@ final class Kirki_Modules_Webfonts_Embed {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads font-files locally and uses the local files instead of the ones from Google's servers.
|
||||
* This addresses any and all GDPR concerns, as well as firewalls that exist in some parts of the world.
|
||||
*
|
||||
* @access private
|
||||
* @since 3.0.36
|
||||
* @param string $css The CSS with original URLs.
|
||||
* @return string The CSS with local URLs.
|
||||
*/
|
||||
private function use_local_files( $css ) {
|
||||
preg_match_all( '/https\:.*?\.woff/', $css, $matches );
|
||||
|
||||
$matches = array_shift( $matches );
|
||||
|
||||
foreach ( $matches as $match ) {
|
||||
if ( 0 === strpos( $match, 'https://fonts.gstatic.com' ) ) {
|
||||
$new_url = Kirki_Fonts_Helper::download_font_file( $match );
|
||||
if ( $new_url ) {
|
||||
$css = str_replace( $match, $new_url, $css );
|
||||
}
|
||||
}
|
||||
}
|
||||
return $css;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@ class Kirki_Modules_Webfonts {
|
|||
*/
|
||||
protected function __construct() {
|
||||
|
||||
include_once wp_normalize_path( dirname( __FILE__ ) . '/class-kirki-fonts-helper.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
|
||||
include_once wp_normalize_path( dirname( __FILE__ ) . '/class-kirki-fonts.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
|
||||
include_once wp_normalize_path( dirname( __FILE__ ) . '/class-kirki-fonts-google.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -3,8 +3,8 @@ Contributors: aristath, dannycooper, wplemon, igmoweb
|
|||
Tags: customizer, options framework, theme, mods, toolkit, gutenberg
|
||||
Donate link: https://aristath.github.io/donate
|
||||
Requires at least: 4.9
|
||||
Tested up to: 5.2
|
||||
Stable tag: 3.0.45
|
||||
Tested up to: 5.3
|
||||
Stable tag: 3.1.0
|
||||
License: MIT
|
||||
License URI: https://opensource.org/licenses/MIT
|
||||
|
||||
|
@ -75,20 +75,15 @@ If you want to integrate Kirki in your theme or plugin, please read the instruct
|
|||
|
||||
== Changelog ==
|
||||
|
||||
= 3.0.45 - 2019-09-01 =
|
||||
|
||||
### Fixed
|
||||
* Compatibility with the latest Gutenberg plugin versions.
|
||||
* Styles for normal font-weights in typography controls (`regular` to `400` conversion).
|
||||
= 3.1.0 - 2020-03-01 =
|
||||
|
||||
### Changed
|
||||
* Completely refactored the google-fonts downloader. Fonts now get stored in `wp-content/fonts/{font-family}/{file}`.
|
||||
* Updated Google-Fonts lists.
|
||||
|
||||
### Removed
|
||||
* Backup fonts are no longer needed since google-fonts are no longer loaded from the google CDN.
|
||||
|
||||
### Deprecated
|
||||
* `kirki_fonts_backup_fonts` filter.
|
||||
* `Kirki_Fonts::get_backup_fonts()` method.
|
||||
* Removed the `branding` module.
|
||||
* Removed the `styling` module.
|
||||
* Removed the `telemetry` module.
|
||||
|
||||
[See the previous changelogs here](https://github.com/aristath/kirki/blob/master/CHANGELOG.md).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue