/home/techb158/public_html/wp-content/plugins/kirki/customizer/packages/modules/css/src
Edit: /home/techb158/public_html/wp-content/plugins/kirki/customizer/packages/modules/css/src/CSS.php (12855B)
$args['output'],
),
);
}
// Convert to array of arrays if needed.
if (isset($args['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($args['settings'])), '3.0.10');
$args['output'] = array($args['output']);
}
if (empty($args['output'])) {
return;
}
foreach ($args['output'] as $key => $output) {
if (empty($output) || !isset($output['element'])) {
unset($args['output'][$key]);
continue;
}
if (!isset($output['sanitize_callback']) && isset($output['callback'])) {
$args['output'][$key]['sanitize_callback'] = $output['callback'];
}
// Convert element arrays to strings.
if (isset($output['element']) && is_array($output['element'])) {
$args['output'][$key]['element'] = array_unique($args['output'][$key]['element']);
sort($args['output'][$key]['element']);
// Trim each element in the array.
foreach ($args['output'][$key]['element'] as $index => $element) {
$args['output'][$key]['element'][$index] = trim($element);
}
$args['output'][$key]['element'] = implode(',', $args['output'][$key]['element']);
}
// Fix for https://github.com/aristath/kirki/issues/1659#issuecomment-346229751.
$args['output'][$key]['element'] = str_replace(array("\t", "\n", "\r", "\0", "\x0B"), ' ', $args['output'][$key]['element']);
$args['output'][$key]['element'] = trim(preg_replace('/\s+/', ' ', $args['output'][$key]['element']));
}
if (!isset($args['type']) && isset($object->type)) {
$args['type'] = $object->type;
}
self::$fields[] = $args;
}
/**
* Print styles inline.
*
* @access public
* @since 3.0.36
* @return void
*/
public function print_styles_inline()
{
$should_print = true;
if (defined('KIRKI_NO_OUTPUT') && true === KIRKI_NO_OUTPUT) {
$should_print = false;
}
ob_start();
$this->print_styles();
$inline_styles = ob_get_clean();
/**
* If KIRKI_NO_OUTPUT constant is defined (and is true), but typography field is defined, then print it.
* Otherwise, the typography field might be broken (missing font-family) if the font-face is not outputted.
*/
if (!$should_print && false !== stripos($inline_styles, '@font-face')) {
$should_print = true;
}
if (!$should_print) {
return;
}
$inline_styles_id = apply_filters('kirki_inline_styles_id', self::$inline_styles_id);
echo '';
}
/**
* Enqueue the styles.
*
* @access public
* @since 3.0.36
* @return void
*/
public function enqueue_styles()
{
$args = array(
'action' => apply_filters('kirki_styles_action_handle', self::$css_handle),
);
if (is_admin()) {
global $current_screen;
/**
* This `enqueue_styles` method is also hooked into `enqueue_block_editor_assets`.
* It needs to be excluded from customize control page.
*
* Why not simply excluding all admin area except gutenberg editing interface?
* Because it would be nice to let the possibility open
* if a 3rd party plugin will output gutenberg styles somewhere in admin area.
*
* Example of possibility:
* In the future, Ultimate Dashboard Pro's admin page feature might supports Gutenberg.
*/
if (is_object($current_screen) && property_exists($current_screen, 'id') && 'customize' === $current_screen->id) {
return;
}
if (property_exists($current_screen, 'is_block_editor') && 1 === (int) $current_screen->is_block_editor) {
$args['editor'] = '1';
}
}
// Enqueue the dynamic stylesheet.
wp_enqueue_style(
self::$css_handle,
add_query_arg( $args, home_url() ),
array(),
'4.0'
);
}
/**
* Prints the styles as an enqueued file.
*
* @access public
* @since 3.0.36
* @return void
*/
public function print_styles_action()
{
/**
* Note to code reviewers:
* There is no need for a nonce check here, we're only checking if this is a valid request or not.
*/
// phpcs:ignore WordPress.Security.NonceVerification
if (empty($_GET['action']) || apply_filters('kirki_styles_action_handle', self::$css_handle) !== $_GET['action']) {
return;
}
// This is a stylesheet.
header('Content-type: text/css');
$this->print_styles();
exit;
}
/**
* Prints the styles.
*
* @access public
*/
public function print_styles()
{
// Go through all configs.
$configs = Kirki::$config;
foreach ($configs as $config_id => $args) {
if (defined('KIRKI_NO_OUTPUT') && true === KIRKI_NO_OUTPUT) {
continue;
}
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)) {
/**
* Note to code reviewers:
*
* Though all output should be run through an escaping function, this is pure CSS.
*
* When used in the print_styles_action() method the PHP header() call makes the browser interpret it as such.
* No code, script or anything else can be executed from inside a stylesheet.
*
* When using in the print_styles_inline() method the wp_strip_all_tags call we use below
* strips anything that has the possibility to be malicious, and since this is inslide a