balmet.com

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

post-preview.php (1567B)


      1 <?php
      2 namespace Elementor\Core\Files\CSS;
      3 
      4 use Elementor\Plugin;
      5 
      6 if ( ! defined( 'ABSPATH' ) ) {
      7 	exit; // Exit if accessed directly.
      8 }
      9 
     10 /**
     11  * Elementor post preview CSS file.
     12  *
     13  * Elementor CSS file handler class is responsible for generating the post
     14  * preview CSS file.
     15  *
     16  * @since 1.9.0
     17  */
     18 class Post_Preview extends Post_Local_Cache {
     19 
     20 	/**
     21 	 * Preview ID.
     22 	 *
     23 	 * Holds the ID of the current post being previewed.
     24 	 *
     25 	 * @var int
     26 	 */
     27 	private $post_id_for_data;
     28 
     29 	/**
     30 	 * Post preview CSS file constructor.
     31 	 *
     32 	 * Initializing the CSS file of the post preview. Set the post ID and the
     33 	 * parent ID and initiate the stylesheet.
     34 	 *
     35 	 * @since 1.9.0
     36 	 * @access public
     37 	 *
     38 	 * @param int $post_id Post ID.
     39 	 */
     40 	public function __construct( $post_id ) {
     41 		$this->post_id_for_data = $post_id;
     42 
     43 		$parent_id = wp_get_post_parent_id( $post_id );
     44 
     45 		parent::__construct( $parent_id );
     46 	}
     47 
     48 	protected function get_post_id_for_data() {
     49 		return $this->post_id_for_data;
     50 	}
     51 
     52 	/**
     53 	 * @since 2.1.0
     54 	 * @access public
     55 	 * @deprecated 3.0.0 Use `Post_Preview::get_post_id_for_data()` instead
     56 	 */
     57 	protected function get_preview_id() {
     58 		_deprecated_function( __METHOD__, '3.0.0', __CLASS__ . '::get_post_id_for_data()' );
     59 
     60 		return $this->get_post_id_for_data();
     61 	}
     62 
     63 	/**
     64 	 * Get file handle ID.
     65 	 *
     66 	 * Retrieve the handle ID for the previewed post CSS file.
     67 	 *
     68 	 * @since 1.9.0
     69 	 * @access protected
     70 	 *
     71 	 * @return string CSS file handle ID.
     72 	 */
     73 	protected function get_file_handle_id() {
     74 		return 'elementor-preview-' . $this->get_post_id_for_data();
     75 	}
     76 }