PluginProbe ʕ •ᴥ•ʔ
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor / 4.0.0
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor v4.0.0
4.0.2 4.0.1 4.0.0 3.10.02 3.10.01 3.9.10 3.9.9 3.9.8 3.9.7 3.9.5 3.9.6 3.9.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.3.0 2.3.1 2.3.1.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.4.0 2.5.0 2.5.1 2.5.10 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.8.5 2.8.6 2.8.7 2.8.8 2.9.0 2.9.1 2.9.2 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.6.0 3.6.1 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8.0 3.8.1 3.8.2 3.9.0 3.9.1 3.9.2 trunk 1.2.6 1.2.7 1.2.9 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.11 1.5.12 1.5.2 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.0.9.1 2.0.9.2 2.0.9.3
elementskit-lite / modules / controls / widget-area-utils.php
elementskit-lite / modules / controls Last commit date
assets 3 weeks ago ajax-select2-api.php 3 weeks ago ajax-select2.php 2 years ago control-manager.php 4 years ago image-choose.php 2 years ago init.php 4 years ago widget-area-modal.php 3 years ago widget-area-utils.php 6 months ago widget-area.php 2 years ago
widget-area-utils.php
122 lines
1 <?php
2 namespace ElementsKit_Lite\Modules\Controls;
3
4 defined( 'ABSPATH' ) || exit;
5
6 class Widget_Area_Utils {
7
8 function init() {
9 add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'modal_content' ) );
10
11 add_action( 'wp_ajax_ekit_widgetarea_content', array( $this, 'ekit_widgetarea_content' ) );
12 add_action( 'wp_ajax_nopriv_ekit_widgetarea_content', array( $this, 'ekit_widgetarea_content' ) );
13 }
14
15 public function ekit_widgetarea_content() {
16
17 if ( !isset($_POST['nonce']) || !wp_verify_nonce( sanitize_key( wp_unslash( $_POST['nonce'] ) ), 'ekit_pro' ) ) {
18 wp_die();
19 }
20
21 $post_id = isset($_POST['post_id']) ? intval( $_POST['post_id'] ) : 0;
22
23 if ( 'publish' !== get_post_status( $post_id ) ) {
24 wp_die();
25 }
26
27 if ( isset( $post_id ) ) {
28 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
29 echo str_replace( '#elementor', '', \ElementsKit_Lite\Utils::render_tab_content( \ElementsKit_Lite\Utils::render_elementor_content( $post_id ), $post_id ) );
30 } else {
31 echo esc_html__( 'Click on the Edit Content button to edit/add the content.', 'elementskit-lite' );
32 }
33
34 wp_die();
35 }
36
37 public function modal_content() {
38 ob_start(); ?>
39 <div class="widgetarea_iframe_modal">
40 <?php include 'widget-area-modal.php'; ?>
41 </div>
42 <?php
43 $output = ob_get_contents();
44 ob_end_clean();
45
46 echo \ElementsKit_Lite\Utils::render( $output ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Already escaped inside of the buffering content
47 }
48
49 /**
50 * $index for old version & data support
51 */
52 public static function parse( $content, $widget_key, $tab_id = 1, $isAjax = '', $index = null ) {
53 $key = ( $content == '' ) ? $widget_key : $content;
54 $extract_key = explode( '***', $key );
55 $extract_key = $extract_key[0];
56 ob_start();
57 ?>
58
59 <div class="widgetarea_warper widgetarea_warper_editable" data-elementskit-widgetarea-key="<?php echo esc_attr( $extract_key ); ?>" data-elementskit-widgetarea-index="<?php echo esc_attr( $tab_id ); ?>">
60
61 <?php if ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) : ?>
62 <div class="widgetarea_warper_edit" data-elementskit-widgetarea-key="<?php echo esc_attr( $extract_key ); ?>" data-elementskit-widgetarea-index="<?php echo esc_attr( $tab_id ); ?>">
63 <i class="eicon-edit" aria-hidden="true"></i>
64 <span><?php esc_html_e( 'Edit Content', 'elementskit-lite' ); ?></span>
65 </div>
66 <?php endif; ?>
67
68 <?php
69 $builder_post_title = 'dynamic-content-widget-' . $extract_key . '-' . $tab_id;
70 $builder_post = \ElementsKit_Lite\Utils::get_page_by_title( $builder_post_title, 'elementskit_content' );
71
72 /**
73 * this checking for already existing content of tab.
74 */
75 $post_id = isset( $builder_post->ID ) ? $builder_post->ID : null;
76 if ( ! $post_id ) {
77 $builder_post_title = 'dynamic-content-widget-' . $extract_key . '-' . $index;
78 $builder_post = \ElementsKit_Lite\Utils::get_page_by_title( $builder_post_title, 'elementskit_content' );
79 }
80
81 if ( $isAjax === 'yes' ) {
82 $post_id = isset( $builder_post->ID ) ? $builder_post->ID : '';
83 echo '<div class="ekit-widget-area-container" data-ajax-post-id="' . esc_attr($post_id). '"></div>';
84 } else {
85 ?>
86 <div class="ekit-widget-area-container">
87 <?php
88 if ( isset( $builder_post->ID ) ) {
89 $builder_post_id = $builder_post->ID;
90
91 // if wpml is active, get the post id from wpml
92 if( defined( 'ICL_SITEPRESS_VERSION' ) ) {
93 $language_details = apply_filters( 'wpml_post_language_details', NULL, get_the_ID() );
94 if( !is_wp_error($language_details) ) {
95 $builder_post_id = apply_filters( 'wpml_object_id', $builder_post_id, 'elementskit_content', true, $language_details['language_code'] );
96 }
97 }
98
99 $builder_content = \ElementsKit_Lite\Utils::render_elementor_content($builder_post_id);
100 $rendered_tab_content = \ElementsKit_Lite\Utils::render_tab_content($builder_content, $builder_post_id);
101 // Remove '#elementor' from the rendered content, except when it's part of 'href="#elementor"'
102 $final_content = preg_replace('/(?<!href=")#elementor/', '', $rendered_tab_content);
103
104 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
105 echo $final_content;
106 } else {
107 echo esc_html__( 'Click on the Edit Content button to edit/add the content.', 'elementskit-lite' );
108 }
109 ?>
110 </div>
111 <?php
112 }
113 ?>
114 </div>
115 <?php
116 $output = ob_get_contents();
117 ob_end_clean();
118
119 return $output;
120 }
121 }
122