for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Customizer Controls Init.
*
* @package Kirki
* @subpackage Controls
* @copyright Copyright (c) 2017, Aristeides Stathopoulos
* @license https://opensource.org/licenses/MIT
* @since 3.0.17
*/
* Controls.
class Kirki_Controls {
* An array of templates to load.
* @access private
* @var array
private $templates = array(
'code',
'color',
'generic',
'image',
'number',
'radio',
'select',
'textarea',
);
* Path to controls views.
* @var string
private $views_path;
* Constructor.
* @access public
public function __construct() {
if ( ! $this->views_path ) {
$this->views_path = wp_normalize_path( dirname( KIRKI_PLUGIN_FILE ) . '/controls/views/' );
}
add_action( 'customize_controls_print_footer_scripts', array( $this, 'underscore_templates' ) );
* Adds underscore.js templates to the footer.
public function underscore_templates() {
foreach ( $this->templates as $template ) {
if ( file_exists( $this->views_path . $template . '.php' ) ) {
echo '<script type="text/html" id="tmpl-kirki-input-' . esc_attr( $template ) . '">';
include $this->views_path . $template . '.php';
echo '</script>';