-
-
-
-
-
-
-
-
-
-
-
-
-
-
- selected <# } #>>
- selected <# } #>>
- selected <# } #>>
- selected <# } #>>
-
-
-
-
-
-
-
- selected <# } #>>
- selected <# } #>>
- selected <# } #>>
- selected <# } #>>
- selected <# } #>>
- selected <# } #>>
- selected <# } #>>
- selected <# } #>>
- selected <# } #>>
-
-
-
-
-
-
-
-
-
- ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ),
- 'noFileSelected' => esc_html__( 'No File Selected', 'kirki' ),
- 'remove' => esc_html__( 'Remove', 'kirki' ),
- 'default' => esc_html__( 'Default', 'kirki' ),
- 'selectFile' => esc_html__( 'Select File', 'kirki' ),
- 'standardFonts' => esc_html__( 'Standard Fonts', 'kirki' ),
- 'googleFonts' => esc_html__( 'Google Fonts', 'kirki' ),
- 'defaultCSSValues' => esc_html__( 'CSS Defaults', 'kirki' ),
- 'defaultBrowserFamily' => esc_html__( 'Default Browser Font-Family', 'kirki' ),
- )
- );
-
- $suffix = str_replace( '.min', '', $suffix );
-
- // Enqueue the style.
- wp_enqueue_style(
- 'kirki-styles',
- "{$kirki_url}controls/css/styles{$suffix}.css",
- array(),
- KIRKI_VERSION
- );
- }
-
- /**
- * Refresh the parameters passed to the JavaScript via JSON.
- *
- * @see WP_Customize_Control::to_json()
- */
- public function to_json() {
-
- // Get the basics from the parent class.
- parent::to_json();
-
- // Default value.
- $this->json['default'] = $this->setting->default;
- if ( isset( $this->default ) ) {
- $this->json['default'] = $this->default;
- }
-
- // Required.
- $this->json['required'] = $this->required;
-
- // Output.
- $this->json['output'] = $this->output;
-
- // Value.
- $this->json['value'] = $this->value();
-
- // Choices.
- $this->json['choices'] = $this->choices;
-
- // The link.
- $this->json['link'] = $this->get_link();
-
- // The ID.
- $this->json['id'] = $this->id;
-
- // Translation strings.
- $this->json['l10n'] = $this->l10n();
-
- // The ajaxurl in case we need it.
- $this->json['ajaxurl'] = admin_url( 'admin-ajax.php' );
-
- // Input attributes.
- $this->json['inputAttrs'] = '';
- foreach ( $this->input_attrs as $attr => $value ) {
- $this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
- }
-
- // The kirki-config.
- $this->json['kirkiConfig'] = $this->kirki_config;
-
- // The option-type.
- $this->json['kirkiOptionType'] = $this->option_type;
-
- // The option-name.
- $this->json['kirkiOptionName'] = $this->option_name;
-
- // The preset.
- $this->json['preset'] = $this->preset;
-
- // The CSS-Variables.
- $this->json['css-var'] = $this->css_vars;
- }
-
- /**
- * Render the control's content.
- *
- * 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
- */
- protected function render_content() {}
-
- /**
- * An Underscore (JS) template for this control's content (but not its container).
- *
- * Class variables for this control class are available in the `data` JS object;
- * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
- *
- * @see WP_Customize_Control::print_template()
- *
- * @access protected
- */
- protected function content_template() {}
-
- /**
- * Returns an array of translation strings.
- *
- * @access protected
- * @since 3.0.0
- * @return array
- */
- protected function l10n() {
- return array();
- }
-}
diff --git a/assets/kirki/controls/php/class-kirki-control-checkbox.php b/assets/kirki/controls/php/class-kirki-control-checkbox.php
deleted file mode 100644
index e66ff45..0000000
--- a/assets/kirki/controls/php/class-kirki-control-checkbox.php
+++ /dev/null
@@ -1,56 +0,0 @@
-render_content.
- *
- * @since 3.0.26
- */
- protected function render_content() {
- $input_id = '_customize-input-' . $this->id;
- $description_id = '_customize-description-' . $this->id;
- ?>
-
- description ) ) ? ' aria-describedby="' . esc_attr( $description_id ) . '" ' : ''; ?>
- type="checkbox"
- value="value() ); ?>"
- link(); ?>
- value() ); ?>
- />
- label ); ?>
- description ) ) : ?>
- description ); ?>
-
-
-
-
- json['required'] = $this->required;
- }
- }
-}
diff --git a/assets/kirki/controls/php/class-kirki-control-color-palette.php b/assets/kirki/controls/php/class-kirki-control-color-palette.php
deleted file mode 100644
index 29f823e..0000000
--- a/assets/kirki/controls/php/class-kirki-control-color-palette.php
+++ /dev/null
@@ -1,79 +0,0 @@
-json['choices']['colors'] ) || empty( $this->json['choices']['colors'] ) ) {
- $this->json['choices']['colors'] = Kirki_Helper::get_material_design_colors( 'primary' );
- }
- if ( ! isset( $this->json['choices']['size'] ) || empty( $this->json['choices']['size'] ) ) {
- $this->json['choices']['size'] = 20;
- }
- }
-
- /**
- * An Underscore (JS) template for this control's content (but not its container).
- *
- * Class variables for this control class are available in the `data` JS object;
- * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
- *
- * @see WP_Customize_Control::print_template()
- *
- * @access protected
- */
- protected function content_template() {
- ?>
- <# if ( ! data.choices ) { return; } #>
-
- {{{ data.label }}}
-
- <# if ( data.description ) { #>
-
{{{ data.description }}}
- <# } #>
-
- <# for ( key in data.choices['colors'] ) { #>
- checked<# } #>>
-
- {{ data.choices['colors'][ key ] }}
-
-
- <# } #>
-
- json['palette'] = $this->palette;
- $this->json['choices']['alpha'] = ( isset( $this->choices['alpha'] ) && $this->choices['alpha'] ) ? 'true' : 'false';
- $this->json['mode'] = $this->mode;
- }
-}
diff --git a/assets/kirki/controls/php/class-kirki-control-cropped-image.php b/assets/kirki/controls/php/class-kirki-control-cropped-image.php
deleted file mode 100644
index 29603be..0000000
--- a/assets/kirki/controls/php/class-kirki-control-cropped-image.php
+++ /dev/null
@@ -1,37 +0,0 @@
-json['required'] = $this->required;
- }
-}
diff --git a/assets/kirki/controls/php/class-kirki-control-custom.php b/assets/kirki/controls/php/class-kirki-control-custom.php
deleted file mode 100644
index 68a168e..0000000
--- a/assets/kirki/controls/php/class-kirki-control-custom.php
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
- <# if ( data.label ) { #>{{{ data.label }}} <# } #>
- <# if ( data.description ) { #>{{{ data.description }}} <# } #>
-
- {{{ data.value }}}
-
- json['icons'] = Kirki_Helper::get_dashicons();
- }
-
- /**
- * An Underscore (JS) template for this control's content (but not its container).
- *
- * Class variables for this control class are available in the `data` JS object;
- * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
- *
- * @see WP_Customize_Control::print_template()
- *
- * @access protected
- */
- protected function content_template() {
- ?>
- <# if ( data.label ) { #>
{{{ data.label }}} <# } #>
- <# if ( data.description ) { #>
{{{ data.description }}} <# } #>
-
- <# if ( ! _.isUndefined( data.choices ) && 1 < _.size( data.choices ) ) { #>
- <# for ( key in data.choices ) { #>
- checked="checked"<# } #>>
-
-
- <# } #>
- <# } else { #>
-
Admin Menu
- <# for ( key in data.icons['admin-menu'] ) { #>
- checked="checked"<# } #>>
-
-
- <# } #>
- Welcome Screen
- <# for ( key in data.icons['welcome-screen'] ) { #>
- checked="checked"<# } #>>
-
-
- <# } #>
- Post Formats
- <# for ( key in data.icons['post-formats'] ) { #>
- checked="checked"<# } #>>
-
-
- <# } #>
- Media
- <# for ( key in data.icons['media'] ) { #>
- checked="checked"<# } #>>
-
-
- <# } #>
- Image Editing
- <# for ( key in data.icons['image-editing'] ) { #>
- checked="checked"<# } #>>
-
-
- <# } #>
- TinyMCE
- <# for ( key in data.icons['tinymce'] ) { #>
- checked="checked"<# } #>>
-
-
- <# } #>
- Posts
- <# for ( key in data.icons['posts'] ) { #>
- checked="checked"<# } #>>
-
-
- <# } #>
- Sorting
- <# for ( key in data.icons['sorting'] ) { #>
- checked="checked"<# } #>>
-
-
- <# } #>
- Social
- <# for ( key in data.icons['social'] ) { #>
- checked="checked"<# } #>>
-
-
- <# } #>
- WordPress
- <# for ( key in data.icons['wordpress_org'] ) { #>
- checked="checked"<# } #>>
-
-
- <# } #>
- Products
- <# for ( key in data.icons['products'] ) { #>
- checked="checked"<# } #>>
-
-
- <# } #>
- Taxonomies
- <# for ( key in data.icons['taxonomies'] ) { #>
- checked="checked"<# } #>>
-
-
- <# } #>
- Widgets
- <# for ( key in data.icons['widgets'] ) { #>
- checked="checked"<# } #>>
-
-
- <# } #>
- Notifications
- <# for ( key in data.icons['notifications'] ) { #>
- checked="checked"<# } #>>
-
-
- <# } #>
- Misc
- <# for ( key in data.icons['misc'] ) { #>
- checked="checked"<# } #>>
-
-
- <# } #>
- <# } #>
-
-
-
- <# if ( data.label ) { #>{{{ data.label }}} <# } #>
- <# if ( data.description ) { #>{{{ data.description }}} <# } #>
-
-
-
-
- esc_html__( 'Invalid Value', 'kirki' ),
- )
- );
- }
-
- /**
- * An Underscore (JS) template for this control's content (but not its container).
- *
- * Class variables for this control class are available in the `data` JS object;
- * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
- *
- * @see WP_Customize_Control::print_template()
- *
- * @access protected
- */
- protected function content_template() {
- ?>
-
- <# if ( data.label ) { #>{{{ data.label }}} <# } #>
- <# if ( data.description ) { #>{{{ data.description }}} <# } #>
-
- <# var val = ( data.value && _.isString( data.value ) ) ? data.value.replace( '%%', '%' ) : ''; #>
-
-
-
- choices ) ) {
- foreach ( $this->choices as $choice => $value ) {
- if ( 'labels' !== $choice && true === $value ) {
- $this->json['choices'][ $choice ] = true;
- }
- }
- }
- if ( is_array( $this->json['default'] ) ) {
- foreach ( $this->json['default'] as $key => $value ) {
- if ( isset( $this->json['choices'][ $key ] ) && ! isset( $this->json['value'][ $key ] ) ) {
- $this->json['value'][ $key ] = $value;
- }
- }
- }
- }
-
- /**
- * Enqueue control related scripts/styles.
- *
- * @access public
- */
- public function enqueue() {
- wp_enqueue_style( 'kirki-styles', trailingslashit( Kirki::$url ) . 'controls/css/styles.css', array(), KIRKI_VERSION );
- wp_localize_script( 'kirki-script', 'dimensionskirkiL10n', $this->l10n() );
- }
-
- /**
- * An Underscore (JS) template for this control's content (but not its container).
- *
- * Class variables for this control class are available in the `data` JS object;
- * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
- *
- * @see WP_Customize_Control::print_template()
- *
- * @access protected
- */
- protected function content_template() {
- ?>
-
- <# if ( data.label ) { #>{{{ data.label }}} <# } #>
- <# if ( data.description ) { #>{{{ data.description }}} <# } #>
-
-
- <# for ( choiceKey in data.default ) { #>
-
-
- <# if ( ! _.isUndefined( data.choices.labels ) && ! _.isUndefined( data.choices.labels[ choiceKey ] ) ) { #>
- {{ data.choices.labels[ choiceKey ] }}
- <# } else if ( ! _.isUndefined( data.l10n[ choiceKey ] ) ) { #>
- {{ data.l10n[ choiceKey ] }}
- <# } else { #>
- {{ choiceKey }}
- <# } #>
-
-
- <# var val = ( ! _.isUndefined( data.value ) && ! _.isUndefined( data.value[ choiceKey ] ) ) ? data.value[ choiceKey ].toString().replace( '%%', '%' ) : ''; #>
-
-
-
- <# } #>
-
-
-
- esc_html__( 'Left Top', 'kirki' ),
- 'left-center' => esc_html__( 'Left Center', 'kirki' ),
- 'left-bottom' => esc_html__( 'Left Bottom', 'kirki' ),
- 'right-top' => esc_html__( 'Right Top', 'kirki' ),
- 'right-center' => esc_html__( 'Right Center', 'kirki' ),
- 'right-bottom' => esc_html__( 'Right Bottom', 'kirki' ),
- 'center-top' => esc_html__( 'Center Top', 'kirki' ),
- 'center-center' => esc_html__( 'Center Center', 'kirki' ),
- 'center-bottom' => esc_html__( 'Center Bottom', 'kirki' ),
- 'font-size' => esc_html__( 'Font Size', 'kirki' ),
- 'font-weight' => esc_html__( 'Font Weight', 'kirki' ),
- 'line-height' => esc_html__( 'Line Height', 'kirki' ),
- 'font-style' => esc_html__( 'Font Style', 'kirki' ),
- 'letter-spacing' => esc_html__( 'Letter Spacing', 'kirki' ),
- 'word-spacing' => esc_html__( 'Word Spacing', 'kirki' ),
- 'top' => esc_html__( 'Top', 'kirki' ),
- 'bottom' => esc_html__( 'Bottom', 'kirki' ),
- 'left' => esc_html__( 'Left', 'kirki' ),
- 'right' => esc_html__( 'Right', 'kirki' ),
- 'center' => esc_html__( 'Center', 'kirki' ),
- 'size' => esc_html__( 'Size', 'kirki' ),
- 'spacing' => esc_html__( 'Spacing', 'kirki' ),
- 'width' => esc_html__( 'Width', 'kirki' ),
- 'height' => esc_html__( 'Height', 'kirki' ),
- 'invalid-value' => esc_html__( 'Invalid Value', 'kirki' ),
- );
- }
-}
diff --git a/assets/kirki/controls/php/class-kirki-control-editor.php b/assets/kirki/controls/php/class-kirki-control-editor.php
deleted file mode 100644
index a947692..0000000
--- a/assets/kirki/controls/php/class-kirki-control-editor.php
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
- <# if ( data.label ) { #>{{{ data.label }}} <# } #>
- <# if ( data.description ) { #>{{{ data.description }}} <# } #>
-
-
-
-
- <# if ( data.label ) { #>{{{ data.label }}} <# } #>
- <# if ( data.description ) { #>{{{ data.description }}} <# } #>
-
-
-
- <# if ( ! data.choices ) { return; } #>
-
- <# if ( data.label ) { #>
{{{ data.label }}} <# } #>
- <# if ( data.description ) { #>
{{{ data.description }}} <# } #>
-
-
- json['alpha'] = (bool) $this->alpha;
- }
-
- /**
- * An Underscore (JS) template for this control's content (but not its container).
- *
- * Class variables for this control class are available in the `data` JS object;
- * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
- *
- * @see WP_Customize_Control::print_template()
- *
- * @access protected
- */
- protected function content_template() {
- ?>
-
- {{{ data.label }}}
-
- <# if ( data.description ) { #>
-
{{{ data.description }}}
- <# } #>
-
- <# for ( key in data.choices ) { #>
- <# if ( 'irisArgs' !== key ) { #>
-
-
-
- <# } #>
- <# } #>
-
-
-
- <# if ( ! data.choices ) { return; } #>
-
- {{{ data.label }}}
-
- <# if ( data.description ) { #>
-
{{{ data.description }}}
- <# } #>
-
- <# for ( key in data.choices ) { #>
- checked<# } #>>
-
- <# for ( color in data.choices[ key ] ) { #>
- {{ data.choices[ key ][ color ] }}
- <# } #>
-
-
- <# } #>
-
-
- <# if ( data.label ) { #>
{{{ data.label }}} <# } #>
- <# if ( data.description ) { #>
{{{ data.description }}} <# } #>
-
- <# for ( key in data.choices ) { #>
- checked="checked" <# } #>>
- {{{ data.choices[ key ] }}}
-
- <# } #>
-
- input_attrs as $attr => $value ) {
- if ( 'style' !== $attr ) {
- $this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
- continue;
- }
- $this->json['labelStyle'] = 'style="' . esc_attr( $value ) . '" ';
- }
-
- }
-
- /**
- * An Underscore (JS) template for this control's content (but not its container).
- *
- * Class variables for this control class are available in the `data` JS object;
- * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
- *
- * @see WP_Customize_Control::print_template()
- *
- * @access protected
- */
- protected function content_template() {
- ?>
-
- <# if ( data.label ) { #>{{{ data.label }}} <# } #>
- <# if ( data.description ) { #>{{{ data.description }}} <# } #>
-
-
- row_label = array(
- 'type' => 'text',
- 'value' => esc_attr__( 'row', 'kirki' ),
- 'field' => false,
- );
-
- // Validate row-labels.
- $this->row_label( $args );
-
- if ( empty( $this->button_label ) ) {
- /* translators: %s represents the label of the row. */
- $this->button_label = sprintf( esc_html__( 'Add new %s', 'kirki' ), $this->row_label['value'] );
- }
-
- if ( empty( $args['fields'] ) || ! is_array( $args['fields'] ) ) {
- $args['fields'] = array();
- }
-
- // An array to store keys of fields that need to be filtered.
- $media_fields_to_filter = array();
-
- foreach ( $args['fields'] as $key => $value ) {
- if ( ! isset( $value['default'] ) ) {
- $args['fields'][ $key ]['default'] = '';
- }
- if ( ! isset( $value['label'] ) ) {
- $args['fields'][ $key ]['label'] = '';
- }
- $args['fields'][ $key ]['id'] = $key;
-
- // We check if the filed is an uploaded media ( image , file, video, etc.. ).
- if ( isset( $value['type'] ) ) {
- switch ( $value['type'] ) {
- 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(
- 'name' => '',
- 'echo' => 0,
- 'show_option_none' => esc_html__( 'Select a Page', 'kirki' ),
- 'option_none_value' => '0',
- 'selected' => '',
- )
- );
-
- // Hackily add in the data link parameter.
- $dropdown = str_replace( '
get_link(), $dropdown ); // phpcs:ignore Generic.Formatting.MultipleStatementAlignment.NotSameWarning
- $args['fields'][ $key ]['dropdown'] = $dropdown;
- break;
- }
- }
- }
-
- $this->fields = $args['fields'];
-
- // Now we are going to filter the fields.
- // First we create a copy of the value that would be used otherwise.
- $this->filtered_value = $this->value();
-
- if ( is_array( $this->filtered_value ) && ! empty( $this->filtered_value ) ) {
-
- // We iterate over the list of fields.
- foreach ( $this->filtered_value as &$filtered_value_field ) {
-
- if ( is_array( $filtered_value_field ) && ! empty( $filtered_value_field ) ) {
-
- // We iterate over the list of properties for this field.
- foreach ( $filtered_value_field as $key => &$value ) {
-
- // We check if this field was marked as requiring extra filtering (in this case image, cropped_images, upload).
- if ( array_key_exists( $key, $media_fields_to_filter ) ) {
-
- // What follows was made this way to preserve backward compatibility.
- // The repeater control use to store the URL for images instead of the attachment ID.
- // We check if the value look like an ID (otherwise it's probably a URL so don't filter it).
- if ( is_numeric( $value ) ) {
-
- // "sanitize" the value.
- $attachment_id = (int) $value;
-
- // Try to get the attachment_url.
- $url = wp_get_attachment_url( $attachment_id );
-
- $filename = basename( get_attached_file( $attachment_id ) );
-
- // If we got a URL.
- if ( $url ) {
-
- // 'id' is needed for form hidden value, URL is needed to display the image.
- $value = array(
- 'id' => $attachment_id,
- 'url' => $url,
- 'filename' => $filename,
- );
- }
- }
- }
- }
- }
- }
- }
- }
-
- /**
- * Refresh the parameters passed to the JavaScript via JSON.
- *
- * @access public
- */
- public function to_json() {
- parent::to_json();
-
- $fields = $this->fields;
-
- $this->json['fields'] = $fields;
- $this->json['row_label'] = $this->row_label;
-
- // If filtered_value has been set and is not empty we use it instead of the actual value.
- if ( is_array( $this->filtered_value ) && ! empty( $this->filtered_value ) ) {
- $this->json['value'] = $this->filtered_value;
- }
- $this->json['value'] = apply_filters( "kirki_controls_repeater_value_{$this->id}", $this->json['value'] );
- }
-
- /**
- * Render the control's content.
- * Allows the content to be overriden without having to rewrite the wrapper in $this->render().
- *
- * @access protected
- */
- protected function render_content() {
- ?>
-
- label ) ) : ?>
- label ); ?>
-
- description ) ) : ?>
- description ); ?>
-
- get_link() ); ?> />
-
-
-
-
- choices['limit'] ) ) : ?>
-
- choices['limit'] ) ); ?>
-
- button_label ); ?>
-
- repeater_js_template();
-
- }
-
- /**
- * An Underscore (JS) template for this control's content (but not its container).
- * Class variables for this control class are available in the `data` JS object.
- *
- * @access public
- */
- public function repeater_js_template() {
- ?>
-
- row_label['type'] = $args['row_label']['type'];
- }
-
- // Validating row label type.
- if ( isset( $args['row_label']['value'] ) && ! empty( $args['row_label']['value'] ) ) {
- $this->row_label['value'] = esc_html( $args['row_label']['value'] );
- }
-
- // Validating row label field.
- if ( isset( $args['row_label']['field'] ) && ! empty( $args['row_label']['field'] ) && isset( $args['fields'][ sanitize_key( $args['row_label']['field'] ) ] ) ) {
- $this->row_label['field'] = esc_html( $args['row_label']['field'] );
- } else {
- // If from field is not set correctly, making sure standard is set as the type.
- $this->row_label['type'] = 'text';
- }
- }
- }
-}
diff --git a/assets/kirki/controls/php/class-kirki-control-select.php b/assets/kirki/controls/php/class-kirki-control-select.php
deleted file mode 100644
index b4181e4..0000000
--- a/assets/kirki/controls/php/class-kirki-control-select.php
+++ /dev/null
@@ -1,58 +0,0 @@
-json['multiple'] = $this->multiple;
- $this->json['placeholder'] = $this->placeholder;
- }
-}
diff --git a/assets/kirki/controls/php/class-kirki-control-slider.php b/assets/kirki/controls/php/class-kirki-control-slider.php
deleted file mode 100644
index c94bfa4..0000000
--- a/assets/kirki/controls/php/class-kirki-control-slider.php
+++ /dev/null
@@ -1,75 +0,0 @@
-json['choices'] = wp_parse_args(
- $this->json['choices'], array(
- 'min' => '0',
- 'max' => '100',
- 'step' => '1',
- 'suffix' => '',
- )
- );
- }
-
- /**
- * An Underscore (JS) template for this control's content (but not its container).
- *
- * Class variables for this control class are available in the `data` JS object;
- * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
- *
- * @see WP_Customize_Control::print_template()
- *
- * @access protected
- */
- protected function content_template() {
- ?>
-
- <# if ( data.label ) { #>{{{ data.label }}} <# } #>
- <# if ( data.description ) { #>{{{ data.description }}} <# } #>
-
-
-
-
-
- {{ data.choices['suffix'] }}
-
-
-
-
-
-
- {{{ data.label }}}
-
- <# if ( data.description ) { #>
- {{{ data.description }}}
- <# } #>
-
-
- <# _.each( data.value, function( choiceID ) { #>
-
-
-
- {{{ data.choices[ choiceID ] }}}
-
- <# }); #>
- <# _.each( data.choices, function( choiceLabel, choiceID ) { #>
- <# if ( -1 === data.value.indexOf( choiceID ) ) { #>
-
-
-
- {{{ data.choices[ choiceID ] }}}
-
- <# } #>
- <# }); #>
-
-
-
-
-
- {{{ data.label }}}
-
- <# if ( data.description ) { #>
- {{{ data.description }}}
- <# } #>
- checked<# } #> />
-
-
- <# data.choices.on = data.choices.on || '' #>
- {{ data.choices.on }}
-
-
- <# data.choices.off = data.choices.off || '' #>
- {{ data.choices.off }}
-
-
-
-
-
-
- {{{ data.label }}}
-
- <# if ( data.description ) { #>
- {{{ data.description }}}
- <# } #>
- checked<# } #> hidden />
-
-
- json['value'] ) ) {
- foreach ( array_keys( $this->json['value'] ) as $key ) {
- if ( ! in_array( $key, array( 'variant', 'font-weight', 'font-style' ), true ) && ! isset( $this->json['default'][ $key ] ) ) {
- unset( $this->json['value'][ $key ] );
- }
-
- // Fix for https://wordpress.org/support/topic/white-font-after-updateing-to-3-0-16.
- if ( ! isset( $this->json['default'][ $key ] ) ) {
- unset( $this->json['value'][ $key ] );
- }
-
- // Fix for https://github.com/aristath/kirki/issues/1405.
- if ( isset( $this->json['default'][ $key ] ) && false === $this->json['default'][ $key ] ) {
- unset( $this->json['value'][ $key ] );
- }
- }
- }
-
- $this->json['show_variants'] = ( true === Kirki_Fonts_Google::$force_load_all_variants ) ? false : true;
- }
-
- /**
- * An Underscore (JS) template for this control's content (but not its container).
- *
- * Class variables for this control class are available in the `data` JS object;
- * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
- *
- * @see WP_Customize_Control::print_template()
- *
- * @access protected
- */
- protected function content_template() {
- ?>
-
- <# if ( data.label ) { #>{{{ data.label }}} <# } #>
- <# if ( data.description ) { #>{{{ data.description }}} <# } #>
-
-
-
-
- <# if ( ! _.isUndefined( data.default['font-family'] ) ) { #>
- <# data.value['font-family'] = data.value['font-family'] || data['default']['font-family']; #>
- <# if ( data.choices['fonts'] ) { data.fonts = data.choices['fonts']; } #>
-
-
-
-
- <# if ( ! _.isUndefined( data.choices['font-backup'] ) && true === data.choices['font-backup'] ) { #>
-
-
-
-
- <# } #>
- <# if ( true === data.show_variants || false !== data.default.variant ) { #>
-
-
-
-
- <# } #>
-
-
-
-
-
-
- <# } #>
-
- <# if ( ! _.isUndefined( data.default['font-size'] ) ) { #>
- <# data.value['font-size'] = data.value['font-size'] || data['default']['font-size']; #>
-
-
-
-
- <# } #>
-
- <# if ( ! _.isUndefined( data.default['line-height'] ) ) { #>
- <# data.value['line-height'] = data.value['line-height'] || data['default']['line-height']; #>
-
-
-
-
- <# } #>
-
- <# if ( ! _.isUndefined( data.default['letter-spacing'] ) ) { #>
- <# data.value['letter-spacing'] = data.value['letter-spacing'] || data['default']['letter-spacing']; #>
-
-
-
-
- <# } #>
-
- <# if ( ! _.isUndefined( data.default['word-spacing'] ) ) { #>
- <# data.value['word-spacing'] = data.value['word-spacing'] || data['default']['word-spacing']; #>
-
-
-
-
- <# } #>
-
- <# if ( ! _.isUndefined( data.default['text-align'] ) ) { #>
- <# data.value['text-align'] = data.value['text-align'] || data['default']['text-align']; #>
-
- <# } #>
-
- <# if ( ! _.isUndefined( data.default['text-transform'] ) ) { #>
- <# data.value['text-transform'] = data.value['text-transform'] || data['default']['text-transform']; #>
-
-
-
- selected<# } #>>
- selected<# } #>>
- selected<# } #>>
- selected<# } #>>
- selected<# } #>>
- selected<# } #>>
- selected<# } #>>
-
-
- <# } #>
-
- <# if ( ! _.isUndefined( data.default['text-decoration'] ) ) { #>
- <# data.value['text-decoration'] = data.value['text-decoration'] || data['default']['text-decoration']; #>
-
-
-
- selected<# } #>>
- selected<# } #>>
- selected<# } #>>
- selected<# } #>>
- selected<# } #>>
- selected<# } #>>
- selected<# } #>>
-
-
- <# } #>
-
- <# if ( ! _.isUndefined( data.default['margin-top'] ) ) { #>
- <# data.value['margin-top'] = data.value['margin-top'] || data['default']['margin-top']; #>
-
-
-
-
- <# } #>
-
- <# if ( ! _.isUndefined( data.default['margin-bottom'] ) ) { #>
- <# data.value['margin-bottom'] = data.value['margin-bottom'] || data['default']['margin-bottom']; #>
-
-
-
-
- <# } #>
-
- <# if ( ! _.isUndefined( data.default['color'] ) && false !== data.default['color'] ) { #>
- <# data.value['color'] = data.value['color'] || data['default']['color']; #>
-
-
-
-
- <# } #>
-
-
-
- $variant,
- 'label' => isset( $all_variants[ $variant ] ) ? $all_variants[ $variant ] : $variant,
- );
- } elseif ( is_array( $variant ) && isset( $variant['id'] ) && isset( $variant['label'] ) ) {
- $final_variants[] = $variant;
- }
- }
- return $final_variants;
- }
-}
diff --git a/assets/kirki/controls/php/class-kirki-control-upload.php b/assets/kirki/controls/php/class-kirki-control-upload.php
deleted file mode 100644
index 365bf69..0000000
--- a/assets/kirki/controls/php/class-kirki-control-upload.php
+++ /dev/null
@@ -1,37 +0,0 @@
-json['required'] = $this->required;
- }
-}
diff --git a/assets/kirki/controls/php/class-kirki-settings-repeater-setting.php b/assets/kirki/controls/php/class-kirki-settings-repeater-setting.php
deleted file mode 100644
index 69eccea..0000000
--- a/assets/kirki/controls/php/class-kirki-settings-repeater-setting.php
+++ /dev/null
@@ -1,79 +0,0 @@
-id}", array( $this, 'sanitize_repeater_setting' ), 10, 1 );
- }
-
- /**
- * Fetch the value of the setting.
- *
- * @access public
- * @return mixed The value.
- */
- public function value() {
- return (array) parent::value();
- }
-
- /**
- * Convert the JSON encoded setting coming from Customizer to an Array.
- *
- * @access public
- * @param string $value URL Encoded JSON Value.
- * @return array
- */
- public function sanitize_repeater_setting( $value ) {
- if ( ! is_array( $value ) ) {
- $value = json_decode( urldecode( $value ) );
- }
- if ( empty( $value ) || ! is_array( $value ) ) {
- $value = array();
- }
-
- // Make sure that every row is an array, not an object.
- foreach ( $value as $key => $val ) {
- $value[ $key ] = (array) $val;
- if ( empty( $val ) ) {
- unset( $value[ $key ] );
- }
- }
-
- // Reindex array.
- if ( is_array( $value ) ) {
- $value = array_values( $value );
- }
-
- return $value;
- }
-}
diff --git a/assets/kirki/controls/views/code.php b/assets/kirki/controls/views/code.php
deleted file mode 100644
index cb51c1e..0000000
--- a/assets/kirki/controls/views/code.php
+++ /dev/null
@@ -1,36 +0,0 @@
-
-<#
-data = _.defaults( data, {
- id: '',
- label: '',
- description: '',
- input_attrs: {}
-});
-<# var elementIdPrefix = 'el' + String( Math.random() ); #>
-
diff --git a/assets/kirki/controls/views/color.php b/assets/kirki/controls/views/color.php
deleted file mode 100644
index 75dec2f..0000000
--- a/assets/kirki/controls/views/color.php
+++ /dev/null
@@ -1,47 +0,0 @@
-
-<#
-data = _.defaults( data, {
- label: '',
- description: '',
- mode: 'full',
- inputAttrs: '',
- 'data-palette': data['data-palette'] ? data['data-palette'] : true,
- 'data-default-color': data['data-default-color'] ? data['data-default-color'] : '',
- 'data-alpha': data['data-alpha'] ? data['data-alpha'] : false,
- value: '',
- 'data-id': ''
-} );
-#>
-
-
-
- <# if ( data.label ) { #>
- {{{ data.label }}}
- <# } #>
- <# if ( data.description ) { #>
- {{{ data.description }}}
- <# } #>
-
-
-
diff --git a/assets/kirki/controls/views/generic.php b/assets/kirki/controls/views/generic.php
deleted file mode 100644
index 38a224d..0000000
--- a/assets/kirki/controls/views/generic.php
+++ /dev/null
@@ -1,43 +0,0 @@
-
-<#
-element = ( data.choices.element ) ? data.choices.element : 'input';
-data = _.defaults( data, {
- label: '',
- description: '',
- inputAttrs: '',
- value: '',
- 'data-id': '',
- choices: {}
-} );
-#>
-
diff --git a/assets/kirki/controls/views/image.php b/assets/kirki/controls/views/image.php
deleted file mode 100644
index b440116..0000000
--- a/assets/kirki/controls/views/image.php
+++ /dev/null
@@ -1,67 +0,0 @@
-
-<#
-data = _.defaults( data, {
- id: '',
- label: '',
- description: '',
- input_attrs: {},
- choices: {}
-});
-
-var saveAs = 'url';
-if ( ! _.isUndefined( data.choices.save_as ) ) {
- saveAs = data.choices.save_as;
-}
-
-url = data.value;
-if ( _.isObject( data.value ) && ! _.isUndefined( data.value.url ) ) {
- url = data.value.url;
-}
-
-data.choices.labels = _.isObject( data.choices.labels ) ? data.choices.labels : {};
-data.choices.labels = _.defaults( data.choices.labels, {
- select: '',
- change: '',
- 'default': '',
- remove: '',
- placeholder: '',
- frame_title: '',
- frame_button: '',
-} );
-#>
-
-
-
- {{{ data.label }}}
-
- <# if ( data.description ) { #>
- {{{ data.description }}}
- <# } #>
-
-
diff --git a/assets/kirki/controls/views/number.php b/assets/kirki/controls/views/number.php
deleted file mode 100644
index bb238ef..0000000
--- a/assets/kirki/controls/views/number.php
+++ /dev/null
@@ -1,37 +0,0 @@
-
-<#
-data = _.defaults( data, {
- label: '',
- description: '',
- inputAttrs: '',
- value: '',
- 'data-id': ''
-} );
-#>
-
-
diff --git a/assets/kirki/controls/views/radio.php b/assets/kirki/controls/views/radio.php
deleted file mode 100644
index 59c9699..0000000
--- a/assets/kirki/controls/views/radio.php
+++ /dev/null
@@ -1,48 +0,0 @@
-
-<# data = _.defaults( data, {
- choices: {},
- label: '',
- description: '',
- inputAttrs: '',
- value: '',
- 'data-id': '',
- 'default': ''
-} );
-#>
-
-
- <# if ( data.label ) { #>
- {{{ data.label }}}
- <# } #>
- <# if ( data.description ) { #>
- {{{ data.description }}}
- <# } #>
- <# _.each( data.choices, function( val, key ) { #>
-
- checked<# } #>
- />
- <# if ( _.isArray( val ) ) { #>
- {{{ val[0] }}}{{{ val[1] }}}
- <# } else { #>
- {{ val }}
- <# } #>
-
- <# } ); #>
-
diff --git a/assets/kirki/controls/views/select.php b/assets/kirki/controls/views/select.php
deleted file mode 100644
index 96269e7..0000000
--- a/assets/kirki/controls/views/select.php
+++ /dev/null
@@ -1,72 +0,0 @@
-
-<#
-data = _.defaults( data, {
- label: '',
- description: '',
- inputAttrs: '',
- 'data-id': '',
- choices: {},
- multiple: 1,
- value: ( 1 < data.multiple ) ? [] : '',
- placeholder: false
-} );
-
-if ( 1 < data.multiple && data.value && _.isString( data.value ) ) {
- data.value = [ data.value ];
-}
-#>
-
-
- <# if ( data.label ) { #>
- {{{ data.label }}}
- <# } #>
- <# if ( data.description ) { #>
- {{{ data.description }}}
- <# } #>
-
- data-multiple="{{ data.multiple }}" multiple="multiple"
- <# } #>
- >
- <# if ( data.placeholder ) { #>
- selected<# } #>>
- <# } #>
- <# _.each( data.choices, function( optionLabel, optionKey ) { #>
- <#
- selected = ( data.value === optionKey );
- if ( 1 < data.multiple && data.value ) {
- selected = _.contains( data.value, optionKey );
- }
- if ( _.isObject( optionLabel ) ) {
- #>
-
- <# _.each( optionLabel[1], function( optgroupOptionLabel, optgroupOptionKey ) { #>
- <#
- selected = ( data.value === optgroupOptionKey );
- if ( 1 < data.multiple && data.value ) {
- selected = _.contains( data.value, optgroupOptionKey );
- }
- #>
- selected<# } #>>{{{ optgroupOptionLabel }}}
- <# } ); #>
-
- <# } else { #>
- selected<# } #>>{{{ optionLabel }}}
- <# } #>
- <# } ); #>
-
-
-
diff --git a/assets/kirki/controls/views/textarea.php b/assets/kirki/controls/views/textarea.php
deleted file mode 100644
index 30f19db..0000000
--- a/assets/kirki/controls/views/textarea.php
+++ /dev/null
@@ -1,41 +0,0 @@
-
-<#
-data = _.defaults( data, {
- label: '',
- description: '',
- inputAttrs: '',
- value: '',
- 'data-id': '',
- choices: {}
-} );
-#>
-
diff --git a/assets/kirki/core/class-kirki-config.php b/assets/kirki/core/class-kirki-config.php
deleted file mode 100644
index 3c93e84..0000000
--- a/assets/kirki/core/class-kirki-config.php
+++ /dev/null
@@ -1,177 +0,0 @@
- $value ) {
- // Is this property whitelisted?
- if ( property_exists( $this, $key ) ) {
- $args[ $key ] = $value;
- }
- }
- $this->id = $config_id;
-
- $this->config_final = wp_parse_args(
- array(
- 'id' => $config_id,
- ),
- $args
- );
- }
-
- /**
- * Use this method to get an instance of your config.
- * Each config has its own instance of this object.
- *
- * @static
- * @access public
- * @param string $id Config ID.
- * @param array $args {
- * Optional. Arguments to override config defaults.
- *
- * @type string $capability @see https://codex.wordpress.org/Roles_and_Capabilities
- * @type string $option_type theme_mod or option.
- * @type string $option_name If we want to used serialized options,
- * this is where we'll be adding the option name.
- * All fields using this config will be items in that array.
- * @type array $compiler Not yet fully implemented
- * @type bool $disable_output If set to true, no CSS will be generated
- * from fields using this configuration.
- * }
- *
- * @return Kirki_Config
- */
- public static function get_instance( $id = 'global', $args = array() ) {
- if ( empty( $id ) ) {
- $id = 'global';
- }
- $id_md5 = md5( $id );
- if ( ! isset( self::$instances[ $id_md5 ] ) ) {
- self::$instances[ $id_md5 ] = new self( $id, $args );
- }
- return self::$instances[ $id_md5 ];
- }
-
- /**
- * Get the IDs of all current configs.
- *
- * @static
- * @access public
- * @since 3.0.22
- * @return array
- */
- public static function get_config_ids() {
- $configs = array();
- foreach ( self::$instances as $instance ) {
- $configs[] = $instance->id;
- }
- return array_unique( $configs );
- }
-
- /**
- * Returns the $config_final property
- *
- * @access public
- * @return array
- */
- public function get_config() {
- return $this->config_final;
- }
-}
diff --git a/assets/kirki/core/class-kirki-control.php b/assets/kirki/core/class-kirki-control.php
deleted file mode 100644
index ccf36b8..0000000
--- a/assets/kirki/core/class-kirki-control.php
+++ /dev/null
@@ -1,117 +0,0 @@
-wp_customize = $wp_customize;
-
- // Set the control types.
- $this->set_control_types();
-
- // Add the control.
- $this->add_control( $args );
-
- }
-
- /**
- * Get the class name of the class needed to create tis control.
- *
- * @access private
- * @param array $args The field definition as sanitized in Kirki_Field.
- *
- * @return string the name of the class that will be used to create this control.
- */
- final private function get_control_class_name( $args ) {
-
- // Set a default class name.
- $class_name = 'WP_Customize_Control';
-
- // Get the classname from the array of control classnames.
- if ( array_key_exists( $args['type'], self::$control_types ) ) {
- $class_name = self::$control_types[ $args['type'] ];
- }
- return $class_name;
- }
-
- /**
- * Adds the control.
- *
- * @access protected
- * @param array $args The field definition as sanitized in Kirki_Field.
- */
- final protected function add_control( $args ) {
-
- // Get the name of the class we're going to use.
- $class_name = $this->get_control_class_name( $args );
-
- // Add the control.
- $this->wp_customize->add_control( new $class_name( $this->wp_customize, $args['settings'], $args ) );
-
- }
-
- /**
- * Sets the $control_types property.
- * Makes sure the kirki_control_types filter is applied
- * and that the defined classes actually exist.
- * If a defined class does not exist, it is removed.
- *
- * @access private
- */
- final private function set_control_types() {
-
- // Early exit if this has already run.
- if ( ! empty( self::$control_types ) ) {
- return;
- }
-
- self::$control_types = apply_filters( 'kirki_control_types', array() );
-
- // Make sure the defined classes actually exist.
- foreach ( self::$control_types as $key => $classname ) {
- if ( ! class_exists( $classname ) ) {
- unset( self::$control_types[ $key ] );
- }
- }
- }
-}
diff --git a/assets/kirki/core/class-kirki-field.php b/assets/kirki/core/class-kirki-field.php
deleted file mode 100644
index 68cde8f..0000000
--- a/assets/kirki/core/class-kirki-field.php
+++ /dev/null
@@ -1,661 +0,0 @@
- 'auto'
- * and have already set an array for the 'output' argument.
- *
- * @see https://kirki.org/docs/arguments/js_vars
- * @access protected
- * @var array
- */
- protected $js_vars = array();
-
- /**
- * If you want to use a CSS compiler, then use this to set the variable names.
- *
- * @see https://kirki.org/docs/arguments/variables
- * @access protected
- * @var array
- */
- protected $variables = array();
-
- /**
- * Text that will be used in a tooltip to provide extra info for this field.
- *
- * @access protected
- * @var string
- */
- protected $tooltip = '';
-
- /**
- * A custom callback to determine if the field should be visible or not.
- *
- * @access protected
- * @var string|array
- */
- protected $active_callback = '__return_true';
-
- /**
- * A custom sanitize callback that will be used to properly save the values.
- *
- * @access protected
- * @var string|array
- */
- protected $sanitize_callback = '';
-
- /**
- * Use 'refresh', 'postMessage' or 'auto'.
- * 'auto' will automatically geberate any 'js_vars' from the 'output' argument.
- *
- * @access protected
- * @var string
- */
- protected $transport = 'refresh';
-
- /**
- * Define dependencies to show/hide this field based on the values of other fields.
- *
- * @access protected
- * @var array
- */
- protected $required = array();
-
- /**
- * Partial Refreshes array.
- *
- * @access protected
- * @var array
- */
- protected $partial_refresh = array();
-
- /**
- * The class constructor.
- * Parses and sanitizes all field arguments.
- * Then it adds the field to Kirki::$fields.
- *
- * @access public
- * @param string $config_id The ID of the config we want to use.
- * Defaults to "global".
- * Configs are handled by the Kirki_Config class.
- * @param array $args The arguments of the field.
- */
- public function __construct( $config_id = 'global', $args = array() ) {
-
- if ( isset( $args['setting'] ) && ! empty( $args['setting'] ) && ( ! isset( $args['settings'] ) || empty( $args['settings'] ) ) ) {
- /* translators: %s represents the field ID where the error occurs. */
- _doing_it_wrong( __METHOD__, sprintf( esc_html__( 'Typo found in field %s - setting instead of settings.', 'kirki' ), esc_html( $args['settings'] ) ), '3.0.10' );
- $args['settings'] = $args['setting'];
- unset( $args['setting'] );
- }
-
- // In case the user only provides 1 argument,
- // assume that the provided argument is $args and set $config_id = 'global'.
- if ( is_array( $config_id ) && empty( $args ) ) {
- /* translators: %1$s represents the field ID where the error occurs. %2$s is the URL in the documentation site. */
- _doing_it_wrong( __METHOD__, sprintf( esc_html__( 'Config not defined for field %1$s - See %2$s for details on how to properly add fields.', 'kirki' ), esc_html( $args['settings'] ), 'https://aristath.github.io/kirki/docs/getting-started/fields.html' ), '3.0.10' );
- $args = $config_id;
- $config_id = 'global';
- }
-
- $args['kirki_config'] = $config_id;
-
- $this->kirki_config = $config_id;
- if ( '' === $config_id ) {
- /* translators: %1$s represents the field ID where the error occurs. %2$s is the URL in the documentation site. */
- _doing_it_wrong( __METHOD__, sprintf( esc_html__( 'Config not defined for field %1$s - See %2$s for details on how to properly add fields.', 'kirki' ), esc_html( $args['settings'] ), 'https://aristath.github.io/kirki/docs/getting-started/fields.html' ), '3.0.10' );
- $this->kirki_config = 'global';
- }
-
- // Get defaults from the class.
- $defaults = get_class_vars( __CLASS__ );
-
- // Get the config arguments, and merge them with the defaults.
- $config_defaults = ( isset( Kirki::$config['global'] ) ) ? Kirki::$config['global'] : array();
- if ( 'global' !== $this->kirki_config && isset( Kirki::$config[ $this->kirki_config ] ) ) {
- $config_defaults = Kirki::$config[ $this->kirki_config ];
- }
- $config_defaults = ( is_array( $config_defaults ) ) ? $config_defaults : array();
- foreach ( $config_defaults as $key => $value ) {
- if ( isset( $defaults[ $key ] ) && ! empty( $value ) && $value !== $defaults[ $key ] ) {
- $defaults[ $key ] = $value;
- }
- }
-
- // Merge our args with the defaults.
- $args = wp_parse_args( $args, $defaults );
-
- // Set the class properties using the parsed args.
- foreach ( $args as $key => $value ) {
- $this->$key = $value;
- }
-
- $this->args = $args;
-
- $this->set_field();
- }
-
- /**
- * Processes the field arguments
- *
- * @access protected
- */
- protected function set_field() {
-
- $properties = get_class_vars( __CLASS__ );
-
- // Some things must run before the others.
- $this->set_option_type();
- $this->set_settings();
-
- // Sanitize the properties, skipping the ones that have already run above.
- foreach ( $properties as $property => $value ) {
- if ( in_array( $property, array( 'option_name', 'option_type', 'settings' ), true ) ) {
- continue;
- }
- if ( method_exists( $this, 'set_' . $property ) ) {
- $method_name = 'set_' . $property;
- $this->$method_name();
- }
- }
-
- // Get all arguments with their values.
- $args = get_object_vars( $this );
- foreach ( array_keys( $args ) as $key ) {
- $args[ $key ] = $this->$key;
- }
-
- // Add the field to the static $fields variable properly indexed.
- Kirki::$fields[ $this->settings ] = $args;
-
- }
-
- /**
- * Escape the $section.
- *
- * @access protected
- */
- protected function set_input_attrs() {
- $this->input_attrs = (array) $this->input_attrs;
- }
-
- /**
- * Make sure we're using the correct option_type
- *
- * @access protected
- */
- protected function set_option_type() {
-
- // Take care of common typos.
- if ( 'options' === $this->option_type ) {
- $this->option_type = 'option';
- }
-
- // 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' );
- $this->option_type = 'theme_mod';
- }
- }
-
- /**
- * Modifications for partial refreshes.
- *
- * @access protected
- */
- protected function set_partial_refresh() {
- if ( ! is_array( $this->partial_refresh ) ) {
- $this->partial_refresh = array();
- }
- foreach ( $this->partial_refresh as $id => $args ) {
- if ( ! is_array( $args ) || ! isset( $args['selector'] ) || ! isset( $args['render_callback'] ) || ! is_callable( $args['render_callback'] ) ) {
- /* translators: %1$s represents the field ID where the error occurs. */
- _doing_it_wrong( __METHOD__, sprintf( esc_html__( '"partial_refresh" invalid entry in field %s', 'kirki' ), esc_html( $this->settings ) ), '3.0.10' );
- unset( $this->partial_refresh[ $id ] );
- continue;
- }
- }
- if ( ! empty( $this->partial_refresh ) ) {
- $this->transport = 'postMessage';
- }
- }
-
- /**
- * Sets the settings.
- * If we're using serialized options it makes sure that settings are properly formatted.
- * We'll also be escaping all setting names here for consistency.
- *
- * @access protected
- */
- protected function set_settings() {
-
- // If settings is not an array, temporarily convert it to an array.
- // This is just to allow us to process everything the same way and avoid code duplication.
- // if settings is not an array then it will not be set as an array in the end.
- if ( ! is_array( $this->settings ) ) {
- $this->settings = array(
- 'kirki_placeholder_setting' => $this->settings,
- );
- }
- $settings = array();
- foreach ( $this->settings as $setting_key => $setting_value ) {
- $settings[ $setting_key ] = $setting_value;
-
- // If we're using serialized options then we need to spice this up.
- if ( 'option' === $this->option_type && '' !== $this->option_name && ( false === strpos( $setting_key, '[' ) ) ) {
- $settings[ $setting_key ] = "{$this->option_name}[{$setting_value}]";
- }
- }
- $this->settings = $settings;
- if ( isset( $this->settings['kirki_placeholder_setting'] ) ) {
- $this->settings = $this->settings['kirki_placeholder_setting'];
- }
- }
-
- /**
- * Sets the active_callback
- * If we're using the $required argument,
- * Then this is where the switch is made to our evaluation method.
- *
- * @access protected
- */
- protected function set_active_callback() {
- if ( is_array( $this->active_callback ) ) {
- if ( ! is_callable( $this->active_callback ) ) {
-
- // Bugfix for https://github.com/aristath/kirki/issues/1961.
- foreach ( $this->active_callback as $key => $val ) {
- if ( is_callable( $val ) ) {
- unset( $this->active_callback[ $key ] );
- }
- }
- if ( isset( $this->active_callback[0] ) ) {
- $this->required = $this->active_callback;
- }
- }
- }
-
- if ( ! empty( $this->required ) ) {
- $this->active_callback = '__return_true';
- return;
- }
- // No need to proceed any further if we're using the default value.
- if ( '__return_true' === $this->active_callback ) {
- return;
- }
-
- // Make sure the function is callable, otherwise fallback to __return_true.
- if ( ! is_callable( $this->active_callback ) ) {
- $this->active_callback = '__return_true';
- }
- }
-
- /**
- * Sets the $id.
- * Setting the ID should happen after the 'settings' sanitization.
- * This way we can also properly handle cases where the option_type is set to 'option'
- * and we're using an array instead of individual options.
- *
- * @access protected
- */
- protected function set_id() {
- $this->id = sanitize_key( str_replace( '[', '-', str_replace( ']', '', $this->settings ) ) );
- }
-
- /**
- * Sets the $choices.
- *
- * @access protected
- */
- protected function set_choices() {
- if ( ! is_array( $this->choices ) ) {
- $this->choices = array();
- }
- }
-
- /**
- * Escapes the $disable_output.
- *
- * @access protected
- */
- protected function set_disable_output() {
- $this->disable_output = (bool) $this->disable_output;
- }
-
- /**
- * Sets the $sanitize_callback
- *
- * @access protected
- */
- protected function set_output() {
- if ( empty( $this->output ) ) {
- return;
- }
- if ( ! is_array( $this->output ) ) {
- /* translators: The field ID where the error occurs. */
- _doing_it_wrong( __METHOD__, sprintf( esc_html__( '"output" invalid format in field %s. The "output" argument should be defined as an array of arrays.', 'kirki' ), esc_html( $this->settings ) ), '3.0.10' );
- $this->output = array(
- array(
- 'element' => $this->output,
- ),
- );
- }
-
- // Convert to array of arrays if needed.
- if ( isset( $this->output['element'] ) ) {
- /* translators: The field ID where the error occurs. */
- _doing_it_wrong( __METHOD__, sprintf( esc_html__( '"output" invalid format in field %s. The "output" argument should be defined as an array of arrays.', 'kirki' ), esc_html( $this->settings ) ), '3.0.10' );
- $this->output = array( $this->output );
- }
-
- foreach ( $this->output as $key => $output ) {
- if ( empty( $output ) || ! isset( $output['element'] ) ) {
- unset( $this->output[ $key ] );
- continue;
- }
- if ( ! isset( $output['sanitize_callback'] ) && isset( $output['callback'] ) ) {
- $this->output[ $key ]['sanitize_callback'] = $output['callback'];
- }
-
- // Convert element arrays to strings.
- if ( isset( $output['element'] ) && is_array( $output['element'] ) ) {
- $this->output[ $key ]['element'] = array_unique( $this->output[ $key ]['element'] );
- sort( $this->output[ $key ]['element'] );
-
- // Trim each element in the array.
- foreach ( $this->output[ $key ]['element'] as $index => $element ) {
- $this->output[ $key ]['element'][ $index ] = trim( $element );
- }
- $this->output[ $key ]['element'] = implode( ',', $this->output[ $key ]['element'] );
- }
-
- // Fix for https://github.com/aristath/kirki/issues/1659#issuecomment-346229751.
- $this->output[ $key ]['element'] = str_replace( array( "\t", "\n", "\r", "\0", "\x0B" ), ' ', $this->output[ $key ]['element'] );
- $this->output[ $key ]['element'] = trim( preg_replace( '/\s+/', ' ', $this->output[ $key ]['element'] ) );
- }
- }
-
- /**
- * Sets the $js_vars
- *
- * @access protected
- */
- protected function set_js_vars() {
- if ( ! is_array( $this->js_vars ) ) {
- $this->js_vars = array();
- }
-
- // Check if transport is set to auto.
- // If not, then skip the auto-calculations and exit early.
- if ( 'auto' !== $this->transport ) {
- return;
- }
-
- // Set transport to refresh initially.
- // Serves as a fallback in case we failt to auto-calculate js_vars.
- $this->transport = 'refresh';
-
- $js_vars = array();
-
- // Try to auto-generate js_vars.
- // First we need to check if js_vars are empty, and that output is not empty.
- if ( empty( $this->js_vars ) && ! empty( $this->output ) ) {
-
- // Start going through each item in the $output array.
- foreach ( $this->output as $output ) {
- $output['function'] = ( isset( $output['function'] ) ) ? $output['function'] : 'style';
-
- // If 'element' or 'property' are not defined, skip this.
- if ( ! isset( $output['element'] ) || ! isset( $output['property'] ) ) {
- continue;
- }
- if ( is_array( $output['element'] ) ) {
- $output['element'] = implode( ',', $output['element'] );
- }
-
- // If there's a sanitize_callback defined skip this, unless we also have a js_callback defined.
- if ( isset( $output['sanitize_callback'] ) && ! empty( $output['sanitize_callback'] ) && ! isset( $output['js_callback'] ) ) {
- continue;
- }
-
- // If we got this far, it's safe to add this.
- $js_vars[] = $output;
- }
-
- // Did we manage to get all the items from 'output'?
- // If not, then we're missing something so don't add this.
- if ( count( $js_vars ) !== count( $this->output ) ) {
- return;
- }
- $this->js_vars = $js_vars;
- $this->transport = 'postMessage';
- }
- }
-
- /**
- * Sets the $variables
- *
- * @access protected
- */
- protected function set_variables() {
- if ( ! is_array( $this->variables ) ) {
- $variable = ( is_string( $this->variables ) && ! empty( $this->variables ) ) ? $this->variables : false;
- $this->variables = array();
- if ( $variable && empty( $this->variables ) ) {
- $this->variables[0]['name'] = $variable;
- }
- }
- }
-
- /**
- * Sets the $transport
- *
- * @access protected
- */
- protected function set_transport() {
- if ( 'postmessage' === trim( strtolower( $this->transport ) ) ) {
- $this->transport = 'postMessage';
- }
- }
-
- /**
- * Sets the $required
- *
- * @access protected
- */
- protected function set_required() {
- if ( ! is_array( $this->required ) ) {
- $this->required = array();
- }
- }
-
- /**
- * Sets the $priority
- *
- * @access protected
- */
- protected function set_priority() {
- $this->priority = absint( $this->priority );
- }
-
- /**
- * Sets the $css_vars
- *
- * @access protected
- */
- protected function set_css_vars() {
- if ( is_string( $this->css_vars ) ) {
- $this->css_vars = array( $this->css_vars );
- }
- if ( isset( $this->css_vars[0] ) && is_string( $this->css_vars[0] ) ) {
- $this->css_vars = array( $this->css_vars );
- }
- foreach ( $this->css_vars as $key => $val ) {
- if ( ! isset( $val[1] ) ) {
- $this->css_vars[ $key ][1] = '$';
- }
- }
- }
-}
diff --git a/assets/kirki/core/class-kirki-helper.php b/assets/kirki/core/class-kirki-helper.php
deleted file mode 100644
index 7fa43db..0000000
--- a/assets/kirki/core/class-kirki-helper.php
+++ /dev/null
@@ -1,447 +0,0 @@
- $value ) {
-
- // Create new key in $array, if it is empty or not an array.
- if ( ! isset( $array[ $key ] ) || ( isset( $array[ $key ] ) && ! is_array( $array[ $key ] ) ) ) {
- $array[ $key ] = array();
- }
-
- // Overwrite the value in the base array.
- if ( is_array( $value ) ) {
- $value = self::recurse( $array[ $key ], $value );
- }
- $array[ $key ] = $value;
- }
- return $array;
- }
-
- /**
- * Initialize the WP_Filesystem
- *
- * @static
- * @access public
- * @return object WP_Filesystem
- */
- public static function init_filesystem() {
- $credentials = array();
-
- if ( ! defined( 'FS_METHOD' ) ) {
- define( 'FS_METHOD', 'direct' );
- }
-
- $method = defined( 'FS_METHOD' ) ? FS_METHOD : false;
-
- if ( 'ftpext' === $method ) {
- // If defined, set it to that, Else, set to NULL.
- $credentials['hostname'] = defined( 'FTP_HOST' ) ? preg_replace( '|\w+://|', '', FTP_HOST ) : null;
- $credentials['username'] = defined( 'FTP_USER' ) ? FTP_USER : null;
- $credentials['password'] = defined( 'FTP_PASS' ) ? FTP_PASS : null;
-
- // Set FTP port.
- if ( strpos( $credentials['hostname'], ':' ) && null !== $credentials['hostname'] ) {
- list( $credentials['hostname'], $credentials['port'] ) = explode( ':', $credentials['hostname'], 2 );
- if ( ! is_numeric( $credentials['port'] ) ) {
- unset( $credentials['port'] );
- }
- } else {
- unset( $credentials['port'] );
- }
-
- // Set connection type.
- if ( ( defined( 'FTP_SSL' ) && FTP_SSL ) && 'ftpext' === $method ) {
- $credentials['connection_type'] = 'ftps';
- } elseif ( ! array_filter( $credentials ) ) {
- $credentials['connection_type'] = null;
- } else {
- $credentials['connection_type'] = 'ftp';
- }
- }
-
- // The WordPress filesystem.
- global $wp_filesystem;
-
- if ( empty( $wp_filesystem ) ) {
- require_once wp_normalize_path( ABSPATH . '/wp-admin/includes/file.php' );
- WP_Filesystem( $credentials );
- }
-
- return $wp_filesystem;
- }
-
- /**
- * Returns the attachment object
- *
- * @static
- * @access public
- * @see https://pippinsplugins.com/retrieve-attachment-id-from-image-url/
- * @param string $url URL to the image.
- * @return int|string Numeric ID of the attachement.
- */
- public static function get_image_id( $url ) {
- global $wpdb;
- if ( empty( $url ) ) {
- return 0;
- }
-
- $attachment = wp_cache_get( 'kirki_image_id_' . md5( $url ), null );
- if ( false === $attachment ) {
- $attachment = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE guid = %s;", $url ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
- wp_cache_add( 'kirki_image_id_' . md5( $url ), $attachment, null );
- }
-
- if ( ! empty( $attachment ) ) {
- return $attachment[0];
- }
- return 0;
- }
-
- /**
- * Returns an array of the attachment's properties.
- *
- * @param string $url URL to the image.
- * @return array
- */
- public static function get_image_from_url( $url ) {
- $image_id = self::get_image_id( $url );
- $image = wp_get_attachment_image_src( $image_id, 'full' );
-
- return array(
- 'url' => $image[0],
- 'width' => $image[1],
- 'height' => $image[2],
- 'thumbnail' => $image[3],
- );
- }
-
- /**
- * Get an array of posts.
- *
- * @static
- * @access public
- * @param array $args Define arguments for the get_posts function.
- * @return array
- */
- public static function get_posts( $args ) {
- if ( is_string( $args ) ) {
- $args = add_query_arg(
- array(
- 'suppress_filters' => false,
- )
- );
- } elseif ( is_array( $args ) && ! isset( $args['suppress_filters'] ) ) {
- $args['suppress_filters'] = false;
- }
-
- // Get the posts.
- // TODO: WordPress.VIP.RestrictedFunctions.get_posts_get_posts.
- $posts = get_posts( $args );
-
- // Properly format the array.
- $items = array();
- foreach ( $posts as $post ) {
- $items[ $post->ID ] = $post->post_title;
- }
- wp_reset_postdata();
-
- return $items;
- }
-
- /**
- * Get an array of publicly-querable taxonomies.
- *
- * @static
- * @access public
- * @return array
- */
- public static function get_taxonomies() {
- $items = array();
-
- // Get the taxonomies.
- $taxonomies = get_taxonomies(
- array(
- 'public' => true,
- )
- );
-
- // Build the array.
- foreach ( $taxonomies as $taxonomy ) {
- $id = $taxonomy;
- $taxonomy = get_taxonomy( $taxonomy );
- $items[ $id ] = $taxonomy->labels->name;
- }
-
- return $items;
- }
-
- /**
- * Get an array of publicly-querable post-types.
- *
- * @static
- * @access public
- * @return array
- */
- public static function get_post_types() {
- $items = array();
-
- // Get the post types.
- $post_types = get_post_types(
- array(
- 'public' => true,
- ), 'objects'
- );
-
- // Build the array.
- foreach ( $post_types as $post_type ) {
- $items[ $post_type->name ] = $post_type->labels->name;
- }
-
- return $items;
- }
-
- /**
- * Get an array of terms from a taxonomy
- *
- * @static
- * @access public
- * @param string|array $taxonomies See https://developer.wordpress.org/reference/functions/get_terms/ for details.
- * @return array
- */
- public static function get_terms( $taxonomies ) {
- $items = array();
-
- // Get the post types.
- $terms = get_terms( $taxonomies );
-
- // Build the array.
- foreach ( $terms as $term ) {
- $items[ $term->term_id ] = $term->name;
- }
-
- return $items;
- }
-
- /**
- * Gets an array of material-design colors.
- *
- * @static
- * @access public
- * @param string $context Allows us to get subsets of the palette.
- * @return array
- */
- public static function get_material_design_colors( $context = 'primary' ) {
- $colors = array(
- 'primary' => array( '#FFFFFF', '#000000', '#F44336', '#E91E63', '#9C27B0', '#673AB7', '#3F51B5', '#2196F3', '#03A9F4', '#00BCD4', '#009688', '#4CAF50', '#8BC34A', '#CDDC39', '#FFEB3B', '#FFC107', '#FF9800', '#FF5722', '#795548', '#9E9E9E', '#607D8B' ),
- 'red' => array( '#FFEBEE', '#FFCDD2', '#EF9A9A', '#E57373', '#EF5350', '#F44336', '#E53935', '#D32F2F', '#C62828', '#B71C1C', '#FF8A80', '#FF5252', '#FF1744', '#D50000' ),
- 'pink' => array( '#FCE4EC', '#F8BBD0', '#F48FB1', '#F06292', '#EC407A', '#E91E63', '#D81B60', '#C2185B', '#AD1457', '#880E4F', '#FF80AB', '#FF4081', '#F50057', '#C51162' ),
- 'purple' => array( '#F3E5F5', '#E1BEE7', '#CE93D8', '#BA68C8', '#AB47BC', '#9C27B0', '#8E24AA', '#7B1FA2', '#6A1B9A', '#4A148C', '#EA80FC', '#E040FB', '#D500F9', '#AA00FF' ),
- 'deep-purple' => array( '#EDE7F6', '#D1C4E9', '#B39DDB', '#9575CD', '#7E57C2', '#673AB7', '#5E35B1', '#512DA8', '#4527A0', '#311B92', '#B388FF', '#7C4DFF', '#651FFF', '#6200EA' ),
- 'indigo' => array( '#E8EAF6', '#C5CAE9', '#9FA8DA', '#7986CB', '#5C6BC0', '#3F51B5', '#3949AB', '#303F9F', '#283593', '#1A237E', '#8C9EFF', '#536DFE', '#3D5AFE', '#304FFE' ),
- 'blue' => array( '#E3F2FD', '#BBDEFB', '#90CAF9', '#64B5F6', '#42A5F5', '#2196F3', '#1E88E5', '#1976D2', '#1565C0', '#0D47A1', '#82B1FF', '#448AFF', '#2979FF', '#2962FF' ),
- 'light-blue' => array( '#E1F5FE', '#B3E5FC', '#81D4fA', '#4fC3F7', '#29B6FC', '#03A9F4', '#039BE5', '#0288D1', '#0277BD', '#01579B', '#80D8FF', '#40C4FF', '#00B0FF', '#0091EA' ),
- 'cyan' => array( '#E0F7FA', '#B2EBF2', '#80DEEA', '#4DD0E1', '#26C6DA', '#00BCD4', '#00ACC1', '#0097A7', '#00838F', '#006064', '#84FFFF', '#18FFFF', '#00E5FF', '#00B8D4' ),
- 'teal' => array( '#E0F2F1', '#B2DFDB', '#80CBC4', '#4DB6AC', '#26A69A', '#009688', '#00897B', '#00796B', '#00695C', '#004D40', '#A7FFEB', '#64FFDA', '#1DE9B6', '#00BFA5' ),
- 'green' => array( '#E8F5E9', '#C8E6C9', '#A5D6A7', '#81C784', '#66BB6A', '#4CAF50', '#43A047', '#388E3C', '#2E7D32', '#1B5E20', '#B9F6CA', '#69F0AE', '#00E676', '#00C853' ),
- 'light-green' => array( '#F1F8E9', '#DCEDC8', '#C5E1A5', '#AED581', '#9CCC65', '#8BC34A', '#7CB342', '#689F38', '#558B2F', '#33691E', '#CCFF90', '#B2FF59', '#76FF03', '#64DD17' ),
- 'lime' => array( '#F9FBE7', '#F0F4C3', '#E6EE9C', '#DCE775', '#D4E157', '#CDDC39', '#C0CA33', '#A4B42B', '#9E9D24', '#827717', '#F4FF81', '#EEFF41', '#C6FF00', '#AEEA00' ),
- 'yellow' => array( '#FFFDE7', '#FFF9C4', '#FFF590', '#FFF176', '#FFEE58', '#FFEB3B', '#FDD835', '#FBC02D', '#F9A825', '#F57F17', '#FFFF82', '#FFFF00', '#FFEA00', '#FFD600' ),
- 'amber' => array( '#FFF8E1', '#FFECB3', '#FFE082', '#FFD54F', '#FFCA28', '#FFC107', '#FFB300', '#FFA000', '#FF8F00', '#FF6F00', '#FFE57F', '#FFD740', '#FFC400', '#FFAB00' ),
- 'orange' => array( '#FFF3E0', '#FFE0B2', '#FFCC80', '#FFB74D', '#FFA726', '#FF9800', '#FB8C00', '#F57C00', '#EF6C00', '#E65100', '#FFD180', '#FFAB40', '#FF9100', '#FF6D00' ),
- 'deep-orange' => array( '#FBE9A7', '#FFCCBC', '#FFAB91', '#FF8A65', '#FF7043', '#FF5722', '#F4511E', '#E64A19', '#D84315', '#BF360C', '#FF9E80', '#FF6E40', '#FF3D00', '#DD2600' ),
- 'brown' => array( '#EFEBE9', '#D7CCC8', '#BCAAA4', '#A1887F', '#8D6E63', '#795548', '#6D4C41', '#5D4037', '#4E342E', '#3E2723' ),
- 'grey' => array( '#FAFAFA', '#F5F5F5', '#EEEEEE', '#E0E0E0', '#BDBDBD', '#9E9E9E', '#757575', '#616161', '#424242', '#212121', '#000000', '#ffffff' ),
- 'blue-grey' => array( '#ECEFF1', '#CFD8DC', '#B0BBC5', '#90A4AE', '#78909C', '#607D8B', '#546E7A', '#455A64', '#37474F', '#263238' ),
- );
-
- switch ( $context ) {
- case '50':
- case '100':
- case '200':
- case '300':
- case '400':
- case '500':
- case '600':
- case '700':
- case '800':
- case '900':
- case 'A100':
- case 'A200':
- case 'A400':
- case 'A700':
- $key = absint( $context ) / 100;
- if ( 'A100' === $context ) {
- $key = 10;
- unset( $colors['grey'] );
- } elseif ( 'A200' === $context ) {
- $key = 11;
- unset( $colors['grey'] );
- } elseif ( 'A400' === $context ) {
- $key = 12;
- unset( $colors['grey'] );
- } elseif ( 'A700' === $context ) {
- $key = 13;
- unset( $colors['grey'] );
- }
- unset( $colors['primary'] );
- $position_colors = array();
- foreach ( $colors as $color_family ) {
- if ( isset( $color_family[ $key ] ) ) {
- $position_colors[] = $color_family[ $key ];
- }
- }
- return $position_colors;
- case 'all':
- unset( $colors['primary'] );
- $all_colors = array();
- foreach ( $colors as $color_family ) {
- foreach ( $color_family as $color ) {
- $all_colors[] = $color;
- }
- }
- return $all_colors;
- case 'primary':
- return $colors['primary'];
- default:
- if ( isset( $colors[ $context ] ) ) {
- return $colors[ $context ];
- }
- return $colors['primary'];
- }
- }
-
- /**
- * Get an array of all available dashicons.
- *
- * @static
- * @access public
- * @return array
- */
- public static function get_dashicons() {
- return array(
- 'admin-menu' => array( 'menu', 'admin-site', 'dashboard', 'admin-post', 'admin-media', 'admin-links', 'admin-page', 'admin-comments', 'admin-appearance', 'admin-plugins', 'admin-users', 'admin-tools', 'admin-settings', 'admin-network', 'admin-home', 'admin-generic', 'admin-collapse', 'filter', 'admin-customizer', 'admin-multisite' ),
- 'welcome-screen' => array( 'welcome-write-blog', 'welcome-add-page', 'welcome-view-site', 'welcome-widgets-menus', 'welcome-comments', 'welcome-learn-more' ),
- 'post-formats' => array( 'format-aside', 'format-image', 'format-gallery', 'format-video', 'format-status', 'format-quote', 'format-chat', 'format-audio', 'camera', 'images-alt', 'images-alt2', 'video-alt', 'video-alt2', 'video-alt3' ),
- 'media' => array( 'media-archive', 'media-audio', 'media-code', 'media-default', 'media-document', 'media-interactive', 'media-spreadsheet', 'media-text', 'media-video', 'playlist-audio', 'playlist-video', 'controls-play', 'controls-pause', 'controls-forward', 'controls-skipforward', 'controls-back', 'controls-skipback', 'controls-repeat', 'controls-volumeon', 'controls-volumeoff' ),
- 'image-editing' => array( 'image-crop', 'image-rotate', 'image-rotate-left', 'image-rotate-right', 'image-flip-vertical', 'image-flip-horizontal', 'image-filter', 'undo', 'redo' ),
- 'tinymce' => array( 'editor-bold', 'editor-italic', 'editor-ul', 'editor-ol', 'editor-quote', 'editor-alignleft', 'editor-aligncenter', 'editor-alignright', 'editor-insertmore', 'editor-spellcheck', 'editor-expand', 'editor-contract', 'editor-kitchensink', 'editor-underline', 'editor-justify', 'editor-textcolor', 'editor-paste-word', 'editor-paste-text', 'editor-removeformatting', 'editor-video', 'editor-customchar', 'editor-outdent', 'editor-indent', 'editor-help', 'editor-strikethrough', 'editor-unlink', 'editor-rtl', 'editor-break', 'editor-code', 'editor-paragraph', 'editor-table' ),
- 'posts' => array( 'align-left', 'align-right', 'align-center', 'align-none', 'lock', 'unlock', 'calendar', 'calendar-alt', 'visibility', 'hidden', 'post-status', 'edit', 'trash', 'sticky' ),
- 'sorting' => array( 'external', 'arrow-up', 'arrow-down', 'arrow-right', 'arrow-left', 'arrow-up-alt', 'arrow-down-alt', 'arrow-right-alt', 'arrow-left-alt', 'arrow-up-alt2', 'arrow-down-alt2', 'arrow-right-alt2', 'arrow-left-alt2', 'sort', 'leftright', 'randomize', 'list-view', 'exerpt-view', 'grid-view' ),
- 'social' => array( 'share', 'share-alt', 'share-alt2', 'twitter', 'rss', 'email', 'email-alt', 'facebook', 'facebook-alt', 'googleplus', 'networking' ),
- 'wordpress_org' => array( 'hammer', 'art', 'migrate', 'performance', 'universal-access', 'universal-access-alt', 'tickets', 'nametag', 'clipboard', 'heart', 'megaphone', 'schedule' ),
- 'products' => array( 'wordpress', 'wordpress-alt', 'pressthis', 'update', 'screenoptions', 'info', 'cart', 'feedback', 'cloud', 'translation' ),
- 'taxonomies' => array( 'tag', 'category' ),
- 'widgets' => array( 'archive', 'tagcloud', 'text' ),
- 'notifications' => array( 'yes', 'no', 'no-alt', 'plus', 'plus-alt', 'minus', 'dismiss', 'marker', 'star-filled', 'star-half', 'star-empty', 'flag', 'warning' ),
- 'misc' => array( 'location', 'location-alt', 'vault', 'shield', 'shield-alt', 'sos', 'search', 'slides', 'analytics', 'chart-pie', 'chart-bar', 'chart-line', 'chart-area', 'groups', 'businessman', 'id', 'id-alt', 'products', 'awards', 'forms', 'testimonial', 'portfolio', 'book', 'book-alt', 'download', 'upload', 'backup', 'clock', 'lightbulb', 'microphone', 'desktop', 'tablet', 'smartphone', 'phone', 'index-card', 'carrot', 'building', 'store', 'album', 'palmtree', 'tickets-alt', 'money', 'smiley', 'thumbs-up', 'thumbs-down', 'layout' ),
- );
- }
-
- /**
- * Compares the 2 values given the condition
- *
- * @param mixed $value1 The 1st value in the comparison.
- * @param mixed $value2 The 2nd value in the comparison.
- * @param string $operator The operator we'll use for the comparison.
- * @return boolean whether The comparison has succeded (true) or failed (false).
- */
- public static function compare_values( $value1, $value2, $operator ) {
- if ( '===' === $operator ) {
- return $value1 === $value2;
- }
- if ( '!==' === $operator ) {
- return $value1 !== $value2;
- }
- if ( ( '!=' === $operator || 'not equal' === $operator ) ) {
- return $value1 != $value2; // WPCS: loose comparison ok.
- }
- if ( ( '>=' === $operator || 'greater or equal' === $operator || 'equal or greater' === $operator ) ) {
- return $value2 >= $value1;
- }
- if ( ( '<=' === $operator || 'smaller or equal' === $operator || 'equal or smaller' === $operator ) ) {
- return $value2 <= $value1;
- }
- if ( ( '>' === $operator || 'greater' === $operator ) ) {
- return $value2 > $value1;
- }
- if ( ( '<' === $operator || 'smaller' === $operator ) ) {
- return $value2 < $value1;
- }
- if ( 'contains' === $operator || 'in' === $operator ) {
- if ( is_array( $value1 ) && is_array( $value2 ) ) {
- foreach ( $value2 as $val ) {
- if ( in_array( $val, $value1 ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
- return true;
- }
- }
- return false;
- }
- if ( is_array( $value1 ) && ! is_array( $value2 ) ) {
- return in_array( $value2, $value1 ); // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
- }
- if ( is_array( $value2 ) && ! is_array( $value1 ) ) {
- return in_array( $value1, $value2 ); // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
- }
- return ( false !== strrpos( $value1, $value2 ) || false !== strpos( $value2, $value1 ) );
- }
- return $value1 == $value2; // WPCS: loose comparison ok.
- }
-}
diff --git a/assets/kirki/core/class-kirki-init.php b/assets/kirki/core/class-kirki-init.php
deleted file mode 100644
index 212aabb..0000000
--- a/assets/kirki/core/class-kirki-init.php
+++ /dev/null
@@ -1,318 +0,0 @@
-control_types = array(
- 'checkbox' => 'Kirki_Control_Checkbox',
- 'kirki-background' => 'Kirki_Control_Background',
- 'code_editor' => 'Kirki_Control_Code',
- 'kirki-color' => 'Kirki_Control_Color',
- 'kirki-color-palette' => 'Kirki_Control_Color_Palette',
- 'kirki-custom' => 'Kirki_Control_Custom',
- 'kirki-date' => 'Kirki_Control_Date',
- 'kirki-dashicons' => 'Kirki_Control_Dashicons',
- 'kirki-dimension' => 'Kirki_Control_Dimension',
- 'kirki-dimensions' => 'Kirki_Control_Dimensions',
- 'kirki-editor' => 'Kirki_Control_Editor',
- 'kirki-fontawesome' => 'Kirki_Control_FontAwesome',
- 'kirki-image' => 'Kirki_Control_Image',
- 'kirki-multicolor' => 'Kirki_Control_Multicolor',
- 'kirki-multicheck' => 'Kirki_Control_MultiCheck',
- 'kirki-number' => 'Kirki_Control_Number',
- 'kirki-palette' => 'Kirki_Control_Palette',
- 'kirki-radio' => 'Kirki_Control_Radio',
- 'kirki-radio-buttonset' => 'Kirki_Control_Radio_ButtonSet',
- 'kirki-radio-image' => 'Kirki_Control_Radio_Image',
- 'repeater' => 'Kirki_Control_Repeater',
- 'kirki-select' => 'Kirki_Control_Select',
- 'kirki-slider' => 'Kirki_Control_Slider',
- 'kirki-sortable' => 'Kirki_Control_Sortable',
- 'kirki-spacing' => 'Kirki_Control_Dimensions',
- 'kirki-switch' => 'Kirki_Control_Switch',
- 'kirki-generic' => 'Kirki_Control_Generic',
- 'kirki-toggle' => 'Kirki_Control_Toggle',
- 'kirki-typography' => 'Kirki_Control_Typography',
- 'image' => 'Kirki_Control_Image',
- 'cropped_image' => 'Kirki_Control_Cropped_Image',
- 'upload' => 'Kirki_Control_Upload',
- );
- return array_merge( $this->control_types, $control_types );
- }
-
- /**
- * Helper function that adds the fields, sections and panels to the customizer.
- */
- public function add_to_customizer() {
- $this->fields_from_filters();
- add_action( 'customize_register', array( $this, 'register_control_types' ) );
- add_action( 'customize_register', array( $this, 'add_panels' ), 97 );
- add_action( 'customize_register', array( $this, 'add_sections' ), 98 );
- add_action( 'customize_register', array( $this, 'add_fields' ), 99 );
- }
-
- /**
- * Register control types
- */
- public function register_control_types() {
- global $wp_customize;
-
- $section_types = apply_filters( 'kirki_section_types', array() );
- foreach ( $section_types as $section_type ) {
- $wp_customize->register_section_type( $section_type );
- }
-
- $this->control_types = $this->default_control_types();
- if ( ! class_exists( 'WP_Customize_Code_Editor_Control' ) ) {
- unset( $this->control_types['code_editor'] );
- }
- foreach ( $this->control_types as $key => $classname ) {
- if ( ! class_exists( $classname ) ) {
- unset( $this->control_types[ $key ] );
- }
- }
-
- $skip_control_types = apply_filters(
- 'kirki_control_types_exclude', array(
- 'Kirki_Control_Repeater',
- 'WP_Customize_Control',
- )
- );
-
- foreach ( $this->control_types as $control_type ) {
- if ( ! in_array( $control_type, $skip_control_types, true ) && class_exists( $control_type ) ) {
- $wp_customize->register_control_type( $control_type );
- }
- }
- }
-
- /**
- * Register our panels to the WordPress Customizer.
- *
- * @access public
- */
- public function add_panels() {
- if ( ! empty( Kirki::$panels ) ) {
- foreach ( Kirki::$panels as $panel_args ) {
- // Extra checks for nested panels.
- if ( isset( $panel_args['panel'] ) ) {
- if ( isset( Kirki::$panels[ $panel_args['panel'] ] ) ) {
- // Set the type to nested.
- $panel_args['type'] = 'kirki-nested';
- }
- }
-
- new Kirki_Panel( $panel_args );
- }
- }
- }
-
- /**
- * Register our sections to the WordPress Customizer.
- *
- * @var object The WordPress Customizer object
- */
- public function add_sections() {
- if ( ! empty( Kirki::$sections ) ) {
- foreach ( Kirki::$sections as $section_args ) {
- // Extra checks for nested sections.
- if ( isset( $section_args['section'] ) ) {
- if ( isset( Kirki::$sections[ $section_args['section'] ] ) ) {
- // Set the type to nested.
- $section_args['type'] = 'kirki-nested';
- // We need to check if the parent section is nested inside a panel.
- $parent_section = Kirki::$sections[ $section_args['section'] ];
- if ( isset( $parent_section['panel'] ) ) {
- $section_args['panel'] = $parent_section['panel'];
- }
- }
- }
- new Kirki_Section( $section_args );
- }
- }
- }
-
- /**
- * Create the settings and controls from the $fields array and register them.
- *
- * @var object The WordPress Customizer object.
- */
- public function add_fields() {
- global $wp_customize;
- foreach ( Kirki::$fields as $args ) {
-
- // Create the settings.
- new Kirki_Settings( $args );
-
- // Check if we're on the customizer.
- // If we are, then we will create the controls, add the scripts needed for the customizer
- // and any other tweaks that this field may require.
- if ( $wp_customize ) {
-
- // Create the control.
- new Kirki_Control( $args );
-
- }
- }
- }
-
- /**
- * Process fields added using the 'kirki_fields' and 'kirki_controls' filter.
- * These filters are no longer used, this is simply for backwards-compatibility.
- *
- * @access private
- * @since 2.0.0
- */
- private function fields_from_filters() {
- $fields = apply_filters( 'kirki_controls', array() );
- $fields = apply_filters( 'kirki_fields', $fields );
-
- if ( ! empty( $fields ) ) {
- foreach ( $fields as $field ) {
- Kirki::add_field( 'global', $field );
- }
- }
- }
-
- /**
- * Alias for the is_plugin static method in the Kirki_Util class.
- * This is here for backwards-compatibility purposes.
- *
- * @static
- * @access public
- * @since 3.0.0
- * @return bool
- */
- public static function is_plugin() {
- return Kirki_Util::is_plugin();
- }
-
- /**
- * Alias for the get_variables static method in the Kirki_Util class.
- * This is here for backwards-compatibility purposes.
- *
- * @static
- * @access public
- * @since 2.0.0
- * @return array Formatted as array( 'variable-name' => value ).
- */
- public static function get_variables() {
-
- // Log error for developers.
- _doing_it_wrong( __METHOD__, esc_html__( 'We detected you\'re using Kirki_Init::get_variables(). Please use Kirki_Util::get_variables() instead.', 'kirki' ), '3.0.10' );
- return Kirki_Util::get_variables();
- }
-
- /**
- * Remove panels.
- *
- * @since 3.0.17
- * @param object $wp_customize The customizer object.
- * @return void
- */
- public function remove_panels( $wp_customize ) {
- foreach ( Kirki::$panels_to_remove as $panel ) {
- $wp_customize->remove_panel( $panel );
- }
- }
-
- /**
- * Remove sections.
- *
- * @since 3.0.17
- * @param object $wp_customize The customizer object.
- * @return void
- */
- public function remove_sections( $wp_customize ) {
- foreach ( Kirki::$sections_to_remove as $section ) {
- $wp_customize->remove_section( $section );
- }
- }
-
- /**
- * Remove controls.
- *
- * @since 3.0.17
- * @param object $wp_customize The customizer object.
- * @return void
- */
- public function remove_controls( $wp_customize ) {
- foreach ( Kirki::$controls_to_remove as $control ) {
- $wp_customize->remove_control( $control );
- }
- }
-}
diff --git a/assets/kirki/core/class-kirki-l10n.php b/assets/kirki/core/class-kirki-l10n.php
deleted file mode 100644
index 6dd0c05..0000000
--- a/assets/kirki/core/class-kirki-l10n.php
+++ /dev/null
@@ -1,144 +0,0 @@
-get_path() ) {
- load_textdomain( $this->textdomain, $this->get_path() );
- }
- load_plugin_textdomain( $this->textdomain, false, Kirki::$path . '/languages' );
- }
-
- /**
- * Gets the path to a translation file.
- *
- * @access protected
- * @return string Absolute path to the translation file.
- */
- protected function get_path() {
- $path_found = false;
- $found_path = null;
- foreach ( $this->get_paths() as $path ) {
- if ( $path_found ) {
- continue;
- }
- $path = wp_normalize_path( $path );
- if ( file_exists( $path ) ) {
- $path_found = true;
- $found_path = $path;
- }
- }
- return $found_path;
- }
-
- /**
- * Returns an array of paths where translation files may be located.
- *
- * @access protected
- * @return array
- */
- protected function get_paths() {
- return array(
- WP_LANG_DIR . '/' . $this->textdomain . '-' . get_locale() . '.mo',
- Kirki::$path . '/languages/' . $this->textdomain . '-' . get_locale() . '.mo',
- );
- }
-
- /**
- * Allows overriding the "kirki" textdomain from a theme.
- *
- * @since 3.0.12
- * @access public
- * @param bool $override Whether to override the .mo file loading. Default false.
- * @param string $domain Text domain. Unique identifier for retrieving translated strings.
- * @param string $mofile Path to the MO file.
- * @return bool
- */
- 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
- }
-
- // Check if the domain is "kirki".
- if ( 'kirki' === $domain ) {
- return true;
- }
- return $override;
- }
-
- /**
- * Get the theme's textdomain.
- *
- * @since 3.0.12
- * @access private
- * @return string
- */
- private function get_theme_textdomain() {
- if ( '' === $this->theme_textdomain ) {
-
- // Get the textdomain.
- $theme = wp_get_theme();
- $this->theme_textdomain = $theme->get( 'TextDomain' );
-
- // If no texdomain was found, use the template folder name.
- if ( ! $this->theme_textdomain ) {
- $this->theme_textdomain = get_template();
- }
- }
- return $this->theme_textdomain;
- }
-}
diff --git a/assets/kirki/core/class-kirki-modules.php b/assets/kirki/core/class-kirki-modules.php
deleted file mode 100644
index c9a61c6..0000000
--- a/assets/kirki/core/class-kirki-modules.php
+++ /dev/null
@@ -1,149 +0,0 @@
- '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',
- 'custom-sections' => 'Kirki_Modules_Custom_Sections',
- 'webfonts' => 'Kirki_Modules_Webfonts',
- 'webfont-loader' => 'Kirki_Modules_Webfont_Loader',
- 'preset' => 'Kirki_Modules_Preset',
- 'gutenberg' => 'Kirki_Modules_Gutenberg',
- )
- );
- }
-
- /**
- * Instantiates the modules.
- * In v3.0.35 the visibility for this method was changed
- * from private to public to fix https://github.com/aristath/kirki/issues/2023
- *
- * @access public
- * @since 3.0.0
- */
- public function init() {
- foreach ( self::$modules as $key => $module_class ) {
- if ( class_exists( $module_class ) ) {
- // Use this syntax instead of $module_class::get_instance()
- // for PHP 5.2 compatibility.
- self::$active_modules[ $key ] = call_user_func( array( $module_class, 'get_instance' ) );
- }
- }
- }
-
- /**
- * Add a module.
- *
- * @static
- * @access public
- * @param string $module The classname of the module to add.
- * @since 3.0.0
- */
- public static function add_module( $module ) {
- if ( ! in_array( $module, self::$modules, true ) ) {
- self::$modules[] = $module;
- }
- }
-
- /**
- * Remove a module.
- *
- * @static
- * @access public
- * @param string $module The classname of the module to add.
- * @since 3.0.0
- */
- public static function remove_module( $module ) {
- $key = array_search( $module, self::$modules, true );
- if ( false !== $key ) {
- unset( self::$modules[ $key ] );
- }
- }
-
- /**
- * Get the modules array.
- *
- * @static
- * @access public
- * @since 3.0.0
- * @return array
- */
- public static function get_modules() {
- return self::$modules;
- }
-
- /**
- * Get the array of active modules (objects).
- *
- * @static
- * @access public
- * @since 3.0.0
- * @return array
- */
- public static function get_active_modules() {
- return self::$active_modules;
- }
-}
diff --git a/assets/kirki/core/class-kirki-panel.php b/assets/kirki/core/class-kirki-panel.php
deleted file mode 100644
index 72c1714..0000000
--- a/assets/kirki/core/class-kirki-panel.php
+++ /dev/null
@@ -1,54 +0,0 @@
- 'WP_Customize_Panel',
- );
-
- /**
- * The class constructor.
- *
- * @access public
- * @param array $args The panel arguments.
- */
- public function __construct( $args ) {
- $this->panel_types = apply_filters( 'kirki_panel_types', $this->panel_types );
- $this->add_panel( $args );
- }
-
- /**
- * Add the panel using the Customizer API.
- *
- * @param array $args The panel arguments.
- */
- public function add_panel( $args ) {
- global $wp_customize;
-
- if ( ! isset( $args['type'] ) || ! array_key_exists( $args['type'], $this->panel_types ) ) {
- $args['type'] = 'default';
- }
- $panel_classname = $this->panel_types[ $args['type'] ];
-
- $wp_customize->add_panel( new $panel_classname( $wp_customize, $args['id'], $args ) );
- }
-}
diff --git a/assets/kirki/core/class-kirki-sanitize-values.php b/assets/kirki/core/class-kirki-sanitize-values.php
deleted file mode 100644
index de114c0..0000000
--- a/assets/kirki/core/class-kirki-sanitize-values.php
+++ /dev/null
@@ -1,203 +0,0 @@
-sanitize( $value );
- }
-
- /**
- * Sanitize number options.
- *
- * @static
- * @access public
- * @since 0.5
- * @param int|float|double|string $value The value to be sanitized.
- * @return integer|double|string
- */
- public static function number( $value ) {
- return ( is_numeric( $value ) ) ? $value : intval( $value );
- }
-
- /**
- * Drop-down Pages sanitization callback.
- *
- * - Sanitization: dropdown-pages
- * - Control: dropdown-pages
- *
- * Sanitization callback for 'dropdown-pages' type controls. This callback sanitizes `$page_id`
- * as an absolute integer, and then validates that $input is the ID of a published page.
- *
- * @see absint() https://developer.wordpress.org/reference/functions/absint/
- * @see get_post_status() https://developer.wordpress.org/reference/functions/get_post_status/
- *
- * @param int $page_id Page ID.
- * @param WP_Customize_Setting $setting Setting instance.
- * @return int|string Page ID if the page is published; otherwise, the setting default.
- */
- public static function dropdown_pages( $page_id, $setting ) {
-
- // Ensure $input is an absolute integer.
- $page_id = absint( $page_id );
-
- // If $page_id is an ID of a published page, return it; otherwise, return the default.
- return ( 'publish' === get_post_status( $page_id ) ? $page_id : $setting->default );
- }
-
- /**
- * Sanitizes css dimensions.
- *
- * @static
- * @access public
- * @since 2.2.0
- * @param string $value The value to be sanitized.
- * @return string
- */
- public static function css_dimension( $value ) {
-
- // Trim it.
- $value = trim( $value );
-
- // If the value is round, then return 50%.
- if ( 'round' === $value ) {
- $value = '50%';
- }
-
- // If the value is empty, return empty.
- if ( '' === $value ) {
- return '';
- }
-
- // If auto, inherit or initial, return the value.
- if ( 'auto' === $value || 'initial' === $value || 'inherit' === $value || 'normal' === $value ) {
- return $value;
- }
-
- // Return empty if there are no numbers in the value.
- if ( ! preg_match( '#[0-9]#', $value ) ) {
- return '';
- }
-
- // If we're using calc() then return the value.
- if ( false !== strpos( $value, 'calc(' ) ) {
- return $value;
- }
-
- // The raw value without the units.
- $raw_value = self::filter_number( $value );
- $unit_used = '';
-
- // An array of all valid CSS units. Their order was carefully chosen for this evaluation, don't mix it up!!!
- $units = array( 'fr', 'rem', 'em', 'ex', '%', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ch', 'vh', 'vw', 'vmin', 'vmax' );
- foreach ( $units as $unit ) {
- if ( false !== strpos( $value, $unit ) ) {
- $unit_used = $unit;
- }
- }
-
- // Hack for rem values.
- if ( 'em' === $unit_used && false !== strpos( $value, 'rem' ) ) {
- $unit_used = 'rem';
- }
-
- return $raw_value . $unit_used;
- }
-
- /**
- * Filters numeric values.
- *
- * @static
- * @access public
- * @param string $value The value to be sanitized.
- * @return int|float
- */
- public static function filter_number( $value ) {
- return filter_var( $value, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );
- }
-
- /**
- * Sanitize RGBA colors
- *
- * @static
- * @since 0.8.5
- * @param string $value The value to be sanitized.
- * @return string
- */
- public static function rgba( $value ) {
- $color = ariColor::newColor( $value );
- return $color->toCSS( 'rgba' );
- }
-
- /**
- * Sanitize colors.
- *
- * @static
- * @since 0.8.5
- * @param string $value The value to be sanitized.
- * @return string
- */
- public static function color( $value ) {
-
- // If the value is empty, then return empty.
- if ( '' === $value ) {
- return '';
- }
-
- // If transparent, then return 'transparent'.
- if ( is_string( $value ) && 'transparent' === trim( $value ) ) {
- return 'transparent';
- }
-
- // Instantiate the object.
- $color = ariColor::newColor( $value );
-
- // Return a CSS value, using the auto-detected mode.
- return $color->toCSS( $color->mode );
- }
-
- /**
- * DOES NOT SANITIZE ANYTHING.
- *
- * @static
- * @since 0.5
- * @param int|string|array $value The value to be sanitized.
- * @return int|string|array
- */
- public static function unfiltered( $value ) {
- return $value;
- }
-}
diff --git a/assets/kirki/core/class-kirki-section.php b/assets/kirki/core/class-kirki-section.php
deleted file mode 100644
index f723de4..0000000
--- a/assets/kirki/core/class-kirki-section.php
+++ /dev/null
@@ -1,60 +0,0 @@
-section_types = apply_filters( 'kirki_section_types', $this->section_types );
- $this->add_section( $args );
- }
-
- /**
- * Adds the section using the WordPress Customizer API.
- *
- * @access public
- * @param array $args The section parameters.
- */
- public function add_section( $args ) {
- global $wp_customize;
-
- // The default class to be used when creating a section.
- $section_classname = 'WP_Customize_Section';
-
- if ( isset( $args['type'] ) && array_key_exists( $args['type'], $this->section_types ) ) {
- $section_classname = $this->section_types[ $args['type'] ];
- }
- if ( isset( $args['type'] ) && 'kirki-outer' === $args['type'] ) {
- $args['type'] = 'outer';
- $section_classname = 'WP_Customize_Section';
- }
-
- // Add the section.
- $wp_customize->add_section( new $section_classname( $wp_customize, $args['id'], $args ) );
- }
-}
diff --git a/assets/kirki/core/class-kirki-sections.php b/assets/kirki/core/class-kirki-sections.php
deleted file mode 100644
index e073452..0000000
--- a/assets/kirki/core/class-kirki-sections.php
+++ /dev/null
@@ -1,47 +0,0 @@
-';
- $css = '';
- if ( ! empty( Kirki::$sections ) ) {
- foreach ( Kirki::$sections as $section_args ) {
- if ( isset( $section_args['id'] ) && isset( $section_args['type'] ) && 'outer' === $section_args['type'] || 'kirki-outer' === $section_args['type'] ) {
- echo '#customize-theme-controls li#accordion-section-' . esc_html( $section_args['id'] ) . '{display:list-item!important;}';
- }
- }
- }
- echo '';
- }
-}
diff --git a/assets/kirki/core/class-kirki-setting-site-option.php b/assets/kirki/core/class-kirki-setting-site-option.php
deleted file mode 100644
index 343a3a7..0000000
--- a/assets/kirki/core/class-kirki-setting-site-option.php
+++ /dev/null
@@ -1,73 +0,0 @@
-id_data['base'], $default );
- }
-
- /**
- * Set the root value for a setting, especially for multidimensional ones.
- *
- * @access protected
- * @since 3.0.0
- * @param mixed $value Value to set as root of multidimensional setting.
- * @return bool Whether the multidimensional root was updated successfully.
- */
- protected function set_root_value( $value ) {
- return update_site_option( $this->id_data['base'], $value );
- }
-
- /**
- * Save the value of the setting, using the related API.
- *
- * @access protected
- * @since 3.0.0
- * @param mixed $value The value to update.
- * @return bool The result of saving the value.
- */
- protected function update( $value ) {
- return $this->set_root_value( $value );
- }
-
- /**
- * Fetch the value of the setting.
- *
- * @access protected
- * @since 3.0.0
- * @return mixed The value.
- */
- public function value() {
- return $this->get_root_value( $this->default );
- }
-}
diff --git a/assets/kirki/core/class-kirki-setting-user-meta.php b/assets/kirki/core/class-kirki-setting-user-meta.php
deleted file mode 100644
index 063c8ba..0000000
--- a/assets/kirki/core/class-kirki-setting-user-meta.php
+++ /dev/null
@@ -1,93 +0,0 @@
-id_data['base'];
-
- // Get all user-meta.
- // We'll use this to check if the value is set or not,
- // in order to figure out if we need to return the default value.
- $user_meta = get_user_meta( get_current_user_id() );
-
- // Get the single meta.
- $single_meta = get_user_meta( get_current_user_id(), $id_base, true );
-
- if ( isset( $user_meta[ $id_base ] ) ) {
- return $single_meta;
- }
- return $default;
- }
-
- /**
- * Set the root value for a setting, especially for multidimensional ones.
- *
- * @access protected
- * @since 3.0.0
- * @param mixed $value Value to set as root of multidimensional setting.
- * @return bool Whether the multidimensional root was updated successfully.
- */
- protected function set_root_value( $value ) {
- $id_base = $this->id_data['base'];
-
- // First delete the current user-meta.
- // We're doing this to avoid duplicate entries.
- delete_user_meta( get_current_user_id(), $id_base );
-
- // Update the user-meta.
- return update_user_meta( get_current_user_id(), $id_base, $value );
- }
-
- /**
- * Save the value of the setting, using the related API.
- *
- * @access protected
- * @since 3.0.0
- * @param mixed $value The value to update.
- * @return bool The result of saving the value.
- */
- protected function update( $value ) {
- return $this->set_root_value( $value );
- }
-
- /**
- * Fetch the value of the setting.
- *
- * @access protected
- * @since 3.0.0
- * @return mixed The value.
- */
- public function value() {
- return $this->get_root_value( $this->default );
- }
-}
diff --git a/assets/kirki/core/class-kirki-settings.php b/assets/kirki/core/class-kirki-settings.php
deleted file mode 100644
index cae5909..0000000
--- a/assets/kirki/core/class-kirki-settings.php
+++ /dev/null
@@ -1,151 +0,0 @@
-wp_customize = $wp_customize;
-
- // Set the setting_types.
- $this->set_setting_types();
-
- // Add the settings.
- $this->add_settings( $args );
-
- }
-
- /**
- * Adds the settings for this field.
- * If settings are defined as an array, then it goes through them
- * and calls the add_setting method.
- * If not an array, then it just calls add_setting
- *
- * @access private
- * @param array $args The field definition as sanitized in Kirki_Field.
- */
- final private function add_settings( $args = array() ) {
-
- // Get the classname we'll be using to create our setting(s).
- $classname = false;
- if ( isset( $args['option_type'] ) && array_key_exists( $args['option_type'], $this->setting_types ) ) {
- $classname = $this->setting_types[ $args['option_type'] ];
- }
- if ( ! isset( $args['type'] ) || ! array_key_exists( $args['type'], $this->setting_types ) ) {
- $args['type'] = 'default';
- }
- $classname = ! $classname ? $this->setting_types[ $args['type'] ] : $classname;
-
- // If settings are defined as an array, then we need to go through them
- // and call add_setting for each one of them separately.
- if ( isset( $args['settings'] ) && is_array( $args['settings'] ) ) {
-
- // Make sure defaults have been defined.
- if ( ! isset( $args['default'] ) || ! is_array( $args['default'] ) ) {
- $args['default'] = array();
- }
- foreach ( $args['settings'] as $key => $value ) {
- $default = ( isset( $defaults[ $key ] ) ) ? $defaults[ $key ] : '';
- $this->add_setting( $classname, $value, $default, $args['option_type'], $args['capability'], $args['transport'], $args['sanitize_callback'] );
- }
- }
- $this->add_setting( $classname, $args['settings'], $args['default'], $args['option_type'], $args['capability'], $args['transport'], $args['sanitize_callback'] );
- }
-
- /**
- * This is where we're finally adding the setting to the Customizer.
- *
- * @access private
- * @param string $classname The name of the class that will be used to create this setting.
- * We're getting this from $this->setting_types.
- * @param string $setting The setting-name.
- * If settings is an array, then this method is called per-setting.
- * @param string|array $default Default value for this setting.
- * @param string $type The data type we're using. Valid options: theme_mod|option.
- * @param string $capability @see https://codex.wordpress.org/Roles_and_Capabilities.
- * @param string $transport Use refresh|postMessage.
- * @param string|array $sanitize_callback A callable sanitization function or method.
- */
- final private function add_setting( $classname, $setting, $default, $type, $capability, $transport, $sanitize_callback ) {
-
- $this->wp_customize->add_setting(
- new $classname(
- $this->wp_customize, $setting, array(
- 'default' => $default,
- 'type' => $type,
- 'capability' => $capability,
- 'transport' => $transport,
- 'sanitize_callback' => $sanitize_callback,
- )
- )
- );
-
- }
-
- /**
- * Sets the $this->setting_types property.
- * Makes sure the kirki_setting_types filter is applied
- * and that the defined classes actually exist.
- * If a defined class does not exist, it is removed.
- */
- final private function set_setting_types() {
-
- // Apply the kirki_setting_types filter.
- $this->setting_types = apply_filters(
- 'kirki_setting_types', array(
- 'default' => 'WP_Customize_Setting',
- 'repeater' => 'Kirki_Settings_Repeater_Setting',
- 'user_meta' => 'Kirki_Setting_User_Meta',
- 'site_option' => 'Kirki_Setting_Site_Option',
- )
- );
-
- // Make sure the defined classes actually exist.
- foreach ( $this->setting_types as $key => $classname ) {
-
- if ( ! class_exists( $classname ) ) {
- unset( $this->setting_types[ $key ] );
- }
- }
- }
-}
diff --git a/assets/kirki/core/class-kirki-toolkit.php b/assets/kirki/core/class-kirki-toolkit.php
deleted file mode 100644
index 3a45fa6..0000000
--- a/assets/kirki/core/class-kirki-toolkit.php
+++ /dev/null
@@ -1,45 +0,0 @@
- $args ) {
- if ( ! $is_plugin && isset( $args['Name'] ) && ( 'Kirki' === $args['Name'] || 'Kirki Toolkit' === $args['Name'] ) ) {
- $is_plugin = true;
- $_plugin = $plugin;
- }
- }
-
- // No need to proceed any further if Kirki wasn't found in the list of plugins.
- if ( ! $is_plugin ) {
- return false;
- }
-
- // Make sure the is_plugins_loaded function is loaded.
- include_once ABSPATH . 'wp-admin/includes/plugin.php';
-
- // Extra logic in case the plugin is installed but not activated.
- if ( $_plugin && is_plugin_inactive( $_plugin ) ) {
- return false;
- }
- return $is_plugin;
- }
-
- /**
- * Build the variables.
- *
- * @static
- * @access public
- * @since 3.0.9
- * @return array Formatted as array( 'variable-name' => value ).
- */
- public static function get_variables() {
-
- $variables = array();
-
- // Loop through all fields.
- foreach ( Kirki::$fields as $field ) {
-
- // Check if we have variables for this field.
- if ( isset( $field['variables'] ) && $field['variables'] && ! empty( $field['variables'] ) ) {
-
- // Loop through the array of variables.
- foreach ( $field['variables'] as $field_variable ) {
-
- // Is the variable ['name'] defined? If yes, then we can proceed.
- if ( isset( $field_variable['name'] ) ) {
-
- // Do we have a callback function defined? If not then set $variable_callback to false.
- $variable_callback = ( isset( $field_variable['callback'] ) && is_callable( $field_variable['callback'] ) ) ? $field_variable['callback'] : false;
-
- // If we have a variable_callback defined then get the value of the option
- // and run it through the callback function.
- // If no callback is defined (false) then just get the value.
- $variables[ $field_variable['name'] ] = Kirki_Values::get_value( $field['settings'] );
- if ( $variable_callback ) {
- $variables[ $field_variable['name'] ] = call_user_func( $field_variable['callback'], Kirki_Values::get_value( $field['settings'] ) );
- }
- }
- }
- }
- }
-
- // Pass the variables through a filter ('kirki_variable') and return the array of variables.
- return apply_filters( 'kirki_variable', $variables );
- }
-
- /**
- * HTTP Request injection.
- *
- * @access public
- * @since 3.0.0
- * @param array $request The request params.
- * @param string $url The request URL.
- * @return array
- */
- public function http_request( $request = array(), $url = '' ) {
-
- // Early exit if installed as a plugin or not a request to wordpress.org,
- // or finally if we don't have everything we need.
- if (
- self::is_plugin() ||
- false === strpos( $url, 'wordpress.org' ) || (
- ! isset( $request['body'] ) ||
- ! isset( $request['body']['plugins'] ) ||
- ! isset( $request['body']['translations'] ) ||
- ! isset( $request['body']['locale'] ) ||
- ! isset( $request['body']['all'] )
- )
- ) {
- return $request;
- }
-
- $plugins = json_decode( $request['body']['plugins'], true );
- if ( ! isset( $plugins['plugins'] ) ) {
- return $request;
- }
- $exists = false;
- foreach ( $plugins['plugins'] as $plugin ) {
- if ( isset( $plugin['Name'] ) && 'Kirki Toolkit' === $plugin['Name'] ) {
- $exists = true;
- }
- }
- // Inject data.
- if ( ! $exists && defined( 'KIRKI_PLUGIN_FILE' ) ) {
- $plugins['plugins']['kirki/kirki.php'] = get_plugin_data( KIRKI_PLUGIN_FILE );
- }
- $request['body']['plugins'] = wp_json_encode( $plugins );
- return $request;
- }
-
- /**
- * Returns the $wp_version.
- *
- * @static
- * @access public
- * @since 3.0.12
- * @param string $context Use 'minor' or 'major'.
- * @return int|string Returns integer when getting the 'major' version.
- * Returns string when getting the 'minor' version.
- */
- public static function get_wp_version( $context = 'minor' ) {
- global $wp_version;
-
- // We only need the major version.
- if ( 'major' === $context ) {
- $version_parts = explode( '.', $wp_version );
- return $version_parts[0];
- }
-
- return $wp_version;
- }
-
- /**
- * Returns the $wp_version, only numeric value.
- *
- * @static
- * @access public
- * @since 3.0.12
- * @param string $context Use 'minor' or 'major'.
- * @param bool $only_numeric Whether we wwant to return numeric value or include beta/alpha etc.
- * @return int|float Returns integer when getting the 'major' version.
- * Returns float when getting the 'minor' version.
- */
- public static function get_wp_version_numeric( $context = 'minor', $only_numeric = true ) {
- global $wp_version;
-
- // We only need the major version.
- if ( 'major' === $context ) {
- $version_parts = explode( '.', $wp_version );
- return absint( $version_parts[0] );
- }
-
- // If we got this far, we want the full monty.
- // Get the numeric part of the version without any beta, alpha etc parts.
- if ( false !== strpos( $wp_version, '-' ) ) {
- // We're on a dev version.
- $version_parts = explode( '-', $wp_version );
- return floatval( $version_parts[0] );
- }
- return floatval( $wp_version );
- }
-}
diff --git a/assets/kirki/core/class-kirki-values.php b/assets/kirki/core/class-kirki-values.php
deleted file mode 100644
index b94e347..0000000
--- a/assets/kirki/core/class-kirki-values.php
+++ /dev/null
@@ -1,152 +0,0 @@
-get_config();
- self::$config[ $config_args['id'] ] = $config_args;
- }
-
- /**
- * Create a new panel.
- *
- * @static
- * @access public
- * @param string $id The ID for this panel.
- * @param array $args The panel arguments.
- */
- public static function add_panel( $id = '', $args = array() ) {
- $args['id'] = $id;
- if ( ! isset( $args['description'] ) ) {
- $args['description'] = '';
- }
- if ( ! isset( $args['priority'] ) ) {
- $args['priority'] = 10;
- }
- if ( ! isset( $args['type'] ) ) {
- $args['type'] = 'default';
- }
- if ( false === strpos( $args['type'], 'kirki-' ) ) {
- $args['type'] = 'kirki-' . $args['type'];
- }
- self::$panels[ $id ] = $args;
- }
-
- /**
- * Remove a panel.
- *
- * @static
- * @access public
- * @since 3.0.17
- * @param string $id The ID for this panel.
- */
- public static function remove_panel( $id = '' ) {
- if ( ! in_array( $id, self::$panels_to_remove, true ) ) {
- self::$panels_to_remove[] = $id;
- }
- }
-
- /**
- * Create a new section.
- *
- * @static
- * @access public
- * @param string $id The ID for this section.
- * @param array $args The section arguments.
- */
- public static function add_section( $id, $args ) {
- $args['id'] = $id;
- if ( ! isset( $args['description'] ) ) {
- $args['description'] = '';
- }
- if ( ! isset( $args['priority'] ) ) {
- $args['priority'] = 10;
- }
- if ( ! isset( $args['type'] ) ) {
- $args['type'] = 'default';
- }
- if ( false === strpos( $args['type'], 'kirki-' ) ) {
- $args['type'] = 'kirki-' . $args['type'];
- }
-
- self::$sections[ $id ] = $args;
- }
-
- /**
- * Remove a section.
- *
- * @static
- * @access public
- * @since 3.0.17
- * @param string $id The ID for this panel.
- */
- public static function remove_section( $id = '' ) {
- if ( ! in_array( $id, self::$sections_to_remove, true ) ) {
- self::$sections_to_remove[] = $id;
- }
- }
-
- /**
- * Create a new field.
- *
- * @static
- * @access public
- * @param string $config_id The configuration ID for this field.
- * @param array $args The field arguments.
- */
- public static function add_field( $config_id, $args ) {
- if ( doing_action( 'customize_register' ) ) {
- _doing_it_wrong( __METHOD__, esc_html__( 'Kirki fields should not be added on customize_register. Please add them directly, or on init.', 'kirki' ), '3.0.10' );
- }
-
- // Early exit if 'type' is not defined.
- if ( ! isset( $args['type'] ) ) {
- return;
- }
-
- // If the field is font-awesome, enqueue the icons on the frontend.
- if ( class_exists( 'Kirki_Modules_CSS' ) && ( 'fontawesome' === $args['type'] || 'kirki-fontawesome' === $args['type'] ) ) {
- Kirki_Modules_CSS::add_fontawesome_script();
- }
-
- $str = str_replace( array( '-', '_' ), ' ', $args['type'] );
- $classname = 'Kirki_Field_' . str_replace( ' ', '_', ucwords( $str ) );
- if ( class_exists( $classname ) ) {
- new $classname( $config_id, $args );
- return;
- }
- if ( false !== strpos( $classname, 'Kirki_Field_Kirki_' ) ) {
- $classname = str_replace( 'Kirki_Field_Kirki_', 'Kirki_Field_', $classname );
- if ( class_exists( $classname ) ) {
- new $classname( $config_id, $args );
- return;
- }
- }
- new Kirki_Field( $config_id, $args );
- }
-
- /**
- * Remove a control.
- *
- * @static
- * @access public
- * @since 3.0.17
- * @param string $id The field ID.
- */
- public static function remove_control( $id ) {
- if ( ! in_array( $id, self::$controls_to_remove, true ) ) {
- self::$controls_to_remove[] = $id;
- }
- }
-
- /**
- * Gets a parameter for a config-id.
- *
- * @static
- * @access public
- * @since 3.0.10
- * @param string $id The config-ID.
- * @param string $param The parameter we want.
- * @return string
- */
- public static function get_config_param( $id, $param ) {
- if ( ! isset( self::$config[ $id ] ) || ! isset( self::$config[ $id ][ $param ] ) ) {
- return '';
- }
- return self::$config[ $id ][ $param ];
- }
-}
diff --git a/assets/kirki/core/dynamic-css.php b/assets/kirki/core/dynamic-css.php
deleted file mode 100644
index 6e6f254..0000000
--- a/assets/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/assets/kirki/deprecated/classes.php b/assets/kirki/deprecated/classes.php
deleted file mode 100644
index abfd7a7..0000000
--- a/assets/kirki/deprecated/classes.php
+++ /dev/null
@@ -1,20 +0,0 @@
-= 0 ) {
- require_once wp_normalize_path( dirname( __FILE__ ) . '/filters.php' );
-}
diff --git a/assets/kirki/deprecated/filters.php b/assets/kirki/deprecated/filters.php
deleted file mode 100644
index 44dadf4..0000000
--- a/assets/kirki/deprecated/filters.php
+++ /dev/null
@@ -1,116 +0,0 @@
-toCSS( \'hex\' )' );
- return Kirki_Color::sanitize_hex( $color );
- }
-}
-
-if ( ! function_exists( 'kirki_get_rgb' ) ) {
- function kirki_get_rgb( $hex, $implode = false ) {
- _deprecated_function( __FUNCTION__, '1.0.0', 'ariColor::newColor( $color )->toCSS( \'rgb\' )' );
- return Kirki_Color::get_rgb( $hex, $implode );
- }
-}
-
-if ( ! function_exists( 'kirki_get_rgba' ) ) {
- function kirki_get_rgba( $hex = '#fff', $opacity = 100 ) {
- _deprecated_function( __FUNCTION__, '1.0.0', 'ariColor::newColor( $color )->toCSS( \'rgba\' )' );
- return Kirki_Color::get_rgba( $hex, $opacity );
- }
-}
-
-if ( ! function_exists( 'kirki_get_brightness' ) ) {
- function kirki_get_brightness( $hex ) {
- _deprecated_function( __FUNCTION__, '1.0.0', 'ariColor::newColor( $color )->lightness' );
- return Kirki_Color::get_brightness( $hex );
- }
-}
-
-if ( ! function_exists( 'Kirki' ) ) {
- function Kirki() {
- return kirki();
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-background.php b/assets/kirki/field/class-kirki-field-background.php
deleted file mode 100644
index d6c1361..0000000
--- a/assets/kirki/field/class-kirki-field-background.php
+++ /dev/null
@@ -1,117 +0,0 @@
-type = 'kirki-background';
- }
-
- /**
- * Sets the $sanitize_callback
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
-
- // If a custom sanitize_callback has been defined,
- // then we don't need to proceed any further.
- if ( ! empty( $this->sanitize_callback ) ) {
- return;
- }
- $this->sanitize_callback = array( $this, 'sanitize' );
- }
-
- /**
- * Sanitizes typography controls
- *
- * @since 2.2.0
- * @param array $value The value.
- * @return array
- */
- public function sanitize( $value ) {
- if ( ! is_array( $value ) ) {
- return array();
- }
- return array(
- 'background-color' => ( isset( $value['background-color'] ) ) ? sanitize_text_field( $value['background-color'] ) : '',
- 'background-image' => ( isset( $value['background-image'] ) ) ? esc_url_raw( $value['background-image'] ) : '',
- 'background-repeat' => ( isset( $value['background-repeat'] ) ) ? sanitize_text_field( $value['background-repeat'] ) : '',
- 'background-position' => ( isset( $value['background-position'] ) ) ? sanitize_text_field( $value['background-position'] ) : '',
- 'background-size' => ( isset( $value['background-size'] ) ) ? sanitize_text_field( $value['background-size'] ) : '',
- 'background-attachment' => ( isset( $value['background-attachment'] ) ) ? sanitize_text_field( $value['background-attachment'] ) : '',
- );
- }
-
- /**
- * Sets the $js_vars
- *
- * @access protected
- */
- protected function set_js_vars() {
-
- // Typecast to array.
- $this->js_vars = (array) $this->js_vars;
-
- // Check if transport is set to auto.
- // If not, then skip the auto-calculations and exit early.
- if ( 'auto' !== $this->transport ) {
- return;
- }
-
- // Set transport to refresh initially.
- // Serves as a fallback in case we failt to auto-calculate js_vars.
- $this->transport = 'refresh';
-
- $js_vars = array();
-
- // Try to auto-generate js_vars.
- // First we need to check if js_vars are empty, and that output is not empty.
- if ( empty( $this->js_vars ) && ! empty( $this->output ) ) {
-
- // Start going through each item in the $output array.
- foreach ( $this->output as $output ) {
-
- // If 'element' is not defined, skip this.
- if ( ! isset( $output['element'] ) ) {
- continue;
- }
- if ( is_array( $output['element'] ) ) {
- $output['element'] = implode( ',', $output['element'] );
- }
-
- // If there's a sanitize_callback defined, skip this.
- if ( isset( $output['sanitize_callback'] ) && ! empty( $output['sanitize_callback'] ) ) {
- continue;
- }
-
- // If we got this far, it's safe to add this.
- $js_vars[] = $output;
- }
-
- // Did we manage to get all the items from 'output'?
- // If not, then we're missing something so don't add this.
- if ( count( $js_vars ) !== count( $this->output ) ) {
- return;
- }
- $this->js_vars = $js_vars;
- $this->transport = 'postMessage';
- }
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-checkbox.php b/assets/kirki/field/class-kirki-field-checkbox.php
deleted file mode 100644
index 1d0160c..0000000
--- a/assets/kirki/field/class-kirki-field-checkbox.php
+++ /dev/null
@@ -1,56 +0,0 @@
-type = 'checkbox';
- }
-
- /**
- * Sets the $sanitize_callback.
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
- if ( ! $this->sanitize_callback ) {
- $this->sanitize_callback = array( $this, 'sanitize' );
- }
- }
-
- /**
- * Sanitizes checkbox values.
- *
- * @access public
- * @param boolean|integer|string|null $value The checkbox value.
- * @return bool
- */
- public function sanitize( $value = null ) {
- return ( '0' === $value || 'false' === $value ) ? false : (bool) $value;
- }
-
- /**
- * Sets the default value.
- *
- * @access protected
- */
- protected function set_default() {
- $this->default = (bool) ( 1 === $this->default || '1' === $this->default || true === $this->default || 'true' === $this->default || 'on' === $this->default );
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-code.php b/assets/kirki/field/class-kirki-field-code.php
deleted file mode 100644
index a5f2726..0000000
--- a/assets/kirki/field/class-kirki-field-code.php
+++ /dev/null
@@ -1,118 +0,0 @@
- 'kirki-code editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4',
- );
-
- /**
- * Sets the control type.
- *
- * @access protected
- */
- protected function set_type() {
- $this->type = 'code_editor';
- }
-
- /**
- * Sets the $choices
- *
- * @access protected
- */
- protected function set_choices() {
- if ( ! isset( $this->choices['language'] ) ) {
- return;
- }
- $language = $this->choices['language'];
- switch ( $language ) {
- case 'json':
- case 'xml':
- $language = 'application/' . $language;
- break;
- case 'http':
- $language = 'message/' . $language;
- break;
- case 'js':
- case 'javascript':
- $language = 'text/javascript';
- break;
- case 'txt':
- $language = 'text/plain';
- break;
- case 'css':
- case 'jsx':
- case 'html':
- $language = 'text/' . $language;
- break;
- default:
- $language = ( 'js' === $language ) ? 'javascript' : $language;
- $language = ( 'htm' === $language ) ? 'html' : $language;
- $language = ( 'yml' === $language ) ? 'yaml' : $language;
- $language = 'text/x-' . $language;
- break;
- }
- if ( ! isset( $this->editor_settings['codemirror'] ) ) {
- $this->editor_settings['codemirror'] = array();
- }
- if ( ! isset( $this->editor_settings['codemirror']['mode'] ) ) {
- $this->editor_settings['codemirror']['mode'] = $language;
- }
- }
-
- /**
- * Sets the $sanitize_callback
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
-
- // If a custom sanitize_callback has been defined,
- // then we don't need to proceed any further.
- if ( ! empty( $this->sanitize_callback ) ) {
- return;
- }
- // Code fields must NOT be filtered. Their values usually contain CSS/JS.
- // It is the responsibility of the theme/plugin that registers this field
- // to properly apply any necessary filtering.
- $this->sanitize_callback = array( 'Kirki_Sanitize_Values', 'unfiltered' );
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-color-alpha.php b/assets/kirki/field/class-kirki-field-color-alpha.php
deleted file mode 100644
index d387af8..0000000
--- a/assets/kirki/field/class-kirki-field-color-alpha.php
+++ /dev/null
@@ -1,28 +0,0 @@
-choices ) ) {
- $this->choices = array();
- }
- $this->choices['alpha'] = true;
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-color-palette.php b/assets/kirki/field/class-kirki-field-color-palette.php
deleted file mode 100644
index bd9b639..0000000
--- a/assets/kirki/field/class-kirki-field-color-palette.php
+++ /dev/null
@@ -1,25 +0,0 @@
-type = 'kirki-color-palette';
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-color.php b/assets/kirki/field/class-kirki-field-color.php
deleted file mode 100644
index 35890a7..0000000
--- a/assets/kirki/field/class-kirki-field-color.php
+++ /dev/null
@@ -1,85 +0,0 @@
-type = 'kirki-color';
- }
-
- /**
- * Sets the $choices
- *
- * @access protected
- */
- protected function set_choices() {
- if ( ! is_array( $this->choices ) ) {
- $this->choices = array();
- }
- if ( true === $this->alpha ) {
- _doing_it_wrong( 'Kirki::add_field', esc_html__( 'Do not use "alpha" as an argument in color controls. Use "choices[alpha]" instead.', 'kirki' ), '3.0.10' );
- $this->choices['alpha'] = true;
- }
- if ( ! isset( $this->choices['alpha'] ) || true !== $this->choices['alpha'] ) {
- $this->choices['alpha'] = true;
- if ( property_exists( $this, 'default' ) && ! empty( $this->default ) && false === strpos( 'rgba', $this->default ) ) {
- $this->choices['alpha'] = false;
- }
- }
-
- if ( ( ! isset( $this->choices['mode'] ) ) || ( 'hex' !== $this->choices['mode'] || 'hue' !== $this->choices['mode'] ) ) {
- $this->choices['mode'] = 'hex';
- }
- }
-
- /**
- * Sets the $sanitize_callback
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
-
- // If a custom sanitize_callback has been defined,
- // then we don't need to proceed any further.
- if ( ! empty( $this->sanitize_callback ) ) {
- return;
- }
- if ( 'hue' === $this->mode ) {
- $this->sanitize_callback = 'absint';
- return;
- }
- $this->sanitize_callback = array( 'Kirki_Sanitize_Values', 'color' );
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-custom.php b/assets/kirki/field/class-kirki-field-custom.php
deleted file mode 100644
index e96c7a5..0000000
--- a/assets/kirki/field/class-kirki-field-custom.php
+++ /dev/null
@@ -1,43 +0,0 @@
-type = 'kirki-custom';
- }
-
- /**
- * Sets the $sanitize_callback
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
-
- // If a custom sanitize_callback has been defined,
- // then we don't need to proceed any further.
- if ( ! empty( $this->sanitize_callback ) ) {
- return;
- }
-
- // Custom fields don't actually save any value.
- // just use __return_true.
- $this->sanitize_callback = '__return_true';
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-dashicons.php b/assets/kirki/field/class-kirki-field-dashicons.php
deleted file mode 100644
index 162f39a..0000000
--- a/assets/kirki/field/class-kirki-field-dashicons.php
+++ /dev/null
@@ -1,40 +0,0 @@
-type = 'kirki-dashicons';
- }
-
- /**
- * Sets the $sanitize_callback
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
-
- // If a custom sanitize_callback has been defined,
- // then we don't need to proceed any further.
- if ( ! empty( $this->sanitize_callback ) ) {
- return;
- }
- $this->sanitize_callback = 'sanitize_text_field';
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-date.php b/assets/kirki/field/class-kirki-field-date.php
deleted file mode 100644
index db0b8de..0000000
--- a/assets/kirki/field/class-kirki-field-date.php
+++ /dev/null
@@ -1,40 +0,0 @@
-type = 'kirki-date';
- }
-
- /**
- * Sets the $sanitize_callback
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
-
- // If a custom sanitize_callback has been defined,
- // then we don't need to proceed any further.
- if ( ! empty( $this->sanitize_callback ) ) {
- return;
- }
- $this->sanitize_callback = 'sanitize_text_field';
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-dimension.php b/assets/kirki/field/class-kirki-field-dimension.php
deleted file mode 100644
index a953c92..0000000
--- a/assets/kirki/field/class-kirki-field-dimension.php
+++ /dev/null
@@ -1,36 +0,0 @@
-type = 'kirki-dimension';
- }
-
- /**
- * Sanitizes the value.
- *
- * @access public
- * @param string $value The value.
- * @return string
- */
- public function sanitize( $value ) {
- return sanitize_text_field( $value );
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-dimensions.php b/assets/kirki/field/class-kirki-field-dimensions.php
deleted file mode 100644
index 4dce1c0..0000000
--- a/assets/kirki/field/class-kirki-field-dimensions.php
+++ /dev/null
@@ -1,71 +0,0 @@
-type = 'kirki-dimensions';
- }
-
- /**
- * Sets the $sanitize_callback.
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
-
- // If a custom sanitize_callback has been defined,
- // then we don't need to proceed any further.
- if ( ! empty( $this->sanitize_callback ) ) {
- return;
- }
- $this->sanitize_callback = array( $this, 'sanitize' );
- }
-
- /**
- * Sanitizes the value.
- *
- * @access public
- * @param array $value The value.
- * @return array
- */
- public function sanitize( $value ) {
-
- // Sanitize each sub-value separately.
- foreach ( $value as $key => $sub_value ) {
- $value[ $key ] = sanitize_text_field( $sub_value );
- }
- return $value;
- }
-
- /**
- * Set the choices.
- * Adds a pseudo-element "controls" that helps with the JS API.
- *
- * @access protected
- */
- protected function set_choices() {
- $this->choices['controls'] = array();
- if ( is_array( $this->default ) ) {
- foreach ( $this->default as $key => $value ) {
- $this->choices['controls'][ $key ] = true;
- }
- }
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-editor.php b/assets/kirki/field/class-kirki-field-editor.php
deleted file mode 100644
index c8a42ce..0000000
--- a/assets/kirki/field/class-kirki-field-editor.php
+++ /dev/null
@@ -1,53 +0,0 @@
-= 0 ) {
- $this->type = 'kirki-editor';
- return;
- }
-
- // Fallback for older WordPress versions.
- $this->type = 'kirki-generic';
- if ( ! is_array( $this->choices ) ) {
- $this->choices = array();
- }
- $this->choices['element'] = 'textarea';
- $this->choices['rows'] = '5';
- }
-
- /**
- * Sets the $sanitize_callback
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
-
- // If a custom sanitize_callback has been defined,
- // then we don't need to proceed any further.
- if ( ! empty( $this->sanitize_callback ) ) {
- return;
- }
- $this->sanitize_callback = 'wp_kses_post';
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-fontawesome.php b/assets/kirki/field/class-kirki-field-fontawesome.php
deleted file mode 100644
index dca4aec..0000000
--- a/assets/kirki/field/class-kirki-field-fontawesome.php
+++ /dev/null
@@ -1,40 +0,0 @@
-type = 'kirki-fontawesome';
- }
-
- /**
- * Sets the $sanitize_callback
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
-
- // If a custom sanitize_callback has been defined,
- // then we don't need to proceed any further.
- if ( ! empty( $this->sanitize_callback ) ) {
- return;
- }
- $this->sanitize_callback = 'sanitize_text_field';
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-generic.php b/assets/kirki/field/class-kirki-field-generic.php
deleted file mode 100644
index 8e7d85d..0000000
--- a/assets/kirki/field/class-kirki-field-generic.php
+++ /dev/null
@@ -1,15 +0,0 @@
-type = 'kirki-image';
- }
-
- /**
- * Sets the button labels.
- *
- * @access protected
- * @since 3.0.23
- * @return void
- */
- protected function set_button_labels() {
- $this->button_labels = wp_parse_args(
- $this->button_labels,
- array(
- 'select' => esc_html__( 'Select image', 'kirki' ),
- 'change' => esc_html__( 'Change image', 'kirki' ),
- 'default' => esc_html__( 'Default', 'kirki' ),
- 'remove' => esc_html__( 'Remove', 'kirki' ),
- 'placeholder' => esc_html__( 'No image selected', 'kirki' ),
- 'frame_title' => esc_html__( 'Select image', 'kirki' ),
- 'frame_button' => esc_html__( 'Choose image', 'kirki' ),
- )
- );
- }
-
- /**
- * Set the choices.
- * Adds a pseudo-element "controls" that helps with the JS API.
- *
- * @access protected
- */
- protected function set_choices() {
- if ( ! is_array( $this->choices ) ) {
- $this->choices = (array) $this->choices;
- }
- if ( ! isset( $this->choices['save_as'] ) ) {
- $this->choices['save_as'] = 'url';
- }
- if ( ! isset( $this->choices['labels'] ) ) {
- $this->choices['labels'] = array();
- }
- $this->set_button_labels();
- $this->choices['labels'] = wp_parse_args( $this->choices['labels'], $this->button_labels );
- }
-
- /**
- * Sets the $sanitize_callback
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
-
- // If a custom sanitize_callback has been defined,
- // then we don't need to proceed any further.
- if ( ! empty( $this->sanitize_callback ) ) {
- return;
- }
- $this->sanitize_callback = array( $this, 'sanitize' );
- }
-
- /**
- * The sanitize method that will be used as a falback
- *
- * @param string|array $value The control's value.
- */
- public function sanitize( $value ) {
- if ( isset( $this->choices['save_as'] ) && 'array' === $this->choices['save_as'] ) {
- return array(
- 'id' => ( isset( $value['id'] ) && '' !== $value['id'] ) ? (int) $value['id'] : '',
- 'url' => ( isset( $value['url'] ) && '' !== $value['url'] ) ? esc_url_raw( $value['url'] ) : '',
- 'width' => ( isset( $value['width'] ) && '' !== $value['width'] ) ? (int) $value['width'] : '',
- 'height' => ( isset( $value['height'] ) && '' !== $value['height'] ) ? (int) $value['height'] : '',
- );
- }
- if ( isset( $this->choices['save_as'] ) && 'id' === $this->choices['save_as'] ) {
- return absint( $value );
- }
- if ( is_string( $value ) ) {
- return esc_url_raw( $value );
- }
- return $value;
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-kirki-generic.php b/assets/kirki/field/class-kirki-field-kirki-generic.php
deleted file mode 100644
index 2f684ee..0000000
--- a/assets/kirki/field/class-kirki-field-kirki-generic.php
+++ /dev/null
@@ -1,55 +0,0 @@
-type = 'kirki-generic';
- }
-
-
- /**
- * Sets the $choices
- *
- * @access protected
- */
- protected function set_choices() {
- if ( ! is_array( $this->choices ) ) {
- $this->choices = array();
- }
- if ( ! isset( $this->choices['element'] ) ) {
- $this->choices['element'] = 'input';
- }
- }
-
- /**
- * Sets the $sanitize_callback
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
-
- // If a custom sanitize_callback has been defined,
- // then we don't need to proceed any further.
- if ( ! empty( $this->sanitize_callback ) ) {
- return;
- }
- $this->sanitize_callback = 'wp_kses_post';
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-link.php b/assets/kirki/field/class-kirki-field-link.php
deleted file mode 100644
index 65c807e..0000000
--- a/assets/kirki/field/class-kirki-field-link.php
+++ /dev/null
@@ -1,15 +0,0 @@
-type = 'kirki-multicheck';
- }
-
- /**
- * Sets the $sanitize_callback
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
-
- // If a custom sanitize_callback has been defined,
- // then we don't need to proceed any further.
- if ( ! empty( $this->sanitize_callback ) ) {
- return;
- }
- $this->sanitize_callback = array( $this, 'sanitize' );
- }
-
- /**
- * The sanitize method that will be used as a falback
- *
- * @param string|array $value The control's value.
- */
- public function sanitize( $value ) {
- $value = ( ! is_array( $value ) ) ? explode( ',', $value ) : $value;
- return ( ! empty( $value ) ) ? array_map( 'sanitize_text_field', $value ) : array();
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-multicolor.php b/assets/kirki/field/class-kirki-field-multicolor.php
deleted file mode 100644
index 80a15d1..0000000
--- a/assets/kirki/field/class-kirki-field-multicolor.php
+++ /dev/null
@@ -1,67 +0,0 @@
-type = 'kirki-multicolor';
-
- }
-
- /**
- * Sets the $choices
- *
- * @access protected
- */
- protected function set_choices() {
-
- // Make sure choices are defined as an array.
- if ( ! is_array( $this->choices ) ) {
- $this->choices = array();
- }
-
- }
-
- /**
- * Sets the $sanitize_callback
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
-
- // If a custom sanitize_callback has been defined,
- // then we don't need to proceed any further.
- if ( ! empty( $this->sanitize_callback ) ) {
- return;
- }
- $this->sanitize_callback = array( $this, 'sanitize' );
-
- }
-
- /**
- * The method that will be used as a `sanitize_callback`.
- *
- * @param array $value The value to be sanitized.
- * @return array The value.
- */
- public function sanitize( $value ) {
- return $value;
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-number.php b/assets/kirki/field/class-kirki-field-number.php
deleted file mode 100644
index 792d2c9..0000000
--- a/assets/kirki/field/class-kirki-field-number.php
+++ /dev/null
@@ -1,81 +0,0 @@
-type = 'kirki-number';
-
- }
-
- /**
- * Sets the $sanitize_callback
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
- $this->sanitize_callback = array( $this, 'sanitize' );
- }
-
- /**
- * Sets the $choices
- *
- * @access protected
- */
- protected function set_choices() {
- $this->choices = wp_parse_args(
- $this->choices,
- array(
- 'min' => -999999999,
- 'max' => 999999999,
- 'step' => 1,
- )
- );
- // Make sure min, max & step are all numeric.
- $this->choices['min'] = filter_var( $this->choices['min'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );
- $this->choices['max'] = filter_var( $this->choices['max'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );
- $this->choices['step'] = filter_var( $this->choices['step'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );
- }
-
- /**
- * Sanitizes numeric values.
- *
- * @access public
- * @param integer|string $value The checkbox value.
- * @return bool
- */
- public function sanitize( $value = 0 ) {
- $this->set_choices();
-
- $value = filter_var( $value, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );
-
- // Minimum & maximum value limits.
- if ( $value < $this->choices['min'] || $value > $this->choices['max'] ) {
- return max( min( $value, $this->choices['max'] ), $this->choices['min'] );
- }
-
- // Only multiple of steps.
- $steps = ( $value - $this->choices['min'] ) / $this->choices['step'];
- if ( ! is_int( $steps ) ) {
- $value = $this->choices['min'] + ( round( $steps ) * $this->choices['step'] );
- }
- return $value;
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-palette.php b/assets/kirki/field/class-kirki-field-palette.php
deleted file mode 100644
index 423fa3a..0000000
--- a/assets/kirki/field/class-kirki-field-palette.php
+++ /dev/null
@@ -1,25 +0,0 @@
-type = 'kirki-palette';
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-preset.php b/assets/kirki/field/class-kirki-field-preset.php
deleted file mode 100644
index 020d43b..0000000
--- a/assets/kirki/field/class-kirki-field-preset.php
+++ /dev/null
@@ -1,42 +0,0 @@
-type = 'kirki-select';
- }
-
- /**
- * Set the preset.
- *
- * @access protected
- * @since 3.0.28
- */
- protected function set_preset() {
-
- // Set preset from the choices.
- $this->preset = $this->choices;
-
- // We're using a flat select.
- foreach ( $this->choices as $key => $args ) {
- $this->choices[ $key ] = $args['label'];
- }
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-radio-buttonset.php b/assets/kirki/field/class-kirki-field-radio-buttonset.php
deleted file mode 100644
index eb6c7e4..0000000
--- a/assets/kirki/field/class-kirki-field-radio-buttonset.php
+++ /dev/null
@@ -1,25 +0,0 @@
-type = 'kirki-radio-buttonset';
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-radio-image.php b/assets/kirki/field/class-kirki-field-radio-image.php
deleted file mode 100644
index 3926a2f..0000000
--- a/assets/kirki/field/class-kirki-field-radio-image.php
+++ /dev/null
@@ -1,25 +0,0 @@
-type = 'kirki-radio-image';
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-radio.php b/assets/kirki/field/class-kirki-field-radio.php
deleted file mode 100644
index 887aa6d..0000000
--- a/assets/kirki/field/class-kirki-field-radio.php
+++ /dev/null
@@ -1,56 +0,0 @@
-type = 'kirki-radio';
-
- // Tweaks for backwards-compatibility:
- // Prior to version 0.8 radio-buttonset & radio-image were part of the radio control.
- if ( in_array( $this->mode, array( 'buttonset', 'image' ), true ) ) {
- /* translators: %1$s represents the field ID where the error occurs. %2%s is buttonset/image. */
- _doing_it_wrong( __METHOD__, sprintf( esc_html__( 'Error in field %1$s. The "mode" argument has been deprecated since Kirki v0.8. Use the "radio-%2$s" type instead.', 'kirki' ), esc_html( $this->settings ), esc_html( $this->mode ) ), '3.0.10' );
- $this->type = 'radio-' . $this->mode;
- }
- }
-
- /**
- * Sets the $sanitize_callback
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
-
- // If a custom sanitize_callback has been defined,
- // then we don't need to proceed any further.
- if ( ! empty( $this->sanitize_callback ) ) {
- return;
- }
- $this->sanitize_callback = 'sanitize_text_field';
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-repeater.php b/assets/kirki/field/class-kirki-field-repeater.php
deleted file mode 100644
index 235b563..0000000
--- a/assets/kirki/field/class-kirki-field-repeater.php
+++ /dev/null
@@ -1,171 +0,0 @@
-type = 'repeater';
- }
-
- /**
- * Sets the $transport
- *
- * @access protected
- */
- protected function set_transport() {
-
- // Force using refresh mode.
- // Currently the repeater control does not support postMessage.
- $this->transport = 'refresh';
- }
-
-
- /**
- * Sets the $sanitize_callback
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
-
- // If a custom sanitize_callback has been defined,
- // then we don't need to proceed any further.
- if ( ! empty( $this->sanitize_callback ) ) {
- return;
- }
- $this->sanitize_callback = array( $this, 'sanitize' );
-
- }
-
- /**
- * The sanitize method that will be used as a falback
- *
- * @param string|array $value The control's value.
- */
- public function sanitize( $value ) {
-
- // is the value formatted as a string?
- if ( is_string( $value ) ) {
- $value = rawurldecode( $value );
- $value = json_decode( $value, true );
- }
-
- // Nothing to sanitize if we don't have fields.
- if ( empty( $this->fields ) ) {
- return $value;
- }
-
- foreach ( $value as $row_id => $row_value ) {
-
- // Make sure the row is formatted as an array.
- if ( ! is_array( $row_value ) ) {
- $value[ $row_id ] = array();
- continue;
- }
-
- // Start parsing sub-fields in rows.
- foreach ( $row_value as $subfield_id => $subfield_value ) {
-
- // Make sure this is a valid subfield.
- // If it's not, then unset it.
- if ( ! isset( $this->fields[ $subfield_id ] ) ) {
- unset( $value[ $row_id ][ $subfield_id ] );
- }
-
- // Get the subfield-type.
- if ( ! isset( $this->fields[ $subfield_id ]['type'] ) ) {
- continue;
- }
- $subfield_type = $this->fields[ $subfield_id ]['type'];
-
- // Allow using a sanitize-callback on a per-field basis.
- if ( isset( $this->fields[ $subfield_id ]['sanitize_callback'] ) ) {
- $subfield_value = call_user_func( $this->fields[ $subfield_id ]['sanitize_callback'], $subfield_value );
- } else {
-
- switch ( $subfield_type ) {
- case 'image':
- case 'cropped_image':
- case 'upload':
- if ( ! is_numeric( $subfield_value ) && is_string( $subfield_value ) ) {
- $subfield_value = esc_url_raw( $subfield_value );
- }
- break;
- case 'dropdown-pages':
- $subfield_value = (int) $subfield_value;
- break;
- case 'color':
- $color_obj = ariColor::newColor( $subfield_value );
- $subfield_value = $color_obj->toCSS( $color_obj->mode );
- break;
- case 'text':
- $subfield_value = sanitize_text_field( $subfield_value );
- break;
- case 'url':
- case 'link':
- $subfield_value = esc_url_raw( $subfield_value );
- break;
- case 'email':
- $subfield_value = filter_var( $subfield_value, FILTER_SANITIZE_EMAIL );
- break;
- case 'tel':
- $subfield_value = sanitize_text_field( $subfield_value );
- break;
- case 'checkbox':
- $subfield_value = (bool) $subfield_value;
- break;
- case 'select':
- if ( isset( $this->fields[ $subfield_id ]['multiple'] ) ) {
- if ( true === $this->fields[ $subfield_id ]['multiple'] ) {
- $multiple = 2;
- }
- $multiple = (int) $this->fields[ $subfield_id ]['multiple'];
- if ( 1 < $multiple ) {
- $subfield_value = (array) $subfield_value;
- foreach ( $subfield_value as $sub_subfield_key => $sub_subfield_value ) {
- $subfield_value[ $sub_subfield_key ] = sanitize_text_field( $sub_subfield_value );
- }
- } else {
- $subfield_value = sanitize_text_field( $subfield_value );
- }
- }
- break;
- case 'radio':
- case 'radio-image':
- $subfield_value = sanitize_text_field( $subfield_value );
- break;
- case 'textarea':
- $subfield_value = html_entity_decode( wp_kses_post( $subfield_value ) );
-
- }
- }
- $value[ $row_id ][ $subfield_id ] = $subfield_value;
- }
- }
- return $value;
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-select.php b/assets/kirki/field/class-kirki-field-select.php
deleted file mode 100644
index 3057f61..0000000
--- a/assets/kirki/field/class-kirki-field-select.php
+++ /dev/null
@@ -1,102 +0,0 @@
- 1, then the maximum number of selectable options
- * is the number defined here.
- *
- * @access protected
- * @var integer
- */
- protected $multiple = 1;
-
- /**
- * Placeholder text.
- *
- * @access protected
- * @since 3.0.21
- * @var string|false
- */
- protected $placeholder = false;
-
- /**
- * Sets the control type.
- *
- * @access protected
- */
- protected function set_type() {
- $this->type = 'kirki-select';
- }
-
- /**
- * Sets the $multiple
- *
- * @access protected
- */
- protected function set_multiple() {
- $this->multiple = absint( $this->multiple );
- }
-
- /**
- * Sets the $sanitize_callback
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
-
- // If a custom sanitize_callback has been defined,
- // then we don't need to proceed any further.
- if ( ! empty( $this->sanitize_callback ) ) {
- return;
- }
- $this->sanitize_callback = array( $this, 'sanitize' );
- }
-
- /**
- * Sanitizes select control values.
- *
- * @since 2.2.8
- * @access public
- * @param array $value The value.
- * @return string|array
- */
- public function sanitize( $value ) {
- if ( is_array( $value ) ) {
- foreach ( $value as $key => $subvalue ) {
- if ( '' !== $subvalue || isset( $this->choices[''] ) ) {
- $key = sanitize_key( $key );
- $value[ $key ] = sanitize_text_field( $subvalue );
- }
- }
- return $value;
- }
- return sanitize_text_field( $value );
- }
-
- /**
- * Sets the default value.
- *
- * @access protected
- * @since 3.0.0
- */
- protected function set_default() {
- if ( 1 < $this->multiple && ! is_array( $this->default ) ) {
- $this->default = array( $this->default );
- }
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-select2-multiple.php b/assets/kirki/field/class-kirki-field-select2-multiple.php
deleted file mode 100644
index a36c29e..0000000
--- a/assets/kirki/field/class-kirki-field-select2-multiple.php
+++ /dev/null
@@ -1,27 +0,0 @@
-multiple = 999;
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-select2.php b/assets/kirki/field/class-kirki-field-select2.php
deleted file mode 100644
index 989d600..0000000
--- a/assets/kirki/field/class-kirki-field-select2.php
+++ /dev/null
@@ -1,17 +0,0 @@
-type = 'kirki-slider';
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-sortable.php b/assets/kirki/field/class-kirki-field-sortable.php
deleted file mode 100644
index fccd333..0000000
--- a/assets/kirki/field/class-kirki-field-sortable.php
+++ /dev/null
@@ -1,56 +0,0 @@
-type = 'kirki-sortable';
- }
-
- /**
- * Sets the $sanitize_callback.
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
- $this->sanitize_callback = array( $this, 'sanitize' );
- }
-
- /**
- * Sanitizes sortable values.
- *
- * @access public
- * @param array $value The checkbox value.
- * @return array
- */
- public function sanitize( $value = array() ) {
- if ( is_string( $value ) || is_numeric( $value ) ) {
- return array(
- sanitize_text_field( $value ),
- );
- }
- $sanitized_value = array();
- foreach ( $value as $sub_value ) {
- if ( isset( $this->choices[ $sub_value ] ) ) {
- $sanitized_value[] = sanitize_text_field( $sub_value );
- }
- }
- return $sanitized_value;
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-spacing.php b/assets/kirki/field/class-kirki-field-spacing.php
deleted file mode 100644
index e2614a3..0000000
--- a/assets/kirki/field/class-kirki-field-spacing.php
+++ /dev/null
@@ -1,41 +0,0 @@
- array(
- 'top' => ( isset( $this->default['top'] ) ),
- 'bottom' => ( isset( $this->default['top'] ) ),
- 'left' => ( isset( $this->default['top'] ) ),
- 'right' => ( isset( $this->default['top'] ) ),
- ),
- 'labels' => array(
- 'top' => esc_html__( 'Top', 'kirki' ),
- 'bottom' => esc_html__( 'Bottom', 'kirki' ),
- 'left' => esc_html__( 'Left', 'kirki' ),
- 'right' => esc_html__( 'Right', 'kirki' ),
- ),
- );
-
- $this->choices = wp_parse_args( $this->choices, $default_args );
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-switch.php b/assets/kirki/field/class-kirki-field-switch.php
deleted file mode 100644
index 1b14742..0000000
--- a/assets/kirki/field/class-kirki-field-switch.php
+++ /dev/null
@@ -1,45 +0,0 @@
-type = 'kirki-switch';
- }
-
- /**
- * Sets the control choices.
- *
- * @access protected
- */
- protected function set_choices() {
- if ( ! is_array( $this->choices ) ) {
- $this->choices = array();
- }
-
- $this->choices = wp_parse_args(
- $this->choices,
- array(
- 'on' => esc_html__( 'On', 'kirki' ),
- 'off' => esc_html__( 'Off', 'kirki' ),
- 'round' => false,
- )
- );
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-text.php b/assets/kirki/field/class-kirki-field-text.php
deleted file mode 100644
index e4de399..0000000
--- a/assets/kirki/field/class-kirki-field-text.php
+++ /dev/null
@@ -1,44 +0,0 @@
-choices ) ) {
- $this->choices = array();
- }
- $this->choices['element'] = 'input';
- $this->choices['type'] = 'text';
- }
-
- /**
- * Sets the $sanitize_callback
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
-
- // If a custom sanitize_callback has been defined,
- // then we don't need to proceed any further.
- if ( ! empty( $this->sanitize_callback ) ) {
- return;
- }
- $this->sanitize_callback = 'sanitize_textarea_field';
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-textarea.php b/assets/kirki/field/class-kirki-field-textarea.php
deleted file mode 100644
index fc94107..0000000
--- a/assets/kirki/field/class-kirki-field-textarea.php
+++ /dev/null
@@ -1,28 +0,0 @@
-choices = array(
- 'element' => 'textarea',
- 'rows' => 5,
- );
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-toggle.php b/assets/kirki/field/class-kirki-field-toggle.php
deleted file mode 100644
index 4cdb9f8..0000000
--- a/assets/kirki/field/class-kirki-field-toggle.php
+++ /dev/null
@@ -1,25 +0,0 @@
-type = 'kirki-toggle';
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-typography.php b/assets/kirki/field/class-kirki-field-typography.php
deleted file mode 100644
index e976351..0000000
--- a/assets/kirki/field/class-kirki-field-typography.php
+++ /dev/null
@@ -1,217 +0,0 @@
-type = 'kirki-typography';
- }
-
- /**
- * The class constructor.
- * Parses and sanitizes all field arguments.
- * Then it adds the field to Kirki::$fields.
- *
- * @access public
- * @param string $config_id The ID of the config we want to use.
- * Defaults to "global".
- * Configs are handled by the Kirki_Config class.
- * @param array $args The arguments of the field.
- */
- public function __construct( $config_id = 'global', $args = array() ) {
- parent::__construct( $config_id, $args );
- $this->set_default();
- }
-
- /**
- * Sets the default value.
- *
- * @access protected
- */
- protected function set_default() {
-
- // Accomodate the use of font-weight and convert to variant.
- if ( isset( $this->default['font-weight'] ) ) {
- $this->default['variant'] = ( 'regular' === $this->default['font-weight'] ) ? 400 : (string) intval( $this->default['font-weight'] );
- }
-
- // Make sure letter-spacing has units.
- if ( isset( $this->default['letter-spacing'] ) && is_numeric( $this->default['letter-spacing'] ) && $this->default['letter-spacing'] ) {
- $this->default['letter-spacing'] .= 'px';
- }
- }
-
- /**
- * Sets the $sanitize_callback
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
-
- // If a custom sanitize_callback has been defined,
- // then we don't need to proceed any further.
- if ( ! empty( $this->sanitize_callback ) ) {
- return;
- }
- $this->sanitize_callback = array( __CLASS__, 'sanitize' );
- }
-
- /**
- * Sets the $js_vars
- *
- * @access protected
- */
- protected function set_js_vars() {
- if ( ! is_array( $this->js_vars ) ) {
- $this->js_vars = array();
- }
-
- // Check if transport is set to auto.
- // If not, then skip the auto-calculations and exit early.
- if ( 'auto' !== $this->transport ) {
- return;
- }
-
- // Set transport to refresh initially.
- // Serves as a fallback in case we failt to auto-calculate js_vars.
- $this->transport = 'refresh';
-
- $js_vars = array();
-
- // Try to auto-generate js_vars.
- // First we need to check if js_vars are empty, and that output is not empty.
- if ( ! empty( $this->output ) ) {
-
- // Start going through each item in the $output array.
- foreach ( $this->output as $output ) {
-
- // If 'element' or 'property' are not defined, skip this.
- if ( ! isset( $output['element'] ) ) {
- continue;
- }
- if ( is_array( $output['element'] ) ) {
- $output['element'] = implode( ',', $output['element'] );
- }
-
- // If we got this far, it's safe to add this.
- $js_vars[] = $output;
- }
-
- // Did we manage to get all the items from 'output'?
- // If not, then we're missing something so don't add this.
- if ( count( $js_vars ) !== count( $this->output ) ) {
- return;
- }
- $this->js_vars = $js_vars;
- $this->transport = 'postMessage';
- }
- }
-
- /**
- * Sanitizes typography controls
- *
- * @static
- * @since 2.2.0
- * @param array $value The value.
- * @return array
- */
- public static function sanitize( $value ) {
- if ( ! is_array( $value ) ) {
- return array();
- }
-
- foreach ( $value as $key => $val ) {
- switch ( $key ) {
- case 'font-family':
- $value['font-family'] = sanitize_text_field( $val );
- break;
- case 'font-weight':
- if ( isset( $value['variant'] ) ) {
- break;
- }
- $value['variant'] = $val;
- if ( isset( $value['font-style'] ) && 'italic' === $value['font-style'] ) {
- $value['variant'] = ( '400' !== $val || 400 !== $val ) ? $value['variant'] . 'italic' : 'italic';
- }
- break;
- case 'variant':
-
- // Use 'regular' instead of 400 for font-variant.
- $value['variant'] = ( 400 === $val || '400' === $val ) ? 'regular' : $val;
-
- // Get font-weight from variant.
- $value['font-weight'] = filter_var( $value['variant'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );
- $value['font-weight'] = ( 'regular' === $value['variant'] || 'italic' === $value['variant'] ) ? 400 : absint( $value['font-weight'] );
-
- // Get font-style from variant.
- if ( ! isset( $value['font-style'] ) ) {
- $value['font-style'] = ( false === strpos( $value['variant'], 'italic' ) ) ? 'normal' : 'italic';
- }
- break;
- case 'font-size':
- case 'letter-spacing':
- case 'word-spacing':
- case 'line-height':
- $value[ $key ] = '' === trim( $value[ $key ] ) ? '' : sanitize_text_field( $val );
- break;
- case 'text-align':
- if ( ! in_array( $val, array( '', 'inherit', 'left', 'center', 'right', 'justify' ), true ) ) {
- $value['text-align'] = '';
- }
- break;
- case 'text-transform':
- if ( ! in_array( $val, array( '', 'none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit' ), true ) ) {
- $value['text-transform'] = '';
- }
- break;
- case 'text-decoration':
- if ( ! in_array( $val, array( '', 'none', 'underline', 'overline', 'line-through', 'initial', 'inherit' ), true ) ) {
- $value['text-transform'] = '';
- }
- break;
- case 'color':
- $value['color'] = '' === $value['color'] ? '' : ariColor::newColor( $val )->toCSS( 'hex' );
- break;
- }
- }
-
- return $value;
- }
-
- /**
- * Sets the $choices
- *
- * @access protected
- * @since 3.0.0
- */
- protected function set_choices() {
- if ( ! is_array( $this->choices ) ) {
- $this->choices = array();
- }
- $this->choices = wp_parse_args(
- $this->choices, array(
- 'variant' => array(),
- 'fonts' => array(
- 'standard' => array(),
- 'google' => array(),
- ),
- )
- );
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-upload.php b/assets/kirki/field/class-kirki-field-upload.php
deleted file mode 100644
index f8a1860..0000000
--- a/assets/kirki/field/class-kirki-field-upload.php
+++ /dev/null
@@ -1,40 +0,0 @@
-type = 'upload';
- }
-
- /**
- * Sets the $sanitize_callback
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
-
- // If a custom sanitize_callback has been defined,
- // then we don't need to proceed any further.
- if ( ! empty( $this->sanitize_callback ) ) {
- return;
- }
- $this->sanitize_callback = 'esc_url_raw';
- }
-}
diff --git a/assets/kirki/field/class-kirki-field-url.php b/assets/kirki/field/class-kirki-field-url.php
deleted file mode 100644
index f3f7464..0000000
--- a/assets/kirki/field/class-kirki-field-url.php
+++ /dev/null
@@ -1,44 +0,0 @@
-choices ) ) {
- $this->choices = array();
- }
- $this->choices['element'] = 'input';
- $this->choices['type'] = 'text';
- }
-
- /**
- * Sets the $sanitize_callback
- *
- * @access protected
- */
- protected function set_sanitize_callback() {
-
- // If a custom sanitize_callback has been defined,
- // then we don't need to proceed any further.
- if ( ! empty( $this->sanitize_callback ) ) {
- return;
- }
- $this->sanitize_callback = 'esc_url_raw';
- }
-}
diff --git a/assets/kirki/kirki.php b/assets/kirki/kirki.php
deleted file mode 100644
index ded38a5..0000000
--- a/assets/kirki/kirki.php
+++ /dev/null
@@ -1,106 +0,0 @@
-modules = new Kirki_Modules();
-
-Kirki::$url = plugins_url( '', __FILE__ );
-
-// Instantiate classes.
-new Kirki();
-new Kirki_L10n();
-
-// Include deprecated functions & methods.
-require_once wp_normalize_path( dirname( __FILE__ ) . '/deprecated/deprecated.php' );
-
-// Include the ariColor library.
-require_once wp_normalize_path( dirname( __FILE__ ) . '/lib/class-aricolor.php' );
-
-// Add an empty config for global fields.
-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;
-}
-
-// Add upgrade notifications.
-require_once wp_normalize_path( dirname( __FILE__ ) . '/upgrade-notifications.php' );
-
-/**
- * To enable tests, add this line to your wp-config.php file (or anywhere alse):
- * define( 'KIRKI_TEST', true );
- *
- * Please note that the example.php file is not included in the wordpress.org distribution
- * 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';
-}
diff --git a/assets/kirki/lib/class-aricolor.php b/assets/kirki/lib/class-aricolor.php
deleted file mode 100644
index 714fa57..0000000
--- a/assets/kirki/lib/class-aricolor.php
+++ /dev/null
@@ -1,982 +0,0 @@
-color = $color;
-
- if ( is_array( $color ) && isset( $color['fallback'] ) ) {
- $this->fallback = $color['fallback'];
- $this->fallback_obj = self::newColor( $this->fallback );
- }
-
- if ( ! method_exists( $this, 'from_' . $mode ) ) {
- $mode = $this->get_mode( $color );
- }
-
- $this->mode = $mode;
-
- if ( ! $mode ) {
- return;
- }
-
- $this->mode = $mode;
- $method = 'from_' . $mode;
- // Call the from_{$color_mode} method.
- $this->$method();
- }
-
- /**
- * Gets an instance for this color.
- * We use a separate instance per color
- * because there's no need to create a completely new instance each time we call this class.
- * Instead using instances helps us improve performance & footprint.
- *
- * @static
- * @access public
- * @since 1.0.0
- * @param string|array $color The color.
- * @param string $mode Mode to be used.
- * @return ariColor (object)
- */
- public static function newColor( $color, $mode = 'auto' ) {
-
- // Get an md5 for this color.
- $color_md5 = ( is_array( $color ) ) ? md5( wp_json_encode( $color ) . $mode ) : md5( $color . $mode );
- // Set the instance if it does not already exist.
- if ( ! isset( self::$instances[ $color_md5 ] ) ) {
- self::$instances[ $color_md5 ] = new self( $color, $mode );
- }
- return self::$instances[ $color_md5 ];
- }
-
- /**
- * Alias of the newColor method.
- *
- * @static
- * @access public
- * @since 1.1
- * @param string|array $color The color.
- * @param string $mode Mode to be used.
- * @return ariColor (object)
- */
- public static function new_color( $color, $mode = 'auto' ) {
- return self::newColor( $color, $mode );
- }
-
- /**
- * Allows us to get a new instance by modifying a property of the existing one.
- *
- * @access public
- * @since 1.0.0
- * @param string $property Can be one of the following:
- * red,
- * green,
- * blue,
- * alpha,
- * hue,
- * saturation,
- * lightness,
- * brightness.
- * @param int|float|string $value The new value.
- * @return ariColor|null
- */
- public function getNew( $property = '', $value = '' ) {
-
- if ( in_array( $property, array( 'red', 'green', 'blue', 'alpha' ), true ) ) {
- // Check if we're changing any of the rgba values.
- $value = max( 0, min( 255, $value ) );
- if ( 'red' === $property ) {
- return self::new_color( 'rgba(' . $value . ',' . $this->green . ',' . $this->blue . ',' . $this->alpha . ')', 'rgba' );
- } elseif ( 'green' === $property ) {
- return self::new_color( 'rgba(' . $this->red . ',' . $value . ',' . $this->blue . ',' . $this->alpha . ')', 'rgba' );
- } elseif ( 'blue' === $property ) {
- return self::new_color( 'rgba(' . $this->red . ',' . $this->green . ',' . $value . ',' . $this->alpha . ')', 'rgba' );
- } elseif ( 'alpha' === $property ) {
- return self::new_color( 'rgba(' . $this->red . ',' . $this->green . ',' . $this->blue . ',' . $value . ')', 'rgba' );
- }
- } elseif ( in_array( $property, array( 'hue', 'saturation', 'lightness' ), true ) ) {
- // Check if we're changing any of the hsl values.
- $value = ( 'hue' === $property ) ? max( 0, min( 360, $value ) ) : max( 0, min( 100, $value ) );
-
- if ( 'hue' === $property ) {
- return self::new_color( 'hsla(' . $value . ',' . $this->saturation . '%,' . $this->lightness . '%,' . $this->alpha . ')', 'hsla' );
- } elseif ( 'saturation' === $property ) {
- return self::new_color( 'hsla(' . $this->hue . ',' . $value . '%,' . $this->lightness . '%,' . $this->alpha . ')', 'hsla' );
- } elseif ( 'lightness' === $property ) {
- return self::new_color( 'hsla(' . $this->hue . ',' . $this->saturation . '%,' . $value . '%,' . $this->alpha . ')', 'hsla' );
- }
- } elseif ( 'brightness' === $property ) {
- // Check if we're changing the brightness.
- if ( $value < $this->brightness['total'] ) {
- $red = max( 0, min( 255, $this->red - ( $this->brightness['total'] - $value ) ) );
- $green = max( 0, min( 255, $this->green - ( $this->brightness['total'] - $value ) ) );
- $blue = max( 0, min( 255, $this->blue - ( $this->brightness['total'] - $value ) ) );
- } elseif ( $value > $this->brightness['total'] ) {
- $red = max( 0, min( 255, $this->red + ( $value - $this->brightness['total'] ) ) );
- $green = max( 0, min( 255, $this->green + ( $value - $this->brightness['total'] ) ) );
- $blue = max( 0, min( 255, $this->blue + ( $value - $this->brightness['total'] ) ) );
- } else {
- // If it's not smaller and it's not greater, then it's equal.
- return $this;
- }
- return self::new_color( 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $this->alpha . ')', 'rgba' );
- }
- return null;
- }
-
- /**
- * Allias for the getNew method.
- *
- * @access public
- * @since 1.1.0
- * @param string $property Can be one of the following:
- * red,
- * green,
- * blue,
- * alpha,
- * hue,
- * saturation,
- * lightness,
- * brightness.
- * @param int|float|string $value The new value.
- * @return ariColor|null
- */
- public function get_new( $property = '', $value = '' ) {
- return $this->getNew( $property, $value );
- }
-
- /**
- * Figure out what mode we're using.
- *
- * @access public
- * @since 1.0.0
- * @param string|array $color The color we're querying.
- * @return string
- */
- public function get_mode( $color ) {
-
- // Check if value is an array.
- if ( is_array( $color ) ) {
- // Does the array have an 'rgba' key?
- if ( isset( $color['rgba'] ) ) {
- $this->color = $color['rgba'];
- return 'rgba';
- } elseif ( isset( $color['color'] ) ) {
- // Does the array have a 'color' key?
- $this->color = $color['color'];
- if ( is_string( $color['color'] ) && false !== strpos( $color['color'], 'rgba' ) ) {
- return 'rgba';
- }
- return 'hex';
- }
- // Is this a simple array with 4 items?
- if ( 4 === count( $color ) && isset( $color[0] ) && isset( $color[1] ) && isset( $color[2] ) && isset( $color[3] ) ) {
- $this->color = 'rgba(' . intval( $color[0] ) . ',' . intval( $color[1] ) . ',' . intval( $color[2] ) . ',' . intval( $color[3] ) . ')';
- return 'rgba';
- } elseif ( 3 === count( $color ) && isset( $color[0] ) && isset( $color[1] ) && isset( $color[2] ) ) {
- // Is this a simple array with 3 items?
- $this->color = 'rgba(' . intval( $color[0] ) . ',' . intval( $color[1] ) . ',' . intval( $color[2] ) . ',1)';
- return 'rgba';
- }
-
- // Check for other keys in the array and get values from there.
- $finders_keepers = array(
- 'r' => 'red',
- 'g' => 'green',
- 'b' => 'blue',
- 'a' => 'alpha',
- 'red' => 'red',
- 'green' => 'green',
- 'blue' => 'blue',
- 'alpha' => 'alpha',
- 'opacity' => 'alpha',
- );
- $found = false;
- foreach ( $finders_keepers as $finder => $keeper ) {
- if ( isset( $color[ $finder ] ) ) {
- $found = true;
- $this->$keeper = $color[ $finder ];
- }
- }
-
- // We failed, use fallback.
- if ( ! $found ) {
- $this->from_fallback();
- return $this->mode;
- }
-
- // We did not fail, so use rgba values recovered above.
- $this->color = 'rgba(' . $this->red . ',' . $this->green . ',' . $this->blue . ',' . $this->alpha . ')';
- return 'rgba';
- }
-
- // If a string and 3 or 6 characters long, add # since it's a hex.
- if ( 3 === strlen( $this->color ) || 6 === strlen( $this->color ) && false === strpos( $this->color, '#' ) ) {
- $this->color = '#' . $this->color;
- $color = $this->color;
- }
-
- // If we got this far, it's not an array.
- // Check for key identifiers in the value.
- $finders_keepers = array(
- '#' => 'hex',
- 'rgba' => 'rgba',
- 'rgb' => 'rgb',
- 'hsla' => 'hsla',
- 'hsl' => 'hsl',
- );
- foreach ( $finders_keepers as $finder => $keeper ) {
- if ( false !== strrpos( $color, $finder ) ) {
-
- // Make sure hex colors have 6 digits and not more.
- if ( '#' === $finder && 7 < strlen( $color ) ) {
- $this->color = substr( $color, 0, 7 );
- }
-
- return $keeper;
- }
- }
- // Perhaps we're using a word like "orange"?
- $wordcolors = $this->get_word_colors();
- if ( is_string( $color ) && array_key_exists( $color, $wordcolors ) ) {
- $this->color = '#' . $wordcolors[ $color ];
- return 'hex';
- }
- // Fallback to hex.
-
- $this->color = $this->fallback;
- return 'hex';
- }
-
- /**
- * Starts with a HEX color and calculates all other properties.
- *
- * @access protected
- * @since 1.0.0
- * @return null
- */
- protected function from_hex() {
-
- if ( ! function_exists( 'sanitize_hex_color' ) ) {
- require_once wp_normalize_path( ABSPATH . WPINC . '/class-wp-customize-manager.php' );
- }
- // Is this perhaps a word-color?
- $word_colors = $this->get_word_colors();
- if ( array_key_exists( $this->color, $word_colors ) ) {
- $this->color = '#' . $word_colors[ $this->color ];
- }
- // Sanitize color.
- $this->hex = sanitize_hex_color( maybe_hash_hex_color( $this->color ) );
- $hex = ltrim( $this->hex, '#' );
-
- // Fallback if needed.
- if ( ! $hex || 3 > strlen( $hex ) ) {
- $this->from_fallback();
- return;
- }
- // Make sure we have 6 digits for the below calculations.
- if ( 3 === strlen( $hex ) ) {
- $hex = ltrim( $this->hex, '#' );
- $hex = substr( $hex, 0, 1 ) . substr( $hex, 0, 1 ) . substr( $hex, 1, 1 ) . substr( $hex, 1, 1 ) . substr( $hex, 2, 1 ) . substr( $hex, 2, 1 );
- }
-
- // Set red, green, blue.
- $this->red = hexdec( substr( $hex, 0, 2 ) );
- $this->green = hexdec( substr( $hex, 2, 2 ) );
- $this->blue = hexdec( substr( $hex, 4, 2 ) );
- $this->alpha = 1;
- // Set other color properties.
- $this->set_brightness();
- $this->set_hsl();
- $this->set_luminance();
-
- }
-
- /**
- * Starts with an RGB color and calculates all other properties.
- *
- * @access protected
- * @since 1.0.0
- * @return null
- */
- protected function from_rgb() {
- $value = explode( ',', str_replace( array( ' ', 'rgb', '(', ')' ), '', $this->color ) );
- // Set red, green, blue.
- $this->red = ( isset( $value[0] ) ) ? intval( $value[0] ) : 255;
- $this->green = ( isset( $value[1] ) ) ? intval( $value[1] ) : 255;
- $this->blue = ( isset( $value[2] ) ) ? intval( $value[2] ) : 255;
- $this->alpha = 1;
- // Set the hex.
- $this->hex = $this->rgb_to_hex( $this->red, $this->green, $this->blue );
- // Set other color properties.
- $this->set_brightness();
- $this->set_hsl();
- $this->set_luminance();
- }
-
- /**
- * Starts with an RGBA color and calculates all other properties.
- *
- * @access protected
- * @since 1.0.0
- * @return null
- */
- protected function from_rgba() {
- // Set r, g, b, a properties.
- $value = explode( ',', str_replace( array( ' ', 'rgba', '(', ')' ), '', $this->color ) );
- $this->red = ( isset( $value[0] ) ) ? intval( $value[0] ) : 255;
- $this->green = ( isset( $value[1] ) ) ? intval( $value[1] ) : 255;
- $this->blue = ( isset( $value[2] ) ) ? intval( $value[2] ) : 255;
- $this->alpha = ( isset( $value[3] ) ) ? filter_var( $value[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ) : 1;
- // Limit values in the range of 0 - 255.
- $this->red = max( 0, min( 255, $this->red ) );
- $this->green = max( 0, min( 255, $this->green ) );
- $this->blue = max( 0, min( 255, $this->blue ) );
- // Limit values 0 - 1.
- $this->alpha = max( 0, min( 1, $this->alpha ) );
- // Set hex.
- $this->hex = $this->rgb_to_hex( $this->red, $this->green, $this->blue );
- // Set other color properties.
- $this->set_brightness();
- $this->set_hsl();
- $this->set_luminance();
- }
-
- /**
- * Starts with an HSL color and calculates all other properties.
- *
- * @access protected
- * @since 1.0.0
- * @return null
- */
- protected function from_hsl() {
- $value = explode( ',', str_replace( array( ' ', 'hsl', '(', ')', '%' ), '', $this->color ) );
- $this->hue = $value[0];
- $this->saturation = $value[1];
- $this->lightness = $value[2];
- $this->from_hsl_array();
- }
-
- /**
- * Starts with an HSLA color and calculates all other properties.
- *
- * @access protected
- * @since 1.0.0
- * @return null
- */
- protected function from_hsla() {
- $value = explode( ',', str_replace( array( ' ', 'hsla', '(', ')', '%' ), '', $this->color ) );
- $this->hue = $value[0];
- $this->saturation = $value[1];
- $this->lightness = $value[2];
- $this->alpha = $value[3];
- $this->from_hsl_array();
- }
-
- /**
- * Generates the HEX value of a color given values for $red, $green, $blue.
- *
- * @access protected
- * @since 1.0.0
- * @param int|string $red The red value of this color.
- * @param int|string $green The green value of this color.
- * @param int|string $blue The blue value of this color.
- * @return string
- */
- protected function rgb_to_hex( $red, $green, $blue ) {
- // Get hex values properly formatted.
- $hex_red = $this->dexhex_double_digit( $red );
- $hex_green = $this->dexhex_double_digit( $green );
- $hex_blue = $this->dexhex_double_digit( $blue );
- return '#' . $hex_red . $hex_green . $hex_blue;
- }
-
- /**
- * Convert a decimal value to hex and make sure it's 2 characters.
- *
- * @access protected
- * @since 1.0.0
- * @param int|string $value The value to convert.
- * @return string
- */
- protected function dexhex_double_digit( $value ) {
- $value = dechex( $value );
- if ( 1 === strlen( $value ) ) {
- $value = '0' . $value;
- }
- return $value;
- }
-
- /**
- * Calculates the red, green, blue values of an HSL color.
- *
- * @access protected
- * @since 1.0.0
- * @see https://gist.github.com/brandonheyer/5254516
- */
- protected function from_hsl_array() {
- $h = $this->hue / 360;
- $s = $this->saturation / 100;
- $l = $this->lightness / 100;
-
- $r = $l;
- $g = $l;
- $b = $l;
- $v = ( $l <= 0.5 ) ? ( $l * ( 1.0 + $s ) ) : ( $l + $s - $l * $s );
- if ( $v > 0 ) {
- $m = $l + $l - $v;
- $sv = ( $v - $m ) / $v;
- $h *= 6.0;
- $sextant = floor( $h );
- $fract = $h - $sextant;
- $vsf = $v * $sv * $fract;
- $mid1 = $m + $vsf;
- $mid2 = $v - $vsf;
- switch ( $sextant ) {
- case 0:
- $r = $v;
- $g = $mid1;
- $b = $m;
- break;
- case 1:
- $r = $mid2;
- $g = $v;
- $b = $m;
- break;
- case 2:
- $r = $m;
- $g = $v;
- $b = $mid1;
- break;
- case 3:
- $r = $m;
- $g = $mid2;
- $b = $v;
- break;
- case 4:
- $r = $mid1;
- $g = $m;
- $b = $v;
- break;
- case 5:
- $r = $v;
- $g = $m;
- $b = $mid2;
- break;
- }
- }
- $this->red = round( $r * 255, 0 );
- $this->green = round( $g * 255, 0 );
- $this->blue = round( $b * 255, 0 );
-
- $this->hex = $this->rgb_to_hex( $this->red, $this->green, $this->blue );
- $this->set_luminance();
- }
-
- /**
- * Returns a CSS-formatted value for colors.
- *
- * @access public
- * @since 1.0.0
- * @param string $mode The mode we're using.
- * @return string
- */
- public function toCSS( $mode = 'hex' ) {
-
- $value = '';
-
- switch ( $mode ) {
- case 'hex':
- $value = strtolower( $this->hex );
- break;
- case 'rgba':
- $value = 'rgba(' . $this->red . ',' . $this->green . ',' . $this->blue . ',' . $this->alpha . ')';
- break;
- case 'rgb':
- $value = 'rgb(' . $this->red . ',' . $this->green . ',' . $this->blue . ')';
- break;
- case 'hsl':
- $value = 'hsl(' . $this->hue . ',' . round( $this->saturation ) . '%,' . round( $this->lightness ) . '%)';
- break;
- case 'hsla':
- $value = 'hsla(' . $this->hue . ',' . round( $this->saturation ) . '%,' . round( $this->lightness ) . '%,' . $this->alpha . ')';
- break;
- }
- return $value;
- }
-
- /**
- * Alias for the toCSS method.
- *
- * @access public
- * @since 1.1
- * @param string $mode The mode we're using.
- * @return string
- */
- public function to_css( $mode = 'hex' ) {
- return $this->toCSS( $mode );
- }
-
- /**
- * Sets the HSL values of a color based on the values of red, green, blue.
- *
- * @access public
- * @since 1.0.0
- */
- protected function set_hsl() {
- $red = $this->red / 255;
- $green = $this->green / 255;
- $blue = $this->blue / 255;
-
- $max = max( $red, $green, $blue );
- $min = min( $red, $green, $blue );
-
- $lightness = ( $max + $min ) / 2;
- $difference = $max - $min;
-
- if ( ! $difference ) {
- $hue = $saturation = 0; // Achromatic.
- } else {
- $saturation = $difference / ( 1 - abs( 2 * $lightness - 1 ) );
- switch ( $max ) {
- case $red:
- $hue = 60 * fmod( ( ( $green - $blue ) / $difference ), 6 );
- if ( $blue > $green ) {
- $hue += 360;
- }
- break;
- case $green:
- $hue = 60 * ( ( $blue - $red ) / $difference + 2 );
- break;
- case $blue:
- $hue = 60 * ( ( $red - $green ) / $difference + 4 );
- break;
- }
- }
-
- $this->hue = round( $hue );
- $this->saturation = round( $saturation * 100 );
- $this->lightness = round( $lightness * 100 );
- }
-
- /**
- * Sets the brightness of a color based on the values of red, green, blue.
- *
- * @access protected
- * @since 1.0.0
- */
- protected function set_brightness() {
- $this->brightness = array(
- 'red' => round( $this->red * .299 ),
- 'green' => round( $this->green * .587 ),
- 'blue' => round( $this->blue * .114 ),
- 'total' => intval( ( $this->red * .299 ) + ( $this->green * .587 ) + ( $this->blue * .114 ) ),
- );
- }
-
- /**
- * Sets the luminance of a color (range:0-255) based on the values of red, green, blue.
- *
- * @access protected
- * @since 1.0.0
- */
- protected function set_luminance() {
- $lum = ( 0.2126 * $this->red ) + ( 0.7152 * $this->green ) + ( 0.0722 * $this->blue );
- $this->luminance = round( $lum );
- }
-
- /**
- * Gets an array of all the wordcolors.
- *
- * @access protected
- * @since 1.0.0
- * @return array
- */
- protected function get_word_colors() {
- return array(
- 'aliceblue' => 'F0F8FF',
- 'antiquewhite' => 'FAEBD7',
- 'aqua' => '00FFFF',
- 'aquamarine' => '7FFFD4',
- 'azure' => 'F0FFFF',
- 'beige' => 'F5F5DC',
- 'bisque' => 'FFE4C4',
- 'black' => '000000',
- 'blanchedalmond' => 'FFEBCD',
- 'blue' => '0000FF',
- 'blueviolet' => '8A2BE2',
- 'brown' => 'A52A2A',
- 'burlywood' => 'DEB887',
- 'cadetblue' => '5F9EA0',
- 'chartreuse' => '7FFF00',
- 'chocolate' => 'D2691E',
- 'coral' => 'FF7F50',
- 'cornflowerblue' => '6495ED',
- 'cornsilk' => 'FFF8DC',
- 'crimson' => 'DC143C',
- 'cyan' => '00FFFF',
- 'darkblue' => '00008B',
- 'darkcyan' => '008B8B',
- 'darkgoldenrod' => 'B8860B',
- 'darkgray' => 'A9A9A9',
- 'darkgreen' => '006400',
- 'darkgrey' => 'A9A9A9',
- 'darkkhaki' => 'BDB76B',
- 'darkmagenta' => '8B008B',
- 'darkolivegreen' => '556B2F',
- 'darkorange' => 'FF8C00',
- 'darkorchid' => '9932CC',
- 'darkred' => '8B0000',
- 'darksalmon' => 'E9967A',
- 'darkseagreen' => '8FBC8F',
- 'darkslateblue' => '483D8B',
- 'darkslategray' => '2F4F4F',
- 'darkslategrey' => '2F4F4F',
- 'darkturquoise' => '00CED1',
- 'darkviolet' => '9400D3',
- 'deeppink' => 'FF1493',
- 'deepskyblue' => '00BFFF',
- 'dimgray' => '696969',
- 'dimgrey' => '696969',
- 'dodgerblue' => '1E90FF',
- 'firebrick' => 'B22222',
- 'floralwhite' => 'FFFAF0',
- 'forestgreen' => '228B22',
- 'fuchsia' => 'FF00FF',
- 'gainsboro' => 'DCDCDC',
- 'ghostwhite' => 'F8F8FF',
- 'gold' => 'FFD700',
- 'goldenrod' => 'DAA520',
- 'gray' => '808080',
- 'green' => '008000',
- 'greenyellow' => 'ADFF2F',
- 'grey' => '808080',
- 'honeydew' => 'F0FFF0',
- 'hotpink' => 'FF69B4',
- 'indianred' => 'CD5C5C',
- 'indigo' => '4B0082',
- 'ivory' => 'FFFFF0',
- 'khaki' => 'F0E68C',
- 'lavender' => 'E6E6FA',
- 'lavenderblush' => 'FFF0F5',
- 'lawngreen' => '7CFC00',
- 'lemonchiffon' => 'FFFACD',
- 'lightblue' => 'ADD8E6',
- 'lightcoral' => 'F08080',
- 'lightcyan' => 'E0FFFF',
- 'lightgoldenrodyellow' => 'FAFAD2',
- 'lightgray' => 'D3D3D3',
- 'lightgreen' => '90EE90',
- 'lightgrey' => 'D3D3D3',
- 'lightpink' => 'FFB6C1',
- 'lightsalmon' => 'FFA07A',
- 'lightseagreen' => '20B2AA',
- 'lightskyblue' => '87CEFA',
- 'lightslategray' => '778899',
- 'lightslategrey' => '778899',
- 'lightsteelblue' => 'B0C4DE',
- 'lightyellow' => 'FFFFE0',
- 'lime' => '00FF00',
- 'limegreen' => '32CD32',
- 'linen' => 'FAF0E6',
- 'magenta' => 'FF00FF',
- 'maroon' => '800000',
- 'mediumaquamarine' => '66CDAA',
- 'mediumblue' => '0000CD',
- 'mediumorchid' => 'BA55D3',
- 'mediumpurple' => '9370D0',
- 'mediumseagreen' => '3CB371',
- 'mediumslateblue' => '7B68EE',
- 'mediumspringgreen' => '00FA9A',
- 'mediumturquoise' => '48D1CC',
- 'mediumvioletred' => 'C71585',
- 'midnightblue' => '191970',
- 'mintcream' => 'F5FFFA',
- 'mistyrose' => 'FFE4E1',
- 'moccasin' => 'FFE4B5',
- 'navajowhite' => 'FFDEAD',
- 'navy' => '000080',
- 'oldlace' => 'FDF5E6',
- 'olive' => '808000',
- 'olivedrab' => '6B8E23',
- 'orange' => 'FFA500',
- 'orangered' => 'FF4500',
- 'orchid' => 'DA70D6',
- 'palegoldenrod' => 'EEE8AA',
- 'palegreen' => '98FB98',
- 'paleturquoise' => 'AFEEEE',
- 'palevioletred' => 'DB7093',
- 'papayawhip' => 'FFEFD5',
- 'peachpuff' => 'FFDAB9',
- 'peru' => 'CD853F',
- 'pink' => 'FFC0CB',
- 'plum' => 'DDA0DD',
- 'powderblue' => 'B0E0E6',
- 'purple' => '800080',
- 'red' => 'FF0000',
- 'rosybrown' => 'BC8F8F',
- 'royalblue' => '4169E1',
- 'saddlebrown' => '8B4513',
- 'salmon' => 'FA8072',
- 'sandybrown' => 'F4A460',
- 'seagreen' => '2E8B57',
- 'seashell' => 'FFF5EE',
- 'sienna' => 'A0522D',
- 'silver' => 'C0C0C0',
- 'skyblue' => '87CEEB',
- 'slateblue' => '6A5ACD',
- 'slategray' => '708090',
- 'slategrey' => '708090',
- 'snow' => 'FFFAFA',
- 'springgreen' => '00FF7F',
- 'steelblue' => '4682B4',
- 'tan' => 'D2B48C',
- 'teal' => '008080',
- 'thistle' => 'D8BFD8',
- 'tomato' => 'FF6347',
- 'turquoise' => '40E0D0',
- 'violet' => 'EE82EE',
- 'wheat' => 'F5DEB3',
- 'white' => 'FFFFFF',
- 'whitesmoke' => 'F5F5F5',
- 'yellow' => 'FFFF00',
- 'yellowgreen' => '9ACD32',
- );
-
- }
-
- /**
- * Use fallback object.
- *
- * @access protected
- * @since 1.2.0
- */
- protected function from_fallback() {
- $this->color = $this->fallback;
-
- if ( ! $this->fallback_obj ) {
- $this->fallback_obj = self::newColor( $this->fallback );
- }
- $this->color = $this->fallback_obj->color;
- $this->mode = $this->fallback_obj->mode;
- $this->red = $this->fallback_obj->red;
- $this->green = $this->fallback_obj->green;
- $this->blue = $this->fallback_obj->blue;
- $this->alpha = $this->fallback_obj->alpha;
- $this->hue = $this->fallback_obj->hue;
- $this->saturation = $this->fallback_obj->saturation;
- $this->lightness = $this->fallback_obj->lightness;
- $this->luminance = $this->fallback_obj->luminance;
- $this->hex = $this->fallback_obj->hex;
- }
-
- /**
- * Handle non-existing public methods.
- *
- * @access public
- * @since 1.1.0
- * @param string $name The method name.
- * @param mixed $arguments The method arguments.
- * @return mixed
- */
- public function __call( $name, $arguments ) {
- if ( method_exists( $this, $name ) ) {
- call_user_func( array( $this, $name ), $arguments );
- } else {
- return $arguments;
- }
- }
-
- /**
- * Handle non-existing public static methods.
- *
- * @static
- * @access public
- * @since 1.1.0
- * @param string $name The method name.
- * @param mixed $arguments The method arguments.
- * @return mixed
- */
- public static function __callStatic( $name, $arguments ) {
- if ( method_exists( __CLASS__, $name ) ) {
- call_user_func( array( __CLASS__, $name ), $arguments );
- } else {
- return $arguments;
- }
- }
- }
-}
diff --git a/assets/kirki/lib/class-kirki-color.php b/assets/kirki/lib/class-kirki-color.php
deleted file mode 100644
index b761e44..0000000
--- a/assets/kirki/lib/class-kirki-color.php
+++ /dev/null
@@ -1,342 +0,0 @@
-mode;
- }
- return $obj->toCSS( $mode );
- }
-
- /**
- * Gets the rgb value of a color.
- *
- * @static
- * @access public
- * @param string $color The color.
- * @param boolean $implode Whether we want to implode the values or not.
- * @return array|string
- */
- public static function get_rgb( $color, $implode = false ) {
- $obj = ariColor::newColor( $color );
- if ( $implode ) {
- return $obj->toCSS( 'rgb' );
- }
- return array( $obj->red, $obj->green, $obj->blue );
- }
-
- /**
- * A proxy for the sanitize_color method.
- *
- * @static
- * @access public
- * @param string|array $color The color to convert.
- * @return string The hex value of the color.
- */
- public static function rgba2hex( $color ) {
- return self::sanitize_color( $color, 'hex' );
- }
-
- /**
- * Get the alpha channel from an rgba color.
- *
- * @static
- * @access public
- * @param string $color The rgba color formatted like rgba(r,g,b,a).
- * @return int|float The alpha value of the color.
- */
- public static function get_alpha_from_rgba( $color ) {
- $obj = ariColor::newColor( $color );
- return $obj->alpha;
- }
-
- /**
- * Gets the rgba value of the $color.
- *
- * @static
- * @access public
- * @param string $color The hex value of a color.
- * @param int|float $alpha Opacity level (0-1).
- * @return string
- */
- public static function get_rgba( $color = '#fff', $alpha = 1 ) {
- $obj = ariColor::newColor( $color );
- if ( 1 == $alpha ) {
- return $obj->toCSS( 'rgba' );
- }
- // Make sure that opacity is properly formatted.
- // Converts 1-100 values to 0-1.
- if ( $alpha > 1 || $alpha < -1 ) {
- // Divide by 100.
- $alpha /= 100;
- }
- // Get absolute value.
- $alpha = abs( $alpha );
- // Max 1.
- if ( 1 < $alpha ) {
- $alpha = 1;
- }
- $new_obj = $obj->getNew( 'alpha', $alpha );
- return $new_obj->toCSS( 'rgba' );
- }
-
- /**
- * Strips the alpha value from an RGBA color string.
- *
- * @static
- * @access public
- * @param string $color The RGBA color string.
- * @return string The corresponding RGB string.
- */
- public static function rgba_to_rgb( $color ) {
- $obj = ariColor::newColor( $color );
- return $obj->toCSS( 'rgb' );
- }
-
- /**
- * Gets the brightness of the $hex color.
- *
- * @static
- * @access public
- * @param string $hex The hex value of a color.
- * @return int Value between 0 and 255.
- */
- public static function get_brightness( $hex ) {
- $hex = self::sanitize_hex( $hex, false );
-
- // Returns brightness value from 0 to 255.
- return intval( ( ( hexdec( substr( $hex, 0, 2 ) ) * 299 ) + ( hexdec( substr( $hex, 2, 2 ) ) * 587 ) + ( hexdec( substr( $hex, 4, 2 ) ) * 114 ) ) / 1000 );
- }
-
- /**
- * Adjusts brightness of the $hex color.
- *
- * @static
- * @access public
- * @param string $hex The hex value of a color.
- * @param integer $steps Should be between -255 and 255. Negative = darker, positive = lighter.
- * @return string Returns hex color.
- */
- public static function adjust_brightness( $hex, $steps ) {
- $hex = self::sanitize_hex( $hex, false );
- $steps = max( -255, min( 255, $steps ) );
-
- // Adjust number of steps and keep it inside 0 to 255.
- $red = max( 0, min( 255, hexdec( substr( $hex, 0, 2 ) ) + $steps ) );
- $green = max( 0, min( 255, hexdec( substr( $hex, 2, 2 ) ) + $steps ) );
- $blue = max( 0, min( 255, hexdec( substr( $hex, 4, 2 ) ) + $steps ) );
-
- $red_hex = str_pad( dechex( $red ), 2, '0', STR_PAD_LEFT );
- $green_hex = str_pad( dechex( $green ), 2, '0', STR_PAD_LEFT );
- $blue_hex = str_pad( dechex( $blue ), 2, '0', STR_PAD_LEFT );
- return self::sanitize_hex( $red_hex . $green_hex . $blue_hex );
- }
-
- /**
- * Mixes 2 hex colors.
- * The "percentage" variable is the percent of the first color.
- * to be used it the mix. default is 50 (equal mix).
- *
- * @static
- * @access public
- * @param string|false $hex1 Color.
- * @param string|false $hex2 Color.
- * @param int $percentage A value between 0 and 100.
- * @return string Returns hex color.
- */
- public static function mix_colors( $hex1, $hex2, $percentage ) {
- $hex1 = self::sanitize_hex( $hex1, false );
- $hex2 = self::sanitize_hex( $hex2, false );
- $red = ( $percentage * hexdec( substr( $hex1, 0, 2 ) ) + ( 100 - $percentage ) * hexdec( substr( $hex2, 0, 2 ) ) ) / 100;
- $green = ( $percentage * hexdec( substr( $hex1, 2, 2 ) ) + ( 100 - $percentage ) * hexdec( substr( $hex2, 2, 2 ) ) ) / 100;
- $blue = ( $percentage * hexdec( substr( $hex1, 4, 2 ) ) + ( 100 - $percentage ) * hexdec( substr( $hex2, 4, 2 ) ) ) / 100;
- $red_hex = str_pad( dechex( $red ), 2, '0', STR_PAD_LEFT );
- $green_hex = str_pad( dechex( $green ), 2, '0', STR_PAD_LEFT );
- $blue_hex = str_pad( dechex( $blue ), 2, '0', STR_PAD_LEFT );
- return self::sanitize_hex( $red_hex . $green_hex . $blue_hex );
- }
-
- /**
- * Convert hex color to hsv.
- *
- * @static
- * @access public
- * @param string $hex The hex value of color 1.
- * @return array Returns array( 'h', 's', 'v' ).
- */
- public static function hex_to_hsv( $hex ) {
- $rgb = (array) (array) self::get_rgb( self::sanitize_hex( $hex, false ) );
- return self::rgb_to_hsv( $rgb );
- }
-
- /**
- * Convert hex color to hsv.
- *
- * @static
- * @access public
- * @param string $color The rgb color to convert array( 'r', 'g', 'b' ).
- * @return array Returns array( 'h', 's', 'v' ).
- */
- public static function rgb_to_hsv( $color = array() ) {
- $var_r = ( $color[0] / 255 );
- $var_g = ( $color[1] / 255 );
- $var_b = ( $color[2] / 255 );
- $var_min = min( $var_r, $var_g, $var_b );
- $var_max = max( $var_r, $var_g, $var_b );
- $del_max = $var_max - $var_min;
- $h = 0;
- $s = 0;
- $v = $var_max;
- if ( 0 != $del_max ) {
- $s = $del_max / $var_max;
- $del_r = ( ( ( $var_max - $var_r ) / 6 ) + ( $del_max / 2 ) ) / $del_max;
- $del_g = ( ( ( $var_max - $var_g ) / 6 ) + ( $del_max / 2 ) ) / $del_max;
- $del_b = ( ( ( $var_max - $var_b ) / 6 ) + ( $del_max / 2 ) ) / $del_max;
- if ( $var_r == $var_max ) {
- $h = $del_b - $del_g;
- } elseif ( $var_g == $var_max ) {
- $h = ( 1 / 3 ) + $del_r - $del_b;
- } elseif ( $var_b == $var_max ) {
- $h = ( 2 / 3 ) + $del_g - $del_r;
- }
- if ( $h < 0 ) {
- $h++;
- }
- if ( $h > 1 ) {
- $h--;
- }
- }
- return array(
- 'h' => round( $h, 2 ),
- 's' => round( $s, 2 ),
- 'v' => round( $v, 2 ),
- );
- }
-
- /**
- * This is a very simple algorithm that works by summing up the differences between the three color components red, green and blue.
- * A value higher than 500 is recommended for good readability.
- *
- * @static
- * @access public
- * @param string $color_1 The 1st color.
- * @param string $color_2 The 2nd color.
- * @return string
- */
- public static function color_difference( $color_1 = '#ffffff', $color_2 = '#000000' ) {
- $color_1 = self::sanitize_hex( $color_1, false );
- $color_2 = self::sanitize_hex( $color_2, false );
- $color_1_rgb = self::get_rgb( $color_1 );
- $color_2_rgb = self::get_rgb( $color_2 );
- $r_diff = max( $color_1_rgb[0], $color_2_rgb[0] ) - min( $color_1_rgb[0], $color_2_rgb[0] );
- $g_diff = max( $color_1_rgb[1], $color_2_rgb[1] ) - min( $color_1_rgb[1], $color_2_rgb[1] );
- $b_diff = max( $color_1_rgb[2], $color_2_rgb[2] ) - min( $color_1_rgb[2], $color_2_rgb[2] );
- $color_diff = $r_diff + $g_diff + $b_diff;
- return $color_diff;
- }
-
- /**
- * This function tries to compare the brightness of the colors.
- * A return value of more than 125 is recommended.
- * Combining it with the color_difference function above might make sense.
- *
- * @static
- * @access public
- * @param string $color_1 The 1st color.
- * @param string $color_2 The 2nd color.
- * @return string
- */
- public static function brightness_difference( $color_1 = '#ffffff', $color_2 = '#000000' ) {
- $color_1 = self::sanitize_hex( $color_1, false );
- $color_2 = self::sanitize_hex( $color_2, false );
- $color_1_rgb = self::get_rgb( $color_1 );
- $color_2_rgb = self::get_rgb( $color_2 );
- $br_1 = ( 299 * $color_1_rgb[0] + 587 * $color_1_rgb[1] + 114 * $color_1_rgb[2] ) / 1000;
- $br_2 = ( 299 * $color_2_rgb[0] + 587 * $color_2_rgb[1] + 114 * $color_2_rgb[2] ) / 1000;
- return intval( abs( $br_1 - $br_2 ) );
- }
-
- /**
- * Uses the luminosity to calculate the difference between the given colors.
- * The returned value should be bigger than 5 for best readability.
- *
- * @static
- * @access public
- * @param string $color_1 The 1st color.
- * @param string $color_2 The 2nd color.
- * @return string
- */
- public static function lumosity_difference( $color_1 = '#ffffff', $color_2 = '#000000' ) {
- $color_1 = self::sanitize_hex( $color_1, false );
- $color_2 = self::sanitize_hex( $color_2, false );
- $color_1_rgb = self::get_rgb( $color_1 );
- $color_2_rgb = self::get_rgb( $color_2 );
- $l1 = 0.2126 * pow( $color_1_rgb[0] / 255, 2.2 ) + 0.7152 * pow( $color_1_rgb[1] / 255, 2.2 ) + 0.0722 * pow( $color_1_rgb[2] / 255, 2.2 );
- $l2 = 0.2126 * pow( $color_2_rgb[0] / 255, 2.2 ) + 0.7152 * pow( $color_2_rgb[1] / 255, 2.2 ) + 0.0722 * pow( $color_2_rgb[2] / 255, 2.2 );
- $lum_diff = ( $l1 > $l2 ) ? ( $l1 + 0.05 ) / ( $l2 + 0.05 ) : ( $l2 + 0.05 ) / ( $l1 + 0.05 );
- return round( $lum_diff, 2 );
- }
-}
diff --git a/assets/kirki/modules/css-vars/class-kirki-modules-css-vars.php b/assets/kirki/modules/css-vars/class-kirki-modules-css-vars.php
deleted file mode 100644
index 40cf7be..0000000
--- a/assets/kirki/modules/css-vars/class-kirki-modules-css-vars.php
+++ /dev/null
@@ -1,155 +0,0 @@
-val].
- *
- * @access private
- * @since 3.0.35
- * @var array
- */
- private $vars = array();
-
- /**
- * Constructor
- *
- * @access protected
- * @since 3.0.28
- */
- protected function __construct() {
- add_action( 'init', array( $this, 'populate_vars' ) );
- add_action( 'wp_head', array( $this, 'the_style' ), 999 );
- add_action( 'admin_head', array( $this, 'the_style' ), 999 );
- add_action( 'customize_preview_init', array( $this, 'postmessage' ) );
- }
-
- /**
- * Gets an instance of this object.
- * Prevents duplicate instances which avoid artefacts and improves performance.
- *
- * @static
- * @access public
- * @since 3.0.28
- * @return object
- */
- public static function get_instance() {
- if ( ! self::$instance ) {
- self::$instance = new self();
- }
- return self::$instance;
- }
-
- /**
- * Populates the $vars property of this object.
- *
- * @access public
- * @since 3.0.35
- * @return void
- */
- public function populate_vars() {
-
- // Get an array of all fields.
- $fields = Kirki::$fields;
- foreach ( $fields as $id => $args ) {
- if ( ! isset( $args['css_vars'] ) || empty( $args['css_vars'] ) ) {
- continue;
- }
- $val = Kirki_Values::get_value( $args['kirki_config'], $id );
- foreach ( $args['css_vars'] as $css_var ) {
- if ( isset( $css_var[2] ) && is_array( $val ) && isset( $val[ $css_var[2] ] ) ) {
- $this->vars[ $css_var[0] ] = str_replace( '$', $val[ $css_var[2] ], $css_var[1] );
- } else {
- $this->vars[ $css_var[0] ] = str_replace( '$', $val, $css_var[1] );
- }
- }
- }
- }
-
- /**
- * Add styles in .
- *
- * @access public
- * @since 3.0.28
- * @return void
- */
- public function the_style() {
- if ( empty( $this->vars ) ) {
- return;
- }
-
- echo '';
- }
-
- /**
- * Get an array of all the variables.
- *
- * @access public
- * @since 3.0.35
- * @return array
- */
- public function get_vars() {
- return $this->vars;
- }
-
- /**
- * Enqueues the script that handles postMessage
- * and adds variables to it using the wp_localize_script function.
- * The rest is handled via JS.
- *
- * @access public
- * @since 3.0.28
- * @return void
- */
- public function postmessage() {
- wp_enqueue_script( 'kirki_auto_css_vars', trailingslashit( Kirki::$url ) . 'modules/css-vars/script.js', array( 'jquery', 'customize-preview' ), KIRKI_VERSION, true );
- $fields = Kirki::$fields;
- $data = array();
- foreach ( $fields as $field ) {
- if ( isset( $field['transport'] ) && 'postMessage' === $field['transport'] && isset( $field['css_vars'] ) && ! empty( $field['css_vars'] ) ) {
- $data[] = $field;
- }
- }
- wp_localize_script( 'kirki_auto_css_vars', 'kirkiCssVarFields', $data );
- }
-}
diff --git a/assets/kirki/modules/css-vars/script.js b/assets/kirki/modules/css-vars/script.js
deleted file mode 100644
index 8354b12..0000000
--- a/assets/kirki/modules/css-vars/script.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/* global kirkiCssVarFields */
-var kirkiCssVars = {
-
- /**
- * Get styles.
- *
- * @since 3.0.28
- * @returns {Object}
- */
- getStyles: function() {
- var style = jQuery( '#kirki-css-vars' ),
- styles = style.html().replace( ':root{', '' ).replace( '}', '' ).split( ';' ),
- stylesObj = {};
-
- // Format styles as a object we can then tweak.
- _.each( styles, function( style ) {
- style = style.split( ':' );
- if ( style[0] && style[1] ) {
- stylesObj[ style[0] ] = style[1];
- }
- } );
- return stylesObj;
- },
-
- /**
- * Builds the styles from an object.
- *
- * @since 3.0.28
- * @param {Object} vars - The vars.
- * @returns {string}
- */
- buildStyle: function( vars ) {
- var style = '';
-
- _.each( vars, function( val, name ) {
- style += name + ':' + val + ';';
- } );
- return ':root{' + style + '}';
- }
-};
-
-jQuery( document ).ready( function() {
- _.each( kirkiCssVarFields, function( field ) {
- wp.customize( field.settings, function( value ) {
- value.bind( function( newVal ) {
- var styles = kirkiCssVars.getStyles();
-
- _.each( field.css_vars, function( cssVar ) {
- if ( 'object' === typeof newVal ) {
- if ( cssVar[2] && newVal[ cssVar[2] ] ) {
- styles[ cssVar[0] ] = cssVar[1].replace( '$', newVal[ cssVar[2] ] );
- }
- } else {
- styles[ cssVar[0] ] = cssVar[1].replace( '$', newVal );
- }
- } );
- jQuery( '#kirki-css-vars' ).html( kirkiCssVars.buildStyle( styles ) );
- } );
- } );
- } );
-} );
-
-wp.customize.bind( 'preview-ready', function() {
- wp.customize.preview.bind( 'active', function() {
- _.each( kirkiCssVarFields, function( field ) {
- wp.customize( field.settings, function( value ) {
- var styles = kirkiCssVars.getStyles(),
- newVal = window.parent.wp.customize( value.id ).get();
- _.each( field.css_vars, function( cssVar ) {
- if ( 'object' === typeof newVal ) {
- if ( cssVar[2] && newVal[ cssVar[2] ] ) {
- styles[ cssVar[0] ] = cssVar[1].replace( '$', newVal[ cssVar[2] ] );
- }
- } else {
- styles[ cssVar[0] ] = cssVar[1].replace( '$', newVal );
- }
- } );
- jQuery( '#kirki-css-vars' ).html( kirkiCssVars.buildStyle( styles ) );
- } );
- } );
- } );
-} );
diff --git a/assets/kirki/modules/css/class-kirki-css-to-file.php b/assets/kirki/modules/css/class-kirki-css-to-file.php
deleted file mode 100644
index 02b512a..0000000
--- a/assets/kirki/modules/css/class-kirki-css-to-file.php
+++ /dev/null
@@ -1,143 +0,0 @@
-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/assets/kirki/modules/css/class-kirki-modules-css-generator.php b/assets/kirki/modules/css/class-kirki-modules-css-generator.php
deleted file mode 100644
index c4fce0d..0000000
--- a/assets/kirki/modules/css/class-kirki-modules-css-generator.php
+++ /dev/null
@@ -1,278 +0,0 @@
- self::$output,
- 'sanitize_callback' => null,
- ),
- );
- }
-
- // Get the value of this field.
- self::$value = Kirki_Values::get_sanitized_field_value( $field );
-
- // 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',
- )
- );
- if ( array_key_exists( self::$field_type, $field_output_classes ) ) {
- $classname = $field_output_classes[ self::$field_type ];
- }
- $obj = new $classname( $field['kirki_config'], self::$output, self::$value, $field );
- return $obj->get_styles();
- }
-
- /**
- * Gets the array of generated styles and creates the minimized, inline CSS.
- *
- * @static
- * @access public
- * @param array $css The CSS definitions array.
- * @return string The generated CSS.
- */
- public static function styles_parse( $css = array() ) {
-
- // Pass our styles from the kirki_styles_array filter.
- $css = apply_filters( 'kirki_styles_array', $css );
-
- // Process the array of CSS properties and produce the final CSS.
- $final_css = '';
- if ( ! is_array( $css ) || empty( $css ) ) {
- return '';
- }
- foreach ( $css as $media_query => $styles ) {
- $final_css .= ( 'global' !== $media_query ) ? $media_query . '{' : '';
- foreach ( $styles as $style => $style_array ) {
- $css_for_style = '';
-
- foreach ( $style_array as $property => $value ) {
- if ( is_string( $value ) && '' !== $value ) {
- $css_for_style .= $property . ':' . $value . ';';
- } elseif ( is_array( $value ) ) {
- foreach ( $value as $subvalue ) {
- if ( is_string( $subvalue ) && '' !== $subvalue ) {
- $css_for_style .= $property . ':' . $subvalue . ';';
- }
- }
- }
- $value = ( is_string( $value ) ) ? $value : '';
- }
- if ( '' !== $css_for_style ) {
- $final_css .= $style . '{' . $css_for_style . '}';
- }
- }
- $final_css .= ( 'global' !== $media_query ) ? '}' : '';
- }
- return $final_css;
- }
-
- /**
- * Add prefixes if necessary.
- *
- * @param array $css The CSS definitions array.
- * @return array
- */
- public static function add_prefixes( $css ) {
- if ( is_array( $css ) ) {
- foreach ( $css as $media_query => $elements ) {
- foreach ( $elements as $element => $style_array ) {
- foreach ( $style_array as $property => $value ) {
-
- // Add -webkit-* and -moz-*.
- if ( is_string( $property ) && in_array(
- $property, array(
- 'border-radius',
- 'box-shadow',
- 'box-sizing',
- 'text-shadow',
- 'transform',
- 'background-size',
- 'transition',
- 'transition-property',
- ), true
- ) ) {
- unset( $css[ $media_query ][ $element ][ $property ] );
- $css[ $media_query ][ $element ][ '-webkit-' . $property ] = $value;
- $css[ $media_query ][ $element ][ '-moz-' . $property ] = $value;
- $css[ $media_query ][ $element ][ $property ] = $value;
- }
-
- // Add -ms-* and -o-*.
- if ( is_string( $property ) && in_array(
- $property, array(
- 'transform',
- 'background-size',
- 'transition',
- 'transition-property',
- ), true
- ) ) {
- unset( $css[ $media_query ][ $element ][ $property ] );
- $css[ $media_query ][ $element ][ '-ms-' . $property ] = $value;
- $css[ $media_query ][ $element ][ '-o-' . $property ] = $value;
- $css[ $media_query ][ $element ][ $property ] = $value;
- }
- }
- }
- }
- }
- return $css;
- }
-}
diff --git a/assets/kirki/modules/css/class-kirki-modules-css.php b/assets/kirki/modules/css/class-kirki-modules-css.php
deleted file mode 100644
index 903c245..0000000
--- a/assets/kirki/modules/css/class-kirki-modules-css.php
+++ /dev/null
@@ -1,334 +0,0 @@
- '/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',
- 'Kirki_Output_Field_Image' => '/field/class-kirki-output-field-image.php',
- 'Kirki_Output_Field_Multicolor' => '/field/class-kirki-output-field-multicolor.php',
- 'Kirki_Output_Field_Dimensions' => '/field/class-kirki-output-field-dimensions.php',
- 'Kirki_Output_Field_Typography' => '/field/class-kirki-output-field-typography.php',
- 'Kirki_Output_Property' => '/property/class-kirki-output-property.php',
- 'Kirki_Output_Property_Background_Image' => '/property/class-kirki-output-property-background-image.php',
- 'Kirki_Output_Property_Background_Position' => '/property/class-kirki-output-property-background-position.php',
- 'Kirki_Output_Property_Font_Family' => '/property/class-kirki-output-property-font-family.php',
- );
-
- foreach ( $class_files as $class_name => $file ) {
- if ( ! class_exists( $class_name ) ) {
- include_once wp_normalize_path( dirname( __FILE__ ) . $file );
- }
- }
- add_action( 'init', array( $this, 'init' ) );
- }
-
- /**
- * 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;
- }
-
- /**
- * Init.
- *
- * @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 ) {
-
- // 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' ) );
- }
- 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 );
- }
-
- /**
- * Enqueues compiled CSS file.
- *
- * @access public
- * @since 3.0.0
- */
- public function enqueue_compiled_file() {
- wp_enqueue_style( 'kirki-styles', $this->css_to_file->get_url(), array(), $this->css_to_file->get_timestamp() );
- }
- /**
- * Adds inline styles.
- *
- * @access public
- */
- 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;
- }
-
- 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
- *
- * @access public
- */
- public function ajax_dynamic_css() {
- require wp_normalize_path( Kirki::$path . '/modules/css/dynamic-css.php' );
- exit;
- }
-
- /**
- * Enqueues the ajax stylesheet.
- *
- * @access public
- */
- public function frontend_styles() {
- wp_enqueue_style( 'kirki-styles-php', admin_url( 'admin-ajax.php' ) . '?action=kirki_dynamic_css', array(), KIRKI_VERSION );
- }
-
- /**
- * Loop through all fields and create an array of style definitions.
- *
- * @static
- * @access public
- * @param string $config_id The configuration ID.
- */
- public static function loop_controls( $config_id ) {
-
- // Get an instance of the Kirki_Modules_CSS_Generator class.
- // This will make sure google fonts and backup fonts are loaded.
- Kirki_Modules_CSS_Generator::get_instance();
-
- $fields = Kirki::$fields;
- $css = array();
-
- // Early exit if no fields are found.
- if ( empty( $fields ) ) {
- return;
- }
-
- foreach ( $fields as $field ) {
-
- // Only process fields that belong to $config_id.
- if ( $config_id !== $field['kirki_config'] ) {
- continue;
- }
-
- if ( true === apply_filters( "kirki_{$config_id}_css_skip_hidden", true ) ) {
-
- // Only continue if field dependencies are met.
- if ( ! empty( $field['required'] ) ) {
- $valid = true;
-
- foreach ( $field['required'] as $requirement ) {
- if ( isset( $requirement['setting'] ) && isset( $requirement['value'] ) && isset( $requirement['operator'] ) ) {
- $controller_value = Kirki_Values::get_value( $config_id, $requirement['setting'] );
- if ( ! Kirki_Helper::compare_values( $controller_value, $requirement['value'], $requirement['operator'] ) ) {
- $valid = false;
- }
- }
- }
-
- if ( ! $valid ) {
- continue;
- }
- }
- }
-
- // Only continue if $field['output'] is set.
- if ( isset( $field['output'] ) && ! empty( $field['output'] ) ) {
- $css = Kirki_Helper::array_replace_recursive( $css, Kirki_Modules_CSS_Generator::css( $field ) );
-
- // Add the globals.
- if ( isset( self::$css_array[ $config_id ] ) && ! empty( self::$css_array[ $config_id ] ) ) {
- Kirki_Helper::array_replace_recursive( $css, self::$css_array[ $config_id ] );
- }
- }
- }
-
- $css = apply_filters( "kirki_{$config_id}_styles", $css );
-
- if ( is_array( $css ) ) {
- return Kirki_Modules_CSS_Generator::styles_parse( Kirki_Modules_CSS_Generator::add_prefixes( $css ) );
- }
- }
-
- /**
- * Runs when we're adding a font-awesome field to allow enqueueing the
- * fontawesome script on the frontend.
- *
- * @static
- * @since 3.0.26
- * @access public
- * @return void
- */
- public static function add_fontawesome_script() {
- self::$enqueue_fa = true;
- }
-
- /**
- * Check if FontAwesome should be loaded.
- *
- * @static
- * @since 3.0.35
- * @access public
- * @return void
- */
- public static function get_enqueue_fa() {
- return self::$enqueue_fa;
- }
-}
diff --git a/assets/kirki/modules/css/class-kirki-output.php b/assets/kirki/modules/css/class-kirki-output.php
deleted file mode 100644
index 49f7b68..0000000
--- a/assets/kirki/modules/css/class-kirki-output.php
+++ /dev/null
@@ -1,345 +0,0 @@
-config_id = $config_id;
- $this->value = $value;
- $this->output = $output;
- $this->field = $field;
-
- $this->parse_output();
- }
-
- /**
- * If we have a sanitize_callback defined, apply it to the value.
- *
- * @param array $output The output args.
- * @param string|array $value The value.
- *
- * @return string|array
- */
- protected function apply_sanitize_callback( $output, $value ) {
- if ( isset( $output['sanitize_callback'] ) && null !== $output['sanitize_callback'] ) {
-
- // If the sanitize_callback is invalid, return the value.
- if ( ! is_callable( $output['sanitize_callback'] ) ) {
- return $value;
- }
- return call_user_func( $output['sanitize_callback'], $this->value );
- }
- return $value;
- }
-
- /**
- * If we have a value_pattern defined, apply it to the value.
- *
- * @param array $output The output args.
- * @param string|array $value The value.
- * @return string|array
- */
- protected function apply_value_pattern( $output, $value ) {
- if ( isset( $output['value_pattern'] ) && ! empty( $output['value_pattern'] ) && is_string( $output['value_pattern'] ) ) {
- if ( ! is_array( $value ) ) {
- $value = str_replace( '$', $value, $output['value_pattern'] );
- }
- if ( is_array( $value ) ) {
- foreach ( array_keys( $value ) as $value_k ) {
- if ( ! is_string( $value[ $value_k ] ) ) {
- continue;
- }
- if ( isset( $output['choice'] ) ) {
- if ( $output['choice'] === $value_k ) {
- $value[ $output['choice'] ] = str_replace( '$', $value[ $output['choice'] ], $output['value_pattern'] );
- }
- continue;
- }
- $value[ $value_k ] = str_replace( '$', $value[ $value_k ], $output['value_pattern'] );
- }
- }
- $value = $this->apply_pattern_replace( $output, $value );
- }
- return $value;
- }
-
- /**
- * If we have a value_pattern defined, apply it to the value.
- *
- * @param array $output The output args.
- * @param string|array $value The value.
- * @return string|array
- */
- protected function apply_pattern_replace( $output, $value ) {
- if ( isset( $output['pattern_replace'] ) && is_array( $output['pattern_replace'] ) ) {
- $option_type = ( '' !== Kirki::get_config_param( $this->config_id, 'option_type' ) ) ? Kirki::get_config_param( $this->config_id, 'option_type' ) : 'theme_mod';
- $option_name = Kirki::get_config_param( $this->config_id, 'option_name' );
- $options = array();
- if ( $option_name ) {
- $options = ( 'site_option' === $option_type ) ? get_site_option( $option_name ) : get_option( $option_name );
- }
- foreach ( $output['pattern_replace'] as $search => $replace ) {
- $replacement = '';
- switch ( $option_type ) {
- case 'option':
- if ( is_array( $options ) ) {
- if ( $option_name ) {
- $subkey = str_replace( array( $option_name, '[', ']' ), '', $replace );
- $replacement = ( isset( $options[ $subkey ] ) ) ? $options[ $subkey ] : '';
- break;
- }
- $replacement = ( isset( $options[ $replace ] ) ) ? $options[ $replace ] : '';
- break;
- }
- $replacement = get_option( $replace );
- break;
- case 'site_option':
- $replacement = ( is_array( $options ) && isset( $options[ $replace ] ) ) ? $options[ $replace ] : get_site_option( $replace );
- break;
- case 'user_meta':
- $user_id = get_current_user_id();
- if ( $user_id ) {
- $replacement = get_user_meta( $user_id, $replace, true );
- }
- break;
- default:
- $replacement = get_theme_mod( $replace );
- }
- $replacement = ( false === $replacement ) ? '' : $replacement;
- if ( is_array( $value ) ) {
- foreach ( $value as $k => $v ) {
- $_val = ( isset( $value[ $v ] ) ) ? $value[ $v ] : $v;
- $value[ $k ] = str_replace( $search, $replacement, $_val );
- }
- return $value;
- }
- $value = str_replace( $search, $replacement, $value );
- }
- }
- return $value;
- }
-
- /**
- * Parses the output arguments.
- * Calls the process_output method for each of them.
- *
- * @access protected
- */
- protected function parse_output() {
- foreach ( $this->output as $output ) {
- $skip = false;
-
- // Apply any sanitization callbacks defined.
- $value = $this->apply_sanitize_callback( $output, $this->value );
-
- // Skip if value is empty.
- if ( '' === $this->value ) {
- $skip = true;
- }
-
- // No need to proceed this if the current value is the same as in the "exclude" value.
- if ( isset( $output['exclude'] ) && is_array( $output['exclude'] ) ) {
- foreach ( $output['exclude'] as $exclude ) {
- if ( is_array( $value ) ) {
- if ( is_array( $exclude ) ) {
- $diff1 = array_diff( $value, $exclude );
- $diff2 = array_diff( $exclude, $value );
-
- if ( empty( $diff1 ) && empty( $diff2 ) ) {
- $skip = true;
- }
- }
- // If 'choice' is defined check for sub-values too.
- // Fixes https://github.com/aristath/kirki/issues/1416.
- if ( isset( $output['choice'] ) && isset( $value[ $output['choice'] ] ) && $exclude == $value[ $output['choice'] ] ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
- $skip = true;
- }
- }
- if ( $skip ) {
- continue;
- }
-
- // Skip if value is defined as excluded.
- if ( $exclude === $value || ( '' === $exclude && empty( $value ) ) ) {
- $skip = true;
- }
- }
- }
- if ( $skip ) {
- continue;
- }
-
- // Apply any value patterns defined.
- $value = $this->apply_value_pattern( $output, $value );
-
- if ( isset( $output['element'] ) && is_array( $output['element'] ) ) {
- $output['element'] = array_unique( $output['element'] );
- sort( $output['element'] );
- $output['element'] = implode( ',', $output['element'] );
- }
-
- $value = $this->process_value( $value, $output );
-
- if ( is_admin() && ! is_customize_preview() ) {
-
- // Check if this is an admin style.
- if ( ! isset( $output['context'] ) || ! in_array( 'editor', $output['context'] ) ) {
- continue;
- }
- } elseif ( isset( $output['context'] ) && ! in_array( 'front', $output['context'] ) ) {
-
- // Check if this is a frontend style.
- continue;
- }
- $this->process_output( $output, $value );
- }
- }
-
- /**
- * Parses an output and creates the styles array for it.
- *
- * @access protected
- * @param array $output The field output.
- * @param string|array $value The value.
- *
- * @return null
- */
- protected function process_output( $output, $value ) {
- if ( ! isset( $output['element'] ) || ! isset( $output['property'] ) ) {
- return;
- }
- $output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global';
- $output['prefix'] = ( isset( $output['prefix'] ) ) ? $output['prefix'] : '';
- $output['units'] = ( isset( $output['units'] ) ) ? $output['units'] : '';
- $output['suffix'] = ( isset( $output['suffix'] ) ) ? $output['suffix'] : '';
-
- // Properties that can accept multiple values.
- // Useful for example for gradients where all browsers use the "background-image" property
- // and the browser prefixes go in the value_pattern arg.
- $accepts_multiple = array(
- 'background-image',
- 'background',
- );
- if ( in_array( $output['property'], $accepts_multiple, true ) ) {
- if ( isset( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) && ! is_array( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) ) {
- $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = (array) $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ];
- }
- $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ][] = $output['prefix'] . $value . $output['units'] . $output['suffix'];
- return;
- }
- if ( is_string( $value ) || is_numeric( $value ) ) {
- $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix'];
- }
- }
-
- /**
- * Some CSS properties are unique.
- * We need to tweak the value to make everything works as expected.
- *
- * @access protected
- * @param string $property The CSS property.
- * @param string|array $value The value.
- *
- * @return array
- */
- protected function process_property_value( $property, $value ) {
- $properties = apply_filters(
- "kirki_{$this->config_id}_output_property_classnames", array(
- 'font-family' => 'Kirki_Output_Property_Font_Family',
- 'background-image' => 'Kirki_Output_Property_Background_Image',
- 'background-position' => 'Kirki_Output_Property_Background_Position',
- )
- );
- if ( array_key_exists( $property, $properties ) ) {
- $classname = $properties[ $property ];
- $obj = new $classname( $property, $value );
- return $obj->get_value();
- }
- return $value;
- }
-
- /**
- * Returns the value.
- *
- * @access protected
- * @param string|array $value The value.
- * @param array $output The field "output".
- * @return string|array
- */
- protected function process_value( $value, $output ) {
- if ( isset( $output['property'] ) ) {
- return $this->process_property_value( $output['property'], $value );
- }
- return $value;
- }
-
- /**
- * Exploses the private $styles property to the world
- *
- * @access protected
- * @return array
- */
- public function get_styles() {
- return $this->styles;
- }
-}
diff --git a/assets/kirki/modules/css/field/class-kirki-output-field-background.php b/assets/kirki/modules/css/field/class-kirki-output-field-background.php
deleted file mode 100644
index 93790dd..0000000
--- a/assets/kirki/modules/css/field/class-kirki-output-field-background.php
+++ /dev/null
@@ -1,47 +0,0 @@
- 'global',
- 'element' => 'body',
- 'prefix' => '',
- 'suffix' => '',
- )
- );
-
- foreach ( array( 'background-image', 'background-color', 'background-repeat', 'background-position', 'background-size', 'background-attachment' ) as $property ) {
-
- // See https://github.com/aristath/kirki/issues/1808.
- if ( 'background-color' === $property && isset( $value['background-color'] ) && $value['background-color'] && ( ! isset( $value['background-image'] ) || empty( $value['background-image'] ) ) ) {
- $this->styles[ $output['media_query'] ][ $output['element'] ]['background'] = $output['prefix'] . $this->process_property_value( $property, $value[ $property ] ) . $output['suffix'];
- }
-
- if ( isset( $value[ $property ] ) && ! empty( $value[ $property ] ) ) {
- $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $output['prefix'] . $this->process_property_value( $property, $value[ $property ] ) . $output['suffix'];
- }
- }
- }
-}
diff --git a/assets/kirki/modules/css/field/class-kirki-output-field-dimensions.php b/assets/kirki/modules/css/field/class-kirki-output-field-dimensions.php
deleted file mode 100644
index 5550d56..0000000
--- a/assets/kirki/modules/css/field/class-kirki-output-field-dimensions.php
+++ /dev/null
@@ -1,55 +0,0 @@
- '',
- 'property' => '',
- 'media_query' => 'global',
- 'prefix' => '',
- 'suffix' => '',
- )
- );
-
- if ( ! is_array( $value ) ) {
- return;
- }
-
- foreach ( array_keys( $value ) as $key ) {
-
- $property = ( empty( $output['property'] ) ) ? $key : $output['property'] . '-' . $key;
- if ( isset( $output['choice'] ) && $output['property'] ) {
- if ( $key === $output['choice'] ) {
- $property = $output['property'];
- } else {
- continue;
- }
- }
- if ( false !== strpos( $output['property'], '%%' ) ) {
- $property = str_replace( '%%', $key, $output['property'] );
- }
- $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $output['prefix'] . $this->process_property_value( $property, $value[ $key ] ) . $output['suffix'];
- }
- }
-}
diff --git a/assets/kirki/modules/css/field/class-kirki-output-field-image.php b/assets/kirki/modules/css/field/class-kirki-output-field-image.php
deleted file mode 100644
index fdbedb1..0000000
--- a/assets/kirki/modules/css/field/class-kirki-output-field-image.php
+++ /dev/null
@@ -1,49 +0,0 @@
- 'global',
- 'prefix' => '',
- 'units' => '',
- 'suffix' => '',
- )
- );
- if ( is_array( $value ) ) {
- if ( isset( $output['choice'] ) && $output['choice'] ) {
- $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value[ $output['choice'] ] ) . $output['units'] . $output['suffix'];
- return;
- }
- if ( isset( $value['url'] ) ) {
- $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value['url'] ) . $output['units'] . $output['suffix'];
- return;
- }
- return;
- }
- $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix'];
- }
-}
diff --git a/assets/kirki/modules/css/field/class-kirki-output-field-multicolor.php b/assets/kirki/modules/css/field/class-kirki-output-field-multicolor.php
deleted file mode 100644
index d215b33..0000000
--- a/assets/kirki/modules/css/field/class-kirki-output-field-multicolor.php
+++ /dev/null
@@ -1,53 +0,0 @@
- $sub_value ) {
-
- // If "element" is not defined, there's no reason to continue.
- if ( ! isset( $output['element'] ) ) {
- continue;
- }
-
- // If the "choice" is not the same as the $key in our loop, there's no reason to proceed.
- if ( isset( $output['choice'] ) && $key !== $output['choice'] ) {
- continue;
- }
-
- // If "property" is not defined, fallback to the $key.
- $property = ( ! isset( $output['property'] ) || empty( $output['property'] ) ) ? $key : $output['property'];
-
- // If "media_query" is not defined, use "global".
- if ( ! isset( $output['media_query'] ) || empty( $output['media_query'] ) ) {
- $output['media_query'] = 'global';
- }
-
- // If "suffix" is defined, add it to the value.
- $output['suffix'] = ( isset( $output['suffix'] ) ) ? $output['suffix'] : '';
-
- // Create the styles.
- $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $sub_value . $output['suffix'];
-
- }
- }
-}
diff --git a/assets/kirki/modules/css/field/class-kirki-output-field-typography.php b/assets/kirki/modules/css/field/class-kirki-output-field-typography.php
deleted file mode 100644
index df9278a..0000000
--- a/assets/kirki/modules/css/field/class-kirki-output-field-typography.php
+++ /dev/null
@@ -1,95 +0,0 @@
-field['default'][ $property ] ) ) {
- continue;
- }
-
- // Early exit if the value is not saved in the values.
- if ( ! isset( $value[ $property ] ) || ! $value[ $property ] ) {
- continue;
- }
-
- // Early exit if we use "choice" but not for this property.
- if ( isset( $output['choice'] ) && $output['choice'] !== $property ) {
- continue;
- }
-
- // Take care of variants.
- if ( 'variant' === $property && isset( $value['variant'] ) && ! empty( $value['variant'] ) ) {
-
- // Get the font_weight.
- $font_weight = str_replace( 'italic', '', $value['variant'] );
- $font_weight = ( in_array( $font_weight, array( '', 'regular' ), true ) ) ? '400' : $font_weight;
-
- // Is this italic?
- $is_italic = ( false !== strpos( $value['variant'], 'italic' ) );
- $this->styles[ $output['media_query'] ][ $output['element'] ]['font-weight'] = $font_weight;
- if ( $is_italic ) {
- $this->styles[ $output['media_query'] ][ $output['element'] ]['font-style'] = 'italic';
- }
- continue;
- }
-
- $property_value = $this->process_property_value( $property, $value[ $property ] );
- if ( 'font-family' === $property ) {
- $value['font-backup'] = ( isset( $value['font-backup'] ) ) ? $value['font-backup'] : '';
- $property_value = $this->process_property_value(
- $property, array(
- $value['font-family'],
- $value['font-backup'],
- )
- );
- }
- $property = ( isset( $output['choice'] ) && isset( $output['property'] ) ) ? $output['property'] : $property;
- $property_value = ( is_array( $property_value ) && isset( $property_value[0] ) ) ? $property_value[0] : $property_value;
- $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $output['prefix'] . $property_value . $output['suffix'];
- }
- }
-}
diff --git a/assets/kirki/modules/css/property/class-kirki-output-property-background-image.php b/assets/kirki/modules/css/property/class-kirki-output-property-background-image.php
deleted file mode 100644
index ad71e1a..0000000
--- a/assets/kirki/modules/css/property/class-kirki-output-property-background-image.php
+++ /dev/null
@@ -1,37 +0,0 @@
-value ) && isset( $this->value['url'] ) ) {
- $this->value = $this->value['url'];
- }
- if ( false === strpos( $this->value, 'gradient' ) && false === strpos( $this->value, 'url(' ) ) {
- if ( empty( $this->value ) ) {
- return;
- }
- if ( preg_match( '/^\d+$/', $this->value ) ) {
- $this->value = 'url("' . set_url_scheme( wp_get_attachment_url( $this->value ) ) . '")';
- } else {
- $this->value = 'url("' . set_url_scheme( $this->value ) . '")';
- }
- }
- }
-}
diff --git a/assets/kirki/modules/css/property/class-kirki-output-property-background-position.php b/assets/kirki/modules/css/property/class-kirki-output-property-background-position.php
deleted file mode 100644
index b1dd3ea..0000000
--- a/assets/kirki/modules/css/property/class-kirki-output-property-background-position.php
+++ /dev/null
@@ -1,71 +0,0 @@
-value = trim( $this->value );
-
- // If you use calc() there, I suppose you know what you're doing.
- // No need to process this any further, just exit.
- if ( false !== strpos( $this->value, 'calc' ) ) {
- return;
- }
-
- // If the value is initial or inherit, we don't need to do anything.
- // Just exit.
- if ( 'initial' === $this->value || 'inherit' === $this->value ) {
- return;
- }
-
- $x_dimensions = array( 'left', 'center', 'right' );
- $y_dimensions = array( 'top', 'center', 'bottom' );
-
- // If there's a space, we have an X and a Y value.
- if ( false !== strpos( $this->value, ' ' ) ) {
- $xy = explode( ' ', $this->value );
-
- $x = trim( $xy[0] );
- $y = trim( $xy[1] );
-
- // If x is not left/center/right, we need to sanitize it.
- if ( ! in_array( $x, $x_dimensions, true ) ) {
- $x = sanitize_text_field( $x );
- }
- if ( ! in_array( $y, $y_dimensions, true ) ) {
- $y = sanitize_text_field( $y );
- }
- $this->value = $x . ' ' . $y;
- return;
- }
- $x = 'center';
- foreach ( $x_dimensions as $x_dimension ) {
- if ( false !== strpos( $this->value, $x_dimension ) ) {
- $x = $x_dimension;
- }
- }
- $y = 'center';
- foreach ( $y_dimensions as $y_dimension ) {
- if ( false !== strpos( $this->value, $y_dimension ) ) {
- $y = $y_dimension;
- }
- }
- $this->value = $x . ' ' . $y;
- }
-}
diff --git a/assets/kirki/modules/css/property/class-kirki-output-property-font-family.php b/assets/kirki/modules/css/property/class-kirki-output-property-font-family.php
deleted file mode 100644
index 344bf9f..0000000
--- a/assets/kirki/modules/css/property/class-kirki-output-property-font-family.php
+++ /dev/null
@@ -1,64 +0,0 @@
-value;
- $backup = '';
- if ( is_array( $this->value ) && isset( $this->value[0] ) && isset( $this->value[1] ) ) {
- $family = $this->value[0];
- $backup = $this->value[1];
- }
-
- // Make sure the value is a string.
- // If not, then early exit.
- if ( ! is_string( $family ) ) {
- return;
- }
-
- // Hack for standard fonts.
- $family = str_replace( '"', '"', $family );
-
- // Add backup font.
- if ( Kirki_Fonts::is_google_font( $family ) ) {
-
- if ( '' === $backup && isset( $google_fonts_array[ $family ] ) && isset( $backup_fonts[ $google_fonts_array[ $family ]['category'] ] ) ) {
- $backup = $backup_fonts[ $google_fonts_array[ $family ]['category'] ];
- }
-
- // Add double quotes if needed.
- if ( false !== strpos( $family, ' ' ) && false === strpos( $family, '"' ) ) {
- $this->value = '"' . $family . '", ' . $backup;
- return;
- }
- $this->value = $family . ', ' . $backup;
- return;
- }
-
- // Add double quotes if needed.
- if ( false !== strpos( $family, ' ' ) && false === strpos( $family, '"' ) ) {
- $this->value = '"' . $family . '"';
- }
- $this->value = html_entity_decode( $family, ENT_QUOTES );
- }
-}
diff --git a/assets/kirki/modules/css/property/class-kirki-output-property.php b/assets/kirki/modules/css/property/class-kirki-output-property.php
deleted file mode 100644
index a81697b..0000000
--- a/assets/kirki/modules/css/property/class-kirki-output-property.php
+++ /dev/null
@@ -1,64 +0,0 @@
-property = $property;
- $this->value = $value;
- $this->process_value();
- }
-
- /**
- * Modifies the value.
- *
- * @access protected
- */
- protected function process_value() {
-
- }
-
- /**
- * Gets the value.
- *
- * @access protected
- */
- public function get_value() {
- return $this->value;
- }
-}
diff --git a/assets/kirki/modules/custom-sections/class-kirki-modules-custom-sections.php b/assets/kirki/modules/custom-sections/class-kirki-modules-custom-sections.php
deleted file mode 100644
index 43c1a9f..0000000
--- a/assets/kirki/modules/custom-sections/class-kirki-modules-custom-sections.php
+++ /dev/null
@@ -1,158 +0,0 @@
- 'Kirki_Sections_Default_Section',
- 'kirki-expanded' => 'Kirki_Sections_Expanded_Section',
- 'kirki-nested' => 'Kirki_Sections_Nested_Section',
- );
- return array_merge( $section_types, $new_types );
- }
-
- /**
- * Add the custom panel types.
- *
- * @access public
- * @since 3.0.0
- * @param array $panel_types The registered section-types.
- * @return array
- */
- public function set_panel_types( $panel_types ) {
- $new_types = array(
- 'kirki-nested' => 'Kirki_Panels_Nested_Panel',
- );
- return array_merge( $panel_types, $new_types );
- }
-
- /**
- * Include the custom-section classes.
- *
- * @access public
- * @since 3.0.0
- */
- public function include_sections_and_panels() {
-
- // Sections.
- $folder_path = dirname( __FILE__ ) . '/sections/';
- $section_types = apply_filters( 'kirki_section_types', array() );
-
- foreach ( $section_types as $id => $class ) {
- if ( ! class_exists( $class ) ) {
- $path = wp_normalize_path( $folder_path . 'class-kirki-sections-' . $id . '-section.php' );
- if ( file_exists( $path ) ) {
- include_once $path;
- continue;
- }
- $path = str_replace( 'class-kirki-sections-kirki-', 'class-kirki-sections-', $path );
- if ( file_exists( $path ) ) {
- include_once $path;
- }
- }
- }
-
- // Panels.
- $folder_path = dirname( __FILE__ ) . '/panels/';
- $panel_types = apply_filters( 'kirki_panel_types', array() );
-
- foreach ( $panel_types as $id => $class ) {
- if ( ! class_exists( $class ) ) {
- $path = wp_normalize_path( $folder_path . 'class-kirki-panels-' . $id . '-panel.php' );
- if ( file_exists( $path ) ) {
- include_once $path;
- continue;
- }
- $path = str_replace( 'class-kirki-panels-kirki-', 'class-kirki-panels-', $path );
- if ( file_exists( $path ) ) {
- include_once $path;
- }
- }
- }
- }
-
- /**
- * Enqueues any necessary scripts and styles.
- *
- * @access public
- * @since 3.0.0
- */
- public function enqueue_scrips() {
- wp_enqueue_style( 'kirki-custom-sections', trailingslashit( Kirki::$url ) . 'modules/custom-sections/sections.css', array(), KIRKI_VERSION );
- wp_enqueue_script( 'kirki-custom-sections', trailingslashit( Kirki::$url ) . 'modules/custom-sections/sections.js', array( 'jquery', 'customize-base', 'customize-controls' ), KIRKI_VERSION, false );
- }
-}
diff --git a/assets/kirki/modules/custom-sections/panels/class-kirki-panels-nested-panel.php b/assets/kirki/modules/custom-sections/panels/class-kirki-panels-nested-panel.php
deleted file mode 100644
index 262c553..0000000
--- a/assets/kirki/modules/custom-sections/panels/class-kirki-panels-nested-panel.php
+++ /dev/null
@@ -1,60 +0,0 @@
-title, ENT_QUOTES, get_bloginfo( 'charset' ) );
- $array['content'] = $this->get_content();
- $array['active'] = $this->active();
- $array['instanceNumber'] = $this->instance_number;
-
- return $array;
- }
-}
diff --git a/assets/kirki/modules/custom-sections/sections.css b/assets/kirki/modules/custom-sections/sections.css
deleted file mode 100644
index 969698f..0000000
--- a/assets/kirki/modules/custom-sections/sections.css
+++ /dev/null
@@ -1,26 +0,0 @@
-#customize-theme-controls .control-section-kirki-expanded .accordion-section-title {
- display: none;
-}
-#customize-theme-controls .control-section-kirki-expanded .customize-section-back {
- 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;
-}
-
-#customize-theme-controls .customize-pane-child.current-section-parent,
-.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel-parent {
- transform: translateX(-100%);
-}
-
-.control-section-kirki-nested {
- margin: 0 -12px;
-}
-
-/*# sourceMappingURL=sections.css.map */
diff --git a/assets/kirki/modules/custom-sections/sections.js b/assets/kirki/modules/custom-sections/sections.js
deleted file mode 100644
index 1e8a378..0000000
--- a/assets/kirki/modules/custom-sections/sections.js
+++ /dev/null
@@ -1,256 +0,0 @@
-jQuery( document ).ready( function() {
-
- wp.customize.section.each( function( section ) {
-
- // Get the pane element.
- var pane = jQuery( '#sub-accordion-section-' + section.id ),
- sectionLi = jQuery( '#accordion-section-' + section.id );
-
- // Check if the section is expanded.
- if ( sectionLi.hasClass( 'control-section-kirki-expanded' ) ) {
-
- // Move element.
- pane.appendTo( sectionLi );
-
- }
-
- } );
-
-} );
-
-/**
- * @see https://wordpress.stackexchange.com/a/256103/17078
- */
-( function() {
-
- var _panelEmbed,
- _panelIsContextuallyActive,
- _panelAttachEvents,
- _sectionEmbed,
- _sectionIsContextuallyActive,
- _sectionAttachEvents;
-
- wp.customize.bind( 'pane-contents-reflowed', function() {
-
- var panels = [],
- sections = [];
-
- // Reflow Sections.
- wp.customize.section.each( function( section ) {
-
- if ( 'kirki-nested' !== section.params.type || _.isUndefined( section.params.section ) ) {
- return;
- }
- sections.push( section );
- } );
-
- sections.sort( wp.customize.utils.prioritySort ).reverse();
-
- jQuery.each( sections, function( i, section ) {
- var parentContainer = jQuery( '#sub-accordion-section-' + section.params.section );
-
- parentContainer.children( '.section-meta' ).after( section.headContainer );
- } );
-
- // Reflow Panels.
- wp.customize.panel.each( function( panel ) {
- if ( 'kirki-nested' !== panel.params.type || _.isUndefined( panel.params.panel ) ) {
- return;
- }
- panels.push( panel );
- } );
-
- panels.sort( wp.customize.utils.prioritySort ).reverse();
-
- jQuery.each( panels, function( i, panel ) {
- var parentContainer = jQuery( '#sub-accordion-panel-' + panel.params.panel );
-
- parentContainer.children( '.panel-meta' ).after( panel.headContainer );
- } );
- } );
-
- // Extend Panel.
- _panelEmbed = wp.customize.Panel.prototype.embed;
- _panelIsContextuallyActive = wp.customize.Panel.prototype.isContextuallyActive;
- _panelAttachEvents = wp.customize.Panel.prototype.attachEvents;
-
- wp.customize.Panel = wp.customize.Panel.extend( {
- attachEvents: function() {
- var panel;
-
- if ( 'kirki-nested' !== this.params.type || _.isUndefined( this.params.panel ) ) {
- _panelAttachEvents.call( this );
- return;
- }
-
- _panelAttachEvents.call( this );
-
- panel = this;
-
- panel.expanded.bind( function( expanded ) {
- var parent = wp.customize.panel( panel.params.panel );
-
- if ( expanded ) {
- parent.contentContainer.addClass( 'current-panel-parent' );
- } else {
- parent.contentContainer.removeClass( 'current-panel-parent' );
- }
- } );
-
- panel.container.find( '.customize-panel-back' ).off( 'click keydown' ).on( 'click keydown', function( event ) {
- if ( wp.customize.utils.isKeydownButNotEnterEvent( event ) ) {
- return;
- }
- event.preventDefault(); // Keep this AFTER the key filter above
-
- if ( panel.expanded() ) {
- wp.customize.panel( panel.params.panel ).expand();
- }
- } );
- },
-
- embed: function() {
-
- var panel = this,
- parentContainer;
- if ( 'kirki-nested' !== this.params.type || _.isUndefined( this.params.panel ) ) {
- _panelEmbed.call( this );
- return;
- }
-
- _panelEmbed.call( this );
-
- parentContainer = jQuery( '#sub-accordion-panel-' + this.params.panel );
-
- parentContainer.append( panel.headContainer );
- },
-
- isContextuallyActive: function() {
-
- var panel = this,
- children,
- activeCount = 0;
-
- if ( 'kirki-nested' !== this.params.type ) {
- return _panelIsContextuallyActive.call( this );
- }
-
- children = this._children( 'panel', 'section' );
-
- wp.customize.panel.each( function( child ) {
- if ( ! child.params.panel ) {
- return;
- }
-
- if ( child.params.panel !== panel.id ) {
- return;
- }
-
- children.push( child );
- } );
-
- children.sort( wp.customize.utils.prioritySort );
-
- _( children ).each( function( child ) {
- if ( child.active() && child.isContextuallyActive() ) {
- activeCount += 1;
- }
- } );
- return ( 0 !== activeCount );
- }
- } );
-
- // Extend Section.
- _sectionEmbed = wp.customize.Section.prototype.embed;
- _sectionIsContextuallyActive = wp.customize.Section.prototype.isContextuallyActive;
- _sectionAttachEvents = wp.customize.Section.prototype.attachEvents;
-
- wp.customize.Section = wp.customize.Section.extend( {
- attachEvents: function() {
-
- var section = this;
-
- if ( 'kirki-nested' !== this.params.type || _.isUndefined( this.params.section ) ) {
- _sectionAttachEvents.call( section );
- return;
- }
-
- _sectionAttachEvents.call( section );
-
- section.expanded.bind( function( expanded ) {
- var parent = wp.customize.section( section.params.section );
-
- if ( expanded ) {
- parent.contentContainer.addClass( 'current-section-parent' );
- } else {
- parent.contentContainer.removeClass( 'current-section-parent' );
- }
- } );
-
- section.container.find( '.customize-section-back' ).off( 'click keydown' ).on( 'click keydown', function( event ) {
- if ( wp.customize.utils.isKeydownButNotEnterEvent( event ) ) {
- return;
- }
- event.preventDefault(); // Keep this AFTER the key filter above
- if ( section.expanded() ) {
- wp.customize.section( section.params.section ).expand();
- }
- } );
- },
-
- embed: function() {
-
- var section = this,
- parentContainer;
-
- if ( 'kirki-nested' !== this.params.type || _.isUndefined( this.params.section ) ) {
- _sectionEmbed.call( section );
- return;
- }
-
- _sectionEmbed.call( section );
-
- parentContainer = jQuery( '#sub-accordion-section-' + this.params.section );
-
- parentContainer.append( section.headContainer );
- },
-
- isContextuallyActive: function() {
- var section = this,
- children,
- activeCount = 0;
- if ( 'kirki-nested' !== this.params.type ) {
- return _sectionIsContextuallyActive.call( this );
- }
-
- children = this._children( 'section', 'control' );
-
- wp.customize.section.each( function( child ) {
- if ( ! child.params.section ) {
- return;
- }
-
- if ( child.params.section !== section.id ) {
- return;
- }
- children.push( child );
- } );
-
- children.sort( wp.customize.utils.prioritySort );
-
- _( children ).each( function( child ) {
- if ( 'undefined' !== typeof child.isContextuallyActive ) {
- if ( child.active() && child.isContextuallyActive() ) {
- activeCount += 1;
- }
- } else {
- if ( child.active() ) {
- activeCount += 1;
- }
- }
- } );
-
- return ( 0 !== activeCount );
- }
- } );
-}( jQuery ) );
diff --git a/assets/kirki/modules/custom-sections/sections/class-kirki-sections-default-section.php b/assets/kirki/modules/custom-sections/sections/class-kirki-sections-default-section.php
deleted file mode 100644
index af676f5..0000000
--- a/assets/kirki/modules/custom-sections/sections/class-kirki-sections-default-section.php
+++ /dev/null
@@ -1,25 +0,0 @@
-title, ENT_QUOTES, get_bloginfo( 'charset' ) );
- $array['content'] = $this->get_content();
- $array['active'] = $this->active();
- $array['instanceNumber'] = $this->instance_number;
-
- $array['customizeAction'] = esc_html__( 'Customizing', 'kirki' );
- if ( $this->panel ) {
- /* translators: The title. */
- $array['customizeAction'] = sprintf( esc_html__( 'Customizing ▸ %s', 'kirki' ), esc_html( $this->manager->get_panel( $this->panel )->title ) );
- }
- return $array;
- }
-}
diff --git a/assets/kirki/modules/customizer-branding/branding.js b/assets/kirki/modules/customizer-branding/branding.js
deleted file mode 100644
index 3a3c273..0000000
--- a/assets/kirki/modules/customizer-branding/branding.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/* global kirkiBranding */
-jQuery( document ).ready( function() {
-
- 'use strict';
-
- if ( '' !== kirkiBranding.logoImage ) {
- jQuery( 'div#customize-info .preview-notice' ).replaceWith( ' ' );
- }
-
- if ( '' !== kirkiBranding.description ) {
- jQuery( 'div#customize-info > .customize-panel-description' ).replaceWith( '' + kirkiBranding.description + '
' );
- }
-
-} );
diff --git a/assets/kirki/modules/customizer-branding/class-kirki-modules-customizer-branding.php b/assets/kirki/modules/customizer-branding/class-kirki-modules-customizer-branding.php
deleted file mode 100644
index 651c6dd..0000000
--- a/assets/kirki/modules/customizer-branding/class-kirki-modules-customizer-branding.php
+++ /dev/null
@@ -1,88 +0,0 @@
- '',
- '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' );
- }
- }
-}
diff --git a/assets/kirki/modules/customizer-styling/class-kirki-modules-customizer-styling.php b/assets/kirki/modules/customizer-styling/class-kirki-modules-customizer-styling.php
deleted file mode 100644
index f3475cc..0000000
--- a/assets/kirki/modules/customizer-styling/class-kirki-modules-customizer-styling.php
+++ /dev/null
@@ -1,422 +0,0 @@
- $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 );
- }
- ?>
-
- =' === operator || 'greater or equal' === operator || 'equal or greater' === operator ) {
- return value2 >= value1;
- }
- if ( '<=' === operator || 'smaller or equal' === operator || 'equal or smaller' === operator ) {
- return value2 <= value1;
- }
- if ( '>' === operator || 'greater' === operator ) {
- return value2 > value1;
- }
- if ( '<' === operator || 'smaller' === operator ) {
- return value2 < value1;
- }
- if ( 'contains' === operator || 'in' === operator ) {
- if ( _.isArray( value1 ) && _.isArray( value2 ) ) {
- _.each( value2, function( value ) {
- if ( value1.includes( value ) ) {
- found = true;
- return false;
- }
- } );
- return found;
- }
- if ( _.isArray( value2 ) ) {
- _.each( value2, function( value ) {
- if ( value == value1 ) { // jshint ignore:line
- found = true;
- }
- } );
- return found;
- }
- if ( _.isObject( value2 ) ) {
- if ( ! _.isUndefined( value2[ value1 ] ) ) {
- found = true;
- }
- _.each( value2, function( subValue ) {
- if ( value1 === subValue ) {
- found = true;
- }
- } );
- return found;
- }
- if ( _.isString( value2 ) ) {
- if ( _.isString( value1 ) ) {
- return ( -1 < value1.indexOf( value2 ) && -1 < value2.indexOf( value1 ) );
- }
- return -1 < value1.indexOf( value2 );
- }
- }
- return value1 == value2;
- }
-};
-
-jQuery( document ).ready( function() {
- kirkiDependencies.init();
-} );
diff --git a/assets/kirki/modules/gutenberg/class-kirki-modules-gutenberg.php b/assets/kirki/modules/gutenberg/class-kirki-modules-gutenberg.php
deleted file mode 100644
index 52c0328..0000000
--- a/assets/kirki/modules/gutenberg/class-kirki-modules-gutenberg.php
+++ /dev/null
@@ -1,355 +0,0 @@
-set_configs();
- $this->set_enabled();
- $this->set_modules_css();
- $this->set_google_fonts();
- $this->set_modules_webfonts();
- $this->set_modules_webfont_loader();
- $this->add_hooks();
- }
-
- /**
- * 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 hooks for Gutenberg editor integration.
- *
- * @access protected
- * @since 3.0.35
- */
- protected function add_hooks() {
- if ( ! $this->is_disabled() ) {
- add_action( 'after_setup_theme', array( $this, 'add_theme_support' ), 999 );
- add_action( 'enqueue_block_editor_assets', array( $this, 'load_fonts' ) );
- add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_fontawesome' ) );
- add_filter( 'block_editor_settings', array( $this, 'enqueue' ) );
- }
- }
-
- /**
- * 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' );
- }
- }
-
- /**
- * Enqueue styles to Gutenberg Editor.
- *
- * @access public
- * @since 3.0.35
- */
- public function enqueue( $settings ) {
- $styles = $this->get_styles();
-
- if ( ! empty( $styles ) ) {
- $settings['styles'][] = array( 'css' => $styles );
- }
-
- return $settings;
- }
-
- /**
- * Gets the styles to add to Gutenberg Editor.
- *
- * @access public
- * @since 3.0.35
- *
- * @return string $styles String containing inline styles to add to Gutenberg.
- */
- public function get_styles() {
-
- $styles = null;
-
- foreach ( $this->configs as $config_id => $args ) {
-
- if ( true === $this->is_disabled( $args ) ) {
- continue;
- }
-
- $modules_css = $this->modules_css;
- $styles = $modules_css::loop_controls( $config_id );
- $styles = apply_filters( "kirki_gutenberg_{$config_id}_dynamic_css", $styles );
-
- if ( empty( $styles ) ) {
- continue;
- }
- }
-
- return $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
- * @since 3.0.35
- *
- * @return bool $disabled Is gutenberg integration feature disabled?
- */
- private function is_disabled( $args = array() ) {
- 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;
- }
-
- /**
- * Load Fonts in Gutenberg Editor.
- *
- * @access public
- * @since 3.0.35
- */
- public function load_fonts() {
-
- $modules_webfonts = $this->modules_webfonts;
- $google_fonts = $this->google_fonts;
- foreach ( $this->configs as $config_id => $args ) {
-
- if ( $this->is_disabled( $args ) ) {
- continue;
- }
-
- $this->modules_webfont_loader->set_load( true );
- $this->modules_webfont_loader->enqueue_scripts();
-
- $async = new Kirki_Modules_Webfonts_Async(
- $config_id,
- $modules_webfonts::get_instance(),
- $google_fonts::get_instance()
- );
-
- $async->webfont_loader();
- $async->webfont_loader_script();
-
- $local_fonts = new Kirki_Modules_Webfonts_Local(
- $modules_webfonts::get_instance(),
- $google_fonts::get_instance()
- );
-
- $local_fonts->add_styles();
-
- return;
- }
- }
-
- /**
- * Enqueue fontawesome in Gutenberg Editor.
- *
- * @access public
- * @since 3.0.35
- */
- public function enqueue_fontawesome() {
- foreach ( $this->configs as $config_id => $args ) {
-
- if ( $this->is_disabled( $args ) ) {
- continue;
- }
- $modules_css = $this->modules_css;
- if ( $modules_css::get_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 );
- }
-
- return;
- }
- }
-
- /**
- * Set class property for $configs.
- *
- * @access private
- * @since 3.0.35
- */
- private function set_configs() {
- return $this->configs = Kirki::$config;
- }
-
- /**
- * 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 = Kirki_Modules_CSS::get_instance();
- }
-
- /**
- * Set class property for $google_fonts.
- *
- * @access private
- * @since 3.0.35
- */
- private function set_google_fonts() {
- $this->google_fonts = Kirki_Fonts_Google::get_instance();
- }
-
- /**
- * Set class property for $modules_webfonts.
- *
- * @access private
- * @since 3.0.35
- */
- private function set_modules_webfonts() {
- $this->modules_webfonts = Kirki_Modules_Webfonts::get_instance();
- }
-
- /**
- * Set class property for $modules_webfont_loader.
- *
- * @access private
- * @since 3.0.35
- */
- private function set_modules_webfont_loader() {
- $this->modules_webfont_loader = Kirki_Modules_Webfont_Loader::get_instance();
- }
-}
diff --git a/assets/kirki/modules/icons/class-kirki-modules-icons.php b/assets/kirki/modules/icons/class-kirki-modules-icons.php
deleted file mode 100644
index 988ad0c..0000000
--- a/assets/kirki/modules/icons/class-kirki-modules-icons.php
+++ /dev/null
@@ -1,104 +0,0 @@
-add_icon( $section['id'], $section['icon'], 'section' );
- }
- }
-
- // Parse panels and find ones with icons.
- foreach ( $panels as $panel ) {
- if ( isset( $panel['icon'] ) ) {
- $this->add_icon( $panel['id'], $panel['icon'], 'panel' );
- }
- }
-
- wp_enqueue_script( 'kirki_panel_and_section_icons', trailingslashit( Kirki::$url ) . 'modules/icons/icons.js', array( 'jquery', 'customize-base', 'customize-controls' ), KIRKI_VERSION, true );
- wp_localize_script( 'kirki_panel_and_section_icons', 'kirkiIcons', self::$icons );
- }
-}
diff --git a/assets/kirki/modules/icons/icons.js b/assets/kirki/modules/icons/icons.js
deleted file mode 100644
index 51698a2..0000000
--- a/assets/kirki/modules/icons/icons.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/* global kirkiIcons */
-jQuery( document ).ready( function() {
-
- 'use strict';
-
- if ( ! _.isUndefined( kirkiIcons.section ) ) {
-
- // Parse sections and add icons.
- _.each( kirkiIcons.section, function( icon, sectionID ) {
-
- // Add icons in list.
- jQuery( '#accordion-section-' + sectionID + ' > h3' ).addClass( 'dashicons-before ' + icon );
-
- // Add icons on titles when a section is open.
- jQuery( '#sub-accordion-section-' + sectionID + ' .customize-section-title > h3' ).append( ' ' );
- } );
-
- }
-
- if ( ! _.isUndefined( kirkiIcons.panel ) ) {
-
- _.each( kirkiIcons.panel, function( icon, panelID ) {
-
- // Add icons in lists & headers.
- jQuery( '#accordion-panel-' + panelID + ' > h3, #sub-accordion-panel-' + panelID + ' .panel-title' ).addClass( 'dashicons-before ' + icon );
- } );
-
- }
-
-} );
diff --git a/assets/kirki/modules/loading/class-kirki-modules-loading.php b/assets/kirki/modules/loading/class-kirki-modules-loading.php
deleted file mode 100644
index 234d5f0..0000000
--- a/assets/kirki/modules/loading/class-kirki-modules-loading.php
+++ /dev/null
@@ -1,167 +0,0 @@
-remove_default_loading_styles();
- }
-
- /**
- * Adds a custom "loading" div $ its styles when changes are made to the customizer.
- *
- * @access public
- */
- public function add_loader_to_footer() {
- ?>
-
-
-
- `.
- *
- * @access public
- */
- public function add_loader_styles_to_header() {
- ?>
-
- meta = get_post_custom( $queried_post->id );
- }
- $wp_scripts->add_data( 'kirki_post_meta_previewed_preview', 'data', sprintf( 'var _customizePostPreviewedQueriedObject = %s;', wp_json_encode( $queried_post ) ) );
- }
-}
diff --git a/assets/kirki/modules/post-meta/customize-controls.js b/assets/kirki/modules/post-meta/customize-controls.js
deleted file mode 100644
index 09d8797..0000000
--- a/assets/kirki/modules/post-meta/customize-controls.js
+++ /dev/null
@@ -1,23 +0,0 @@
-jQuery( document ).ready( function() {
-
- var self;
-
- self = {
- queriedPost: new wp.customize.Value()
- };
-
- // Listen for queried-post messages from the preview.
- wp.customize.bind( 'ready', function() {
- wp.customize.previewer.bind( 'queried-post', function( queriedPost ) {
- self.queriedPost.set( queriedPost || false );
- } );
- } );
-
- // Listen for post
- self.queriedPost.bind( function( newPost, oldPost ) {
- window.kirkiPost = false;
- if ( newPost || oldPost ) {
- window.kirkiPost = ( newPost ) ? newPost : oldPost;
- }
- } );
-} );
diff --git a/assets/kirki/modules/post-meta/customize-preview.js b/assets/kirki/modules/post-meta/customize-preview.js
deleted file mode 100644
index 8648d63..0000000
--- a/assets/kirki/modules/post-meta/customize-preview.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/* global wp, _customizePostPreviewedQueriedObject */
-jQuery( document ).ready( function() {
-
- var self = {
- queriedPost: ( ! _.isUndefined( _customizePostPreviewedQueriedObject ) ) ? _customizePostPreviewedQueriedObject : null
- };
-
- // Send the queried post object to the Customizer pane when ready.
- wp.customize.bind( 'preview-ready', function() {
- wp.customize.preview.bind( 'active', function() {
- wp.customize.preview.send( 'queried-post', self.queriedPost );
- } );
- } );
-} );
diff --git a/assets/kirki/modules/postmessage/class-kirki-modules-postmessage.php b/assets/kirki/modules/postmessage/class-kirki-modules-postmessage.php
deleted file mode 100644
index 4ac5cec..0000000
--- a/assets/kirki/modules/postmessage/class-kirki-modules-postmessage.php
+++ /dev/null
@@ -1,515 +0,0 @@
-script .= $this->script( $field );
- }
- }
- $this->script = apply_filters( 'kirki_postmessage_script', $this->script );
- wp_add_inline_script( 'kirki_auto_postmessage', $this->script, 'after' );
- }
-
- /**
- * Generates script for a single field.
- *
- * @access protected
- * @since 3.0.0
- * @param array $args The arguments.
- */
- protected function script( $args ) {
- $script = 'wp.customize(\'' . $args['settings'] . '\',function(value){value.bind(function(newval){';
-
- $add_css = false;
- foreach ( $args['js_vars'] as $js_var ) {
- if ( ! isset( $js_var['function'] ) || 'html' !== $js_var['function'] ) {
- $add_css = true;
- }
- }
-
- if ( $add_css ) {
-
- // append unique style tag if not exist
- // The style ID.
- $style_id = 'kirki-postmessage-' . str_replace( array( '[', ']' ), '', $args['settings'] );
- $script .= 'if(null===document.getElementById(\'' . $style_id . '\')||\'undefined\'===typeof document.getElementById(\'' . $style_id . '\')){jQuery(\'head\').append(\'\');}';
- }
-
- // 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
'edit_theme_options',
- 'option_type' => 'option',
- 'option_name' => 'fsmsp_options',
- )
- );
// Add FSMS Plugin Panel.
- Kirki::add_panel(
+ $wp_customize->add_panel(
'fsmsp_panel',
array(
'title' => __( 'FSMS Plugin', 'full-screen-morphing-search' ),
'priority' => 160,
)
);
+
// Add Color Section.
- Kirki::add_section(
+ $wp_customize->add_section(
'fsmsp_color',
array(
'title' => __( 'FSMS Colors', 'full-screen-morphing-search' ),
@@ -111,400 +100,429 @@ if ( class_exists( 'Kirki' ) ) {
'panel' => 'fsmsp_panel',
)
);
- // FSMS Main Backgroung Color.
- Kirki::add_field(
- 'fsmsp_kirki',
+
+ // =====================================
+ // = FSMS Main Backgroung Color Picker =
+ // =====================================
+ $wp_customize->add_setting(
+ 'fsmsp_options[fsmsp_main_backgroung_color]',
array(
- 'type' => 'color-alpha',
- 'settings' => 'fsmsp_main_backgroung_color',
- 'label' => __( 'FSMS Main Backgroung Color', 'full-screen-morphing-search' ),
- 'description' => esc_attr__( 'Change the main background color', 'full-screen-morphing-search' ),
- 'section' => 'fsmsp_color',
- 'default' => '#f1f1f1',
- 'transport' => 'auto',
- 'output' => array(
- array(
- 'element' => array(
- '#morphsearch',
- 'div.morphsearch-content',
- ),
- 'property' => 'background-color',
- ),
- ),
- )
- );
- // FSMS Close Color.
- Kirki::add_field(
- 'fsmsp_kirki',
- array(
- 'type' => 'color-alpha',
- 'settings' => 'fsmsp_close_icon_color',
- 'label' => __( 'FSMS Close Icon Color', 'full-screen-morphing-search' ),
- 'description' => esc_attr__( 'Change the close icon color', 'full-screen-morphing-search' ),
- 'section' => 'fsmsp_color',
- 'default' => '#000',
- 'transport' => 'auto',
- 'output' => array(
- array(
- 'element' => array(
- 'span.morphsearch-close::before',
- 'span.morphsearch-close::after',
- ),
- 'property' => 'background',
- ),
- ),
- )
- );
- // FSMS Search ... Color.
- Kirki::add_field(
- 'fsmsp_kirki',
- array(
- 'type' => 'color-alpha',
- 'settings' => 'fsmsp_search_text_color',
- 'label' => __( 'FSMS Search … text Color', 'full-screen-morphing-search' ),
- 'description' => esc_attr__( 'Change the search … text color', 'full-screen-morphing-search' ),
- 'section' => 'fsmsp_color',
- 'default' => '#c2c2c2',
- 'transport' => 'auto',
- 'output' => array(
- array(
- 'element' => 'input.morphsearch-input::placeholder',
- 'property' => 'color',
- ),
- ),
- )
- );
- // FSMS Input Text Color.
- Kirki::add_field(
- 'fsmsp_kirki',
- array(
- 'type' => 'color-alpha',
- 'settings' => 'fsmsp_input_text_color',
- 'label' => __( 'FSMS Input Text Color', 'full-screen-morphing-search' ),
- 'description' => esc_attr__( 'Change the input text color', 'full-screen-morphing-search' ),
- 'section' => 'fsmsp_color',
- 'default' => '#ec5a62',
- 'transport' => 'auto',
- 'output' => array(
- array(
- 'element' => '.morphsearch-input',
- 'property' => 'color',
- 'suffix' => ' !important',
- ),
- ),
- )
- );
- // FSMS Magnifier Submit Color.
- Kirki::add_field(
- 'fsmsp_kirki',
- array(
- 'type' => 'color-alpha',
- 'settings' => 'fsmsp_magnifier_submit_color',
- 'label' => __( 'FSMS Magnifier Submit Color', 'full-screen-morphing-search' ),
- 'description' => esc_attr__( 'Change the magnifier submit color', 'full-screen-morphing-search' ),
- 'section' => 'fsmsp_color',
- 'default' => '#ddd',
- 'transport' => 'auto',
- 'output' => array(
- array(
- 'element' => '#Capa_1 path',
- 'property' => 'fill',
- ),
- ),
- )
- );
- // FSMS Headings Color.
- Kirki::add_field(
- 'fsmsp_kirki',
- array(
- 'type' => 'color-alpha',
- 'settings' => 'fsmsp_headings_color',
- 'label' => __( 'FSMS Headings Color', 'full-screen-morphing-search' ),
- 'description' => esc_attr__( 'Change the headings color', 'full-screen-morphing-search' ),
- 'section' => 'fsmsp_color',
- 'default' => '#c2c2c2',
- 'transport' => 'auto',
- 'output' => array(
- array(
- 'element' => 'div.dummy-column h2',
- 'property' => 'color',
- ),
- ),
- )
- );
- // FSMS Columns Background Color.
- Kirki::add_field(
- 'fsmsp_kirki',
- array(
- 'type' => 'color-alpha',
- 'settings' => 'fsmsp_columns_background_color',
- 'label' => __( 'FSMS Columns Background Color', 'full-screen-morphing-search' ),
- 'description' => esc_attr__( 'Change the columns background color', 'full-screen-morphing-search' ),
- 'section' => 'fsmsp_color',
- 'default' => 'rgba(118, 117, 128, 0.05)',
- 'transport' => 'auto',
- 'output' => array(
- array(
- 'element' => 'div.dummy-media-object',
- 'property' => 'background',
- ),
- ),
- )
- );
- // FSMS Columns Hover Background Color.
- Kirki::add_field(
- 'fsmsp_kirki',
- array(
- 'type' => 'color-alpha',
- 'settings' => 'fsmsp_columns_hover_background_color',
- 'label' => __( 'FSMS Columns Hover Background Color', 'full-screen-morphing-search' ),
- 'description' => esc_attr__( 'Change the columns hover background color', 'full-screen-morphing-search' ),
- 'section' => 'fsmsp_color',
- 'default' => 'rgba(118, 117, 128, 0.1)',
- 'transport' => 'auto',
- 'output' => array(
- array(
- 'element' => array(
- 'div.dummy-media-object:hover',
- 'div.dummy-media-object:focus',
- ),
- 'property' => 'background',
- ),
- ),
- )
- );
- // FSMS Links Color.
- Kirki::add_field(
- 'fsmsp_kirki',
- array(
- 'type' => 'color-alpha',
- 'settings' => 'fsmsp_links_color',
- 'label' => __( 'FSMS Links Color', 'full-screen-morphing-search' ),
- 'description' => esc_attr__( 'Change the links color', 'full-screen-morphing-search' ),
- 'section' => 'fsmsp_color',
- 'default' => 'rgba(145, 145, 145, 0.7)',
- 'transport' => 'auto',
- 'output' => array(
- array(
- 'element' => 'div.dummy-column h3 a',
- 'property' => 'color',
- ),
- ),
- )
- );
- // FSMS Links Hover Color.
- Kirki::add_field(
- 'fsmsp_kirki',
- array(
- 'type' => 'color-alpha',
- 'settings' => 'fsmsp_links_hover_color',
- 'label' => __( 'FSMS Links Hover Color', 'full-screen-morphing-search' ),
- 'description' => esc_attr__( 'Change the links hover color', 'full-screen-morphing-search' ),
- 'section' => 'fsmsp_color',
- 'default' => 'rgba(236, 90, 98, 1)',
- 'transport' => 'auto',
- 'output' => array(
- array(
- 'element' => 'div.dummy-media-object:hover h3 a',
- 'property' => 'color',
- ),
- ),
- )
- );
- // Add Search Form Section.
- Kirki::add_section(
- 'fsmsp_search_form',
- array(
- 'title' => __( 'FSMS Search Form', 'full-screen-morphing-search' ),
- 'priority' => 10,
- 'panel' => 'fsmsp_panel',
- )
- );
- // FSMS Search Form Text.
- Kirki::add_field(
- 'fsmsp_kirki',
- array(
- 'type' => 'text',
- 'settings' => 'fsmsp_search_form_text',
- 'label' => __( 'FSMS Search Form Text', 'full-screen-morphing-search' ),
- 'description' => esc_attr__( 'Change the search form text. If leaved blank, it will return to original value !', 'full-screen-morphing-search' ),
- 'section' => 'fsmsp_search_form',
- 'default' => '',
- 'transport' => 'postMessage',
- 'js_vars' => array(
- array(
- 'element' => 'input.morphsearch-input.ui-autocomplete-input',
- 'function' => 'html',
- 'attr' => 'placeholder',
- ),
- ),
- )
- );
- // Add Icons Section.
- Kirki::add_section(
- 'fsmsp_icons',
- array(
- 'title' => __( 'FSMS Icons', 'full-screen-morphing-search' ),
- 'priority' => 15,
- 'panel' => 'fsmsp_panel',
- )
- );
- /**
- * Function to display an uploaded image to the media library.
- * 1- Retrive the images' URL, here by the option.
- * 2- Convert the attachment URL into a post ID. @see https://developer.wordpress.org/reference/functions/attachment_url_to_postid/
- * 3- Choose applied classes depending on the classes option.
- * 4- Display the image with some parameters. @see https://developer.wordpress.org/reference/functions/wp_get_attachment_image/
- * 5- Set this function as a render_callback in the partial_refersh module of the option.
- */
- function full_screen_morphing_search_article_icon() {
- $image_url = get_option( 'fsmsp_options' )['fsmsp_article_icon'];
- $attachment_id = attachment_url_to_postid( $image_url ); // Tries to convert an attachment URL into a post ID.
- $article_i_classes = get_option( 'fsmsp_options' )['fsmsp_article_i_classes'];
- $classes;
- if ( ! empty( $article_i_classes ) ) {
- $classes = 'round fsmsp-article-icon';
- } else {
- $classes = 'fsmsp-article-icon';
- }
- echo wp_get_attachment_image( $attachment_id, 'thumbnail', '', array( 'class' => $classes ) ); // Get an HTML img element representing an image attachment.
- }
- // FSMS Article Icon.
- Kirki::add_field(
- 'fsmsp_kirki',
- array(
- 'type' => 'image',
- 'settings' => 'fsmsp_article_icon',
- 'label' => __( 'FSMS Article Icon', 'full-screen-morphing-search' ),
- 'description' => esc_attr__( 'Change the article icon.', 'full-screen-morphing-search' ),
- 'section' => 'fsmsp_icons',
- 'default' => '',
- 'partial_refresh' => array(
- 'fsmsp_article_icon' => array(
- 'selector' => 'div.dummy-media-object a.fsmsp-article-link',
- 'render_callback' => 'full_screen_morphing_search_article_icon',
- ),
- ),
- )
- );
- // FSMS Article Icon/Image Classes.
- Kirki::add_field(
- 'fsmsp_kirki',
- array(
- 'type' => 'checkbox',
- 'settings' => 'fsmsp_article_i_classes',
- 'label' => __( 'Article Icon/Image Round or Not ?!', 'full-screen-morphing-search' ),
- 'section' => 'fsmsp_icons',
- 'default' => true,
- 'partial_refresh' => array(
- 'fsmsp_article_i_classes' => array(
- 'selector' => 'div.dummy-media-object a.fsmsp-article-link',
- 'render_callback' => 'full_screen_morphing_search_article_icon',
- ),
- ),
+ 'default' => '#f1f1f1',
+ 'sanitize_callback' => 'sanitize_hex_color',
+ 'capability' => 'edit_theme_options',
+ 'type' => 'option',
+ 'transport' => 'postMessage',
+
)
);
- /**
- * Function to display an uploaded image to the media library.
- */
- function full_screen_morphing_search_category_icon() {
- $imagecat_url = get_option( 'fsmsp_options' )['fsmsp_category_icon'];
- $attachmentcat_id = attachment_url_to_postid( $imagecat_url );
- $category_i_classes = get_option( 'fsmsp_options' )['fsmsp_category_i_classes'];
- $classes;
- if ( ! empty( $category_i_classes ) ) {
- $classes = 'round fsmsp-category-icon';
- } else {
- $classes = 'fsmsp-category-icon';
- }
- echo wp_get_attachment_image( $attachmentcat_id, 'thumbnail', '', array( 'class' => $classes ) );
- }
- // FSMS Category Icon.
- Kirki::add_field(
- 'fsmsp_kirki',
- array(
- 'type' => 'image',
- 'settings' => 'fsmsp_category_icon',
- 'label' => __( 'FSMS Category Icon', 'full-screen-morphing-search' ),
- 'description' => esc_attr__( 'Change the category icon.', 'full-screen-morphing-search' ),
- 'section' => 'fsmsp_icons',
- 'default' => '',
- 'partial_refresh' => array(
- 'fsmsp_category_icon' => array(
- 'selector' => 'span.fsmsp-category-image',
- 'render_callback' => 'full_screen_morphing_search_category_icon',
- ),
- ),
- )
- );
- // FSMS Category Icon/Image Classes.
- Kirki::add_field(
- 'fsmsp_kirki',
- array(
- 'type' => 'checkbox',
- 'settings' => 'fsmsp_category_i_classes',
- 'label' => __( 'Category Icon/Image Round or Not ?!', 'full-screen-morphing-search' ),
- 'section' => 'fsmsp_icons',
- 'default' => true,
- 'partial_refresh' => array(
- 'fsmsp_category_i_classes' => array(
- 'selector' => 'span.fsmsp-category-image',
- 'render_callback' => 'full_screen_morphing_search_category_icon',
- ),
- ),
+ $wp_customize->add_control(
+ new WP_Customize_Color_Control(
+ $wp_customize,
+ 'fsmsp_options[fsmsp_main_backgroung_color]',
+ array(
+ 'label' => __( 'FSMS Main Backgroung Color', 'full-screen-morphing-search' ),
+ 'description' => esc_attr__( 'Change the main background color', 'full-screen-morphing-search' ),
+ 'section' => 'fsmsp_color',
+ 'settings' => 'fsmsp_options[fsmsp_main_backgroung_color]',
+ )
)
);
- /**
- * Function to display an uploaded image to the media library.
- */
- function full_screen_morphing_search_tag_icon() {
- $imagetag_url = get_option( 'fsmsp_options' )['fsmsp_tag_icon'];
- $attachmenttag_id = attachment_url_to_postid( $imagetag_url );
- $tag_i_classes = get_option( 'fsmsp_options' )['fsmsp_tag_i_classes'];
- $classes;
- if ( ! empty( $tag_i_classes ) ) {
- $classes = 'round fsmsp-tag-icon';
- } else {
- $classes = 'fsmsp-tag-icon';
- }
- echo wp_get_attachment_image( $attachmenttag_id, 'thumbnail', '', array( 'class' => $classes ) );
- }
- // FSMS Tag Icon.
- Kirki::add_field(
- 'fsmsp_kirki',
+ // =====================
+ // = FSMS Close Color. =
+ // =====================
+ $wp_customize->add_setting(
+ 'fsmsp_options[fsmsp_close_icon_color]',
array(
- 'type' => 'image',
- 'settings' => 'fsmsp_tag_icon',
- 'label' => __( 'FSMS Tag Icon', 'full-screen-morphing-search' ),
- 'description' => esc_attr__( 'Change the tag icon.', 'full-screen-morphing-search' ),
- 'section' => 'fsmsp_icons',
- 'default' => '',
- 'partial_refresh' => array(
- 'fsmsp_tag_icon' => array(
- 'selector' => 'span.fsmsp-tag-image',
- 'render_callback' => 'full_screen_morphing_search_tag_icon',
- ),
- ),
+ 'default' => '#000',
+ 'sanitize_callback' => 'sanitize_hex_color',
+ 'capability' => 'edit_theme_options',
+ 'type' => 'option',
+ 'transport' => 'postMessage',
+
)
);
- // FSMS Tag Icon/Image Classes.
- Kirki::add_field(
- 'fsmsp_kirki',
+
+ $wp_customize->add_control(
+ new WP_Customize_Color_Control(
+ $wp_customize,
+ 'fsmsp_options[fsmsp_close_icon_color]',
+ array(
+ 'label' => __( 'FSMS Close Icon Color', 'full-screen-morphing-search' ),
+ 'description' => esc_attr__( 'Change the close icon color', 'full-screen-morphing-search' ),
+ 'section' => 'fsmsp_color',
+ 'settings' => 'fsmsp_options[fsmsp_close_icon_color]',
+ )
+ )
+ );
+
+ // =========================
+ // = FSMS Search... Color. =
+ // =========================
+ $wp_customize->add_setting(
+ 'fsmsp_options[fsmsp_search_text_color]',
array(
- 'type' => 'checkbox',
- 'settings' => 'fsmsp_tag_i_classes',
- 'label' => __( 'Tag Icon/Image Round or Not ?!', 'full-screen-morphing-search' ),
- 'section' => 'fsmsp_icons',
- 'default' => true,
- 'partial_refresh' => array(
- 'fsmsp_tag_i_classes' => array(
- 'selector' => 'span.fsmsp-tag-image',
- 'render_callback' => 'full_screen_morphing_search_tag_icon',
+ 'default' => '#c2c2c2',
+ 'sanitize_callback' => 'sanitize_hex_color',
+ 'capability' => 'edit_theme_options',
+ 'type' => 'option',
+ 'transport' => 'postMessage',
+
+ )
+ );
+
+ $wp_customize->add_control(
+ new WP_Customize_Color_Control(
+ $wp_customize,
+ 'fsmsp_options[fsmsp_search_text_color]',
+ array(
+ 'label' => __( 'FSMS Search… text Color', 'full-screen-morphing-search' ),
+ 'description' => esc_attr__( 'Change the search… text color', 'full-screen-morphing-search' ),
+ 'section' => 'fsmsp_color',
+ 'settings' => 'fsmsp_options[fsmsp_search_text_color]',
+ )
+ )
+ );
+
+ // ==========================
+ // = FSMS Input Text Color. =
+ // ==========================
+ $wp_customize->add_setting(
+ 'fsmsp_options[fsmsp_input_text_color]',
+ array(
+ 'default' => '#ec5a62',
+ 'sanitize_callback' => 'sanitize_hex_color',
+ 'capability' => 'edit_theme_options',
+ 'type' => 'option',
+ 'transport' => 'postMessage',
+
+ )
+ );
+
+ $wp_customize->add_control(
+ new WP_Customize_Color_Control(
+ $wp_customize,
+ 'fsmsp_options[fsmsp_input_text_color]',
+ array(
+ 'label' => __( 'FSMS Input Text Color', 'full-screen-morphing-search' ),
+ 'description' => esc_attr__( 'Change the input text color', 'full-screen-morphing-search' ),
+ 'section' => 'fsmsp_color',
+ 'settings' => 'fsmsp_options[fsmsp_input_text_color]',
+ )
+ )
+ );
+
+ // ================================
+ // = FSMS Magnifier Submit Color. =
+ // ================================
+ $wp_customize->add_setting(
+ 'fsmsp_options[fsmsp_magnifier_submit_color]',
+ array(
+ 'default' => '#ddd',
+ 'sanitize_callback' => 'sanitize_hex_color',
+ 'capability' => 'edit_theme_options',
+ 'type' => 'option',
+ 'transport' => 'postMessage',
+
+ )
+ );
+
+ $wp_customize->add_control(
+ new WP_Customize_Color_Control(
+ $wp_customize,
+ 'fsmsp_options[fsmsp_magnifier_submit_color]',
+ array(
+ 'label' => __( 'FSMS Magnifier Submit Color', 'full-screen-morphing-search' ),
+ 'description' => esc_attr__( 'Change the magnifier submit color', 'full-screen-morphing-search' ),
+ 'section' => 'fsmsp_color',
+ 'settings' => 'fsmsp_options[fsmsp_magnifier_submit_color]',
+ )
+ )
+ );
+
+ // ========================
+ // = FSMS Headings Color. =
+ // ========================
+ $wp_customize->add_setting(
+ 'fsmsp_options[fsmsp_headings_color]',
+ array(
+ 'default' => '#c2c2c2',
+ 'sanitize_callback' => 'sanitize_hex_color',
+ 'capability' => 'edit_theme_options',
+ 'type' => 'option',
+ 'transport' => 'postMessage',
+
+ )
+ );
+
+ $wp_customize->add_control(
+ new WP_Customize_Color_Control(
+ $wp_customize,
+ 'fsmsp_options[fsmsp_headings_color]',
+ array(
+ 'label' => __( 'FSMS Headings Color', 'full-screen-morphing-search' ),
+ 'description' => esc_attr__( 'Change the headings color', 'full-screen-morphing-search' ),
+ 'section' => 'fsmsp_color',
+ 'settings' => 'fsmsp_options[fsmsp_headings_color]',
+ )
+ )
+ );
+
+ // ==================================
+ // = FSMS Columns Background Color. =
+ // ==================================
+ $wp_customize->add_setting(
+ 'fsmsp_options[fsmsp_columns_background_color]',
+ array(
+ 'default' => '#ebebeb',
+ 'sanitize_callback' => 'sanitize_hex_color',
+ 'capability' => 'edit_theme_options',
+ 'type' => 'option',
+ 'transport' => 'postMessage',
+
+ )
+ );
+
+ $wp_customize->add_control(
+ new WP_Customize_Color_Control(
+ $wp_customize,
+ 'fsmsp_options[fsmsp_columns_background_color]',
+ array(
+ 'label' => __( 'FSMS Columns Background Color', 'full-screen-morphing-search' ),
+ 'description' => esc_attr__( 'Change the columns background color', 'full-screen-morphing-search' ),
+ 'section' => 'fsmsp_color',
+ 'settings' => 'fsmsp_options[fsmsp_columns_background_color]',
+ 'input_attrs' => array( // Optional.
+ 'class' => 'color-picker',
+ 'data-alpha' => true,
),
- ),
+ )
+ )
+ );
+
+ // ========================================
+ // = FSMS Columns Hover Background Color. =
+ // ========================================
+ $wp_customize->add_setting(
+ 'fsmsp_options[fsmsp_columns_hover_background_color]',
+ array(
+ 'default' => '#e4e4e5',
+ 'sanitize_callback' => 'sanitize_hex_color',
+ 'capability' => 'edit_theme_options',
+ 'type' => 'option',
+ 'transport' => 'postMessage',
+ )
+ );
+
+ $wp_customize->add_control(
+ new WP_Customize_Color_Control(
+ $wp_customize,
+ 'fsmsp_options[fsmsp_columns_hover_background_color]',
+ array(
+ 'label' => __( 'FSMS Columns Hover Background Color', 'full-screen-morphing-search' ),
+ 'description' => esc_attr__( 'Change the columns hover background color', 'full-screen-morphing-search' ),
+ 'section' => 'fsmsp_color',
+ 'settings' => 'fsmsp_options[fsmsp_columns_hover_background_color]',
+ )
+ )
+ );
+
+ // =====================
+ // = FSMS Links Color. =
+ // =====================
+ $wp_customize->add_setting(
+ 'fsmsp_options[fsmsp_links_color]',
+ array(
+ 'default' => '#b2b2b2',
+ 'sanitize_callback' => 'sanitize_hex_color',
+ 'capability' => 'edit_theme_options',
+ 'type' => 'option',
+ 'transport' => 'postMessage',
+ )
+ );
+
+ $wp_customize->add_control(
+ new WP_Customize_Color_Control(
+ $wp_customize,
+ 'fsmsp_options[fsmsp_links_color]',
+ array(
+ 'label' => __( 'FSMS Links Color', 'full-screen-morphing-search' ),
+ 'description' => esc_attr__( 'Change the links color', 'full-screen-morphing-search' ),
+ 'section' => 'fsmsp_color',
+ 'settings' => 'fsmsp_options[fsmsp_links_color]',
+ )
+ )
+ );
+
+ // ===========================
+ // = FSMS Links Hover Color. =
+ // ===========================
+ $wp_customize->add_setting(
+ 'fsmsp_options[fsmsp_links_hover_color]',
+ array(
+ 'default' => '#ec5a62',
+ 'sanitize_callback' => 'sanitize_hex_color',
+ 'capability' => 'edit_theme_options',
+ 'type' => 'option',
+ 'transport' => 'postMessage',
+ )
+ );
+
+ $wp_customize->add_control(
+ new WP_Customize_Color_Control(
+ $wp_customize,
+ 'fsmsp_options[fsmsp_links_hover_color]',
+ array(
+ 'label' => __( 'FSMS Links Hover Color', 'full-screen-morphing-search' ),
+ 'description' => esc_attr__( 'Change the links hover color', 'full-screen-morphing-search' ),
+ 'section' => 'fsmsp_color',
+ 'settings' => 'fsmsp_options[fsmsp_links_hover_color]',
+ )
)
);
}
+add_action( 'customize_register', 'full_screen_morphing_search_customize_register' );
+
+/**
+ * Output fsmsp_main_backgroung_color.
+ */
+/*function fsmsp_main_backgroung_color() {
+ $fsmsp_options = get_option( 'fsmsp_options' );
+ if ( ! empty( $fsmsp_options['fsmsp_main_backgroung_color'] ) ) {
+ $fsmsp_main_backgroung_color = $fsmsp_options['fsmsp_main_backgroung_color'];
+ } else {
+ $fsmsp_main_backgroung_color = '#f1f1f1';
+ }
+ echo esc_attr( $fsmsp_main_backgroung_color );
+}*/
+
+/**
+ * Output fsmsp_close_icon_color.
+ */
+function fsmsp_close_icon_color() {
+ $fsmsp_options = get_option( 'fsmsp_options' );
+ if ( ! empty( $fsmsp_options['fsmsp_close_icon_color'] ) ) {
+ $fsmsp_close_icon_color = $fsmsp_options['fsmsp_close_icon_color'];
+ } else {
+ $fsmsp_close_icon_color = '#000';
+ }
+ echo esc_attr( $fsmsp_close_icon_color );
+}
+
+/**
+ * Output fsmsp_search_text_color.
+ */
+function fsmsp_search_text_color() {
+ $fsmsp_options = get_option( 'fsmsp_options' );
+ if ( ! empty( $fsmsp_options['fsmsp_search_text_color'] ) ) {
+ $fsmsp_search_text_color = $fsmsp_options['fsmsp_search_text_color'];
+ } else {
+ $fsmsp_search_text_color = '#c2c2c2';
+ }
+ echo esc_attr( $fsmsp_search_text_color );
+}
+
+/**
+ * Output fsmsp_input_text_color.
+ */
+function fsmsp_input_text_color() {
+ $fsmsp_options = get_option( 'fsmsp_options' );
+ if ( ! empty( $fsmsp_options['fsmsp_input_text_color'] ) ) {
+ $fsmsp_input_text_color = $fsmsp_options['fsmsp_input_text_color'];
+ } else {
+ $fsmsp_input_text_color = '#ec5a62';
+ }
+ echo esc_attr( $fsmsp_input_text_color );
+}
+
+/**
+ * Output FSMS Magnifier Submit Color.
+ */
+function fsmsp_svg_color() {
+ // CN: Modify 'fill' attribute of in .
+ $response = wp_remote_get( 'https://plugins.svn.wordpress.org/full-screen-morphing-search/trunk/assets/img/magnifier.svg' );
+ if ( is_array( $response ) && ! is_wp_error( $response ) ) {
+ $svg = wp_remote_retrieve_body( $response );
+ $dom = new DOMDocument();
+ libxml_use_internal_errors( true );
+ $dom->loadHTML( $svg );
+ libxml_use_internal_errors( false );
+ $nodes = $dom->getElementsByTagName( 'path' );
+ foreach ( $nodes as $node ) {
+ $fsmsp_options = get_option( 'fsmsp_options' );
+ if ( ! empty( $fsmsp_options['fsmsp_magnifier_submit_color'] ) ) {
+ $fill = $node->setAttribute( 'fill', $fsmsp_options['fsmsp_magnifier_submit_color'] );
+ } else {
+ $fill = $node->setAttribute( 'fill', '#ddd' );
+ }
+ }
+ echo wp_kses( $dom->saveHTML(), 'full_screen_morphing_search_add_svg_tags' );
+ }
+}
+
+/**
+ * Output fsmsp_headings_color.
+ */
+function fsmsp_headings_color() {
+ $fsmsp_options = get_option( 'fsmsp_options' );
+ if ( ! empty( $fsmsp_options['fsmsp_headings_color'] ) ) {
+ $fsmsp_headings_color = $fsmsp_options['fsmsp_headings_color'];
+ } else {
+ $fsmsp_headings_color = '#c2c2c2';
+ }
+ echo esc_attr( $fsmsp_headings_color );
+}
+
+/**
+ * Output fsmsp_columns_background_color.
+ */
+function fsmsp_columns_background_color() {
+ $fsmsp_options = get_option( 'fsmsp_options' );
+ if ( ! empty( $fsmsp_options['fsmsp_columns_background_color'] ) ) {
+ $fsmsp_columns_background_color = $fsmsp_options['fsmsp_columns_background_color'];
+ } else {
+ $fsmsp_columns_background_color = '#ebebeb';
+ }
+ echo esc_attr( $fsmsp_columns_background_color );
+}
+
+/**
+ * Output fsmsp_columns_hover_background_color.
+ */
+function fsmsp_columns_hover_background_color() {
+ $fsmsp_options = get_option( 'fsmsp_options' );
+ if ( ! empty( $fsmsp_options['fsmsp_columns_hover_background_color'] ) ) {
+ $fsmsp_columns_hover_background_color = $fsmsp_options['fsmsp_columns_hover_background_color'];
+ } else {
+ $fsmsp_columns_hover_background_color = '#e4e4e5';
+ }
+ echo esc_attr( $fsmsp_columns_hover_background_color );
+}
+
+/**
+ * Output fsmsp_links_color.
+ */
+function fsmsp_links_color() {
+ $fsmsp_options = get_option( 'fsmsp_options' );
+ if ( ! empty( $fsmsp_options['fsmsp_links_color'] ) ) {
+ $fsmsp_links_color = $fsmsp_options['fsmsp_links_color'];
+ } else {
+ $fsmsp_links_color = '#b2b2b2';
+ }
+ echo esc_attr( $fsmsp_links_color );
+}
+
+/**
+ * Output fsmsp_links_hover_color.
+ */
+function fsmsp_links_hover_color() {
+ $fsmsp_options = get_option( 'fsmsp_options' );
+ if ( ! empty( $fsmsp_options['fsmsp_links_hover_color'] ) ) {
+ $fsmsp_links_hover_color = $fsmsp_options['fsmsp_links_hover_color'];
+ } else {
+ $fsmsp_links_hover_color = '#ec5a62';
+ }
+ echo esc_attr( $fsmsp_links_hover_color );
+}
diff --git a/languages/full-screen-morphing-search.pot b/languages/full-screen-morphing-search.pot
deleted file mode 100644
index 3ba9bbe..0000000
--- a/languages/full-screen-morphing-search.pot
+++ /dev/null
@@ -1,136 +0,0 @@
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: Full Screen Morphing Search\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2018-11-22 02:53+0000\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME \n"
-"Language-Team: \n"
-"Language: \n"
-"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: Loco https://localise.biz/\n"
-"X-Loco-Version: 2.2.0; wp-4.9.8"
-
-#: class-full-screen-morphing-search.php:87
-msgctxt "placeholder"
-msgid "Search …"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:39
-msgid "FSMS Plugin"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:47
-msgid "FSMS Colors"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:58
-msgid "FSMS Main Backgroung Color"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:59
-msgid "Change the main background color"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:80
-msgid "FSMS Close Icon Color"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:81
-msgid "Change the close icon color"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:102
-msgid "FSMS Search … text Color"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:103
-msgid "Change the search … text color"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:121
-msgid "FSMS Magnifier Submit Color"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:122
-msgid "Change the magnifier submit color"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:143
-msgid "FSMS Headings Color"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:144
-msgid "Change the headings color"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:162
-msgid "FSMS Columns Background Color"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:163
-msgid "Change the columns background color"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:181
-msgid "FSMS Columns Hover Background Color"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:182
-msgid "Change the columns hover background color"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:203
-msgid "FSMS Links Color"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:204
-msgid "Change the links color"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:222
-msgid "FSMS Links Hover Color"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:223
-msgid "Change the links hover color"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:239
-msgid "FSMS Search Form"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:250
-msgid "FSMS Search Form Text"
-msgstr ""
-
-#: functions-full-screen-morphing-search.php:251
-msgid ""
-"Change the search form text. If leaved blank, it will return to original "
-"value !"
-msgstr ""
-
-#. Name of the plugin
-msgid "Full Screen Morphing Search"
-msgstr ""
-
-#. Description of the plugin
-msgid ""
-"Effect for any WordPress search input that morphs into a fullscreen overlay."
-msgstr ""
-
-#. URI of the plugin
-msgid "http://tympanus.net/codrops/2014/11/04/simple-morphing-search/"
-msgstr ""
-
-#. Author of the plugin
-msgid "LebCit"
-msgstr ""
-
-#. Author URI of the plugin
-msgid "https://lebcit.tk/"
-msgstr ""
diff --git a/readme.txt b/readme.txt
index e2581c1..559e904 100644
--- a/readme.txt
+++ b/readme.txt
@@ -2,9 +2,8 @@
Contributors: lebcit
Tags: search, full screen search, morphing search, search overlay, jQuery UI autocomplete
Requires at least: 4.6
-Tested up to: 5.2.2
-Requires PHP: 5.6
-Stable tag: 2.7
+Tested up to: 4.9.4
+Stable tag: 1.2.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -14,8 +13,6 @@ Responsive Full Screen Morphing Search Page Overlay With Predictive Autocomplete
= Full Screen Morphing Search =
-**Please Read The FAQ **
-
Effect for any WordPress search input that morphs into a fullscreen overlay.
Enlarge the search input and show 5 most recent posts, 5 most used categories and tags with counter.
Once the input is clicked, the whole search element expands to a fullscreen overlay.
@@ -24,9 +21,6 @@ The fullscreen overlay has a bigger search input.
There are no settings for this plugin. Simply activate it, click on any search input and see the magic happens !
**PLEASE, MAKE SURE TO HAVE AT LEAST ONE POST WITH ONE CATEGORY AND ONE TAG BEFORE ACTIVATING**
-**As of version 2.0**, head over the Customizer, look for **FSMS Plugin**, design it as you want !
-You can change colors, search placeholder's text and default icons with a styling option !
-
Don't forget to take a look at the FAQ Section.
If you have some issues **don't hesitate**, head over to the Support Section !
You can also visit my site LebCit.Tk to see the plugin in action and leave your comments.
@@ -36,7 +30,7 @@ If you use this plugin, please consider leaving a Manoela Ilic .
If you want to learn more about this plugin, visit the Simple Morphing Search original post.
-> A Picture is worth a thousand words
+> A Picture is worth a thousand words
I think that a demo is even better !
See how Full Screen Morphing Search works.
@@ -45,46 +39,30 @@ The jQuery UI autocompletition implemented in this plugin is based on Dominykas
How to create a jQuery autocomplete drop down in WordPress
The main plugin icon is made by Pixel Buddha from www.flaticon.com and is licensed by CC 3.0 BY
-The article icon is made by Freepik from www.flaticon.com and is licensed by CC 3.0 BY
-The category icon is made by Freepik from www.flaticon.com and is licensed by CC 3.0 BY
-The tag icon is made by Freepik from www.flaticon.com and is licensed by CC 3.0 BY
+The category icon is made by Picol from www.flaticon.com and is licensed by CC 3.0 BY
+The tag icon is made by Elegant Themes from www.flaticon.com and is licensed by CC 3.0 BY
== Installation ==
= How to install the plugin and get it working. =
1. Install Full Screen Morphing Search plugin through the WordPress plugins screen directly.
-2. **Make sure to have at least one post with one category and one tag before activating**.
+2. Make sure to have at least one post with one category and one tag before activating.
3. Activate the plugin through the 'Plugins' screen in WordPress.
4. Navigate to your site and click on any search input and see the magic happens !
-5. In the Customizer, look for **FSMS Plugin**, design it as you want !
== Frequently Asked Questions ==
= Recent posts thumbnails are not round ! =
You will have to use a thumbnail regenerator.
-I recommend Regenerate Thumbnails .
+I recommend Force Regenerate Thumbnails .
= The overlay is not covering the whole page ! =
-
If your theme has some boxed style(s), like Twenty Sixteen or Twenty Twelve,
the overlay will only cover the inside box (the site content) !
-= How to change the search input text color ? =
-
-First, you'll have to type something in the input,
-then choose the desired color.
-Take a look at the Screenshots .
-
-= How to change the shape of New Icon/Image ? =
-
-First make sure that you have used a thumbnail regenerator, see first FAQ.
-Then, click on the checkbox option **Icon/Image Round or Not ?!**
-If the new Icon/Image is already round (like the default one of category and tag), this option will have no effect !
-
= Autocomplete predicts only posts and pages ! =
-
Yes, just for now !
I'll be adding some more cool functions with time.
@@ -95,52 +73,8 @@ The first column shows the most 5 recent posts.
The second column shows the top 5 used categories and how many posts each category has.
The third column shows the top 5 used tags and how many posts each tag has.
-2. FSMS Plugin in the Customizer.
-
-3. Posts with no Featured Image defined.
-
-4. Change the default icons and choose to make the new Icon/Image Round or Not !
-
-5. First type something in the input text field, then change the input text color.
-
-6. Old screenshot.
-
== Changelog ==
-= 2.7 =
-* Corrected Undefined Index 'fsmsp_search_form_text'.
-
-= 2.6 =
-* Corrected Undefined Index Error.
-* Force Search Input height.
-* Tested up to version 5.2.2 of WordPress.
-
-= 2.5 =
-* Tested up to version 5.2 of WordPress.
-* Updated Kirki from 3.0.34.1 to 3.0.35.3
-
-= 2.4 =
-* Added full_screen_morphing_search_add_svg_tags( $svg_tags )
-* Changed magnifier.svg
-* Removed file_get_contents()
-
-= 2.3 =
-* Corrected Undefined Index Error.
-* Removed Undefined Index Error from FAQ Section.
-
-= 2.2 =
-* Corrected MutationObserver for categories and tags icons.
-* Updated readme FAQ section for Undefined Index Error.
-
-= 2.1 =
-* Added ability to change icons from Customizer.
-* Added ability to change input text color.
-* Added italic font-style to input.
-* Changed placehoder's text behaviour on total remove.
-
-= 2.0 =
-* Plugin rewritten from ground up.
-
= 1.2.1 =
* Tested up to version 4.9.4 of WordPress.