PluginProbe
Elementor Website Builder – more than just a page builder / 3.34.1
Elementor Website Builder – more than just a page builder v3.34.1
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / modules / promotions / promotion-data.php

promotion-data.php in Elementor Website Builder – more than just a page builder 3.34.1, at modules/promotions/promotion-data.php

127 lines 4.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Modules\Promotions;
3
4 use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
5 use Elementor\Includes\EditorAssetsAPI;
6 use Elementor\Utils;
7
8 class PromotionData {
9 protected EditorAssetsAPI $editor_assets_api;
10
11 public function __construct( EditorAssetsAPI $editor_assets_api ) {
12 $this->editor_assets_api = $editor_assets_api;
13 }
14
15 public function get_promotion_data( $force_request = false ): array {
16 $assets_data = $this->transform_assets_data( $force_request );
17
18 return [
19 Utils::ANIMATED_HEADLINE => $this->get_animated_headline_data( $assets_data ),
20 Utils::VIDEO_PLAYLIST => $this->get_video_playlist_data( $assets_data ),
21 Utils::CTA => $this->get_cta_button_data( $assets_data ),
22 Utils::IMAGE_CAROUSEL => $this->get_image_carousel_data( $assets_data ),
23 Utils::TESTIMONIAL_WIDGET => $this->get_testimonial_widget_data( $assets_data ),
24 ];
25 }
26
27 private function transform_assets_data( $force_request = false ) {
28 $assets_data = $this->editor_assets_api->get_assets_data( $force_request );
29 $transformed_data = [];
30
31 foreach ( $assets_data as $asset ) {
32 $transformed_data[ $asset['id'] ] = $asset['imageSrc'];
33 }
34
35 return $transformed_data;
36 }
37
38 private function get_animated_headline_data( $assets_data ) {
39 $data = [
40 'image' => esc_url( $assets_data[ Utils::ANIMATED_HEADLINE ] ?? '' ),
41 'image_alt' => esc_attr__( 'Upgrade', 'elementor' ),
42 'title' => esc_html__( 'Bring Headlines to Life', 'elementor' ),
43 'description' => [
44 esc_html__( 'Highlight key messages dynamically.', 'elementor' ),
45 esc_html__( 'Apply rotating effects to text.', 'elementor' ),
46 esc_html__( 'Fully customize your headlines.', 'elementor' ),
47 ],
48 'upgrade_text' => esc_html__( 'Upgrade Now', 'elementor' ),
49 'upgrade_url' => 'https://go.elementor.com/go-pro-heading-widget-control/',
50 ];
51
52 return $this->filter_data( Utils::ANIMATED_HEADLINE, $data );
53 }
54
55 private function get_video_playlist_data( $assets_data ) {
56 $data = [
57 'image' => esc_url( $assets_data[ Utils::VIDEO_PLAYLIST ] ?? '' ),
58 'image_alt' => esc_attr__( 'Upgrade', 'elementor' ),
59 'title' => esc_html__( 'Showcase Video Playlists', 'elementor' ),
60 'description' => [
61 esc_html__( 'Embed videos with full control.', 'elementor' ),
62 esc_html__( 'Adjust layout and playback settings.', 'elementor' ),
63 esc_html__( 'Seamlessly customize video appearance.', 'elementor' ),
64 ],
65 'upgrade_text' => esc_html__( 'Upgrade Now', 'elementor' ),
66 'upgrade_url' => 'https://go.elementor.com/go-pro-video-widget-control/',
67 ];
68
69 return $this->filter_data( Utils::VIDEO_PLAYLIST, $data );
70 }
71
72 private function get_cta_button_data( $assets_data ) {
73 $data = [
74 'image' => esc_url( $assets_data[ Utils::CTA ] ?? '' ),
75 'image_alt' => esc_attr__( 'Upgrade', 'elementor' ),
76 'title' => esc_html__( 'Boost Conversions with CTAs', 'elementor' ),
77 'description' => [
78 esc_html__( 'Combine text, buttons, and images.', 'elementor' ),
79 esc_html__( 'Add hover animations and CSS effects.', 'elementor' ),
80 esc_html__( 'Create unique, interactive designs.', 'elementor' ),
81 ],
82 'upgrade_text' => esc_html__( 'Upgrade Now', 'elementor' ),
83 'upgrade_url' => 'https://go.elementor.com/go-pro-button-widget-control/',
84 ];
85
86 return $this->filter_data( Utils::CTA, $data );
87 }
88
89 private function get_image_carousel_data( $assets_data ) {
90 $data = [
91 'image' => esc_url( $assets_data[ Utils::IMAGE_CAROUSEL ] ?? '' ),
92 'image_alt' => esc_attr__( 'Upgrade', 'elementor' ),
93 'title' => esc_html__( 'Design Custom Carousels', 'elementor' ),
94 'description' => [
95 esc_html__( 'Create flexible custom carousels.', 'elementor' ),
96 esc_html__( 'Adjust transitions and animations.', 'elementor' ),
97 esc_html__( 'Showcase multiple items with style.', 'elementor' ),
98 ],
99 'upgrade_text' => esc_html__( 'Upgrade Now', 'elementor' ),
100 'upgrade_url' => 'https://go.elementor.com/go-pro-image-carousel-widget-control/',
101 ];
102
103 return $this->filter_data( Utils::IMAGE_CAROUSEL, $data );
104 }
105
106 private function get_testimonial_widget_data( $assets_data ) {
107 $data = [
108 'image' => esc_url( $assets_data[ Utils::TESTIMONIAL_WIDGET ] ?? '' ),
109 'image_alt' => esc_attr__( 'Upgrade', 'elementor' ),
110 'title' => esc_html__( 'Upgrade Your Testimonials', 'elementor' ),
111 'description' => [
112 esc_html__( 'Display reviews in a rotating carousel.', 'elementor' ),
113 esc_html__( 'Boost credibility with dynamic testimonials.', 'elementor' ),
114 esc_html__( 'Customize layouts for visual appeal.', 'elementor' ),
115 ],
116 'upgrade_text' => esc_html__( 'Upgrade Now', 'elementor' ),
117 'upgrade_url' => 'https://go.elementor.com/go-pro-testimonial-widget-control/',
118 ];
119
120 return $this->filter_data( Utils::TESTIMONIAL_WIDGET, $data );
121 }
122
123 private function filter_data( $widget_name, $asset_data ): array {
124 return Filtered_Promotions_Manager::get_filtered_promotion_data( $asset_data, "elementor/widgets/{$widget_name}/custom_promotion", 'upgrade_url' );
125 }
126 }
127