PluginProbe ʕ •ᴥ•ʔ
Essential Classy Addons for Elementor – 150+ Widgets, Templates & Performance Tools / 3.0.31
Essential Classy Addons for Elementor – 150+ Widgets, Templates & Performance Tools v3.0.31
3.0.59 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 3.0 3.0.1 3.0.10 3.0.11 3.0.12 3.0.13 3.0.14 3.0.15 3.0.16 3.0.18 3.0.2 3.0.20 3.0.21 3.0.22 3.0.23 3.0.24 3.0.25 3.0.26 3.0.27 3.0.28 3.0.29 3.0.3 3.0.30 3.0.31 3.0.32 3.0.33 3.0.34 3.0.35 3.0.36 3.0.37 3.0.38 3.0.39 3.0.4 3.0.40 3.0.41 3.0.42 3.0.43 3.0.44 3.0.45 3.0.46 3.0.47 3.0.48 3.0.49 3.0.5 3.0.50 3.0.51 3.0.52 3.0.53 3.0.54 3.0.55 3.0.56 3.0.57 3.0.58 3.0.6 3.0.7 3.0.8 3.0.9
essential-classy-addons-for-elementor / classes / builder-content.php
essential-classy-addons-for-elementor / classes Last commit date
builders 1 year ago documents 1 year ago builder-content.php 1 year ago class-helper.php 1 year ago class-loader.php 1 year ago class-panel-options.php 1 year ago conditions-file.php 1 year ago conditions-rules.php 1 year ago elementor-document.php 1 year ago theme-builder.php 1 year ago widgets-passing-lists.php 1 year ago
builder-content.php
88 lines
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit; // Exit if accessed directly.
4 }
5
6 class Ec_Template_Builder_Content {
7
8 public static $instance = null;
9
10 public static function get_instance() {
11 if ( ! isset( self::$instance ) ) {
12 self::$instance = new self;
13 }
14 return self::$instance;
15 }
16
17 public function ec_get_render_content( $template_ids = ''){
18 $content = '';
19 if( is_array($template_ids) ){
20 foreach( $template_ids as $post_id){
21 $content .= $this->ec_render_content($post_id);
22 }
23 }else{
24 $content .= $this->ec_render_content( $template_ids );
25 }
26
27 return $content;
28 }
29
30 public function ec_render_content( $post_id = ''){
31 global $wp_post_types;
32
33 // Check if the post is published
34 if ( 'publish' !== get_post_status( $post_id ) ) {
35 return esc_html__( 'Template Not Yet Published.', 'essential-classy-addons-for-elementor' );
36 }
37
38 //Elementor Builder
39 if ( class_exists( '\Elementor\Plugin' ) && $this->ec_is_elementor_build($post_id) ) {
40 $has_css = false;
41 if (('internal' === get_option('elementor_css_print_method')) || \Elementor\Plugin::$instance->preview->is_preview_mode()) {
42 $has_css = true;
43 }
44 $content = \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $post_id, $has_css ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
45 if(empty($content)){
46 $content = \Elementor\Plugin::instance()->frontend->get_builder_content( $post_id );
47 }
48
49 return $content;
50 }
51
52 $has_rest_support = $wp_post_types[ ECAFE_POST ]->show_in_rest;
53
54 if ( $has_rest_support ) {
55 $output = '';
56 $curr_post = get_post( $post_id, OBJECT );
57
58 if ( has_blocks( $curr_post ) ) {
59 $blocks = parse_blocks( $curr_post->post_content );
60 foreach ( $blocks as $block ) {
61 $output .= render_block( $block );
62 }
63 } else if(isset($curr_post->post_content) && !empty($curr_post->post_content)) {
64 $output = $curr_post->post_content;
65 }
66
67 ob_start();
68 echo do_shortcode( $output );
69 return ob_get_clean(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
70 }
71 }
72
73 /**
74 * Check Elementor Builder
75 */
76 public function ec_is_elementor_build( $post_id ) {
77 if(class_exists( '\Elementor\Plugin' ) ){
78 $document = \Elementor\Plugin::$instance->documents->get( $post_id );
79 if ( $document ) {
80 return $document->is_built_with_elementor();
81 } else {
82 return false;
83 }
84 }else{
85 return false;
86 }
87 }
88 }