Update to Kirki 4.0.22

This commit is contained in:
AlxMedia 2022-03-15 14:29:17 +01:00
parent 2b6ac38550
commit 78edeb1b25
492 changed files with 29668 additions and 39884 deletions

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 kirki-framework
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,207 @@
<?php
/**
* Gutenberg integration for Kirki.
*
* This class contains methods for integrating Kirki with
* the new WordPress core editor, Gutenberg. It provides
* fonts and styles to be output by the theme.
*
* @package Kirki
* @category Core
* @author Tim Elsass
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
* @license https://opensource.org/licenses/MIT
* @since 3.0.35
*/
namespace Kirki\Module;
use Kirki\Compatibility\Kirki;
/**
* Wrapper class for static methods.
*
* @since 3.0.35
*/
class Editor_Styles {
/**
* Configuration reference.
*
* @access public
* @since 3.0.35
* @var object $configs
*/
private $configs;
/**
* Whether feature is enabled.
*
* @access public
* @since 3.0.35
* @var bool $enabled
*/
public $enabled;
/**
* CSS Module reference.
*
* @access public
* @since 3.0.35
* @var object $modules_css
*/
public $modules_css;
/**
* Webfonts Module reference.
*
* @access public
* @since 3.0.35
* @var object $modules_webfonts
*/
private $modules_webfonts;
/**
* Google Fonts reference.
*
* @access public
* @since 3.0.35
* @var object $google_fonts
*/
private $google_fonts;
/**
* Constructor.
*
* @access public
* @since 3.0.0
*/
public function __construct() {
add_action( 'admin_init', [ $this, 'init' ] );
}
/**
* Initialize Module.
*
* Sets class properties and add necessary hooks.
*
* @since 3.0.35
*/
public function init() {
$this->set_configs();
$this->set_enabled();
$this->set_modules_css();
$this->set_google_fonts();
$this->set_modules_webfonts();
$this->add_hooks();
}
/**
* Add hooks for Gutenberg editor integration.
*
* @access protected
* @since 3.0.35
*/
protected function add_hooks() {
if ( ! $this->is_disabled() ) {
add_action( 'enqueue_block_editor_assets', [ $this->modules_css, 'enqueue_styles' ], 999 );
add_action( 'after_setup_theme', [ $this, 'add_theme_support' ], 999 );
}
}
/**
* Add theme support for editor styles.
*
* This checks if theme has declared editor-styles support
* already, and if not present, declares it. Hooked late.
*
* @access public
* @since 3.0.35
*/
public function add_theme_support() {
if ( true !== get_theme_support( 'editor-styles' ) ) {
add_theme_support( 'editor-styles' );
}
}
/**
* Helper method to check if feature is disabled.
*
* Feature can be disabled by KIRKI_NO_OUTPUT constant,
* gutenbeg_support argument, and disabled output argument.
*
* @access public
* @param array $args An array of arguments.
* @since 3.0.35
*
* @return bool $disabled Is gutenberg integration feature disabled?
*/
private function is_disabled( $args = [] ) {
if ( defined( 'KIRKI_NO_OUTPUT' ) && true === KIRKI_NO_OUTPUT ) {
return true;
}
if ( ! empty( $args ) ) {
if ( isset( $args['disable_output'] ) && true === $args['disable_output'] ) {
return true;
}
if ( ! isset( $args['gutenberg_support'] ) || true !== $args['gutenberg_support'] ) {
return true;
}
}
return false;
}
/**
* Set class property for $configs.
*
* @access private
* @since 3.0.35
*/
private function set_configs() {
$this->configs = Kirki::$config;
return $this->configs;
}
/**
* Set class property for $enabled.
*
* @access private
* @since 3.0.35
*/
private function set_enabled() {
$this->enabled = ! $this->is_disabled();
}
/**
* Set class property for $modules_css.
*
* @access private
* @since 3.0.35
*/
private function set_modules_css() {
$this->modules_css = new \Kirki\Module\CSS();
}
/**
* Set class property for $google_fonts.
*
* @access private
* @since 3.0.35
*/
private function set_google_fonts() {
$this->google_fonts = \Kirki\Module\Webfonts\Google::get_instance();
}
/**
* Set class property for $modules_webfonts.
*
* @access private
* @since 3.0.35
*/
private function set_modules_webfonts() {
$this->modules_webfonts = new \Kirki\Module\Webfonts();
}
}