/var/www/html_us/wp-content/plugins/elementor/modules/promotions/promotion-data.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
namespace Elementor\Modules\Promotions;

use 
Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
use 
Elementor\Includes\EditorAssetsAPI;
use 
Elementor\Utils;

class 
PromotionData {
    protected 
EditorAssetsAPI $editor_assets_api;

    public function 
__constructEditorAssetsAPI $editor_assets_api ) {
        
$this->editor_assets_api $editor_assets_api;
    }

    public function 
get_promotion_data$force_request false ): array {
        
$assets_data $this->transform_assets_data$force_request );

        return [
            
Utils::ANIMATED_HEADLINE => $this->get_animated_headline_data$assets_data ),
            
Utils::VIDEO_PLAYLIST => $this->get_video_playlist_data$assets_data ),
            
Utils::CTA => $this->get_cta_button_data$assets_data ),
            
Utils::IMAGE_CAROUSEL => $this->get_image_carousel_data$assets_data ),
            
Utils::TESTIMONIAL_WIDGET => $this->get_testimonial_widget_data$assets_data ),
        ];
    }

    private function 
transform_assets_data$force_request false ) {
        
$assets_data $this->editor_assets_api->get_assets_data$force_request );
        
$transformed_data = [];

        foreach ( 
$assets_data as $asset ) {
            
$transformed_data$asset['id'] ] = $asset['imageSrc'];
        }

        return 
$transformed_data;
    }

    private function 
get_animated_headline_data$assets_data ) {
        
$data = [
            
'image' => esc_url$assets_dataUtils::ANIMATED_HEADLINE ] ?? '' ),
            
'image_alt' => esc_attr__'Upgrade''elementor' ),
            
'title' => esc_html__'Bring Headlines to Life''elementor' ),
            
'description' => [
                
esc_html__'Highlight key messages dynamically.''elementor' ),
                
esc_html__'Apply rotating effects to text.''elementor' ),
                
esc_html__'Fully customize your headlines.''elementor' ),
            ],
            
'upgrade_text' => esc_html__'Upgrade Now''elementor' ),
            
'upgrade_url' => 'https://go.elementor.com/go-pro-heading-widget-control/',
        ];

        return 
$this->filter_dataUtils::ANIMATED_HEADLINE$data );
    }

    private function 
get_video_playlist_data$assets_data ) {
        
$data = [
            
'image' => esc_url$assets_dataUtils::VIDEO_PLAYLIST ] ?? '' ),
            
'image_alt' => esc_attr__'Upgrade''elementor' ),
            
'title' => esc_html__'Showcase Video Playlists''elementor' ),
            
'description' => [
                
esc_html__'Embed videos with full control.''elementor' ),
                
esc_html__'Adjust layout and playback settings.''elementor' ),
                
esc_html__'Seamlessly customize video appearance.''elementor' ),
            ],
            
'upgrade_text' => esc_html__'Upgrade Now''elementor' ),
            
'upgrade_url' => 'https://go.elementor.com/go-pro-video-widget-control/',
        ];

        return 
$this->filter_dataUtils::VIDEO_PLAYLIST$data );
    }

    private function 
get_cta_button_data$assets_data ) {
        
$data = [
            
'image' => esc_url$assets_dataUtils::CTA ] ?? '' ),
            
'image_alt' => esc_attr__'Upgrade''elementor' ),
            
'title' => esc_html__'Boost Conversions with CTAs''elementor' ),
            
'description' => [
                
esc_html__'Combine text, buttons, and images.''elementor' ),
                
esc_html__'Add hover animations and CSS effects.''elementor' ),
                
esc_html__'Create unique, interactive designs.''elementor' ),
            ],
            
'upgrade_text' => esc_html__'Upgrade Now''elementor' ),
            
'upgrade_url' => 'https://go.elementor.com/go-pro-button-widget-control/',
        ];

        return 
$this->filter_dataUtils::CTA$data );
    }

    private function 
get_image_carousel_data$assets_data ) {
        
$data = [
            
'image' => esc_url$assets_dataUtils::IMAGE_CAROUSEL ] ?? '' ),
            
'image_alt' => esc_attr__'Upgrade''elementor' ),
            
'title' => esc_html__'Design Custom Carousels''elementor' ),
            
'description' => [
                
esc_html__'Create flexible custom carousels.''elementor' ),
                
esc_html__'Adjust transitions and animations.''elementor' ),
                
esc_html__'Showcase multiple items with style.''elementor' ),
            ],
            
'upgrade_text' => esc_html__'Upgrade Now''elementor' ),
            
'upgrade_url' => 'https://go.elementor.com/go-pro-image-carousel-widget-control/',
        ];

        return 
$this->filter_dataUtils::IMAGE_CAROUSEL$data );
    }

    private function 
get_testimonial_widget_data$assets_data ) {
        
$data = [
            
'image' => esc_url$assets_dataUtils::TESTIMONIAL_WIDGET ] ?? '' ),
            
'image_alt' => esc_attr__'Upgrade''elementor' ),
            
'title' => esc_html__'Upgrade Your Testimonials''elementor' ),
            
'description' => [
                
esc_html__'Display reviews in a rotating carousel.''elementor' ),
                
esc_html__'Boost credibility with dynamic testimonials.''elementor' ),
                
esc_html__'Customize layouts for visual appeal.''elementor' ),
            ],
            
'upgrade_text' => esc_html__'Upgrade Now''elementor' ),
            
'upgrade_url' => 'https://go.elementor.com/go-pro-testimonial-widget-control/',
        ];

        return 
$this->filter_dataUtils::TESTIMONIAL_WIDGET$data );
    }

    private function 
filter_data$widget_name$asset_data ): array {
        return 
Filtered_Promotions_Manager::get_filtered_promotion_data$asset_data"elementor/widgets/{$widget_name}/custom_promotion"'upgrade_url' );
    }
}