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 +144 -14 1.1.8 → 1.5.9 View file →
@@ -29,8 +29,9 @@
29 29 protected $data = array();
30 30 protected $WMVC = NULL;
31 31
32 32 public function __construct($data = array(), $args = null) {
33 +
33 34 /* load icons for tabs in edit mode */
34 35 wp_enqueue_style( 'wdk-elementor-main', WPDIRECTORYKIT_URL. 'elementor-elements/assets/css/wdk-main.css' );
35 36
36 37 if ($this->is_edit_mode_load()) {
@@ -36,8 +37,13 @@
36 37 if ($this->is_edit_mode_load()) {
37 38 $this->enqueue_styles_scripts();
38 39 }
39 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');
40 46 parent::__construct($data, $args);
41 47 }
42 48
43 49 /**
@@ -161,13 +167,8 @@
161 167 */
162 168 protected function render() {
163 169 $this->enqueue_styles_scripts();
164 170 $this->add_page_settings_css();
165 -
166 - $this->WMVC = &wdk_get_instance();
167 - $this->WMVC->model('listingfield_m');
168 - $this->WMVC->model('listing_m');
169 - $this->WMVC->load_helper('listing');
170 171 }
171 172
172 173
173 174 public function view($view_file = '', $element = NULL, $print = false)
@@ -210,9 +211,9 @@
210 211 }
211 212
212 213 public function generate_renders_tabs($selectors = array(), $tab_prefix='', $enable_options = array(), $disable_options = array()) {
213 214 /* margin */
214 - //$options = ['margin','align','typo','color','background','border','border_radius','padding','shadow','transition','image_size_control', 'height', 'width','font-size','css_filters','background_group','hover_animation'];
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'];
215 216 $options = ['typo','color','background','border','border_radius','padding','shadow']; // default
216 217
217 218 /* defined */
218 219 if(is_string($enable_options)){
@@ -224,9 +225,10 @@
224 225 case 'text': $enable_options = ['align','typo','color','background','border','border_radius','padding','shadow','transition'];
225 226 break;
226 227 case 'full': $enable_options = ['margin','align','typo','color','background','border','border_radius','padding','shadow','transition'];
227 228 break;
228 - 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 +
229 231 break;
230 232 }
231 233 }
232 234
@@ -344,8 +346,77 @@
344 346 'selector' => $selector,
345 347 ]
346 348 );
347 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 +
348 419 if(in_array('border_radius',$options))
349 420 $this->add_responsive_control(
350 421 $type.'_border_radius'.$prefix,
351 422 [
@@ -589,8 +660,50 @@
589 660 );
590 661 }
591 662
592 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 +
593 706 if (in_array('css_filters', $options)) {
594 707 $this->add_group_control(
595 708 \Elementor\Group_Control_Css_Filter::get_type(),
596 709 [
@@ -701,8 +814,12 @@
701 814 * @param $post_css Post
702 815 */
703 816 public function add_page_settings_css() {
704 817 $settings = $this->get_settings();
818 +
819 + if(!isset($settings['custom_css']))
820 + return;
821 +
705 822 $custom_css = $settings['custom_css'];
706 823 $custom_css = trim( $custom_css );
707 824
708 825 if ( empty( $custom_css ) ) {
@@ -709,14 +826,16 @@
709 826 return;
710 827 }
711 828
712 829 // Add a css comment
713 - $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 */';
714 834
715 -
716 - $custom_css = str_replace( 'selector', '#wdk_el_' . $this->get_id(), $custom_css );
717 835
718 - 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>';
719 838 }
720 839
721 840 private function break_css($css)
722 841 {
@@ -739,9 +858,9 @@
739 858 }
740 859 $output = '';
741 860 // handler SVG Icon
742 861 if ( 'svg' === $icon['library'] ) {
743 - $output = \Elementor\Icons_Manager::render_svg_icon( $icon['value'] );
862 + $output = \Elementor\Icons_Manager::render_uploaded_svg_icon( $icon['value'] );
744 863 } else {
745 864 $output = $this->render_icon_html( $icon, $attributes, $tag );
746 865 }
747 866
@@ -837,9 +956,10 @@
837 956 ],
838 957 ],
839 958 'default' => '1',
840 959 'toggle' => false,
841 - '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>'
842 962
843 963 ]
844 964 );
845 965
@@ -846,5 +966,15 @@
846 966 $this->end_controls_section();
847 967 }
848 968 }
849 969
850 -}
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 +}