class-ele-builder-document-base.php
1 year ago
class-ele-builder-documents.php
1 year ago
class-ele-document-singular.php
1 year ago
class-ele-document-singular.php
42 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Class: Ecafe_Ele_Document |
| 4 | * Name: Ecafe Document |
| 5 | * Slug: ec_theme_builder |
| 6 | * |
| 7 | * @package Ecafe |
| 8 | * @since 3.0.24 |
| 9 | */ |
| 10 | if ( ! defined( 'WPINC' ) ) { |
| 11 | die; |
| 12 | } |
| 13 | |
| 14 | class Ecafe_Ele_Document extends Ecafe_Ele_Document_Base { |
| 15 | |
| 16 | public function get_name() { |
| 17 | return 'ec_theme_builder'; |
| 18 | } |
| 19 | |
| 20 | public static function get_title() { |
| 21 | return esc_html__( 'Template Builder', 'essential-classy-addons-for-elementor' ); |
| 22 | } |
| 23 | |
| 24 | public function get_wp_preview_url() { |
| 25 | $current_post_id = $this->get_main_id(); |
| 26 | $document = new Ecafe_Elementor_Builder_Documents(); |
| 27 | $preview_url = get_permalink($current_post_id); |
| 28 | if(method_exists( $document, 'preview_post_setting' )){ |
| 29 | $prev_data = $document->preview_post_setting( $current_post_id ); |
| 30 | $preview_url = (isset($prev_data['preview_url']) && !empty($prev_data['preview_url'])) ? $prev_data['preview_url'] : get_permalink($current_post_id); |
| 31 | } |
| 32 | return add_query_arg( |
| 33 | [ |
| 34 | 'preview_nonce' => wp_create_nonce( 'post_preview_' . $current_post_id ), |
| 35 | 'ecafe_build_template' => $current_post_id, |
| 36 | ], |
| 37 | esc_url($preview_url) |
| 38 | ); |
| 39 | |
| 40 | } |
| 41 | |
| 42 | } |