mirror of
https://ghproxy.net/https://github.com/AlxMedia/splits.git
synced 2025-08-27 01:44:44 +08:00
Initial commit
This commit is contained in:
commit
9f13aa6240
389 changed files with 84369 additions and 0 deletions
|
@ -0,0 +1,159 @@
|
|||
<?php
|
||||
/**
|
||||
* Custom Sections.
|
||||
*
|
||||
* @package Kirki
|
||||
* @category Modules
|
||||
* @subpackage Custom Sections Module
|
||||
* @author Ari Stathopoulos (@aristath)
|
||||
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 3.0.0
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds styles to the customizer.
|
||||
*/
|
||||
class Kirki_Modules_Custom_Sections {
|
||||
|
||||
/**
|
||||
* The object instance.
|
||||
*
|
||||
* @static
|
||||
* @access private
|
||||
* @since 3.0.0
|
||||
* @var object
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @access protected
|
||||
* @since 3.0.0
|
||||
*/
|
||||
protected function __construct() {
|
||||
|
||||
// Register the new section types.
|
||||
add_filter( 'kirki_section_types', array( $this, 'set_section_types' ) );
|
||||
|
||||
// Register the new panel types.
|
||||
add_filter( 'kirki_panel_types', array( $this, 'set_panel_types' ) );
|
||||
|
||||
// Include the section-type files.
|
||||
add_action( 'customize_register', array( $this, 'include_sections_and_panels' ) );
|
||||
|
||||
// Enqueue styles & scripts.
|
||||
add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_scrips' ), 999 );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 the custom section types.
|
||||
*
|
||||
* @access public
|
||||
* @since 3.0.0
|
||||
* @param array $section_types The registered section-types.
|
||||
* @return array
|
||||
*/
|
||||
public function set_section_types( $section_types ) {
|
||||
$new_types = array(
|
||||
'kirki-default' => 'Kirki_Sections_Default_Section',
|
||||
'kirki-expanded' => 'Kirki_Sections_Expanded_Section',
|
||||
'kirki-nested' => 'Kirki_Sections_Nested_Section',
|
||||
'kirki-link' => 'Kirki_Sections_Link_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; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
|
||||
continue;
|
||||
}
|
||||
$path = str_replace( 'class-kirki-sections-kirki-', 'class-kirki-sections-', $path );
|
||||
if ( file_exists( $path ) ) {
|
||||
include_once $path; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
|
||||
continue;
|
||||
}
|
||||
$path = str_replace( 'class-kirki-panels-kirki-', 'class-kirki-panels-', $path );
|
||||
if ( file_exists( $path ) ) {
|
||||
include_once $path; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
/**
|
||||
* Nested section.
|
||||
*
|
||||
* @package Kirki
|
||||
* @subpackage Custom Sections Module
|
||||
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 3.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Nested panel.
|
||||
*/
|
||||
class Kirki_Panels_Nested_Panel extends WP_Customize_Panel {
|
||||
|
||||
/**
|
||||
* The parent panel.
|
||||
*
|
||||
* @access public
|
||||
* @since 3.0.0
|
||||
* @var string
|
||||
*/
|
||||
public $panel;
|
||||
|
||||
/**
|
||||
* Type of this panel.
|
||||
*
|
||||
* @access public
|
||||
* @since 3.0.0
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'kirki-nested';
|
||||
|
||||
/**
|
||||
* Gather the parameters passed to client JavaScript via JSON.
|
||||
*
|
||||
* @access public
|
||||
* @since 3.0.0
|
||||
* @return array The array to be exported to the client as JSON.
|
||||
*/
|
||||
public function json() {
|
||||
$array = wp_array_slice_assoc(
|
||||
(array) $this,
|
||||
array(
|
||||
'id',
|
||||
'description',
|
||||
'priority',
|
||||
'type',
|
||||
'panel',
|
||||
)
|
||||
);
|
||||
|
||||
$array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) );
|
||||
$array['content'] = $this->get_content();
|
||||
$array['active'] = $this->active();
|
||||
$array['instanceNumber'] = $this->instance_number;
|
||||
|
||||
return $array;
|
||||
}
|
||||
}
|
29
functions/kirki/modules/custom-sections/sections.css
Normal file
29
functions/kirki/modules/custom-sections/sections.css
Normal file
|
@ -0,0 +1,29 @@
|
|||
#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 .control-section-kirki-link .button {
|
||||
margin-top: -3px;
|
||||
}
|
||||
|
||||
#customize-theme-controls .customize-pane-child.current-section-parent,
|
||||
.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel-parent {
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
|
||||
.control-section-kirki-nested {
|
||||
margin: 0 -12px;
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=sections.css.map */
|
267
functions/kirki/modules/custom-sections/sections.js
Normal file
267
functions/kirki/modules/custom-sections/sections.js
Normal file
|
@ -0,0 +1,267 @@
|
|||
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://github.com/justintadlock/trt-customizer-pro
|
||||
*/
|
||||
( function() {
|
||||
wp.customize.sectionConstructor['kirki-link'] = wp.customize.Section.extend( {
|
||||
attachEvents: function() {},
|
||||
isContextuallyActive: function() {
|
||||
return true;
|
||||
}
|
||||
} );
|
||||
} () );
|
||||
|
||||
/**
|
||||
* @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 ) );
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
/**
|
||||
* The default section.
|
||||
*
|
||||
* @package Kirki
|
||||
* @subpackage Custom Sections Module
|
||||
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 2.2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Default Section.
|
||||
*/
|
||||
class Kirki_Sections_Default_Section extends WP_Customize_Section {
|
||||
|
||||
/**
|
||||
* The section type.
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'kirki-default';
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
/**
|
||||
* An expanded section.
|
||||
*
|
||||
* @package Kirki
|
||||
* @subpackage Custom Sections Module
|
||||
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 2.2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Expanded Section.
|
||||
*/
|
||||
class Kirki_Sections_Expanded_Section extends WP_Customize_Section {
|
||||
|
||||
/**
|
||||
* The section type.
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'kirki-expanded';
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
/**
|
||||
* The default section.
|
||||
* Inspired from https://github.com/justintadlock/trt-customizer-pro
|
||||
*
|
||||
* @package Kirki
|
||||
* @subpackage Custom Sections Module
|
||||
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 3.0.36
|
||||
*/
|
||||
|
||||
/**
|
||||
* Link Section.
|
||||
*/
|
||||
class Kirki_Sections_Link_Section extends WP_Customize_Section {
|
||||
|
||||
/**
|
||||
* The section type.
|
||||
*
|
||||
* @since 3.0.36
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'kirki-link';
|
||||
|
||||
/**
|
||||
* Button Text
|
||||
*
|
||||
* @since 3.0.36
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $button_text = '';
|
||||
|
||||
/**
|
||||
* Button URL.
|
||||
*
|
||||
* @since 3.0.36
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $button_url = '';
|
||||
|
||||
/**
|
||||
* Gather the parameters passed to client JavaScript via JSON.
|
||||
*
|
||||
* @access public
|
||||
* @since 3.0.36
|
||||
* @return array The array to be exported to the client as JSON.
|
||||
*/
|
||||
public function json() {
|
||||
$json = parent::json();
|
||||
|
||||
$json['button_text'] = $this->button_text;
|
||||
$json['button_url'] = esc_url( $this->button_url );
|
||||
|
||||
return $json;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the Underscore.js template.
|
||||
*
|
||||
* @since 3.0.36
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
protected function render_template() {
|
||||
?>
|
||||
<li id="accordion-section-{{ data.id }}" class="accordion-section control-section control-section-{{ data.type }} cannot-expand">
|
||||
<h3 class="accordion-section-title">
|
||||
{{ data.title }}
|
||||
<a href="{{ data.button_url }}" class="button alignright" target="_blank" rel="nofollow">{{ data.button_text }}</a>
|
||||
</h3>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
/**
|
||||
* Nested section.
|
||||
*
|
||||
* @package Kirki
|
||||
* @subpackage Custom Sections Module
|
||||
* @copyright Copyright (c) 2019, Ari Stathopoulos (@aristath)
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 2.2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Nested section.
|
||||
*/
|
||||
class Kirki_Sections_Nested_Section extends WP_Customize_Section {
|
||||
|
||||
/**
|
||||
* The parent section.
|
||||
*
|
||||
* @access public
|
||||
* @since 3.0.0
|
||||
* @var string
|
||||
*/
|
||||
public $section;
|
||||
|
||||
/**
|
||||
* The section type.
|
||||
*
|
||||
* @access public
|
||||
* @since 3.0.0
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'kirki-nested';
|
||||
|
||||
/**
|
||||
* Gather the parameters passed to client JavaScript via JSON.
|
||||
*
|
||||
* @access public
|
||||
* @since 3.0.0
|
||||
* @return array The array to be exported to the client as JSON.
|
||||
*/
|
||||
public function json() {
|
||||
$array = wp_array_slice_assoc(
|
||||
(array) $this,
|
||||
array(
|
||||
'id',
|
||||
'description',
|
||||
'priority',
|
||||
'panel',
|
||||
'type',
|
||||
'description_hidden',
|
||||
'section',
|
||||
)
|
||||
);
|
||||
|
||||
$array['title'] = html_entity_decode( $this->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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue