File manager - Edit - /home/boiitech111/autorollingright.com/wp-content/themes/carutos/inc/vendor/elementor/widgets/image-box.php
Back
<?php namespace Elementor; if (!defined('ABSPATH')) { exit; // Exit if accessed directly. } /** * Elementor image box widget. * * Elementor widget that displays an image, a headline and a text. * * @since 1.0.0 */ class WPOPAL_Widget_Image_Box extends Widget_Image_Box { /** * Get widget name. * * Retrieve image box widget name. * * @since 1.0.0 * @access public * * @return string Widget name. */ public function get_name() { return 'image-box'; } /** * Get widget title. * * Retrieve image box widget title. * * @since 1.0.0 * @access public * * @return string Widget title. */ public function get_title() { return esc_html__('Image Box', 'carutos'); } /** * Get widget icon. * * Retrieve image box widget icon. * * @since 1.0.0 * @access public * * @return string Widget icon. */ public function get_icon() { return 'eicon-image-box'; } public function get_categories() { return ['opal-addons']; } /** * Register image box widget controls. * * Adds different input fields to allow the user to change and customize the widget settings. * * @since 1.0.0 * @access protected */ protected function register_controls() { $this->start_controls_section( 'section_image', [ 'label' => esc_html__('Image Box', 'carutos'), ] ); $this->add_control( 'image', [ 'label' => esc_html__('Choose Image', 'carutos'), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true, ], 'default' => [ 'url' => Utils::get_placeholder_image_src(), ], ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'thumbnail', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `thumbnail_size` and `thumbnail_custom_dimension`. 'default' => 'full', 'separator' => 'none', ] ); $this->add_control( 'view_style', [ 'label' => esc_html__( 'View', 'carutos' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'default' => esc_html__( 'Default', 'carutos' ), 'stacked' => esc_html__( 'Stacked', 'carutos' ), ], 'default' => 'default', 'prefix_class' => 'elementor-view-', 'condition' => [ 'image!' => '', ], ] ); $this->add_control( 'shape', [ 'label' => esc_html__( 'Shape', 'carutos' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'circle' => esc_html__( 'Circle', 'carutos' ), 'square' => esc_html__( 'Square', 'carutos' ), ], 'default' => 'circle', 'condition' => [ 'view_style!' => 'default', 'image!' => '', ], 'prefix_class' => 'elementor-shape-', ] ); $this->add_control( 'title_text', [ 'label' => esc_html__('Title & Description', 'carutos'), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true, ], 'default' => esc_html__('This is the heading', 'carutos'), 'placeholder' => esc_html__('Enter your title', 'carutos'), 'label_block' => true, ] ); $this->add_control( 'sub_title_text', [ 'label' => esc_html__('Sub Title', 'carutos'), 'type' => Controls_Manager::TEXT, 'placeholder' => esc_html__('Enter your sub-title', 'carutos'), 'label_block' => true, ] ); $this->add_control( 'description_text', [ 'label' => esc_html__('Description', 'carutos'), 'type' => Controls_Manager::TEXTAREA, 'dynamic' => [ 'active' => true, ], 'default' => esc_html__('Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'carutos'), 'placeholder' => esc_html__('Enter your description', 'carutos'), 'separator' => 'none', 'rows' => 10, ] ); $this->add_control( 'hover_animation_wrapper', [ 'label' => esc_html__( 'Hover Wrapper Animation', 'carutos' ), 'type' => Controls_Manager::HOVER_ANIMATION, 'prefix_class' => 'elementor-animation-', ] ); $this->add_control( 'link', [ 'label' => esc_html__('Link to', 'carutos'), 'type' => Controls_Manager::URL, 'dynamic' => [ 'active' => true, ], 'placeholder' => esc_html__('https://your-link.com', 'carutos'), 'separator' => 'before', ] ); $this->add_control( 'link_download', [ 'label' => esc_html__('Donload Link ?', 'carutos'), 'type' => Controls_Manager::SWITCHER, ] ); $this->add_control( 'position', [ 'label' => esc_html__('Image Position', 'carutos'), 'type' => Controls_Manager::CHOOSE, 'default' => 'top', 'options' => [ 'left' => [ 'title' => esc_html__('Left', 'carutos'), 'icon' => 'fa fa-align-left', ], 'top' => [ 'title' => esc_html__('Top', 'carutos'), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => esc_html__('Right', 'carutos'), 'icon' => 'fa fa-align-right', ], ], 'prefix_class' => 'elementor-position-', 'toggle' => false, ] ); $this->add_control( 'title_size', [ 'label' => esc_html__('Title HTML Tag', 'carutos'), 'type' => Controls_Manager::SELECT, 'options' => [ 'h1' => esc_html__( 'H1', 'carutos' ), 'h2' => esc_html__( 'H2', 'carutos' ), 'h3' => esc_html__( 'H3', 'carutos' ), 'h4' => esc_html__( 'H4', 'carutos' ), 'h5' => esc_html__( 'H5', 'carutos' ), 'h6' => esc_html__( 'H6', 'carutos' ), 'div' => esc_html__( 'div', 'carutos' ), 'span' => esc_html__( 'span', 'carutos' ), 'p' => esc_html__( 'p', 'carutos' ), ], 'default' => 'h3', ] ); $this->add_control( 'button_text', [ 'label' => esc_html__('Button', 'carutos'), 'type' => Controls_Manager::TEXT, 'placeholder' => esc_html__('Read more...', 'carutos'), 'label_block' => true, 'separator' => 'before', ] ); $this->add_control( 'button_type', [ 'label' => esc_html__( 'Type', 'carutos' ), 'type' => Controls_Manager::SELECT, 'default' => 'default', 'options' => [ 'default' => esc_html__( 'Default', 'carutos' ), 'info' => esc_html__( 'Info', 'carutos' ), 'success' => esc_html__( 'Success', 'carutos' ), 'warning' => esc_html__( 'Warning', 'carutos' ), 'danger' => esc_html__( 'Danger', 'carutos' ), 'primary' => esc_html__( 'Primary', 'carutos' ), 'outline-pirmary' => esc_html__( 'Outline Pirmary', 'carutos' ), 'btn-secondary' => esc_html__( 'Secondary', 'carutos' ), 'btn-line' => esc_html__( 'Oneline', 'carutos' ), ], 'prefix_class' => 'elementor-button-', ] ); $this->add_control( 'button_size', [ 'label' => esc_html__('Size', 'carutos'), 'type' => Controls_Manager::SELECT, 'default' => 'md', 'options' => [ 'xs' => esc_html__('Extra Small', 'carutos'), 'sm' => esc_html__('Small', 'carutos'), 'md' => esc_html__('Medium', 'carutos'), 'lg' => esc_html__('Large', 'carutos'), 'xl' => esc_html__('Extra Large', 'carutos'), ], 'condition' => [ 'button_text!' => '', ], ] ); $this->add_control( 'button_icon', [ 'label' => esc_html__('Button Icon', 'carutos'), 'type' => Controls_Manager::ICON, 'label_block' => true, 'default' => '', ] ); $this->add_control( 'button_icon_align', [ 'label' => esc_html__( 'Icon Position', 'carutos' ), 'type' => Controls_Manager::SELECT, 'default' => 'right', 'options' => [ 'left' => esc_html__( 'Before', 'carutos' ), 'right' => esc_html__( 'After', 'carutos' ), ], 'condition' => [ 'button_icon!' => '', ], ] ); $this->add_control( 'view', [ 'label' => esc_html__('View', 'carutos'), 'type' => Controls_Manager::HIDDEN, 'default' => 'traditional', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_image', [ 'label' => esc_html__('Image', 'carutos'), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'image_space', [ 'label' => esc_html__('Spacing', 'carutos'), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 15, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}}.elementor-position-right .elementor-image-box-img' => 'margin-left: {{SIZE}}{{UNIT}};', '{{WRAPPER}}.elementor-position-left .elementor-image-box-img' => 'margin-right: {{SIZE}}{{UNIT}};', '{{WRAPPER}}.elementor-position-top .elementor-image-box-img' => 'margin-bottom: {{SIZE}}{{UNIT}};', '(mobile){{WRAPPER}} .elementor-image-box-img' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'image_size', [ 'label' => esc_html__('Size', 'carutos'), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 50, 'unit' => 'px', ], 'range' => [ 'px' => [ 'min' => 50, 'max' => 200, ], '%' => [ 'min' => 5, 'max' => 100, ] ], 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .elementor-image-box-wrapper .elementor-image-box-img' => 'width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'Image_radius', [ 'label' => esc_html__( 'Image Radius', 'carutos' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .elementor-image-box-img img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->start_controls_tabs('tabs_image_hover_style'); $this->start_controls_tab( 'tab_image_hover_style_normal', [ 'label' => esc_html__('Normal', 'carutos'), ] ); $this->add_control( 'image_opacity', [ 'label' => esc_html__('Opacity', 'carutos'), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0.10, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-image-box-wrapper .elementor-image-box-img img' => 'opacity: {{SIZE}};', '{{WRAPPER}} .elementor-image-box-wrapper .elementor-image-box-img svg' => 'opacity: {{SIZE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_image_hover_style_hover', [ 'label' => esc_html__('Hover', 'carutos'), ] ); $this->add_control( 'image_opacity_hover', [ 'label' => esc_html__('Opacity', 'carutos'), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0.10, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}}:hover .elementor-image-box-wrapper .elementor-image-box-img img' => 'opacity: {{SIZE}};', '{{WRAPPER}}:hover .elementor-image-box-wrapper .elementor-image-box-img svg' => 'opacity: {{SIZE}};', ], ] ); $this->add_control( 'hover_animation', [ 'label' => esc_html__('Hover Animation', 'carutos'), 'type' => Controls_Manager::HOVER_ANIMATION, ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'svg_addition_heading', [ 'label' => esc_html__('SVG Options', 'carutos'), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_responsive_control( 'svg_size', [ 'label' => esc_html__('SVG Size', 'carutos'), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 46, 'unit' => 'px', ], 'range' => [ 'min' => 5, 'max' => 100, ], 'selectors' => [ '{{WRAPPER}} .elementor-image-box-img svg' => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};', ], ] ); $this->start_controls_tabs('tabs_svg_style'); $this->start_controls_tab( 'svg_button_normal', [ 'label' => esc_html__('Normal', 'carutos'), ] ); $this->add_control( 'svg_color', [ 'label' => esc_html__('SVG Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .elementor-image-box-wrapper .elementor-image-box-img svg path' => 'fill: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'svg_button_hover', [ 'label' => esc_html__('Hover', 'carutos'), ] ); $this->add_control( 'svg_hover_color', [ 'label' => esc_html__('SVG Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}}:hover .elementor-image-box-wrapper .elementor-image-box-img svg path' => 'fill: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'acdfbox_view_section', [ 'label' => esc_html__('Box View', 'carutos'), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->start_controls_tabs('tabs_view_style'); $this->start_controls_tab( 'view_button_normal', [ 'label' => esc_html__('Normal', 'carutos'), ] ); $this->add_control( 'view_bg', [ 'label' => esc_html__('Box View Background', 'carutos'), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .elementor-image-box-wrapper .elementor-icon' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'framed_color', [ 'label' => esc_html__('Framed Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .elementor-image-box-wrapper .elementor-icon' => 'border:1px solid {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'view_button_hover', [ 'label' => esc_html__('Hover', 'carutos'), ] ); $this->add_control( 'view_bg_hover', [ 'label' => esc_html__('Box View Background', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}}:hover .elementor-image-box-wrapper .elementor-icon' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'framed_color_hover', [ 'label' => esc_html__('Framed Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}}:hover .elementor-image-box-wrapper .elementor-image-framed' => 'border-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_style_content', [ 'label' => esc_html__('Content', 'carutos'), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'text_align', [ 'label' => esc_html__('Alignment', 'carutos'), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => esc_html__('Left', 'carutos'), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => esc_html__('Center', 'carutos'), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => esc_html__('Right', 'carutos'), 'icon' => 'fa fa-align-right', ], 'justify' => [ 'title' => esc_html__('Justified', 'carutos'), 'icon' => 'fa fa-align-justify', ], ], 'selectors' => [ '{{WRAPPER}} .elementor-image-box-wrapper' => 'text-align: {{VALUE}};', ], ] ); $this->add_control( 'content_vertical_alignment', [ 'label' => esc_html__('Vertical Alignment', 'carutos'), 'type' => Controls_Manager::SELECT, 'options' => [ 'top' => esc_html__('Top', 'carutos'), 'middle' => esc_html__('Middle', 'carutos'), 'bottom' => esc_html__('Bottom', 'carutos'), ], 'default' => 'top', 'prefix_class' => 'elementor-vertical-align-', ] ); $this->add_control( 'heading_title', [ 'label' => esc_html__('Title', 'carutos'), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_responsive_control( 'title_bottom_space', [ 'label' => esc_html__('Spacing', 'carutos'), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-image-box-title' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'title_color', [ 'label' => esc_html__('Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .elementor-image-box-content .elementor-image-box-title' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'title_color_hover', [ 'label' => esc_html__('Color Hover (Wrapper)', 'carutos'), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}}:hover .elementor-image-box-content .elementor-image-box-title' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'title_typography', 'selector' => '{{WRAPPER}} .elementor-image-box-content .elementor-image-box-title', ] ); $this->add_control( 'sub_heading_title', [ 'label' => esc_html__('Sub Title', 'carutos'), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_responsive_control( 'sub_title_bottom_space', [ 'label' => esc_html__('Spacing', 'carutos'), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-image-box-sub-title' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'heading_sub_title', [ 'label' => esc_html__('Sub-title', 'carutos'), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'sub_title_color', [ 'label' => esc_html__('Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .elementor-image-box-content .elementor-image-box-sub-title' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'sub_title_typography', 'selector' => '{{WRAPPER}} .elementor-image-box-content .elementor-image-box-sub-title', ] ); $this->add_control( 'heading_description', [ 'label' => esc_html__('Description', 'carutos'), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'description_color', [ 'label' => esc_html__('Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .elementor-image-box-content .elementor-image-box-description' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'description_typography', 'selector' => '{{WRAPPER}} .elementor-image-box-content .elementor-image-box-description', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_button_style', [ 'label' => esc_html__('Button', 'carutos'), 'tab' => Controls_Manager::TAB_STYLE, 'show_label' => false, ] ); $this->start_controls_tabs('tabs_button_style'); $this->start_controls_tab( 'tab_button_normal', [ 'label' => esc_html__('Normal', 'carutos'), 'condition' => [ 'button_text!' => '', ], ] ); $this->add_control( 'button_text_color', [ 'label' => esc_html__('Text Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .elementor-button' => 'color: {{VALUE}};', ], 'condition' => [ 'button_text!' => '', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'button_typography', 'selector' => '{{WRAPPER}} .elementor-button', 'condition' => [ 'button_text!' => '', ], ] ); $this->add_control( 'button_background_color', [ 'label' => esc_html__('Background Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-button' => 'background-color: {{VALUE}};', ], 'condition' => [ 'button_text!' => '', ], ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'button_background_gradient', 'types' => ['gradient'], 'selector' => '{{WRAPPER}} .elementor-button', ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'button_border', 'placeholder' => '1px', 'default' => '1px', 'selector' => '{{WRAPPER}} .elementor-button', 'condition' => [ 'button_text!' => '', ], 'separator' => 'before', ] ); $this->add_control( 'button_border_radius', [ 'label' => esc_html__('Border Radius', 'carutos'), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => ['px', '%'], 'selectors' => [ '{{WRAPPER}} .elementor-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'button_text!' => '', ], ] ); $this->add_control( 'button_text_padding', [ 'label' => esc_html__('Text Padding', 'carutos'), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => ['px', 'em', '%'], 'selectors' => [ '{{WRAPPER}} .elementor-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'button_text!' => '', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_button_hover', [ 'label' => esc_html__('Hover', 'carutos'), 'condition' => [ 'button_text!' => '', ], ] ); $this->add_control( 'button_hover_color', [ 'label' => esc_html__('Text Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-button:hover' => 'color: {{VALUE}};', ], 'condition' => [ 'button_text!' => '', ], ] ); $this->add_control( 'button_background_hover_color', [ 'label' => esc_html__('Background Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-button:hover' => 'background-color: {{VALUE}};', ], 'condition' => [ 'button_text!' => '', ], ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'button_background_gradient_hover', 'types' => ['gradient'], 'selector' => '{{WRAPPER}} .elementor-button:hover', ] ); $this->add_control( 'button_hover_border_color', [ 'label' => esc_html__('Border Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-button:hover' => 'border-color: {{VALUE}};', ], 'condition' => [ 'button_text!' => '', ], ] ); $this->add_control( 'button_hover_animation', [ 'label' => esc_html__('Animation', 'carutos'), 'type' => Controls_Manager::HOVER_ANIMATION, 'condition' => [ 'button_text!' => '', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } protected function render() { $settings = $this->get_settings_for_display(); $has_content = ! empty( $settings['title_text'] ) || ! empty( $settings['description_text'] ); $this->add_render_attribute('wrapper', 'class', 'elementor-image-box-wrapper'); $html = '<div '.$this->get_render_attribute_string("wrapper").'>'; if ( ! empty( $settings['link']['url'] ) ) { $this->add_render_attribute( 'link', 'href', esc_url($settings['link']['url']) ); $this->add_render_attribute( 'button_text', 'href', esc_url($settings['link']['url']) ); if ( $settings['link']['is_external'] ) { $this->add_render_attribute( 'link', 'target', '_blank' ); $this->add_render_attribute( 'button_text', 'target', '_blank' ); } if ( ! empty( $settings['link']['nofollow'] ) ) { $this->add_render_attribute( 'link', 'rel', 'nofollow' ); $this->add_render_attribute( 'button_text', 'rel', 'nofollow' ); } if($settings['link_download'] === 'yes'){ $this->add_render_attribute( 'link', 'download' ); $this->add_render_attribute( 'button_text', 'download' ); } } else { $this->add_render_attribute( 'button_text', 'href', '#' ); } $this->add_render_attribute('button_text', 'class', [ 'elementor-button', 'elementor-size-' . $settings['button_size'], ]); if (!empty($settings['button_icon'])) { $this->add_render_attribute( 'icon-align', 'class', 'elementor-button-icon' ); $this->add_render_attribute( 'icon-align', 'class', 'elementor-align-icon-' . $settings['button_icon_align'] ); } $this->add_inline_editing_attributes('button_text'); $this->add_inline_editing_attributes('button_icon'); if ( ! empty( $settings['image']['url'] ) ) { $this->add_render_attribute( 'image', 'src', $settings['image']['url'] ); $this->add_render_attribute( 'image', 'alt', Control_Media::get_image_alt( $settings['image'] ) ); $this->add_render_attribute( 'image', 'title', Control_Media::get_image_title( $settings['image'] ) ); if ( $settings['hover_animation'] ) { $this->add_render_attribute( 'image', 'class', 'elementor-animation-' . $settings['hover_animation'] ); } $this->add_render_attribute( 'image-wrapper', 'class', 'elementor-image-box-img'); if($settings['view_style'] !== 'default'){ $this->add_render_attribute( 'image-wrapper', 'class', 'elementor-icon'); } $image_url = ''; $image_html = Group_Control_Image_Size::get_attachment_image_html( $settings, 'thumbnail', 'image' ); if(!empty($settings['image']['url'])){ $image_url = $settings['image']['url']; $path_parts = pathinfo($image_url); if ($path_parts['extension'] === 'svg') { $image = $this->get_settings_for_display('image'); $pathSvg = get_attached_file($image['id']); $image_html = osf_elementor_get_icon_svg($pathSvg); } } if ( ! empty( $settings['link']['url'] ) ) { $image_html = '<a ' . $this->get_render_attribute_string( 'link' ) . '>' . $image_html . '</a>'; } $html .= '<div class="elementor-image-framed">'; $html .= '<figure '.$this->get_render_attribute_string("image-wrapper").'>' . $image_html . '</figure>'; $html .= '</div>'; } if ( $has_content ) { $html .= '<div class="elementor-image-box-content">'; if(!empty($settings['sub_title_text'])){ $this->add_render_attribute('sub_title_text', 'class', 'elementor-image-box-sub-title'); $html .= '<div '.$this->get_render_attribute_string("sub_title_text").'>'.esc_html($settings["sub_title_text"]).'</div>'; } if ( ! empty( $settings['title_text'] ) ) { $this->add_render_attribute( 'title_text', 'class', 'elementor-image-box-title' ); $this->add_inline_editing_attributes( 'title_text', 'none' ); $title_html = esc_html($settings['title_text']); if ( ! empty( $settings['link']['url'] ) ) { $title_html = '<a ' . $this->get_render_attribute_string( 'link' ) . '>' . $title_html . '</a>'; } $html .= sprintf( '<%1$s %2$s>%3$s</%1$s>', $settings['title_size'], $this->get_render_attribute_string( 'title_text' ), $title_html ); } if ( ! empty( $settings['description_text'] ) ) { $this->add_render_attribute( 'description_text', 'class', 'elementor-image-box-description' ); $this->add_inline_editing_attributes( 'description_text' ); $html .= sprintf( '<p %1$s>%2$s</p>', $this->get_render_attribute_string( 'description_text' ), wp_kses_post($settings['description_text']) ); } if (!empty($settings['button_text'])) { $html .= '<a ' . $this->get_render_attribute_string('button_text') . '>'; if ( ! empty( $settings['button_icon'] ) ) { $html .= '<span ' . $this->get_render_attribute_string( 'icon-align' ) . '>'; $html .= ' <i class="' . esc_attr( $settings['button_icon'] ) . '" aria-hidden="true"></i>'; $html .= '</span>'; } $html .= esc_html($settings['button_text']); $html .= '</a>'; } $html .= '</div>'; } $html .= '</div>'; $kses_defaults = wp_kses_allowed_html( 'post' ); $svg_args = array( 'svg' => array( 'class' => true, 'aria-hidden' => true, 'aria-labelledby' => true, 'role' => true, 'xmlns' => true, 'width' => true, 'height' => true, 'viewbox' => true, // <= Must be lower case! ), 'g' => array( 'fill' => true ), 'title' => array( 'title' => true ), 'path' => array( 'd' => true, 'fill' => true, ), ); $allowed_tags = array_merge( $kses_defaults, $svg_args ); echo wp_kses( $html, $allowed_tags ); // WPCS: XSS ok. } protected function _content_template() { ?> <# view.addRenderAttribute( 'wrapper', 'class', 'elementor-image-box-wrapper' ); view.addRenderAttribute( 'button_text', 'class', 'elementor-button elementor-size-' + settings.button_size ); if ( settings.link.url ) { view.addRenderAttribute( 'button_text', 'href', settings.link.url ); } else { view.addRenderAttribute( 'button_text', 'href', '#' ); } view.addInlineEditingAttributes('button_text'); view.addRenderAttribute( 'icon-align', 'class', 'elementor-button-icon' ); view.addRenderAttribute( 'icon-align', 'class', 'elementor-align-icon-' + settings.button_icon_align); view.addInlineEditingAttributes( 'icon-align' ); var html = '<div '+ view.getRenderAttributeString("wrapper") +'>'; if ( settings.image.url ) { var image = { id: settings.image.id, url: settings.image.url, size: settings.thumbnail_size, dimension: settings.thumbnail_custom_dimension, model: view.getEditModel() }; var image_url = elementor.imagesManager.getImageUrl( image ); if(typeof image_url !== 'undefined' && image_url.substr((image_url.lastIndexOf('.') + 1)) === 'svg'){ var imageHtml = '<object data="'+image_url+'" type="image/svg+xml"></object>'; }else{ var imageHtml = '<img src="' + image_url + '" class="elementor-animation-' + settings.hover_animation + '" />'; } if ( settings.link.url ) { imageHtml = '<a href="' + settings.link.url + '">' + imageHtml + '</a>'; } view.addRenderAttribute( 'image-wrapper', 'class', 'elementor-image-box-img' ); if(settings.view_style !== 'default'){ view.addRenderAttribute( 'image-wrapper', 'class', 'elementor-icon' ); } html += '<div class="elementor-image-framed">'; html += '<figure ' + view.getRenderAttributeString( 'image-wrapper' ) + '>' + imageHtml + '</figure>'; html += '</div>'; } var hasContent = !! ( settings.title_text || settings.description_text ); if ( hasContent ) { html += '<div class="elementor-image-box-content">'; if ( settings.sub_title_text ) { html += '<div class="elementor-image-box-sub-title">' + settings.sub_title_text + '</div>'; } if ( settings.title_text ) { var title_html = settings.title_text; if ( settings.link.url ) { title_html = '<a href="' + settings.link.url + '">' + title_html + '</a>'; } view.addRenderAttribute( 'title_text', 'class', 'elementor-image-box-title' ); view.addInlineEditingAttributes( 'title_text', 'none' ); html += '<' + settings.title_size + ' ' + view.getRenderAttributeString( 'title_text' ) + '>' + title_html + '</' + settings.title_size + '>'; } if ( settings.description_text ) { view.addRenderAttribute( 'description_text', 'class', 'elementor-image-box-description' ); view.addInlineEditingAttributes( 'description_text' ); html += '<p ' + view.getRenderAttributeString( 'description_text' ) + '>' + settings.description_text + '</p>'; } if (settings.button_text) { html += '<a ' + view.getRenderAttributeString('button_text') + '>'; if (settings.button_icon) { html += '<span ' + view.getRenderAttributeString('icon-align') + '">'; html += ' <i class="' + settings.button_icon + '" aria-hidden="true"></i>'; html += '</span>'; } html += settings.button_text; html += '</a>'; } html += '</div>'; } html += '</div>'; print( html ); #> <?php } } $widgets_manager->register(new WPOPAL_Widget_Image_Box());
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Generation time: 0.06 |
proxy
|
phpinfo
|
Settings