PluginProbe
WP Directory Kit / 1.5.9
WP Directory Kit v1.5.9
1.5.9 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 All 37 releases
← All changes | elementor-elements/classes/wdk-elementor-base.php +251 -16 1.1.0 → 1.5.9 View file →
@@ -12,8 +12,9 @@
12 12 use Elementor\Core\Schemes;
13 13 use Elementor\Group_Control_Typography;
14 14 use Elementor\Group_Control_Border;
15 15 use Elementor\Group_Control_Box_Shadow;
16 +use Elementor\Group_Control_Css_Filter;
16 17
17 18 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
18 19
19 20 /**
@@ -28,8 +29,9 @@
28 29 protected $data = array();
29 30 protected $WMVC = NULL;
30 31
31 32 public function __construct($data = array(), $args = null) {
33 +
32 34 /* load icons for tabs in edit mode */
33 35 wp_enqueue_style( 'wdk-elementor-main', WPDIRECTORYKIT_URL. 'elementor-elements/assets/css/wdk-main.css' );
34 36
35 37 if ($this->is_edit_mode_load()) {
@@ -35,8 +37,13 @@
35 37 if ($this->is_edit_mode_load()) {
36 38 $this->enqueue_styles_scripts();
37 39 }
38 40
41 +
42 + $this->WMVC = &wdk_get_instance();
43 + $this->WMVC->model('listingfield_m');
44 + $this->WMVC->model('listing_m');
45 + $this->WMVC->load_helper('listing');
39 46 parent::__construct($data, $args);
40 47 }
41 48
42 49 /**
@@ -160,13 +167,8 @@
160 167 */
161 168 protected function render() {
162 169 $this->enqueue_styles_scripts();
163 170 $this->add_page_settings_css();
164 -
165 - $this->WMVC = &wdk_get_instance();
166 - $this->WMVC->model('listingfield_m');
167 - $this->WMVC->model('listing_m');
168 - $this->WMVC->load_helper('listing');
169 171 }
170 172
171 173
172 174 public function view($view_file = '', $element = NULL, $print = false)
@@ -200,11 +202,11 @@
200 202 }
201 203 else
202 204 {
203 205 if($print) {
204 - echo 'View file not found in: '.esc_html($file);
206 + echo 'View file not found in: '.esc_html(WPDIRECTORYKIT_PATH.'elementor-elements/views/'.$view_file.'.php');
205 207 } else {
206 - return 'View file not found in: '.esc_html($file);
208 + return 'View file not found in: '.esc_html(WPDIRECTORYKIT_PATH.'elementor-elements/views/'.$view_file.'.php');
207 209 }
208 210 }
209 211 }
210 212
@@ -209,9 +211,9 @@
209 211 }
210 212
211 213 public function generate_renders_tabs($selectors = array(), $tab_prefix='', $enable_options = array(), $disable_options = array()) {
212 214 /* margin */
213 - //$options = ['margin','align','typo','color','background','border','border_radius','padding','shadow','transition','image_size_control', 'height', 'width','font-size'];
215 + //$options = ['margin','align','typo','color','background','border','border_radius','padding','shadow','transition','image_size_control','image_fit_control', 'height', 'width','font-size','css_filters','background_group','hover_animation'];
214 216 $options = ['typo','color','background','border','border_radius','padding','shadow']; // default
215 217
216 218 /* defined */
217 219 if(is_string($enable_options)){
@@ -223,9 +225,10 @@
223 225 case 'text': $enable_options = ['align','typo','color','background','border','border_radius','padding','shadow','transition'];
224 226 break;
225 227 case 'full': $enable_options = ['margin','align','typo','color','background','border','border_radius','padding','shadow','transition'];
226 228 break;
227 - deafult: $enable_options = ['margin','align','typo','color','background','border','border_radius','padding','shadow','transition'];
229 + default: $enable_options = ['margin','align','typo','color','background','border','border_radius','padding','shadow','transition'];
230 +
228 231 break;
229 232 }
230 233 }
231 234
@@ -343,8 +346,77 @@
343 346 'selector' => $selector,
344 347 ]
345 348 );
346 349
350 + if(in_array('outline',$options)) {
351 +
352 + $this->add_responsive_control(
353 + $type.'_outline'.$prefix,
354 + [
355 + 'label' => esc_html_x( 'Outline Type', 'Outline Control', 'wpdirectorykit' ),
356 + 'type' => \Elementor\Controls_Manager::SELECT,
357 + 'options' => [
358 + '' => esc_html__( 'Default', 'wpdirectorykit' ),
359 + 'none' => esc_html__( 'None', 'wpdirectorykit' ),
360 + 'solid' => esc_html_x( 'Solid', 'Outline Control', 'wpdirectorykit' ),
361 + 'double' => esc_html_x( 'Double', 'Outline Control', 'wpdirectorykit' ),
362 + 'dotted' => esc_html_x( 'Dotted', 'Outline Control', 'wpdirectorykit' ),
363 + 'dashed' => esc_html_x( 'Dashed', 'Outline Control', 'wpdirectorykit' ),
364 + 'groove' => esc_html_x( 'Groove', 'Outline Control', 'wpdirectorykit' ),
365 + ],
366 + 'selectors' => [
367 + $selector => 'outline-style: {{VALUE}};',
368 + ],
369 + ]
370 + );
371 +
372 + $this->add_responsive_control(
373 + $type.'_outline_width'.$prefix,
374 + [
375 + 'label' => esc_html_x( 'Width', 'Outline Control', 'wpdirectorykit' ),
376 + 'type' => \Elementor\Controls_Manager::NUMBER,
377 + 'default' => '',
378 + 'selectors' => [
379 + $selector => 'outline-width: {{VALUE}}px;',
380 + ],
381 + 'condition' => [
382 + $type.'_outline'.$prefix.'!' => [ '', 'none' ],
383 + ],
384 + ]
385 + );
386 +
387 + $this->add_responsive_control(
388 + $type.'_outline_color'.$prefix,
389 + [
390 + 'label' => esc_html_x( 'Color', 'Outline Control', 'wpdirectorykit' ),
391 + 'type' => \Elementor\Controls_Manager::COLOR,
392 + 'default' => '',
393 + 'selectors' => [
394 + $selector => 'outline-color: {{VALUE}};',
395 + ],
396 + 'condition' => [
397 + $type.'_outline'.$prefix.'!' => [ '', 'none' ],
398 + ],
399 + ]
400 + );
401 +
402 + $this->add_responsive_control(
403 + $type.'_outline_offset'.$prefix,
404 + [
405 + 'label' => esc_html_x( 'Offset', 'Outline Control', 'wpdirectorykit' ),
406 + 'type' => \Elementor\Controls_Manager::NUMBER,
407 + 'default' => '',
408 + 'selectors' => [
409 + $selector => 'outline-offset: {{VALUE}}px;',
410 + ],
411 + 'condition' => [
412 + $type.'_outline'.$prefix.'!' => [ '', 'none' ],
413 + ],
414 + ]
415 + );
416 +
417 + }
418 +
347 419 if(in_array('border_radius',$options))
348 420 $this->add_responsive_control(
349 421 $type.'_border_radius'.$prefix,
350 422 [
@@ -586,8 +658,154 @@
586 658
587 659 ]
588 660 );
589 661 }
662 +
663 +
664 + if (in_array('image_fit_control', $options)) {
665 +
666 +
667 + $this->add_control(
668 + $type.'_image_fit_control'.$prefix,
669 + [
670 + 'label' => esc_html__( 'Fit', 'wpdirectorykit' ),
671 + 'type' => \Elementor\Controls_Manager::SELECT,
672 + 'options' => [
673 + '' => esc_html__( 'Default', 'wpdirectorykit' ),
674 + 'fill' => esc_html__( 'Fill', 'wpdirectorykit' ),
675 + 'contain' => esc_html__( 'Contain', 'wpdirectorykit' ),
676 + 'cover' => esc_html__( 'Cover', 'wpdirectorykit' ),
677 + 'none' => esc_html__( 'None', 'wpdirectorykit' ),
678 + 'scale-down' => esc_html__( 'Scale down', 'wpdirectorykit' ),
679 + ],
680 + 'selectors' => [
681 + $selector => 'object-fit: {{VALUE}};',
682 + ],
683 + ]
684 + );
685 + $this->add_control(
686 + $type.'_image_fit_control_position'.$prefix,
687 + [
688 + 'label' => esc_html__( 'Fit Position', 'wpdirectorykit' ),
689 + 'type' => \Elementor\Controls_Manager::SELECT,
690 + 'options' => [
691 + '' => esc_html__( 'Default', 'wpdirectorykit' ),
692 + 'top' => esc_html__( 'Top', 'wpdirectorykit' ),
693 + 'bottom' => esc_html__( 'Bottom', 'wpdirectorykit' ),
694 + 'left' => esc_html__( 'Left', 'wpdirectorykit' ),
695 + 'right' => esc_html__( 'Right', 'wpdirectorykit' ),
696 + 'center' => esc_html__( 'Center', 'wpdirectorykit' ),
697 + ],
698 + 'selectors' => [
699 + $selector => 'object-position: {{VALUE}};',
700 + ],
701 + ]
702 + );
703 +
704 + }
705 +
706 + if (in_array('css_filters', $options)) {
707 + $this->add_group_control(
708 + \Elementor\Group_Control_Css_Filter::get_type(),
709 + [
710 + 'name' => $type.'_css_filters'.$prefix,
711 + 'selector' => $selector,
712 + ]
713 + );
714 + }
715 +
716 + if (in_array('background_group', $options)) {
717 + $this->add_group_control(
718 + \Elementor\Group_Control_Background::get_type(),
719 + [
720 + 'name' => $type.'_background_group'.$prefix,
721 + 'label' => esc_html__( 'Background group', 'wpdirectorykit' ),
722 + 'types' => [ 'classic', 'gradient', 'video' ],
723 + 'selector' => $selector,
724 + ]
725 + );
726 + $this->add_control(
727 + $type.'_background_group_hr'.$prefix,
728 + [
729 + 'type' => \Elementor\Controls_Manager::DIVIDER,
730 + ]
731 + );
732 + }
733 +
734 + if (in_array('hover_animation', $options) && $prefix == 'hover') {
735 + $this->add_control(
736 + $type.'_hover_animation'.$prefix,
737 + [
738 + 'label' => esc_html__( 'Hover Animation', 'wpdirectorykit' ),
739 + 'type' => \Elementor\Controls_Manager::SELECT2,
740 + 'multiple' => false,
741 + 'options' => [
742 + 'grow' => esc_html__( 'Grow', 'wpdirectorykit' ),
743 + 'shrink' => esc_html__( 'Shrink', 'wpdirectorykit' ),
744 + 'pulse' => esc_html__( 'Pulse', 'wpdirectorykit' ),
745 + 'pulse-grow' => esc_html__( 'Pulse Grow', 'wpdirectorykit' ),
746 + 'pulse-shrink' => esc_html__( 'Pulse Shrink', 'wpdirectorykit' ),
747 + 'push' => esc_html__( 'Push', 'wpdirectorykit' ),
748 + 'pop' => esc_html__( 'Pop', 'wpdirectorykit' ),
749 + 'bounce-in' => esc_html__( 'Bounce In', 'wpdirectorykit' ),
750 + 'bounce-out' => esc_html__( 'Bounce Out', 'wpdirectorykit' ),
751 + 'rotate' => esc_html__( 'Rotate', 'wpdirectorykit' ),
752 + 'grow-rotate' => esc_html__( 'Grow Rotate', 'wpdirectorykit' ),
753 + 'float' => esc_html__( 'Float', 'wpdirectorykit' ),
754 + 'sink' => esc_html__( 'Sink', 'wpdirectorykit' ),
755 + 'bob' => esc_html__( 'Bob', 'wpdirectorykit' ),
756 + 'hang' => esc_html__( 'Hang', 'wpdirectorykit' ),
757 + 'skew' => esc_html__( 'Skew', 'wpdirectorykit' ),
758 + 'skew-forward' => esc_html__( 'Skew Forward', 'wpdirectorykit' ),
759 + 'skew-backward' => esc_html__( 'Skew Backward', 'wpdirectorykit' ),
760 + 'wobble-vertical' => esc_html__( 'Wobble Vertical', 'wpdirectorykit' ),
761 + 'wobble-horizontal' => esc_html__( 'wobble Horizontal', 'wpdirectorykit' ),
762 + 'wobble-to-bottom-right' => esc_html__( 'Wobble To Bottom Right', 'wpdirectorykit' ),
763 + 'wobble-to-top-right' => esc_html__( 'Wobble To Top Eight', 'wpdirectorykit' ),
764 + 'wobble-top' => esc_html__( 'Wobble Top', 'wpdirectorykit' ),
765 + 'wobble-bottom' => esc_html__( 'Wobble Bottom', 'wpdirectorykit' ),
766 + 'wobble-skew' => esc_html__( 'Wobble Skew', 'wpdirectorykit' ),
767 + 'buzz' => esc_html__( 'Buzz', 'wpdirectorykit' ),
768 + 'buzz-out' => esc_html__( 'Buzz Out', 'wpdirectorykit' ),
769 + ],
770 + 'selectors_dictionary' => [
771 + 'grow' => 'animation-name: wdk-hover-animation-grow;animation-duration: 0.3s;animation-timing-function: linear;animation-iteration-count: 1;',
772 + 'shrink' => 'animation-name: wdk-hover-animation-shrink;animation-duration: 0.3s;animation-timing-function: linear;animation-iteration-count: 1;',
773 + 'pulse' => 'animation-name: wdk-hover-animation-pulse;animation-duration: 1s; animation-timing-function: linear;animation-iteration-count: infinite;',
774 + 'pulse-grow' => 'animation-name: wdk-hover-animation-pulse-grow; animation-duration: 0.3s;animation-timing-function: linear;animation-iteration-count: infinite;animation-direction: alternate;',
775 + 'pulse-shrink' => 'animation-name: wdk-hover-animation-pulse-shrink;animation-duration: 0.3s;animation-timing-function: linear;animation-iteration-count: infinite;animation-direction: alternate;',
776 + 'push' => 'animation-name: wdk-hover-animation-push;animation-duration: 0.3s;animation-timing-function: linear;animation-iteration-count: 1;',
777 + 'pop' => 'animation-name: wdk-hover-animation-pop;animation-duration: 0.3s;animation-timing-function: linear;animation-iteration-count: 1;',
778 + 'bounce-in' => 'animation-name: wdk-hover-animation-bounce-in;animation-duration: 0.5s;animation-timing-function: cubic-bezier(0.47, 2.02, 0.31, -0.36);;animation-iteration-count: 1;',
779 + 'bounce-out' => 'animation-name: wdk-hover-animation-bounce-out;animation-duration: 0.5s;animation-timing-function: cubic-bezier(0.47, 2.02, 0.31, -0.36);animation-iteration-count: 1;',
780 + 'rotate' => 'animation-name: wdk-hover-animation-rotate;animation-duration: 0.3s;animation-timing-function: linear;animation-iteration-count: 1;',
781 + 'grow-rotate' => 'animation-name: wdk-hover-animation-grow;animation-duration: 0.3s;animation-timing-function: linear;animation-iteration-count: 1;',
782 + 'float' => 'animation-name: wdk-hover-animation-float;animation-duration: 0.3s;animation-timing-function: ease-out;animation-iteration-count: 1;',
783 + 'sink' => 'animation-name: wdk-hover-animation-sink;animation-duration: 0.3s;animation-timing-function: ease-out;animation-iteration-count: 1;',
784 + 'bob' => 'animation-name: wdk-hover-animation-bob-float, wdk-hover-animation-bob;animation-duration: .3s, 1.5s;animation-delay: 0s, .3s;animation-timing-function: ease-out, ease-in-out;animation-iteration-count: 1, infinite;animation-fill-mode: forwards;animation-direction: normal, alternate;',
785 + 'hang' => 'animation-name: wdk-hover-animation-hang-sink, wdk-hover-animation-hang;animation-duration: .3s, 1.5s;animation-delay: 0s, .3s;animation-timing-function: ease-out, ease-in-out;animation-iteration-count: 1, infinite;animation-fill-mode: forwards;animation-direction: normal, alternate;',
786 + 'skew' => 'animation-name: wdk-hover-animation-skew;animation-duration: 0.3s;animation-timing-function: ease-out;animation-iteration-count: 1;',
787 + 'skew-forward' => 'animation-name: wdk-hover-animation-skew-forward;animation-duration: 0.3s;animation-timing-function: ease-out;animation-iteration-count: 1;transform-origin: 0 100%;',
788 + 'skew-backward' => 'animation-name: wdk-hover-animation-skew-backward;animation-duration: 0.3s;animation-timing-function: ease-out;animation-iteration-count: 1;transform-origin: 0 100%;',
789 + 'wobble-vertical' => 'animation-name: wdk-hover-animation-wobble-vertical;animation-duration: 1s;animation-timing-function: ease-in-out; animation-iteration-count: 1;',
790 + 'wobble-horizontal' => 'animation-name: wdk-hover-animation-wobble-horizontal; animation-duration: 1s;animation-timing-function: ease-in-out;animation-iteration-count: 1;',
791 + 'wobble-to-bottom-right' => 'animation-name: wdk-hover-animation-wobble-to-bottom-right;animation-duration: 1s;animation-timing-function: ease-in-out;animation-iteration-count: 1;',
792 + 'wobble-to-top-right' => 'animation-name: wdk-hover-animation-wobble-to-top-right;animation-duration: 1s;animation-timing-function: ease-in-out;animation-iteration-count: 1;',
793 + 'wobble-top' => 'transform-origin: 0 100%;animation-name: wdk-hover-animation-wobble-top;animation-duration: 1s;animation-timing-function: ease-in-out;animation-iteration-count: 1;',
794 + 'wobble-bottom' => 'transform-origin: 100% 0;animation-name: wdk-hover-animation-wobble-bottom;animation-duration: 1s;animation-timing-function: ease-in-out;animation-iteration-count: 1;',
795 + 'wobble-skew' => 'animation-name: wdk-hover-animation-wobble-skew;animation-duration: 1s;animation-timing-function: ease-in-out;animation-iteration-count: 1;',
796 + 'buzz' => 'animation-name: wdk-hover-animation-buzz;animation-duration: 0.15s;animation-timing-function: linear;animation-iteration-count: infinite;',
797 + 'buzz-out' => 'animation-name: wdk-hover-animation-buzz-out;animation-duration: 0.75s;animation-timing-function: linear;animation-iteration-count: 1;',
798 + ],
799 + 'default' => '',
800 + 'selectors' => [
801 + $selector => '{{VALUE}};',
802 + ],
803 + 'render_type' => 'template'
804 + ]
805 + );
806 + }
807 +
590 808 if($tabs_enable)
591 809 $this->end_controls_tab();
592 810 }
593 811
@@ -596,8 +814,12 @@
596 814 * @param $post_css Post
597 815 */
598 816 public function add_page_settings_css() {
599 817 $settings = $this->get_settings();
818 +
819 + if(!isset($settings['custom_css']))
820 + return;
821 +
600 822 $custom_css = $settings['custom_css'];
601 823 $custom_css = trim( $custom_css );
602 824
603 825 if ( empty( $custom_css ) ) {
@@ -604,14 +826,16 @@
604 826 return;
605 827 }
606 828
607 829 // Add a css comment
608 - $custom_css = '/* Start custom CSS for page-settings */' . $custom_css . '/* End custom CSS */';
830 + $custom_css_file = '/* Start custom CSS for page-settings */' .
831 + str_replace( 'selector', '#wdk_el_' . $this->get_id_int(), $custom_css ).
832 + str_replace( 'selector', '.elementor-element.elementor-element-' . $this->get_id(), $custom_css ).
833 + '/* End custom CSS */';
609 834
610 -
611 - $custom_css = str_replace( 'selector', '#wdk_el_' . $this->get_id(), $custom_css );
612 835
613 - echo '<style>'.wmvc_xss_clean($custom_css).'</style>';
836 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped, WordPress.WP.I18n.NonSingularStringLiteralText
837 + echo '<style>'.wmvc_xss_clean($custom_css_file).'</style>';
614 838 }
615 839
616 840 private function break_css($css)
617 841 {
@@ -634,9 +858,9 @@
634 858 }
635 859 $output = '';
636 860 // handler SVG Icon
637 861 if ( 'svg' === $icon['library'] ) {
638 - $output = \Elementor\Icons_Manager::render_svg_icon( $icon['value'] );
862 + $output = \Elementor\Icons_Manager::render_uploaded_svg_icon( $icon['value'] );
639 863 } else {
640 864 $output = $this->render_icon_html( $icon, $attributes, $tag );
641 865 }
642 866
@@ -732,9 +956,10 @@
732 956 ],
733 957 ],
734 958 'default' => '1',
735 959 'toggle' => false,
736 - 'description' => '<span class="wdk_control_get_pro">'.sprintf(esc_html__(' %1$sGet our Addons%2$s for more awesome elements and powerful features!','wpdirectorykit'),'<a href="//wpdirectorykit.com/plugins.html" target="_blank">','</a>').'</span>'
960 + /* translators: 1: Tag with link open, 2: close link tag. */
961 + 'description' => '<span class="wdk_control_get_pro">'.wdk_sprintf(esc_html__(' %1$sGet our Addons%2$s for more awesome elements and powerful features!','wpdirectorykit'),'<a href="//wpdirectorykit.com/plugins.html" target="_blank">','</a>').'</span>'
737 962
738 963 ]
739 964 );
740 965
@@ -741,5 +966,15 @@
741 966 $this->end_controls_section();
742 967 }
743 968 }
744 969
745 -}
970 + public function editing_element($key, $toolbar = 'basic', $attr = array()) {
971 + $this->add_inline_editing_attributes( $key, $toolbar );
972 + foreach ($attr as $key_attr => $value_attr) {
973 + $this->add_render_attribute( $key, $key_attr, $value_attr );
974 + }
975 +
976 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped, WordPress.WP.I18n.NonSingularStringLiteralText
977 + echo $this->get_render_attribute_string( $key );
978 + }
979 +
980 +}