| 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 |
* Get file handle ID. |
| 54 |
* |
| 55 |
* Retrieve the handle ID for the previewed post CSS file. |
| 56 |
* |
| 57 |
* @since 1.9.0 |
| 58 |
* @access protected |
| 59 |
* |
| 60 |
* @return string CSS file handle ID. |
| 61 |
*/ |
| 62 |
protected function get_file_handle_id() { |
| 63 |
return 'elementor-preview-' . $this->get_post_id_for_data(); |
| 64 |
} |
| 65 |
} |
| 66 |
|