Sid Gifari File Manager
🏠 Root
/
home
/
ailwtbdh
/
public_html
/
wp-content
/
plugins
/
profundcore
/
addons
/
widgets
/
Editing: position-element.php
<?php /* * Elemntor Position Element Widget * Author & Copyright: MaxxTheme */ namespace Elementor; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly class profund_Position_Element extends Widget_Base{ /** * Retrieve the widget name. * * @since 1.0.0 * * @access public * * @return string Widget name. */ public function get_name(){ return 'profund-position_element'; } /** * Retrieve the widget title. * * @since 1.0.0 * * @access public * * @return string Widget title. */ public function get_title(){ return __( 'Position Element', 'profundcore' ); } /** * Retrieve the widget icon. * * @since 1.0.0 * * @access public * * @return string Widget icon. */ public function get_icon() { return "eicon-navigator"; } /** * Retrieve the list of categories the widget belongs to. * * @since 1.0.0 * * @access public * * @return array Widget categories. */ public function get_categories() { return [ 'profund-addons' ]; } public function get_script_depends() { return [ 'loop-animation' ]; } /** * Register Position Element 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_element_option', [ 'label' => __( 'Options', 'profundcore' ), ] ); $this->add_control( 'element_type', [ 'label' => __( 'Element Type', 'profundcore' ), 'type' => Controls_Manager::SELECT, 'default' => 'text', 'options' => [ 'text' => __( 'Text', 'profundcore' ), 'icon' => __( 'Icon', 'profundcore' ), 'image' => __( 'Image', 'profundcore' ), ], ] ); $this->add_responsive_control( 'element_width', [ 'label' => __( 'Element Width', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1000, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], 'vw' => [ 'min' => 0, 'max' => 100, ] ], 'size_units' => [ 'px', '%', 'vw' ], 'selectors' => [ '{{WRAPPER}}' => 'width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'element_height', [ 'label' => __( 'Element Height', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1000, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], 'vh' => [ 'min' => 0, 'max' => 100, ] ], 'size_units' => [ 'px', '%', 'vh' ], 'selectors' => [ '{{WRAPPER}} .elementor-widget-container' => 'height: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'element_hr_offset', [ 'label' => __( 'Horizontal Offset', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'vw' ], 'range' => [ 'px' => [ 'min' => -2000, 'max' => 2000, ], '%' => [ 'min' => -100, 'max' => 100, ], 'vw' => [ 'min' => -100, 'max' => 100, ] ], 'selectors' => [ '{{WRAPPER}}' => 'position:absolute;left: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'element_vr_offset', [ 'label' => __( 'Vertical Offset', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'vh' ], 'range' => [ 'px' => [ 'min' => -2000, 'max' => 2000, ], '%' => [ 'min' => -100, 'max' => 100, ], 'vh' => [ 'min' => -100, 'max' => 100, ] ], 'selectors' => [ '{{WRAPPER}}' => 'position:absolute;top: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'element_z_index', [ 'label' => __( 'Z Index', 'profundcore' ), 'type' => Controls_Manager::NUMBER, 'min' => -100, 'max' => 100, 'step' => 1, 'default' => -1, 'selectors' => [ '{{WRAPPER}}' => 'z-index: {{SIZE}};', ], ] ); $this->add_responsive_control( 'rotation_along', [ 'label' => __( 'Rotation Along', 'profundcore' ), 'type' => Controls_Manager::SELECT, 'default' => 'z-axis', 'options' => [ 'x-axis' => __( 'X - axis', 'profundcore' ), 'y-axis' => __( 'Y - axis', 'profundcore' ), 'z-axis' => __( 'Z - axis', 'profundcore' ), ], ] ); $this->add_responsive_control( 'element_rotation_x', [ 'label' => __( 'Rotation X - axis', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'condition' => [ 'rotation_along' => 'x-axis', ], 'frontend_available' => true, 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'max' => 360, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}}' => '-webkit-transform:rotateX({{SIZE}}deg); -moz-transform:rotateX({{SIZE}}deg); -ms-transform:rotateX({{SIZE}}deg); -o-transform:rotateX({{SIZE}}deg); transform:rotateX({{SIZE}}deg);', ], ] ); $this->add_responsive_control( 'element_rotation_y', [ 'label' => __( 'Rotation Y - axis', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'condition' => [ 'rotation_along' => 'y-axis', ], 'frontend_available' => true, 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'max' => 360, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}}' => '-webkit-transform:rotateY({{SIZE}}deg); -moz-transform:rotateY({{SIZE}}deg); -ms-transform:rotateY({{SIZE}}deg); -o-transform:rotateY({{SIZE}}deg); transform:rotateY({{SIZE}}deg);', ], ] ); $this->add_responsive_control( 'element_rotation_z', [ 'label' => __( 'Rotation Z - axis', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'condition' => [ 'rotation_along' => 'z-axis', ], 'frontend_available' => true, 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'max' => 360, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}}' => '-webkit-transform:rotateZ({{SIZE}}deg); -moz-transform:rotateZ({{SIZE}}deg); -ms-transform:rotateZ({{SIZE}}deg); -o-transform:rotateZ({{SIZE}}deg); transform:rotateZ({{SIZE}}deg);', ], ] ); $this->add_responsive_control( 'element_opacity', [ 'label' => __( 'Opacity (%)', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}}' => 'opacity: {{SIZE}}', ], ] ); $this->add_responsive_control( 'element_align', [ 'label' => __( 'Element aligment', 'profundcore' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'profundcore' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'profundcore' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'profundcore' ), 'icon' => 'fa fa-align-right', ], ], 'separator' => 'before', 'default' => 'center', 'selectors' => [ '{{WRAPPER}}' => 'text-align: {{VALUE}};', ], ] ); $this->add_control( 'animation_class', [ 'label' => __( 'Infinite Animation', 'profundcore' ), 'type' => Controls_Manager::SELECT, 'default' => 'none', 'options' => [ 'none' => __( 'None', 'profundcore' ), 'sm-y-move 15s alternate infinite linear' => __( 'Move Y Small', 'profundcore' ), 'md-y-move 25s alternate infinite linear' => __( 'Move Y Medium', 'profundcore' ), 'lg-y-move 35s alternate infinite linear' => __( 'Move Y Large', 'profundcore' ), 'sm-x-move 15s alternate infinite linear' => __( 'Move X Small', 'profundcore' ), 'md-x-move 25s alternate infinite linear' => __( 'Move X Medium', 'profundcore' ), 'lg-x-move 35s alternate infinite linear' => __( 'Move X Large', 'profundcore' ), 'sm-xy-move 5s alternate infinite linear' => __( 'Move XY Small', 'profundcore' ), 'md-xy-move 10s alternate infinite linear' => __( 'Move XY Medium', 'profundcore' ), 'lg-xy-move 15s alternate infinite linear' => __( 'Move XY Large', 'profundcore' ), 'sm-yx-move 5s alternate infinite linear' => __( 'Move YX Small', 'profundcore' ), 'md-yx-move 10s alternate infinite linear' => __( 'Move YX Medium', 'profundcore' ), 'lg-yx-move 15s alternate infinite linear' => __( 'Move YX Large', 'profundcore' ), 'fade-in-out 5s normal infinite linear' => __( 'Fade In Out', 'profundcore' ), 'rotate-x 15s normal infinite linear' => __( 'Rotate X', 'profundcore' ), 'rotate-y 15s normal infinite linear' => __( 'Rotate Y', 'profundcore' ), ], 'selectors' => [ '{{WRAPPER}}' => 'animation: {{VALUE}};', ], ] ); $this->end_controls_section();// end: Section $this->start_controls_section( 'section_element_type', [ 'label' => __( 'Element', 'profundcore' ), ] ); $this->add_control( 'icon', [ 'label' => __( 'Icon', 'profundcore' ), 'type' => Controls_Manager::ICON, 'label_block' => true, 'default' => 'fa fa-arrow-right', 'condition' => [ 'element_type' => 'icon', ], ] ); $this->add_control( 'text', [ 'label' => __( 'Text', 'profundcore' ), 'type' => Controls_Manager::TEXTAREA, 'condition' => [ 'element_type' => 'text', ], 'frontend_available' => true, 'placeholder' => __( 'Enter your Text', 'profundcore' ), 'default' => __( 'Add Your Text ', 'profundcore' ), ] ); $this->add_control( 'media_image', [ 'label' => __( 'Choose Image', 'profundcore' ), 'type'=>Controls_Manager::MEDIA, 'default' => [ 'url' => Utils::get_placeholder_image_src(), ], 'frontend_available' => true, 'condition' => [ 'element_type' => 'image', ] ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'media_imagesize', 'default' => 'large', 'separator' => 'none', 'condition' => [ 'element_type' => 'image', ] ] ); $this->end_controls_section();// end: Section $this->start_controls_section( 'section_text_style', [ 'label' => __( 'Text', 'profundcore' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'element_type' => 'text', ], 'frontend_available' => true, ] ); $this->add_control( 'text_color', [ 'label' => __( 'Color', 'profundcore' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .profund-el-text' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'text_typography', 'selector' => '{{WRAPPER}} .profund-el-text', ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'text_text_shadow', 'selector' => '{{WRAPPER}} .profund-el-text', ] ); $this->end_controls_section();// end: Section $this->start_controls_section( 'section_icon_style', [ 'label' => __( 'Icon', 'profundcore' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'element_type' => 'icon', ], 'frontend_available' => true, ] ); $this->add_control( 'icon_color', [ 'label' => __( 'Color', 'profundcore' ), 'type' => Controls_Manager::COLOR, 'frontend_available' => true, 'selectors' => [ '{{WRAPPER}} .profund-el-icon i' => 'color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'icon_size', [ 'label' => __( 'Size', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 500, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .profund-el-icon i' => 'font-size: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section();// end: Section $this->start_controls_section( 'section_image_style', [ 'label' => __( 'Image', 'profundcore' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'element_type' => 'image', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'img_size', [ 'label' => __( 'Size', 'profundcore' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1000, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .profund-el-image' => 'width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'img_border', 'separator' => 'before', 'selector' => '{{WRAPPER}} .profund-el-image', ] ); $this->add_control( 'img_border_radius', [ 'label' => __( 'Border Radius', 'profundcore' ), 'type' => Controls_Manager::DIMENSIONS, 'separator' => 'before', 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .profund-el-image, {{WRAPPER}} .profund-el-image' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'image_box_shadow', 'selector' => '{{WRAPPER}} .profund-el-image', ] ); $this->end_controls_section();// end: Section } /** * Render Position Element widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.0.0 * @access protected */ protected function render() { $settings = $this->get_settings_for_display(); // init empty var $text_box_html = ''; $element_type = !empty( $settings['element_type'] ) ? $settings['element_type'] : ''; ?> <?php switch ($element_type) : case 'text': $text = !empty( $settings['text'] ) ? $settings['text'] : ''; echo "<div class='profund-el-text'>".$text."</div>"; break; case 'icon': $icon = !empty( $settings['icon'] ) ? $settings['icon'] : ''; echo '<div class="profund-el-icon"><i class="'.esc_attr($icon).'" ></i></div>'; break; case 'image': $media_image = Group_Control_Image_Size::get_attachment_image_html( $settings, 'media_imagesize', 'media_image' ); echo '<div class="profund-el-image">'.$media_image.'</div>'; break; endswitch; ?> <?php } } Plugin::instance()->widgets_manager->register_widget_type( new profund_Position_Element );
Save
Cancel