Server IP : 172.67.158.161 / Your IP : 3.133.148.117 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/giankuin/sieuthiweb.com.vn/wp-content/themes/flatsome/inc/admin/kirki/modules/postmessage/ |
Upload File : |
<?php /** * Automatic postMessage scripts calculation for Kirki controls. * * @package Kirki * @category Modules * @author Ari Stathopoulos (@aristath) * @copyright Copyright (c) 2020, David Vongries * @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_PostMessage { /** * 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() { 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.0 * @return object */ public static function get_instance() { if ( ! self::$instance ) { self::$instance = new self(); } return self::$instance; } /** * Enqueues the postMessage script * and adds variables to it using the wp_localize_script function. * The rest is handled via JS. */ public function postmessage() { wp_enqueue_script( 'kirki_auto_postmessage', trailingslashit( Kirki::$url ) . 'modules/postmessage/postmessage.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['js_vars'] ) && ! empty( $field['js_vars'] ) && is_array( $field['js_vars'] ) && isset( $field['settings'] ) ) { $data[] = $field; } } wp_localize_script( 'kirki_auto_postmessage', 'kirkiPostMessageFields', $data ); $extras = apply_filters( 'kirki_postmessage_script', false ); if ( $extras ) { wp_add_inline_script( 'kirki_auto_postmessage', $extras, 'after' ); } } }