PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more / 4.4.3
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more v4.4.3
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 / Classes / Extend_Elementor_Controls.php
embedpress / EmbedPress / Includes / Classes Last commit date
Analytics 8 months ago Database 9 months ago Elementor_Enhancer.php 1 year ago EmbedPress_Core_Installer.php 6 years ago EmbedPress_Notice.php 2 years ago EmbedPress_Plugin_Usage_Tracker.php 1 year ago Extend_CustomPlayer_Controls.php 1 year ago Extend_Elementor_Controls.php 1 year ago Feature_Enhancer.php 9 months ago Helper.php 9 months ago PermalinkHelper.php 10 months ago
Extend_Elementor_Controls.php
562 lines
1 <?php
2
3 namespace EmbedPress\Includes\Classes;
4
5 use \Elementor\Controls_Manager;
6
7 class Extend_Elementor_Controls
8 {
9
10 public function __construct()
11 {
12 add_action('extend_elementor_controls', [$this, 'extend_elementor_share_and_lock_controls'], 10, 4);
13 }
14
15 public function get_user_roles()
16 {
17 global $wp_roles;
18
19 $all = $wp_roles->roles;
20 $all_roles = array();
21
22 if (!empty($all)) {
23 foreach ($all as $key => $value) {
24 $all_roles[$key] = $all[$key]['name'];
25 }
26 }
27
28 return $all_roles;
29 }
30
31 public function extend_elementor_share_and_lock_controls($that, $infix = '', $pro_text = '', $pro_class = '')
32 {
33 $ad_condition = [
34 'adManager' => 'yes'
35 ];
36 $ai_condition = [
37 'active' => false,
38 ];
39
40 $that->start_controls_section(
41 'embedpress_adManager',
42 [
43 'label' => esc_html__('EP Ads Settings', 'embedpress'),
44 ]
45 );
46
47 $that->add_control(
48 'adManager',
49 [
50 'label' => sprintf(__('Ads Settings %s', 'embedpress'), $pro_text),
51 'type' => Controls_Manager::SWITCHER,
52 'label_block' => false,
53 'return_value' => 'yes',
54 'default' => '',
55 'classes' => $pro_class,
56 ]
57 );
58
59 $that->add_control(
60 'adSource',
61 [
62 'label' => __('Ad Source', 'embedpress'),
63 'type' => \Elementor\Controls_Manager::SELECT,
64 'options' => [
65 'video' => __('Upload Video', 'embedpress'),
66 'image' => __('Upload Image', 'embedpress'),
67 // 'url' => __('URL', 'embedpress'),
68 ],
69 'default' => 'video',
70 'condition' => $ad_condition,
71 'ai' => $ai_condition,
72 ]
73 );
74
75 $that->add_control(
76 'adFileUrl',
77 [
78 'label' => __('Uploaded Video', 'embedpress'),
79 'type' => \Elementor\Controls_Manager::MEDIA,
80 'media_types' => [
81 'video'
82 ],
83 'condition' => [
84 'adManager' => 'yes',
85 'adSource' => 'video',
86 ],
87 'ai' => $ai_condition,
88 ]
89 );
90 $that->add_control(
91 'adFileUrl1',
92 [
93 'label' => __('Uploaded Image', 'embedpress'),
94 'type' => \Elementor\Controls_Manager::MEDIA,
95 'media_types' => [
96 'image'
97 ],
98 'condition' => [
99 'adManager' => 'yes',
100 'adSource' => 'image',
101 ],
102 'ai' => $ai_condition,
103 ]
104 );
105 // $that->add_control(
106 // 'adFileUrl2',
107 // [
108 // 'type' => \Elementor\Controls_Manager::URL,
109 // 'condition' => [
110 // 'adManager' => 'yes',
111 // 'adSource' => 'url',
112 // ],
113 // 'ai' => $ai_condition,
114 // ]
115 // );
116
117 // For Ad Width TextControl
118 $that->add_control(
119 'adWidth',
120 [
121 'label' => __('Ad Width', 'embedpress'),
122 'type' => \Elementor\Controls_Manager::TEXT,
123 'condition' => [
124 'adManager' => 'yes',
125 'adSource' => 'image',
126 ],
127 'default' => '300',
128 'ai' => $ai_condition,
129 ]
130 );
131
132 // For Ad Height TextControl
133 $that->add_control(
134 'adHeight',
135 [
136 'label' => __('Ad Height', 'embedpress'),
137 'type' => \Elementor\Controls_Manager::TEXT,
138 'condition' => [
139 'adManager' => 'yes',
140 'adSource' => 'image',
141 ],
142 'default' => '200',
143 'ai' => $ai_condition,
144 ]
145 );
146
147 // For Ad X Position RangeControl
148 $that->add_control(
149 'adXPosition',
150 [
151 'label' => __('Ad X Position(%)', 'embedpress'),
152 'type' => \Elementor\Controls_Manager::NUMBER,
153 'default' => 25, // Set the default value if needed
154 'min' => 0,
155 'max' => 100,
156 'condition' => [
157 'adManager' => 'yes',
158 'adSource' => 'image',
159 ],
160 ]
161 );
162
163 // For Ad Y Position RangeControl
164 $that->add_control(
165 'adYPosition',
166 [
167 'label' => __('Ad Y Position(%)', 'embedpress'),
168 'type' => \Elementor\Controls_Manager::NUMBER,
169 'default' => 20, // Set the default value if needed
170 'min' => 0,
171 'max' => 100,
172 'condition' => [
173 'adManager' => 'yes',
174 'adSource' => 'image',
175 ],
176 ]
177 );
178
179 $that->add_control(
180 'adUrl',
181 [
182 'label' => __('Ad URL', 'embedpress'),
183 'type' => \Elementor\Controls_Manager::TEXT,
184 'condition' => $ad_condition,
185 'ai' => $ai_condition,
186
187 ]
188 );
189
190 $that->add_control(
191 'adStart',
192 [
193 'label' => __('Ad Start After (sec)', 'embedpress'),
194 'type' => \Elementor\Controls_Manager::TEXT,
195 'condition' => $ad_condition,
196 'default' => '5',
197 'ai' => $ai_condition,
198
199 ]
200 );
201
202 $that->add_control(
203 'adSkipButton',
204 [
205 'label' => __('Ad Skip Button', 'embedpress'),
206 'type' => \Elementor\Controls_Manager::SWITCHER,
207 'label_on' => __('Yes', 'embedpress'),
208 'label_off' => __('No', 'embedpress'),
209 'default' => 'yes',
210 'condition' => $ad_condition
211 ]
212 );
213
214 $that->add_control(
215 'adSkipButtonAfter',
216 [
217 'label' => __('Skip Button After (sec)', 'embedpress'),
218 'type' => \Elementor\Controls_Manager::TEXT,
219 'condition' => [
220 'adManager' => 'yes',
221 'adSkipButton' => 'yes',
222 ],
223 'ai' => $ai_condition,
224 'default' => '5'
225 ]
226 );
227
228 $that->end_controls_section();
229
230 $that->start_controls_section(
231 'embedpress_content_protection_settings',
232 [
233 'label' => esc_html__('EP Content Protection', 'embedpress'),
234 ]
235 );
236
237 $that->add_control(
238 'embedpress' . $infix . 'lock_content',
239 [
240 'label' => sprintf(__('Enable Content Protection %s', 'embedpress'), $pro_text),
241 'type' => Controls_Manager::SWITCHER,
242 'label_block' => false,
243 'return_value' => 'yes',
244 'default' => '',
245 'classes' => $pro_class,
246 ]
247 );
248
249 $that->add_control(
250 'embedpress' . $infix . 'protection_type',
251 [
252 'label' => __('Protection Type', 'embedpress'),
253 'type' => \Elementor\Controls_Manager::SELECT,
254 'options' => [
255 'user-role' => __('User Role', 'embedpress'),
256 'password' => __('Password Protected', 'embedpress'),
257 ],
258 'default' => 'password',
259 'condition' => [
260 'embedpress' . $infix . 'lock_content' => 'yes',
261 ]
262 ]
263 );
264 $user_role_condition = [
265 'embedpress' . $infix . 'protection_type' => 'user-role',
266 'embedpress' . $infix . 'lock_content' => 'yes',
267 ];
268 $password_condition = [
269 'embedpress' . $infix . 'protection_type' => 'password',
270 'embedpress' . $infix . 'lock_content' => 'yes',
271 ];
272
273 $that->add_control(
274 'embedpress' . $infix . 'select_roles',
275 [
276 'label' => __('Select roles', 'embedpress'),
277 'type' => \Elementor\Controls_Manager::SELECT2,
278 'multiple' => true,
279 'options' => $this->get_user_roles(),
280 'label_block' => true,
281 'default' => [''],
282 'condition' => $user_role_condition
283 ]
284 );
285 $that->add_control(
286 'embedpress' . $infix . 'protection_message',
287 [
288 'label' => __('Protection Message', 'embedpress'),
289 'type' => Controls_Manager::TEXTAREA,
290 'default' => sprintf(__('You do not have access to this content. Only users with the following roles can view it: %s.', 'embedpress'), '[user_roles]'),
291 'placeholder' => sprintf(__('You do not have access to this content. Only users with the following roles can view it: %s.', 'embedpress'), '[user_roles]'),
292 'label_block' => true,
293 'condition' => $user_role_condition
294 ]
295 );
296
297 $that->add_control(
298 'embedpress' . $infix . 'lock_content_password',
299 [
300 'label' => __('Set Password', 'embedpress'),
301 'type' => Controls_Manager::TEXT,
302 'default' => '',
303 'placeholder' => '••••••',
304 'label_block' => false,
305 'condition' => $password_condition
306
307 ]
308 );
309
310
311 $that->add_control(
312 'embedpress' . $infix . 'lock_content_error_message',
313 [
314 'label' => __('Error Message', 'embedpress'),
315 'type' => Controls_Manager::TEXTAREA,
316 'default' => 'Oops, that wasn\'t the right password. Try again.',
317 'placeholder' => __('Oops, that wasn\'t the right password. Try again.', 'embedpress'),
318 'label_block' => true,
319 'condition' => $password_condition
320
321 ]
322 );
323 $that->add_control(
324 'embedpress' . $infix . 'password_placeholder',
325 [
326 'label' => __('Placeholder', 'embedpress'),
327 'type' => Controls_Manager::TEXT,
328 'default' => 'Password',
329 'placeholder' => __('Password', 'embedpress'),
330 'label_block' => false,
331 'condition' => $password_condition
332
333 ]
334 );
335 $that->add_control(
336 'embedpress' . $infix . 'submit_button_text',
337 [
338 'label' => __('Button Text', 'embedpress'),
339 'type' => Controls_Manager::TEXT,
340 'default' => 'Unlock',
341 'placeholder' => __('Unlock', 'embedpress'),
342 'label_block' => false,
343 'condition' => $password_condition
344
345 ]
346 );
347 $that->add_control(
348 'embedpress' . $infix . 'submit_Unlocking_text',
349 [
350 'label' => __('Loader Text', 'embedpress'),
351 'type' => Controls_Manager::TEXT,
352 'default' => 'Unlocking...',
353 'placeholder' => __('Unlocking...', 'embedpress'),
354 'label_block' => false,
355 'condition' => $password_condition
356
357 ]
358 );
359
360 $that->add_control(
361 'embedpress' . $infix . 'lock_content_heading',
362 [
363 'label' => __('Header', 'embedpress'),
364 'type' => Controls_Manager::TEXT,
365 'default' => 'Content Locked',
366 'placeholder' => __('Content Locked', 'embedpress'),
367 'label_block' => false,
368 'condition' => $password_condition
369
370 ]
371 );
372
373 $that->add_control(
374 'embedpress' . $infix . 'lock_content_sub_heading',
375 [
376 'label' => __('Description', 'embedpress'),
377 'type' => Controls_Manager::TEXTAREA,
378 'default' => 'Content is locked and requires password to access it.',
379 'placeholder' => __('Content is locked and requires password to access it.', 'embedpress'),
380 'label_block' => true,
381 'condition' => $password_condition
382
383 ]
384 );
385
386
387 $that->add_control(
388 'embedpress' . $infix . 'enable_footer_message',
389 [
390 'label' => __('Footer Text', 'embedpress'),
391 'type' => Controls_Manager::SWITCHER,
392 'label_block' => false,
393 'return_value' => 'yes',
394 'default' => '',
395 'condition' => $password_condition
396
397 ]
398 );
399
400 $that->add_control(
401 'embedpress' . $infix . 'lock_content_footer_message',
402 [
403 'label' => __('Footer', 'embedpress'),
404 'type' => Controls_Manager::TEXTAREA,
405 'default' => 'In case you don\'t have the password, kindly reach out to content owner or administrator to request access.',
406 'placeholder' => __('In case you don\'t have the password, kindly reach out to content owner or administrator to request access.', 'embedpress'),
407 'label_block' => true,
408 'condition' => [
409 'embedpress' . $infix . 'enable_footer_message' => 'yes',
410 'embedpress' . $infix . 'protection_type' => 'password'
411 ]
412 ]
413 );
414
415 $that->end_controls_section();
416
417
418
419
420 $that->start_controls_section(
421 'embedpress_content_share_settings',
422 [
423 'label' => esc_html__('EP Social Share', 'embedpress'),
424 ]
425 );
426
427 $that->add_control(
428 'embedpress' . $infix . 'content_share',
429 [
430 'label' => __('Enable Social Share', 'embedpress'),
431 'type' => Controls_Manager::SWITCHER,
432 'label_block' => false,
433 'return_value' => 'yes',
434 'default' => '',
435 ]
436 );
437 $that->add_control(
438 'embedpress' . $infix . 'content_share_position',
439 [
440 'label' => __('Position', 'embedpress'),
441 'type' => Controls_Manager::SELECT,
442 'default' => 'right',
443 'options' => [
444 'top' => __('Top', 'embedpress'),
445 'right' => __('Right', 'embedpress'),
446 'bottom' => __('Bottom', 'embedpress'),
447 'left' => __('Left', 'embedpress'),
448 ],
449 'condition' => [
450 'embedpress' . $infix . 'content_share' => 'yes'
451 ]
452 ]
453 );
454 $that->add_control(
455 'embedpress' . $infix . 'content_title',
456 [
457 'label' => __('Title', 'embedpress'),
458 'type' => Controls_Manager::TEXT,
459 'placeholder' => __('Enter share title', 'embedpress'),
460 'condition' => [
461 'embedpress' . $infix . 'content_share' => 'yes'
462 ]
463 ]
464 );
465 $that->add_control(
466 'embedpress' . $infix . 'content_descripiton',
467 [
468 'label' => __('Description', 'embedpress'),
469 'type' => Controls_Manager::TEXTAREA,
470 'placeholder' => __('Enter share description', 'embedpress'),
471 'condition' => [
472 'embedpress' . $infix . 'content_share' => 'yes'
473 ]
474 ]
475 );
476
477 $that->add_control(
478 'embedpress' . $infix . 'content_share_custom_thumbnail',
479 [
480 'label' => esc_html__('Thumbnail', 'embedpress'),
481 'type' => \Elementor\Controls_Manager::MEDIA,
482 'default' => [
483 'url' => \Elementor\Utils::get_placeholder_image_src(),
484 ],
485 'condition' => [
486 'embedpress' . $infix . 'content_share' => 'yes'
487 ]
488 ]
489 );
490
491 $that->add_control(
492 'embedpress_share_platforms_heading',
493 [
494 'label' => __('Share Platforms', 'embedpress'),
495 'type' => \Elementor\Controls_Manager::HEADING,
496 'separator' => 'before',
497 'condition' => [
498 'embedpress' . $infix . 'content_share' => 'yes'
499 ]
500 ]
501 );
502
503 $that->add_control(
504 'embedpress' . $infix . 'share_facebook',
505 [
506 'label' => __('Facebook', 'embedpress'),
507 'type' => Controls_Manager::SWITCHER,
508 'label_block' => false,
509 'return_value' => 'yes',
510 'default' => 'yes',
511 'condition' => [
512 'embedpress' . $infix . 'content_share' => 'yes'
513 ]
514 ]
515 );
516
517 $that->add_control(
518 'embedpress' . $infix . 'share_twitter',
519 [
520 'label' => __('Twitter', 'embedpress'),
521 'type' => Controls_Manager::SWITCHER,
522 'label_block' => false,
523 'return_value' => 'yes',
524 'default' => 'yes',
525 'condition' => [
526 'embedpress' . $infix . 'content_share' => 'yes'
527 ]
528 ]
529 );
530
531 $that->add_control(
532 'embedpress' . $infix . 'share_pinterest',
533 [
534 'label' => __('Pinterest', 'embedpress'),
535 'type' => Controls_Manager::SWITCHER,
536 'label_block' => false,
537 'return_value' => 'yes',
538 'default' => 'yes',
539 'condition' => [
540 'embedpress' . $infix . 'content_share' => 'yes'
541 ]
542 ]
543 );
544
545 $that->add_control(
546 'embedpress' . $infix . 'share_linkedin',
547 [
548 'label' => __('LinkedIn', 'embedpress'),
549 'type' => Controls_Manager::SWITCHER,
550 'label_block' => false,
551 'return_value' => 'yes',
552 'default' => 'yes',
553 'condition' => [
554 'embedpress' . $infix . 'content_share' => 'yes'
555 ]
556 ]
557 );
558
559 $that->end_controls_section();
560 }
561 }
562