PluginProbe
Pixel Gallery Addons for Elementor – Easy Grid, Creative Gallery, Drag and Drop Grid, Custom Grid Layout, Portfolio Gallery / trunk
Pixel Gallery Addons for Elementor – Easy Grid, Creative Gallery, Drag and Drop Grid, Custom Grid Layout, Portfolio Gallery vtrunk
2.1.14 2.1.13 2.1.12 2.1.11 2.1.10 2.1.9 2.1.8 2.1.7 trunk 1.2.2 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.4.0 1.4.1 1.4.10 1.4.11 1.4.2 1.4.3 1.4.5 1.4.6 All 74 releases
pixel-gallery / modules / fixer / widgets / fixer.php

fixer.php in Pixel Gallery Addons for Elementor – Easy Grid, Creative Gallery, Drag and Drop Grid, Custom Grid Layout, Portfolio Gallery trunk, at modules/fixer/widgets/fixer.php

527 lines 15.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace PixelGallery\Modules\Fixer\Widgets;
4
5 use PixelGallery\Base\Module_Base;
6 use Elementor\Controls_Manager;
7 use Elementor\Group_Control_Border;
8 use Elementor\Group_Control_Typography;
9 use Elementor\Group_Control_Background;
10 use Elementor\Group_Control_Box_Shadow;
11 use Elementor\Group_Control_Image_Size;
12 use Elementor\Group_Control_Text_Shadow;
13 use Elementor\Icons_Manager;
14 use Elementor\Group_Control_Css_Filter;
15 use Elementor\Group_Control_Text_Stroke;
16 use Elementor\Repeater;
17 use PixelGallery\Utils;
18 use PixelGallery\Traits\Global_Widget_Controls;
19
20 if (!defined('ABSPATH')) exit; // Exit if accessed directly
21
22 class Fixer extends Module_Base {
23
24 use Global_Widget_Controls;
25
26 public function get_name() {
27 return 'pg-fixer';
28 }
29
30 public function get_title() {
31 return BDTPG . esc_html__('Fixer', 'pixel-gallery');
32 }
33
34 public function get_icon() {
35 return 'pg-icon-fixer pg-new';
36 }
37
38 public function get_categories() {
39 return ['pixel-gallery'];
40 }
41
42 public function get_keywords() {
43 return ['fixer', 'grid', 'gallery'];
44 }
45
46 public function get_style_depends() {
47 return ['pg-fixer'];
48 }
49
50 public function get_script_depends() {
51 if ( true === _is_pg_pro_activated() ) {
52 return ['justified-gallery'];
53 } else {
54 return [];
55 }
56 }
57
58 public function has_widget_inner_wrapper(): bool {
59 return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
60 }
61 protected function is_dynamic_content(): bool {
62 return false;
63 }
64
65 protected function register_controls() {
66
67 $this->start_controls_section(
68 'section_layout',
69 [
70 'label' => __('Layout', 'pixel-gallery'),
71 'tab' => Controls_Manager::TAB_CONTENT,
72 ]
73 );
74
75 //Global
76 $this->register_grid_controls('fixer');
77 $this->register_global_height_controls('fixer');
78 $this->register_justified_gallery_controls();
79 $this->register_title_tag_controls();
80 $this->register_show_meta_controls();
81 $this->register_alignment_controls('fixer');
82 $this->register_thumbnail_size_controls();
83
84 //Global Lightbox Controls
85 $this->register_lightbox_controls();
86 $this->end_controls_section();
87
88 $this->start_controls_section(
89 'section_item_content',
90 [
91 'label' => __('Items', 'pixel-gallery'),
92 'tab' => Controls_Manager::TAB_CONTENT,
93 ]
94 );
95
96 $repeater = new Repeater();
97 $repeater->start_controls_tabs('tabs_item_content');
98 $repeater->start_controls_tab(
99 'tab_item_content',
100 [
101 'label' => esc_html__('Content', 'pixel-gallery'),
102 ]
103 );
104 $this->register_repeater_media_controls($repeater);
105 $this->register_repeater_title_controls($repeater);
106 $this->register_repeater_meta_controls($repeater);
107 $this->register_repeater_custom_url_controls($repeater);
108 $this->register_repeater_hidden_item_controls($repeater);
109
110 $repeater->end_controls_tab();
111 $repeater->start_controls_tab(
112 'tab_item_grid',
113 [
114 'label' => esc_html__('Grid', 'pixel-gallery'),
115 ]
116 );
117 $this->register_repeater_grid_controls($repeater, 'fixer');
118 $this->register_repeater_item_height_controls($repeater, 'fixer');
119 $repeater->end_controls_tab();
120 $repeater->end_controls_tabs();
121 $this->register_repeater_items_controls($repeater);
122 $this->end_controls_section();
123
124 //Style
125 $this->start_controls_section(
126 'pg_section_style',
127 [
128 'label' => esc_html__( 'Items', 'pixel-gallery' ),
129 'tab' => Controls_Manager::TAB_STYLE,
130 ]
131 );
132
133 $this->start_controls_tabs( 'tabs_item_style' );
134
135 $this->start_controls_tab(
136 'tab_item_normal',
137 [
138 'label' => esc_html__( 'Normal', 'pixel-gallery' ),
139 ]
140 );
141
142 $this->add_group_control(
143 Group_Control_Background::get_type(),
144 [
145 'name' => 'item_background',
146 'label' => esc_html__( 'Background', 'pixel-gallery' ),
147 'types' => [ 'classic', 'gradient' ],
148 // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams, WordPress.DB.SlowDBQuery -- Intentional bounded query; exclusions/keys are plugin-controlled, not user request input.
149 'exclude' => [ 'image' ],
150 'selector' => '{{WRAPPER}} .pg-fixer-item',
151 ]
152 );
153
154 $this->add_group_control(
155 Group_Control_Border::get_type(),
156 [
157 'name' => 'item_border',
158 'selector' => '{{WRAPPER}} .pg-fixer-item',
159 'separator' => 'before',
160 ]
161 );
162
163 $this->add_responsive_control(
164 'item_border_radius',
165 [
166 'label' => esc_html__( 'Border Radius', 'pixel-gallery' ),
167 'type' => Controls_Manager::DIMENSIONS,
168 'size_units' => [ 'px', 'em', '%' ],
169 'selectors' => [
170 '{{WRAPPER}} .pg-fixer-item, {{WRAPPER}} .pg-fixer-image-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
171 ],
172 ]
173 );
174
175 $this->add_responsive_control(
176 'item_padding',
177 [
178 'label' => esc_html__( 'Padding', 'pixel-gallery' ),
179 'type' => Controls_Manager::DIMENSIONS,
180 'size_units' => [ 'px', 'em', '%' ],
181 'selectors' => [
182 '{{WRAPPER}} .pg-fixer-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
183 ],
184 ]
185 );
186
187
188 $this->add_responsive_control(
189 'item_margin',
190 [
191 'label' => esc_html__( 'Margin', 'pixel-gallery' ),
192 'type' => Controls_Manager::DIMENSIONS,
193 'size_units' => [ 'px', 'em', '%' ],
194 'selectors' => [
195 '{{WRAPPER}} .pg-fixer-item' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
196 ],
197 ]
198 );
199
200 $this->add_group_control(
201 Group_Control_Box_Shadow::get_type(),
202 [
203 'name' => 'item_box_shadow',
204 'selector' => '{{WRAPPER}} .pg-fixer-item',
205 ]
206 );
207
208 $this->end_controls_tab();
209
210 $this->start_controls_tab(
211 'tab_item_hover',
212 [
213 'label' => esc_html__( 'Hover', 'pixel-gallery' ),
214 ]
215 );
216
217 $this->add_control(
218 'item_hover_border_color',
219 [
220 'label' => esc_html__( 'Border Color', 'pixel-gallery' ),
221 'type' => Controls_Manager::COLOR,
222 'condition' => [
223 'item_border_border!' => '',
224 ],
225 'selectors' => [
226 '{{WRAPPER}} .pg-fixer-item:hover' => 'border-color: {{VALUE}};',
227 ],
228 ]
229 );
230
231 $this->add_group_control(
232 Group_Control_Box_Shadow::get_type(),
233 [
234 'name' => 'item_hover_box_shadow',
235 'selector' => '{{WRAPPER}} .pg-fixer-item:hover',
236 ]
237 );
238
239 $this->end_controls_tab();
240
241 $this->end_controls_tabs();
242
243 $this->end_controls_section();
244
245 $this->start_controls_section(
246 'section_style_content',
247 [
248 'label' => esc_html__( 'Content', 'pixel-gallery' ),
249 'tab' => Controls_Manager::TAB_STYLE,
250 ]
251 );
252
253 $this->add_control(
254 'glassmorphism_effect',
255 [
256 'label' => esc_html__('Glassmorphism', 'pixel-gallery') . BDTPG_NC,
257 'type' => Controls_Manager::SWITCHER,
258 /* translators: %1$s: opening anchor tag, %2$s: closing anchor tag */
259 'description' => sprintf(esc_html__('This feature will not work in the Firefox browser untill you enable browser compatibility so please %1$s look here %2$s', 'pixel-gallery'), '<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility" target="_blank">', '</a>'),
260
261 ]
262 );
263
264 $this->add_control(
265 'glassmorphism_blur_level',
266 [
267 'label' => esc_html__('Blur Level', 'pixel-gallery'),
268 'type' => Controls_Manager::SLIDER,
269 'range' => [
270 'px' => [
271 'min' => 0,
272 'step' => 1,
273 'max' => 50,
274 ]
275 ],
276 'default' => [
277 'size' => 5
278 ],
279 'selectors' => [
280 '{{WRAPPER}} .pg-fixer-content' => 'backdrop-filter: blur({{SIZE}}px); -webkit-backdrop-filter: blur({{SIZE}}px);'
281 ],
282 'condition' => [
283 'glassmorphism_effect' => 'yes',
284 ]
285 ]
286 );
287
288 $this->add_group_control(
289 Group_Control_Background::get_type(),
290 [
291 'name' => 'content_background',
292 'label' => esc_html__( 'Background', 'pixel-gallery' ),
293 'types' => [ 'classic', 'gradient' ],
294 // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams, WordPress.DB.SlowDBQuery -- Intentional bounded query; exclusions/keys are plugin-controlled, not user request input.
295 'exclude' => [ 'image' ],
296 'selector' => '{{WRAPPER}} .pg-fixer-content',
297 'fields_options' => [
298 'background' => [
299 'default' => 'classic',
300 ],
301 'color' => [
302 'default' => '#fff',
303 ],
304 ],
305 'separator' => 'before',
306 ]
307 );
308
309 $this->add_group_control(
310 Group_Control_Border::get_type(),
311 [
312 'name' => 'content_border',
313 'selector' => '{{WRAPPER}} .pg-fixer-content',
314 'separator' => 'before',
315 ]
316 );
317
318 $this->add_responsive_control(
319 'content_border_radius',
320 [
321 'label' => esc_html__( 'Border Radius', 'pixel-gallery' ),
322 'type' => Controls_Manager::DIMENSIONS,
323 'size_units' => [ 'px', 'em', '%' ],
324 'selectors' => [
325 '{{WRAPPER}} .pg-fixer-content' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
326 ],
327 ]
328 );
329
330 $this->add_responsive_control(
331 'content_padding',
332 [
333 'label' => esc_html__( 'Padding', 'pixel-gallery' ),
334 'type' => Controls_Manager::DIMENSIONS,
335 'size_units' => [ 'px', 'em', '%' ],
336 'selectors' => [
337 '{{WRAPPER}} .pg-fixer-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
338 ],
339 ]
340 );
341
342
343 $this->add_responsive_control(
344 'content_margin',
345 [
346 'label' => esc_html__( 'Margin', 'pixel-gallery' ),
347 'type' => Controls_Manager::DIMENSIONS,
348 'size_units' => [ 'px', 'em', '%' ],
349 'selectors' => [
350 '{{WRAPPER}} .pg-fixer-content' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
351 ],
352 ]
353 );
354
355 $this->add_group_control(
356 Group_Control_Box_Shadow::get_type(),
357 [
358 'name' => 'content_box_shadow',
359 'selector' => '{{WRAPPER}} .pg-fixer-content',
360 ]
361 );
362 //content position left right choose option
363 $this->add_control(
364 'content_position',
365 [
366 'label' => esc_html__('Content Position', 'pixel-gallery') . BDTPG_NC,
367 'type' => Controls_Manager::CHOOSE,
368 // 'default' => 'left',
369 'options' => [
370 'left' => [
371 'title' => __('Left', 'pixel-gallery'),
372 'icon' => 'eicon-h-align-left',
373 ],
374 'right' => [
375 'title' => __('Right', 'pixel-gallery'),
376 'icon' => 'eicon-h-align-right',
377 ],
378 ],
379 'selectors_dictionary' => [
380 'left' => 'left: 0;',
381 'right' => 'right: 0;',
382 ],
383 'selectors' => [
384 '{{WRAPPER}} .pg-fixer-content' => '{{VALUE}};',
385 ],
386 'render_type' => 'template',
387 'separator' => 'before',
388 'toggle' => false,
389 ]
390 );
391
392
393 $this->end_controls_section();
394
395 //Global Title Controls
396 $this->register_title_controls('fixer');
397
398 //Global Meta Controls
399 $this->register_meta_controls('fixer');
400
401 //Clip Path Controls
402 $this->register_clip_path_controls('fixer');
403
404 }
405
406 public function render_items() {
407 $settings = $this->get_settings_for_display();
408 $id = 'pg-fixer-' . $this->get_id();
409 $slide_index = 1;
410 foreach ($settings['items'] as $index => $item) :
411
412 $attr_name = 'grid-item' . $index;
413 $this->add_render_attribute($attr_name, 'class', 'pg-fixer-item pg-item elementor-repeater-item-' . esc_attr($item['_id']), true);
414
415 /**
416 * Render Video Inject Here
417 * Video Would be work on Media File & Lightbox
418 * @since 1.0.0
419 */
420 if ($item['media_type'] == 'video') {
421 $this->render_video_frame($item, $attr_name, $id);
422 }
423
424 ?>
425
426 <div <?php $this->print_render_attribute_string($attr_name); ?>>
427 <?php if ($item['item_hidden'] !== 'yes' ) : ?>
428 <?php $this->render_image_wrap($item, 'fixer'); ?>
429 <?php if ('yes' === $settings['show_title'] || 'yes' === $settings['show_meta']) : ?>
430 <div class="pg-fixer-content-wrap">
431 <div class="pg-fixer-content">
432 <?php $this->render_title($item, 'fixer'); ?>
433 <?php $this->render_meta($item, 'fixer'); ?>
434 </div>
435 </div>
436 <?php endif; ?>
437 <?php $this->render_lightbox_link_url($item, $index, $id); ?>
438 <?php endif; ?>
439 </div>
440
441 <?php
442 $slide_index++;
443 endforeach;
444 }
445
446 public function render() {
447 $settings = $this->get_settings_for_display();
448 $this->add_render_attribute('grid', 'class', 'pg-fixer-grid pg-grid');
449
450 /**
451 * Render Justified Gallery Attributes
452 */
453 $this->render_justified_gallery_attributes('grid');
454
455 if (isset($settings['pg_in_animation_show']) && ($settings['pg_in_animation_show'] == 'yes')) {
456 $this->add_render_attribute( 'grid', 'class', 'pg-in-animation' );
457 if (isset($settings['pg_in_animation_delay']['size'])) {
458 $this->add_render_attribute( 'grid', 'data-in-animation-delay', $settings['pg_in_animation_delay']['size'] );
459 }
460 }
461
462 ?>
463 <div <?php $this->print_render_attribute_string('grid'); ?>>
464 <?php $this->render_items(); ?>
465 </div>
466 <?php
467 }
468 /**
469 * Elementor editor Backbone template.
470 */
471 protected function content_template() {
472 ?>
473 <#
474 var items = settings.items || [];
475 var animDelay = ( settings.pg_in_animation_delay && settings.pg_in_animation_delay.size ) ? settings.pg_in_animation_delay.size : '';
476 var alwaysLb = false;
477 var gridClass = 'pg-fixer-grid pg-grid';
478 if ( settings.pg_in_animation_show === 'yes' ) {
479 gridClass += ' pg-in-animation';
480 }
481 #>
482 <div class="{{{ gridClass }}}"
483 <# if ( settings.pg_in_animation_show === 'yes' && animDelay !== '' ) { #> data-in-animation-delay="{{ animDelay }}"<# } #>
484 >
485 <# _.each( items, function( item, index ) {
486 var itemClass = 'pg-fixer-item pg-item elementor-repeater-item-' + item._id;
487 #>
488 <div class="{{{ itemClass }}}">
489 <# if ( item.item_hidden !== 'yes' ) { #>
490 <div class="pg-fixer-image-wrap bdt-pg-img-mask">
491 <# if ( item.media_type === 'video' ) { #>
492 <# if ( item.poster && item.poster.url ) { #>
493 <img src="{{ item.poster.url }}" alt="{{ item.title }}" class="pg-fixer-img">
494 <# } #>
495 <# } else if ( item.image && item.image.url ) { #>
496 <img src="{{ item.image.url }}" alt="{{ item.title }}" class="pg-fixer-img">
497 <# } #>
498 <# if ( settings.link_to === 'file' && item.media_type === 'video' ) { #>
499 <span class="pg-video-icon-wrap">
500 <i class="pg-icon-play-circle pg-eicon-play"></i>
501 </span>
502 <# } #>
503 </div>
504 <# if ( settings.show_title === 'yes' || settings.show_meta === 'yes' ) { #>
505 <div class="pg-fixer-content-wrap">
506 <div class="pg-fixer-content">
507 <# if ( settings.show_title === 'yes' && item.title ) { #>
508 <# var ttag = settings.title_tag || 'h3'; #>
509 <{{{ ttag }}} class="pg-fixer-title">{{{ item.title }}}</{{{ ttag }}}>
510 <# } #>
511 <# if ( settings.show_meta === 'yes' && item.meta ) { #>
512 <div class="pg-fixer-meta">{{{ item.meta }}}</div>
513 <# } #>
514 </div>
515 </div>
516 <# } #>
517 <# if ( alwaysLb || ( settings.link_to !== 'none' && ( settings.link_target || 'whole_item' ) === 'whole_item' ) ) { #>
518 <?php $this->print_content_template_lightbox_overlay( 'fixer' ); ?>
519 <# } #>
520 <# } #>
521 </div>
522 <# } ); #>
523 </div>
524 <?php
525 }
526
527 }