ru-se.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

dynamic-css.php (1190B)


      1 <?php
      2 /**
      3  * Generates & echo the styles when using the AJAx method.
      4  *
      5  * @package     Kirki
      6  * @category    Core
      7  * @author      Aristeides Stathopoulos
      8  * @copyright   Copyright (c) 2016, Aristeides Stathopoulos
      9  * @license     http://opensource.org/licenses/https://opensource.org/licenses/MIT
     10  */
     11 
     12 // Do not allow directly accessing this file.
     13 if ( ! class_exists( 'Kirki' ) ) {
     14 	die( 'File can\'t be accessed directly' );
     15 }
     16 
     17 // Make sure we set the correct MIME type.
     18 header( 'Content-Type: text/css' );
     19 
     20 // Echo the styles.
     21 $configs = Kirki::$config;
     22 foreach ( $configs as $config_id => $args ) {
     23 	if ( true === $args['disable_output'] ) {
     24 		continue;
     25 	}
     26 
     27 	$styles = Kirki_Styles_Frontend::loop_controls( $config_id );
     28 	$styles = apply_filters( 'kirki/' . $config_id . '/dynamic_css', $styles );
     29 
     30 	// Some people put weird stuff in their CSS, KSES tends to be greedy.
     31 	$styles = str_replace( '<=', '&lt;=', $styles );
     32 
     33 	$styles = wp_kses_post( $styles );
     34 
     35 	// @codingStandardsIgnoreStart
     36 
     37 	// Why both KSES and strip_tags? Because we just added some '>'.
     38 	// kses replaces lone '>' with &gt;.
     39 	echo strip_tags( str_replace( '&gt;', '>', $styles ) );
     40 	// @codingStandardsIgnoreStop
     41 }