| Server IP : 34.67.85.211 / Your IP : 216.73.217.52 Web Server : Apache System : Linux wordpress-1-vm 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64 User : root ( 0) PHP Version : 7.4.9 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /var/www/html/wp-content/plugins/kirki/modules/post-meta/ |
Upload File : |
<?php
/**
* Customize_Queried_Post_Info class.
*
* @package CustomizeQueriedPostInfo
*/
/**
* Class Customize_Queried_Post_Info.
*/
class Kirki_Modules_Post_Meta {
/**
* The object instance.
*
* @static
* @access private
* @since 3.0.0
* @var object
*/
private static $instance;
/**
* 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;
}
/**
* Constructor.
*
* @access protected
* @since 3.1.0
*/
protected function __construct() {
add_action( 'customize_preview_init', array( $this, 'customize_preview_init' ) );
add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_control_scripts' ) );
}
/**
* Enqueue Customizer control scripts.
*
* @access public
* @since 3.1.0
*/
public function enqueue_control_scripts() {
wp_enqueue_script( 'kirki_post_meta_previewed_controls', trailingslashit( Kirki::$url ) . 'modules/post-meta/customize-controls.js', array( 'jquery', 'customize-controls' ), KIRKI_VERSION, true );
}
/**
* Initialize Customizer preview.
*
* @access public
* @since 3.1.0
*/
public function customize_preview_init() {
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_preview_scripts' ) );
}
/**
* Enqueue script for Customizer preview.
*
* @access public
* @since 3.1.0
*/
public function enqueue_preview_scripts() {
wp_enqueue_script( 'kirki_post_meta_previewed_preview', trailingslashit( Kirki::$url ) . 'modules/post-meta/customize-preview.js', array( 'jquery', 'customize-preview' ), KIRKI_VERSION, true );
$wp_scripts = wp_scripts();
$queried_post = null;
if ( is_singular() && get_queried_object() ) {
$queried_post = get_queried_object();
$queried_post->meta = get_post_custom( $queried_post->id );
}
$wp_scripts->add_data( 'kirki_post_meta_previewed_preview', 'data', sprintf( 'var _customizePostPreviewedQueriedObject = %s;', wp_json_encode( $queried_post ) ) );
}
}