PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents / 3.3.1
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents v3.3.1
4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.2.0 3.2.1 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.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.7.0 3.7.1 3.7.2 3.7.3 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.14 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.10 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.4.0 4.4.1 4.4.10 4.4.11 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5.0 4.5.1
embedpress / EmbedPress / Includes / Traits / Branding.php
embedpress / EmbedPress / Includes / Traits Last commit date
Branding.php 4 years ago Shared.php 4 years ago
Branding.php
213 lines
1 <?php
2 namespace EmbedPress\Includes\Traits;
3 if ( !defined( 'ABSPATH' ) ) {
4 exit;
5 } // Exit if accessed directly
6 use Elementor\Controls_Manager as Controls_Manager;
7 use Elementor\Group_Control_Image_Size;
8
9 Trait Branding {
10 /**
11 * @param string $provider_name
12 */
13 public function init_branding_controls( $provider_name='' ) {
14 if ( !isset( $this->pro_class) ) {
15 $this->pro_class = '';
16 }
17 if ( !isset( $this->pro_text) ) {
18 $this->pro_text = '';
19 }
20
21 global $pro_active;
22 $settings = get_option( EMBEDPRESS_PLG_NAME.':'.$provider_name, []);
23 $branding = isset( $settings['branding']) ? $settings['branding'] : 'no';
24 $logo_xpos = isset( $settings['logo_xpos']) ? intval( $settings['logo_xpos']) : 10;
25 $logo_ypos = isset( $settings['logo_ypos']) ? intval( $settings['logo_ypos']) : 10;
26 $logo_opacity = isset( $settings['logo_opacity']) ? intval( $settings['logo_opacity']) : 50;
27 $logo_id = isset( $settings['logo_id']) ? intval( $settings['logo_id']) : 0;
28 $logo_url = isset( $settings['logo_url']) ? esc_url( $settings['logo_url']) : '';
29 $cta_url = isset( $settings['cta_url']) ? esc_url( $settings['cta_url']) : '';
30
31 $logo_condition = [
32 "embedpress_pro_{$provider_name}_logo[url]!" =>''
33 ];
34 $condition = [];
35 if ( $provider_name !== 'document' ) {
36 $logo_condition["embedpress_pro_embeded_source"] = $provider_name;
37 $condition["embedpress_pro_embeded_source"] = $provider_name;
38 }
39 $this->add_control(
40 "{$provider_name}_custom_logo_cta_heading",
41 [
42 'label' => __( 'Custom Branding', 'embedpress' ),
43 'type' => Controls_Manager::HEADING,
44 'separator' => 'before',
45 'condition' => $condition,
46 ]
47 );
48 $this->add_control(
49 "embedpress_pro_{$provider_name}_logo",
50 [
51 'label' => sprintf(__( 'Custom Logo %s', 'embedpress' ), $this->pro_text ),
52 'description' => __( 'Leave it empty to hide it', 'embedpress' ),
53 'type' => Controls_Manager::MEDIA,
54 'dynamic' => [
55 'active' => true,
56 ],
57 'default' => [
58 'url' => $logo_url,
59 'id' => $logo_id,
60 ],
61 'classes' => $this->pro_class,
62 'condition' => $condition,
63 ]
64 );
65 $this->add_group_control(
66 Group_Control_Image_Size::get_type(),
67 [
68 'name' => "embedpress_pro_{$provider_name}_logo",
69 'default' => 'full',
70 'condition' => $logo_condition,
71 'classes' => $this->pro_class,
72 ]
73 );
74 $this->add_responsive_control(
75 "embedpress_pro_{$provider_name}_logo_xpos",
76 [
77 'label' => sprintf( __( 'Logo X Position %s', 'embedpress' ), $this->pro_text),
78 'description' => __( 'Change this number to move your logo in horizontal direction.', 'embedpress' ),
79 'type' => Controls_Manager::SLIDER,
80 'size_units' => [ 'px', '%' ],
81 'range' => [
82 'px' => [
83 'min' => 0,
84 'max' => 1000,
85 'step' => 5,
86 ],
87 '%' => [
88 'min' => 0,
89 'max' => 100,
90 ],
91 ],
92 'default' => [
93 'unit' => '%',
94 'size' => $logo_xpos,
95 ],
96 'selectors' => [
97 "{{WRAPPER}} .ose-{$provider_name} .watermark" => 'right: {{SIZE}}{{UNIT}};',
98 ],
99 'condition' => $logo_condition,
100 'classes' => $this->pro_class,
101 ]
102 );
103 $this->add_responsive_control(
104 "embedpress_pro_{$provider_name}_logo_ypos",
105 [
106 'label' => sprintf( __( 'Logo Y Position %s', 'embedpress' ), $this->pro_text),
107 'description' => __( 'Change this number to move your logo in vertical direction.', 'embedpress' ),
108 'type' => Controls_Manager::SLIDER,
109 'size_units' => [ 'px', '%' ],
110 'range' => [
111 'px' => [
112 'min' => 0,
113 'max' => 1000,
114 'step' => 5,
115 ],
116 '%' => [
117 'min' => 0,
118 'max' => 100,
119 ],
120 ],
121 'default' => [
122 'unit' => '%',
123 'size' => $logo_ypos,
124 ],
125 'selectors' => [
126 "{{WRAPPER}} .ose-{$provider_name} .watermark" => 'bottom: {{SIZE}}{{UNIT}};',
127 ],
128 'condition' => $logo_condition,
129 'classes' => $this->pro_class,
130
131 ]
132 );
133 $this->start_controls_tabs(
134 "ep_{$provider_name}_cta_style_tabs",
135 [
136 'condition' => $logo_condition,
137 ]
138 );
139 $this->start_controls_tab( "ep_{$provider_name}_cta_normal_tab",
140 [
141 'label' => __( 'Normal', 'embedpress' ),
142 ]
143 );
144 $this->add_control(
145 "embedpress_pro_{$provider_name}_logo_opacity",
146 [
147 'label' => sprintf( __( 'Logo Opacity %s', 'embedpress' ), $this->pro_text),
148 'type' => Controls_Manager::SLIDER,
149 'default' => [
150 'size' => $logo_opacity,
151 ],
152 'range' => [
153 'px' => [
154 'max' => 1,
155 'step' => 0.01,
156 ],
157 ],
158 'selectors' => [
159 "{{WRAPPER}} .ose-{$provider_name} .watermark" => 'opacity: {{SIZE}};',
160 ],
161 'condition' => $logo_condition,
162 'classes' => $this->pro_class,
163
164 ]
165 );
166 $this->end_controls_tab();
167 $this->start_controls_tab( "ep_{$provider_name}_cta_hover__tab",
168 [
169 'label' => __( 'Hover', 'embedpress' ),
170 ]
171 );
172 $this->add_control(
173 "embedpress_pro_{$provider_name}_logo_opacity_hover",
174 [
175 'label' => sprintf( __( 'Logo Opacity %s', 'embedpress' ), $this->pro_text),
176 'type' => Controls_Manager::SLIDER,
177 'size_units' => [ '%'],
178 'default' => [
179 'size' => 1,
180 ],
181 'range' => [
182 'px' => [
183 'max' => 1,
184 'step' => 0.01,
185 ],
186 ],
187 'selectors' => [
188 "{{WRAPPER}} .ose-{$provider_name} .watermark:hover" => 'opacity: {{SIZE}};',
189 ],
190 'condition' => $logo_condition,
191 'classes' => $this->pro_class,
192
193 ]
194 );
195 $this->end_controls_tab();
196 $this->end_controls_tabs();
197 $this->add_control(
198 "embedpress_pro_{$provider_name}_cta",
199 [
200 'label' => sprintf( __( 'CTA link for Logo %s', 'embedpress' ), $this->pro_text),
201 'description' => __( 'You can show the logo inside a link. Leave it empty to hide it', 'embedpress' ),
202 'type' => Controls_Manager::URL,
203 'dynamic' => [
204 'active' => true,
205 ],
206 'placeholder' => __( 'https://your-link.com', 'embedpress' ),
207 'condition' => $logo_condition,
208 'classes' => $this->pro_class,
209 'separator' => 'before',
210 ]
211 );
212 }
213 }