This commit is contained in:
2025-11-18 16:39:33 +00:00
parent c70394d367
commit df1f90c6cd
9673 changed files with 3464697 additions and 34 deletions
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\AdvancedAccordion;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_name() {
return 'wpr-advanced-accordion';
}
public function get_widgets() {
return [
'Wpr_Advanced_Accordion',
];
}
}
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\AdvancedSlider;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_name() {
return 'wpr-advanced-slider';
}
public function get_widgets() {
return [
'Wpr_Advanced_Slider',
];
}
}
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\AdvancedText;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_widgets() {
return [
'Advanced_Text',
];
}
public function get_name() {
return 'wpr-advanced-text';
}
}
@@ -0,0 +1,922 @@
<?php
namespace WprAddons\Modules\AdvancedText\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use Elementor\Group_Control_Background;
use Elementor\Group_Control_Image_Size;
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
use Elementor\Group_Control_Text_Shadow;
use Elementor\Utils;
use Elementor\Icons;
use WprAddons\Classes\Utilities;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Advanced_Text extends Widget_Base {
public function get_name() {
return 'wpr-advanced-text';
}
public function get_title() {
return esc_html__( 'Advanced Text', 'wpr-addons' );
}
public function get_icon() {
return 'wpr-icon eicon-animated-headline';
}
public function get_categories() {
return [ 'wpr-widgets'];
}
public function get_keywords() {
return [ 'royal', 'advanced text', 'text effects', 'typing text', 'fancy text', 'animated text', '3d text', 'text mask', 'text rotator', 'text animaiton' ];
}
public function has_widget_inner_wrapper(): bool {
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
}
public function get_style_depends() {
return [ 'wpr-text-animations-css' ];
}
public function get_custom_help_url() {
if ( empty(get_option('wpr_wl_plugin_links')) )
// return 'https://royal-elementor-addons.com/contact/?ref=rea-plugin-panel-advanced-text-help-btn';
return 'https://wordpress.org/support/plugin/royal-elementor-addons/';
}
public function add_control_text_style() {
$this->add_control(
'text_style',
[
'label' => esc_html__( 'Style', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'default' => 'animated',
'options' => [
'animated' => esc_html__( 'Animated', 'wpr-addons' ),
'highlighted' => esc_html__( 'Highlighted', 'wpr-addons' ),
'pro-cp' => esc_html__( 'Clipped (Pro)', 'wpr-addons' ),
],
'prefix_class' => 'wpr-advanced-text-style-',
'render_type' => 'template',
]
);
}
public function add_control_clipped_text() {}
public function add_section_style_clipped_text() {}
protected function register_controls() {
// Section: Content ---------
$this->start_controls_section(
'section_content',
[
'label' => esc_html__( 'Content', 'wpr-addons' ),
]
);
Utilities::wpr_library_buttons( $this, Controls_Manager::RAW_HTML );
$this->add_control_text_style();
// Upgrade to Pro Notice
Utilities::upgrade_pro_notice( $this, Controls_Manager::RAW_HTML, 'advanced-text', 'text_style', ['pro-cp'] );
$this->add_control(
'text_type',
[
'label' => esc_html__( 'Animation', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'default' => 'typing',
'options' => [
'typing' => esc_html__( 'Typing', 'wpr-addons' ),
'rotate-1' => esc_html__( 'Skew', 'wpr-addons' ),
'rotate-2' => esc_html__( 'Flip VR', 'wpr-addons' ),
'rotate-3' => esc_html__( 'Flip HR', 'wpr-addons' ),
'slide' => esc_html__( 'Slide', 'wpr-addons' ),
'clip' => esc_html__( 'Clip', 'wpr-addons' ),
'zoom' => esc_html__( 'Zoom', 'wpr-addons' ),
'scale' => esc_html__( 'Scale', 'wpr-addons' ),
'push' => esc_html__( 'Push', 'wpr-addons' ),
],
'prefix_class' => 'wpr-fancy-text-',
'render_type' => 'template',
'condition' => [
'text_style' => 'animated',
],
]
);
$this->add_control(
'highlighted_shape',
[
'label' => esc_html__( 'Shape', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'default' => 'circle',
'options' => [
'circle' => esc_html__( 'Circle', 'wpr-addons' ),
'underline-zigzag' => esc_html__( 'Underline Zigzag', 'wpr-addons' ),
'curly' => esc_html__( 'Curly', 'wpr-addons' ),
'x' => esc_html__( 'Cross X', 'wpr-addons' ),
'strikethrough' => esc_html__( 'Linethrough', 'wpr-addons' ),
'underline' => esc_html__( 'Underline', 'wpr-addons' ),
'double' => esc_html__( 'Double', 'wpr-addons' ),
'double-underline' => esc_html__( 'Double Underline', 'wpr-addons' ),
'diagonal' => esc_html__( 'Diagonal', 'wpr-addons' ),
],
'condition' => [
'text_style' => 'highlighted',
],
]
);
$this->add_control(
'highlighted_duration',
[
'label' => esc_html__( 'Animation Duration', 'wpr-addons' ),
'type' => Controls_Manager::NUMBER,
'default' => 5,
'min' => 0,
'max' => 50,
'step' => 1,
'selectors' => [
'{{WRAPPER}} .wpr-highlighted-text svg path' => '-webkit-animation-duration: {{VALUE}}s; animation-duration: {{VALUE}}s;',
],
'render_type' => 'template',
'condition' => [
'text_style' => 'highlighted',
],
]
);
$this->add_control(
'animated_duration_a',
[
'label' => esc_html__( 'Animation Duration', 'wpr-addons' ),
'type' => Controls_Manager::NUMBER,
'default' => 0.2,
'min' => 0,
'max' => 50,
'step' => 0.05,
'selectors' => [
],
'render_type' => 'template',
'condition' => [
'text_style' => 'animated',
'text_type' => [ 'typing', 'rotate-2', 'rotate-3', 'scale' ]
],
]
);
$this->add_control(
'animated_duration_b',
[
'label' => esc_html__( 'Animation Duration', 'wpr-addons' ),
'type' => Controls_Manager::NUMBER,
'default' => 1,
'min' => 0,
'max' => 50,
'step' => 0.1,
'selectors' => [
'{{WRAPPER}} .wpr-anim-text.wpr-anim-text-type-rotate-1 b' => '-webkit-animation-duration: {{VALUE}}s; animation-duration: {{VALUE}}s;',
'{{WRAPPER}} .wpr-anim-text.wpr-anim-text-type-slide b' => '-webkit-animation-duration: {{VALUE}}s; animation-duration: {{VALUE}}s;',
'{{WRAPPER}} .wpr-anim-text.wpr-anim-text-type-zoom b' => '-webkit-animation-duration: {{VALUE}}s; animation-duration: {{VALUE}}s;',
'{{WRAPPER}} .wpr-anim-text.wpr-anim-text-type-push b' => '-webkit-animation-duration: {{VALUE}}s; animation-duration: {{VALUE}}s;',
],
'render_type' => 'template',
'condition' => [
'text_style' => 'animated',
'text_type' => [ 'rotate-1', 'zoom', 'clip', 'slide', 'push' ]
],
]
);
$this->add_control(
'anim_delay',
[
'label' => esc_html__( 'Animation Delay', 'wpr-addons' ),
'type' => Controls_Manager::NUMBER,
'default' => 2,
'min' => 0,
'max' => 15,
'step' => 0.1,
'selectors' => [
'{{WRAPPER}} .wpr-highlighted-text svg path' => '-webkit-animation-delay: {{VALUE}}s; animation-delay: {{VALUE}}s;',
'{{WRAPPER}} .wpr-highlighted-text svg.wpr-highlight-x path:first-child' => '-webkit-animation-delay: -webkit-calc({{VALUE}}s + 0.3s); animation-delay: calc({{VALUE}}s + 0.3s);',
'{{WRAPPER}} .wpr-highlighted-text svg.wpr-highlight-double path:last-child' => '-webkit-animation-delay: -webkit-calc({{VALUE}}s + 0.3s); animation-delay: calc({{VALUE}}s + 0.3s);',
'{{WRAPPER}} .wpr-highlighted-text svg.wpr-highlight-double-underline path:last-child' => '-webkit-animation-delay: -webkit-calc({{VALUE}}s + 0.3s); animation-delay: calc({{VALUE}}s + 0.3s);',
],
'render_type' => 'template',
'condition' => [
'text_style!' => 'clipped',
],
]
);
$this->add_control(
'anim_loop',
[
'label' => esc_html__( 'Loop', 'wpr-addons' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'frontend_available' => true,
'selectors' => [
'{{WRAPPER}} .wpr-highlighted-text svg path' => '-webkit-animation-iteration-count: infinite; animation-iteration-count: infinite;',
],
'prefix_class' => 'wpr-animated-text-infinite-',
'render_type' => 'template',
'condition' => [
'text_style!' => 'clipped',
],
]
);
$this->add_control(
'anim_cursor',
[
'label' => esc_html__( 'Cursor', 'wpr-addons' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'separator' => 'before',
'condition' => [
'text_style' => 'animated',
'text_type' => ['typing','clip'],
],
]
);
$this->add_control(
'anim_cursor_content',
[
'label' => esc_html__( 'Text', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'label_block' => true,
'default' => '|',
'condition' => [
'anim_cursor' => 'yes',
'text_style' => 'animated',
'text_type' => ['typing','clip'],
],
]
);
$this->add_control(
'anim_cursor_duration',
[
'label' => esc_html__( 'Duration', 'wpr-addons' ),
'type' => Controls_Manager::NUMBER,
'default' => 0.7,
'min' => 0,
'max' => 15,
'step' => 0.1,
'selectors' => [
'{{WRAPPER}} .wpr-anim-text-cursor' => '-webkit-animation-duration: {{VALUE}}s; animation-duration: {{VALUE}}s;',
],
'condition' => [
'anim_cursor' => 'yes',
'text_style' => 'animated',
'text_type' => ['typing','clip'],
],
'render_type' => 'template',
]
);
$this->add_control(
'prefix_text',
[
'label' => esc_html__( 'Prefix Text', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'label_block' => true,
'default' => esc_html__( 'We are Creating the', 'wpr-addons' ),
'placeholder' => esc_html__( 'Enter your text', 'wpr-addons' ),
'separator' => 'before',
]
);
$this->add_control(
'animated_text',
[
'label' => esc_html__( 'Animated Text', 'wpr-addons' ),
'type' => Controls_Manager::TEXTAREA,
'dynamic' => [
'active' => true,
],
'placeholder' => esc_html__( 'Enter each word in a separate line', 'wpr-addons' ),
'default' => "Best Websites\nAmazing Plugins",
'rows' => 5,
'condition' => [
'text_style' => 'animated',
],
]
);
$this->add_control_clipped_text();
$this->add_control(
'highlighted_text',
[
'label' => esc_html__( 'Highlight Text', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'label_block' => true,
'default' => esc_html__( 'Best Websites', 'wpr-addons' ),
'placeholder' => esc_html__( 'Enter your text', 'wpr-addons' ),
'condition' => [
'text_style' => 'highlighted',
],
]
);
$this->add_control(
'suffix_text',
[
'label' => esc_html__( 'Suffix Text', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'default' => esc_html__( '', 'wpr-addons' ),
'label_block' => true,
]
);
$this->add_control(
'text_link',
[
'type' => Controls_Manager::URL,
'dynamic' => [
'active' => true,
],
'label' => esc_html__( 'Link', 'wpr-addons' ),
'placeholder' => esc_html__( 'https://your-link.com', 'wpr-addons' ),
'separator' => 'before',
]
);
$this->add_responsive_control(
'text_align',
[
'label' => esc_html__( 'Alignment', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'center',
'label_block' => false,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'wpr-addons' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'wpr-addons' ),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'wpr-addons' ),
'icon' => 'eicon-text-align-right',
],
],
'selectors' => [
'{{WRAPPER}} .wpr-advanced-text' => 'text-align: {{VALUE}};',
'{{WRAPPER}} .wpr-advanced-text a' => 'text-align: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->add_control(
'text_tag',
[
'label' => esc_html__( 'Text HTML Tag', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'h1' => esc_html__( 'H1', 'wpr-addons' ),
'h2' => esc_html__( 'H2', 'wpr-addons' ),
'h3' => esc_html__( 'H3', 'wpr-addons' ),
'h4' => esc_html__( 'H4', 'wpr-addons' ),
'h5' => esc_html__( 'H5', 'wpr-addons' ),
'h6' => esc_html__( 'H6', 'wpr-addons' ),
'div' => esc_html__( 'div', 'wpr-addons' ),
'span' => esc_html__( 'span', 'wpr-addons' ),
'p' => esc_html__( 'p', 'wpr-addons' ),
],
'default' => 'h3',
'separator' => 'before',
]
);
$this->end_controls_section(); // End Controls Section
// Section: Request New Feature
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
// Section: Pro Features
Utilities::pro_features_list_section( $this, '', Controls_Manager::RAW_HTML, 'advanced-text', [
'Clipped Text Effect',
'Examples - <a href="https://royal-elementor-addons.com/elementor-advanced-text-widget/?ref=rea-plugin-panel-pro-sec-advanced-text#clipped1" target="_blank">Clipped effects</a>',
] );
// // Widget Extra Buttons ---------
// $this->start_controls_section(
// 'section_widget_extra_buttons',
// [
// 'label' => '<a href="#">Widget Preview</a> <a href="#">Predefined Styles</a>',
// ]
// );
// $this->end_controls_section(); // End Controls Section
// Styles
// Section: Prefix ----------
$this->start_controls_section(
'section_style_prefix',
[
'label' => esc_html__( 'Prefix Text', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'prefix_color',
[
'label' => esc_html__( 'Text Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#333333',
'selectors' => [
'{{WRAPPER}} .wpr-advanced-text-preffix' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'prefix_typography_divider',
[
'type' => Controls_Manager::DIVIDER,
'style' => 'thick',
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'prefix_typography',
'selector' => '{{WRAPPER}} .wpr-advanced-text-preffix',
'separator' => 'before',
]
);
$this->end_controls_section(); // End Controls Section
// Styles
// Section: Text -----------
$this->start_controls_section(
'section_style_text',
[
'label' => esc_html__( 'Advanced Text', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
'condition' => [
'text_style' => [ 'animated', 'highlighted' ],
],
]
);
$this->add_control(
'text_color',
[
'label' => esc_html__( 'Text Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#605BE5',
'selectors' => [
'{{WRAPPER}} .wpr-anim-text' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpr-highlighted-text' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'text_bg_color',
[
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpr-anim-text' => 'background-color: {{VALUE}}',
'{{WRAPPER}} .wpr-highlighted-text' => 'background-color: {{VALUE}}',
],
]
);
$this->add_control(
'text_selected_color',
[
'label' => esc_html__( 'Typing Text Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#605BE5',
'selectors' => [
'{{WRAPPER}} .wpr-anim-text-selected ' => 'color: {{VALUE}}',
],
'condition' => [
'text_style' => 'animated',
'text_type' => 'typing',
],
]
);
$this->add_control(
'text_selected_bg_color',
[
'label' => esc_html__( 'Typing Background Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpr-anim-text-selected ' => 'background-color: {{VALUE}}',
],
'condition' => [
'text_style' => 'animated',
'text_type' => 'typing',
],
]
);
$this->add_control(
'text_typography_divider',
[
'type' => Controls_Manager::DIVIDER,
'style' => 'thick',
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'text_typography',
'selector' => '{{WRAPPER}} .wpr-anim-text b, {{WRAPPER}} .wpr-anim-text b i,{{WRAPPER}} .wpr-anim-text,{{WRAPPER}} .wpr-highlighted-text',
'separator' => 'before',
]
);
$this->add_responsive_control(
'text_padding',
[
'label' => esc_html__( 'Padding', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'default' => [
'top' => 10,
'right' => 10,
'bottom' => 10,
'left' => 10,
],
'size_units' => [ 'px', ],
'selectors' => [
'{{WRAPPER}} .wpr-anim-text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpr-highlighted-text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpr-advanced-text-preffix' => 'padding-top: {{TOP}}{{UNIT}};padding-bottom: {{BOTTOM}}{{UNIT}};',
'{{WRAPPER}} .wpr-advanced-text-suffuix' => 'padding-top: {{TOP}}{{UNIT}};padding-bottom: {{BOTTOM}}{{UNIT}};',
],
'separator' => 'before'
]
);
$this->add_control(
'marker_section',
[
'label' => esc_html__( 'Marker', 'wpr-addons' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
'condition' => [
'text_style' => 'highlighted',
],
]
);
$this->add_control(
'marker_color',
[
'label' => esc_html__( 'Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#605BE5',
'selectors' => [
'{{WRAPPER}} .wpr-highlighted-text path' => 'stroke: {{VALUE}};',
],
'condition' => [
'text_style' => 'highlighted',
],
]
);
$this->add_responsive_control(
'marker_width',
[
'label' => esc_html__( 'Width', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 120,
],
],
'default' => [
'unit' => 'px',
'size' => 100,
],
'selectors' => [
'{{WRAPPER}} .wpr-highlighted-text svg' => 'width: {{SIZE}}%;',
],
'condition' => [
'text_style' => 'highlighted',
],
]
);
$this->add_responsive_control(
'marker_height',
[
'label' => esc_html__( 'Height', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 120,
],
],
'default' => [
'unit' => 'px',
'size' => 90,
],
'selectors' => [
'{{WRAPPER}} .wpr-highlighted-text svg' => 'height: {{SIZE}}%;',
],
'condition' => [
'text_style' => 'highlighted',
],
]
);
$this->add_responsive_control(
'marker_weight',
[
'label' => esc_html__( 'Weight', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 150,
],
],
'default' => [
'unit' => 'px',
'size' => 10,
],
'selectors' => [
'{{WRAPPER}} .wpr-highlighted-text path' => 'stroke-width: {{SIZE}}{{UNIT}}',
],
'condition' => [
'text_style' => 'highlighted',
],
]
);
$this->add_control(
'marker_position',
[
'label' => esc_html__( 'Z-index', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'default' => 'over',
'options' => [
'under' => esc_html__( 'Under Text', 'wpr-addons' ),
'over' => esc_html__( 'Over Text', 'wpr-addons' ),
],
'selectors_dictionary' => [
'under' => '0',
'over' => '1'
],
'selectors' => [
'{{WRAPPER}} .wpr-highlighted-text svg' => 'z-index: {{VALUE}}',
],
'condition' => [
'text_style' => 'highlighted',
],
]
);
$this->end_controls_section(); // End Controls Section
// Styles
// Section: Clipped --------------------
$this->add_section_style_clipped_text();
// Styles
// Section: Suffix -----------
$this->start_controls_section(
'section_style_suffix',
[
'label' => esc_html__( 'Suffix Text', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'suffix_color',
[
'label' => esc_html__( 'Text Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#333333',
'selectors' => [
'{{WRAPPER}} .wpr-advanced-text-suffix' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'suffix_typography_divider',
[
'type' => Controls_Manager::DIVIDER,
'style' => 'thick',
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'suffix_typography',
'selector' => '{{WRAPPER}} .wpr-advanced-text-suffix',
'separator' => 'before',
]
);
$this->end_controls_section(); // End Controls Section
}
public function wpr_clipped_text() {}
public function wpr_highlighted_text() {
$settings = $this->get_settings();
$svg_arr = [
'circle' => [ 'M284.72,15.61C276.85,14.43,2-2.85,2,80.46c0,34.09,45.22,58.86,196.31,62.81C719.59,154.18,467-74.85,109,29.15' ],
'curly' => [ 'M1.15,18C64.07,44.13,108.42,1.4,169.63,3.1,182.11,3.76,191.39,6.58,201,10c71.41,33.39,112-8.7,188.65-7,35.22,1.74,69.81,22.6,103,17' ],
'underline' => [ 'M.68,28.11c110.51-22,247.46-34.55,400.89-14.68,32.94,4.27,64.42,9.74,94.37,16.09' ],
'double' => [ 'M.58,16s93-15.56,303-12c118,2,180,12,180,12', 'M.58,127s93-13.31,303.15-10.26C421.79,118.48,483.83,127,483.83,127' ],
'double-underline' => [ 'M.58,16s93-15.56,303-12c118,2,180,12,180,12', 'M29.83,33.28S111.54,17.1,296.13,20.8c103.71,2.08,158.2,12.48,158.2,12.48' ],
'underline-zigzag' => [ 'M9.3,127.3c49.3-3,150.7-7.6,199.7-7.4c121.9,0.4,189.9,0.4,282.3,7.2C380.1,129.6,181.2,130.6,70,139 c82.6-2.9,254.2-1,335.9,1.3c-56,1.4-137.2-0.3-197.1,9' ],
'diagonal' => [ 'M.25,3.49C114.44,11.6,252,36.14,397.07,97.15c31.14,13.1,60.52,27,88.18,41.34' ],
'strikethrough' => [ 'M4,74.8h499.3' ],
'x' => [ 'M1.61,3.49C115.8,11.6,253.39,36.14,398.43,97.15c31.14,13.1,60.53,27,88.18,41.34', 'M486.61,3.49C372.42,11.6,234.84,36.14,89.79,97.15c-31.14,13.1-60.52,27-88.18,41.34' ]
];
?>
<span class="wpr-highlighted-text">
<?php if ( '' !== $svg_arr[$settings['highlighted_shape']] && !empty($settings['highlighted_text']) ) : ?>
<span class="wpr-highlighted-text-inner"><?php echo wp_kses_post( $settings['highlighted_text'] ); ?></span>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 150" class="wpr-highlight-<?php echo esc_html( $settings['highlighted_shape'] ); ?>" preserveAspectRatio="none">
<?php foreach ( $svg_arr[$settings['highlighted_shape']] as $value ) : ?>
<path d="<?php echo esc_attr($value); ?>"></path>
<?php endforeach; ?>
</svg>
<?php endif; ?>
</span>
<?php
}
public function wpr_animated_text() {
$settings = $this->get_settings();
$animated_text = array_filter( explode( "\n", $settings['animated_text'] ) );
$anim_duration_value = $settings['highlighted_duration'];
if ( 'animated' === $settings['text_style'] ) {
if ( in_array($settings['text_type'], ['typing', 'rotate-2', 'rotate-3', 'scale']) ) {
$anim_duration_value = $settings['animated_duration_a'];
} else {
$anim_duration_value = $settings['animated_duration_b'];
}
}
$anim_duration = [
absint( $anim_duration_value * 1000 ),
absint( $settings['anim_delay'] * 1000 ),
];
$anim_duration = implode( ',', $anim_duration );
$this->add_render_attribute( 'wpr-anim-text', 'class', 'wpr-anim-text wpr-anim-text-type-'. esc_attr($settings['text_type']) );
$is_anim_letters = in_array( $settings['text_type'], [ 'typing', 'rotate-2', 'rotate-3', 'scale' ] );
if ( $is_anim_letters ) {
$this->add_render_attribute( 'wpr-anim-text', 'class', 'wpr-anim-text-letters' );
}
$this->add_render_attribute( 'wpr-anim-text', 'data-anim-duration', $anim_duration );
$this->add_render_attribute( 'wpr-anim-text', 'data-anim-loop', esc_attr($settings['anim_loop']) );
?>
<span <?php echo $this->get_render_attribute_string( 'wpr-anim-text' ); ?>>
<span class="wpr-anim-text-inner">
<?php foreach ( $animated_text as $value ) : ?>
<b><?php echo esc_html( $value ); ?></b>
<?php endforeach; ?>
</span>
<?php $this->wpr_animated_text_cursor(); ?>
</span>
<?php
}
public function wpr_animated_text_cursor() {
// Get Settings
$settings = $this->get_settings();
if ( '' !== $settings['anim_cursor_content'] && 'animated' === $settings['text_style'] && $settings['anim_cursor'] && ( 'typing' == $settings['text_type'] || 'clip' == $settings['text_type'] ) ) {
echo '<span class="wpr-anim-text-cursor">'. esc_html( $settings['anim_cursor_content'] ) .'</span>';
}
}
protected function render() {
// Get Settings
$settings = $this->get_settings();
$tags_whitelist = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'span', 'p'];
$text_tag = $settings['text_tag'];
if ( !in_array( $text_tag, $tags_whitelist ) ) {
$text_tag = 'h3';
}
?>
<<?php echo esc_attr( $text_tag ); ?> class="wpr-advanced-text">
<?php
if ( '' !== $settings['text_link']['url'] ) {
$this->add_render_attribute( 'text_link', 'href', esc_url( $settings['text_link']['url'] ) );
if ( $settings['text_link']['is_external'] ) {
$this->add_render_attribute( 'text_link', 'target', '_blank' );
}
if ( $settings['text_link']['nofollow'] ) {
$this->add_render_attribute( 'text_link', 'nofollow', '' );
}
echo '<a '. $this->get_render_attribute_string( 'text_link' ) .'>' ;
}
?>
<?php if ( '' !== $settings['prefix_text'] ) : ?>
<span class="wpr-advanced-text-preffix"><?php echo wp_kses_post($settings['prefix_text']); ?></span>
<?php endif;
if ( 'animated' === $settings['text_style'] ) {
$this->wpr_animated_text();
} elseif ( 'highlighted' === $settings['text_style'] ) {
$this->wpr_highlighted_text();
} elseif ( 'clipped' === $settings['text_style'] ) {
$this->wpr_clipped_text();
}
if ( '' !== $settings['suffix_text'] ) : ?>
<span class="wpr-advanced-text-suffix"><?php echo wp_kses_post($settings['suffix_text']); ?></span>
<?php endif;
if ( '' !== $settings['text_link']['url'] ) {
echo '</a>';
}
?>
</<?php echo esc_attr( $text_tag ); ?>>
<?php
}
}
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\BackToTop;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_widgets() {
return [
'Wpr_Back_To_Top',
];
}
public function get_name() {
return 'wpr-back-to-top';
}
}
@@ -0,0 +1,719 @@
<?php
namespace WprAddons\Modules\BackToTop\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use WprAddons\Classes\Utilities;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Wpr_Back_To_Top extends Widget_Base {
public function get_name() {
return 'wpr-back-to-top';
}
public function get_title() {
return esc_html__( 'Back To Top', 'wpr-addons' );
}
public function get_icon() {
return 'wpr-icon eicon-arrow-up';
}
public function get_categories() {
return [ 'wpr-widgets'];
}
public function get_keywords() {
return [ 'royal', 'back to top', 'scroll', 'scroll to top', 'back', 'top' ];
}
public function has_widget_inner_wrapper(): bool {
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
}
public function get_custom_help_url() {
if ( empty(get_option('wpr_wl_plugin_links')) )
// return 'https://royal-elementor-addons.com/contact/?ref=rea-plugin-panel-back-to-top-help-btn';
return 'https://wordpress.org/support/plugin/royal-elementor-addons/';
}
protected function register_controls() {
// Section: General ----------
$this->start_controls_section(
'section_general',
[
'label' => esc_html__( 'General', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
Utilities::wpr_library_buttons( $this, Controls_Manager::RAW_HTML );
$this->add_control(
'button_position',
[
'label' => esc_html__( 'Button Position', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'default' => 'fixed',
'label_block' => false,
'render_type' => 'template',
'options' => [
'fixed' => esc_html__( 'Fixed', 'wpr-addons' ),
'inline' => esc_html__( 'Inline', 'wpr-addons' ),
],
'prefix_class' => 'wpr-stt-btn-align-',
]
);
$this->add_responsive_control(
'button_position_inline',
[
'label' => esc_html__( 'Inline Position', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'center',
'label_block' => false,
'options' => [
'flex-start' => [
'title' => esc_html__( 'Left', 'wpr-addons' ),
'icon' => 'eicon-h-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'wpr-addons' ),
'icon' => 'eicon-h-align-center',
],
'flex-end' => [
'title' => esc_html__( 'Right', 'wpr-addons' ),
'icon' => 'eicon-h-align-right',
],
],
'selectors' => [
'{{WRAPPER}} .wpr-stt-wrapper' => 'justify-content: {{VALUE}}',
],
'separator' => 'before',
'condition' => [
'button_position' => 'inline',
],
]
);
$this->add_control(
'button_position_fixed',
[
'label' => esc_html__( 'Fixed Position', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'right',
'label_block' => false,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'wpr-addons' ),
'icon' => 'eicon-h-align-left',
],
'right' => [
'title' => esc_html__( 'Right', 'wpr-addons' ),
'icon' => 'eicon-h-align-right',
],
],
'separator' => 'before',
'default' => 'right',
'condition' => [
'button_position' => 'fixed',
],
'prefix_class' => 'wpr-stt-btn-align-fixed-',
]
);
$this->add_responsive_control(
'distance_x_right',
[
'label' => esc_html__( 'Distance Right', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 30,
],
'selectors' => [
'{{WRAPPER}}.wpr-stt-btn-align-fixed-right .wpr-stt-btn' => 'right: {{SIZE}}{{UNIT}};',
],
'condition' => [
'button_position' => 'fixed',
'button_position_fixed' => 'right',
],
]
);
$this->add_responsive_control(
'distance_y_right',
[
'label' => esc_html__( 'Distance Bottom', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 30,
],
'selectors' => [
'{{WRAPPER}}.wpr-stt-btn-align-fixed-right .wpr-stt-btn' => 'bottom: {{SIZE}}{{UNIT}};',
],
'condition' => [
'button_position' => 'fixed',
'button_position_fixed' => 'right',
],
]
);
$this->add_responsive_control(
'distance_x_left',
[
'label' => esc_html__( 'Distance Left', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 30,
],
'selectors' => [
'{{WRAPPER}}.wpr-stt-btn-align-fixed-left .wpr-stt-btn' => 'left: {{SIZE}}{{UNIT}};',
],
'condition' => [
'button_position' => 'fixed',
'button_position_fixed' => 'left',
],
]
);
$this->add_responsive_control(
'distance_y_left',
[
'label' => esc_html__( 'Distance Bottom', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 30,
],
'selectors' => [
'{{WRAPPER}}.wpr-stt-btn-align-fixed-left .wpr-stt-btn' => 'bottom: {{SIZE}}{{UNIT}};',
],
'condition' => [
'button_position' => 'fixed',
'button_position_fixed' => 'left',
],
]
);
$this->add_control(
'select_icon',
[
'label' => esc_html__( 'Select Icon', 'wpr-addons' ),
'type' => Controls_Manager::ICONS,
'skin' => 'inline',
'label_block' => false,
'default' => [
'value' => 'fas fa-chevron-up',
'library' => 'fa-solid',
],
'separator' => 'before',
'recommended' => [
'fa-solid' => [
'arrow-up',
'arrow-circle-up',
'chevron-up',
],
],
]
);
$this->add_control(
'button_txt_show',
[
'label' => __( 'Button Text', 'wpr-addons' ),
'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __( 'Show', 'wpr-addons' ),
'label_off' => __( 'Hide', 'wpr-addons' ),
'return_value' => 'yes',
'default' => 'no',
]
);
$this->add_control(
'icon_layout_select',
[
'label' => esc_html__( 'Icon Align', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'default' => 'left',
'label_block' => false,
'options' => [
'top' => esc_html__( 'Top', 'wpr-addons' ),
'bottom' => esc_html__( 'Bottom', 'wpr-addons' ),
'right' => esc_html__( 'Right', 'wpr-addons' ),
'left' => esc_html__( 'Left', 'wpr-addons' ),
],
'condition' => [
'select_icon[value]!' => '',
'button_txt_show' => 'yes',
],
'prefix_class' => 'wpr-stt-btn-icon-',
]
);
$this->add_control(
'button_text',
[
'label' => esc_html__( 'Text', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'default' => 'Scroll To Top',
'condition' => [
'button_txt_show' => 'yes',
],
]
);
$this->add_control(
'animation_type_select',
[
'label' => esc_html__( 'Animation', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'default' => 'fade',
'label_block' => false,
'options' => [
'fade' => esc_html__( 'Fade', 'wpr-addons' ),
'slide' => esc_html__( 'Slide', 'wpr-addons' ),
'none' => esc_html__('None','wpr-addons'),
],
'separator' => 'before',
'condition' =>[
'button_position' => 'fixed',
],
]
);
$this->add_responsive_control(
'button_offset',
[
'label' => esc_html__( 'Show after page scroll (px)', 'wpr-addons' ),
'type' => Controls_Manager::NUMBER,
'default' => 0,
'min' => 0,
'condition' => [
'button_position' => 'fixed',
],
]
);
$this->add_control(
'stt_animation_duration',
[
'label' => esc_html__( 'Show up speed', 'wpr-addons' ),
'type' => Controls_Manager::NUMBER,
'default' => 200,
'min' => 0,
'condition' => [
'button_position' => 'fixed',
'animation_type_select!' => 'none',
],
]
);
$this->add_control(
'stt_animation_duration_top',
[
'label' => esc_html__( 'Scrolling animation Speed', 'wpr-addons' ),
'type' => Controls_Manager::NUMBER,
'default' => 800,
'min' => 0,
]
);
$this->end_controls_section();
// Section: Request New Feature
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
// Section Button ------------
$this->start_controls_section(
'section_style_button',
[
'label' => esc_html__( 'Button', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->start_controls_tabs( 'tabs_stt_button_colors' );
// Normal Tab ------------
$this->start_controls_tab(
'tab_stt_button_normal_colors',
[
'label' => esc_html__( 'Normal', 'wpr-addons' ),
]
);
$this->add_control(
'button_text_color',
[
'label' => esc_html__( ' Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#ffffff',
'selectors' => [
'{{WRAPPER}} .wpr-stt-content' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpr-stt-icon' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpr-stt-icon svg' => 'fill: {{VALUE}}',
],
]
);
$this->add_control(
'button_bg_color',
[
'label' => esc_html__( 'Background', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#605BE5',
'selectors' => [
'{{WRAPPER}} .wpr-stt-btn' => 'background-color: {{VALUE}}',
],
]
);
$this->add_control(
'button_border_color',
[
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#E8E8E8',
'selectors' => [
'{{WRAPPER}} .wpr-stt-btn' => 'border-color: {{VALUE}}',
],
'condition' =>[
'border_switcher' => 'yes',
],
]
);
$this->add_group_control(
\Elementor\Group_Control_Box_Shadow::get_type(),
[
'name' => 'button_box_shadow',
'label' => __( 'Box Shadow', 'wpr-addons' ),
'selector' => '{{WRAPPER}} .wpr-stt-btn',
]
);
$this->end_controls_tab();// normal tab end
// Hover Tab -------------
$this->start_controls_tab(
'tab_button_hover_colors',
[
'label' => esc_html__( 'Hover', 'wpr-addons' ),
]
);
$this->add_control(
'button_texte_color_hover',
[
'label' => esc_html__( 'Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#fff',
'selectors' => [
'{{WRAPPER}} .wpr-stt-btn:hover > .wpr-stt-icon' => 'Color: {{VALUE}}',
'{{WRAPPER}} .wpr-stt-btn:hover > .wpr-stt-icon svg' => 'fill: {{VALUE}}',
],
]
);
$this->add_control(
'button_bg_color_hover',
[
'label' => esc_html__( 'Background', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#4039EC',
'selectors' => [
'{{WRAPPER}} .wpr-stt-btn:hover' => 'background-color: {{VALUE}}',
],
]
);
$this->add_control(
'button_border_color_hover',
[
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#E8E8E8',
'selectors' => [
'{{WRAPPER}} .wpr-stt-btn:hover' => 'border-color: {{VALUE}}',
],
'condition' =>[
'border_switcher' => 'yes',
],
]
);
$this->add_group_control(
\Elementor\Group_Control_Box_Shadow::get_type(),
[
'name' => 'button_box_shadow_hover',
'label' => __( 'Box Shadow', 'wpr-addons' ),
'selector' => '{{WRAPPER}} .wpr-stt-btn:hover',
]
);
$this->end_controls_tab();// hover tab end
$this->end_controls_tabs();// End tabs
$this->add_control(
'hover_animation_hover_duration',
[
'label' => __( 'Hover Animation Duration', 'wpr-addons' ),
'type' => \Elementor\Controls_Manager::NUMBER,
'min' => 0,
'max' => 5,
'step' => 0.1,
'default' => 0.3,
'selectors' => [
'{{WRAPPER}} .wpr-stt-btn' => 'transition: all {{VALUE}}s ease-in-out 0s;',
'{{WRAPPER}} .wpr-stt-btn svg' => 'transition: all {{VALUE}}s ease-in-out 0s;',
],
'separator' => 'before',
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'button_typography',
'selector' => '{{WRAPPER}} .wpr-stt-content,{{WRAPPER}} .wpr-stt-content::after',
'separator' => 'before',
'condition' => [
'button_txt_show' => 'yes',
],
]
);
$this->add_control(
'icon_size',
[
'label' => esc_html__( 'Icon Size', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 14,
],
'selectors' => [
'{{WRAPPER}} .wpr-stt-icon' => 'font-size: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-stt-icon svg' => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};',
],
'separator' => 'before',
'condition' => [
'select_icon[value]!' => '',
],
]
);
$this->add_control(
'icon_distanz',
[
'label' => esc_html__( 'Icon Distance', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 25,
],
],
'default' => [
'unit' => 'px',
'size' => 18,
],
'selectors' => [
'{{WRAPPER}}.wpr-stt-btn-icon-top .wpr-stt-icon' => 'margin-bottom: {{SIZE}}{{UNIT}};',
'{{WRAPPER}}.wpr-stt-btn-icon-left .wpr-stt-icon' => 'margin-right: {{SIZE}}{{UNIT}};',
'{{WRAPPER}}.wpr-stt-btn-icon-right .wpr-stt-icon' => 'margin-left: {{SIZE}}{{UNIT}};',
'{{WRAPPER}}.wpr-stt-btn-icon-bottom .wpr-stt-icon' => 'margin-top: {{SIZE}}{{UNIT}};',
],
'separator' => 'before',
'condition' => [
'select_icon[value]!' => '',
'button_txt_show' => 'yes',
],
]
);
$this->add_responsive_control(
'button_padding',
[
'label' => esc_html__( 'Padding', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'default' => [
'top' => 15,
'right' => 15,
'bottom' => 15,
'left' => 15,
],
'selectors' => [
'{{WRAPPER}} .wpr-stt-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_control(
'border_switcher',
[
'label' => esc_html__( 'Border', 'wpr-addons' ),
'type' => Controls_Manager::SWITCHER,
'separator' => 'before',
'return_value' => 'yes',
'label_block' => false,
]
);
$this->add_control(
'button_border_type',
[
'label' => esc_html__( 'Border Type', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'none' => esc_html__( 'None', 'wpr-addons' ),
'solid' => esc_html__( 'Solid', 'wpr-addons' ),
'double' => esc_html__( 'Double', 'wpr-addons' ),
'dotted' => esc_html__( 'Dotted', 'wpr-addons' ),
'dashed' => esc_html__( 'Dashed', 'wpr-addons' ),
'groove' => esc_html__( 'Groove', 'wpr-addons' ),
],
'default' => 'solid',
'selectors' => [
'{{WRAPPER}} .wpr-stt-btn' => 'border-style: {{VALUE}};',
],
'condition' =>[
'border_switcher' => 'yes',
],
]
);
$this->add_responsive_control(
'border_width',
[
'label' => esc_html__( 'Border Width', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'default' => [
'top' => 1,
'right' => 1,
'bottom' => 1,
'left' => 1,
],
'selectors' => [
'{{WRAPPER}} .wpr-stt-btn' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before',
'condition' =>[
'border_switcher' => 'yes',
'button_border_type!' => 'none',
],
]
);
$this->add_responsive_control(
'button_border_radius',
[
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%' ],
'default' => [
'top' => 2,
'right' => 2,
'bottom' => 2,
'left' => 2,
],
'selectors' => [
'{{WRAPPER}} .wpr-stt-btn' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'after',
]
);
$this->end_controls_section();
}
protected function render() {
// Get Settings
$settings = $this->get_settings();
// Widget JSON Settings
$stt_settings = [
'animation' => esc_attr($settings['animation_type_select']),
'animationOffset' => esc_attr($settings['button_offset']),
'animationDuration' => esc_attr($settings['stt_animation_duration']),
'fixed' => esc_attr($settings['button_position']),
'scrolAnim' => esc_attr($settings['stt_animation_duration_top']),
];
echo '<div class="wpr-stt-wrapper">';
echo "<div class='wpr-stt-btn' data-settings='". esc_attr(wp_json_encode($stt_settings)) ."'>";
if ( '' !== $settings['select_icon']['value'] ) {
echo '<span class="wpr-stt-icon">';
\Elementor\Icons_Manager::render_icon( $settings['select_icon'] );
echo '</span>';
}
if ( '' !== $settings['button_text'] && $settings['button_txt_show'] == 'yes' ) {
echo '<div class="wpr-stt-content">'. esc_html($settings['button_text']) .'</div>';
}
echo '</div>';
echo '</div>';
}
}
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\BeforeAfter;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-before-after';
}
public function get_widgets() {
return [
'Wpr_Before_After', // This should match the widget/element class.
];
}
}
@@ -0,0 +1,788 @@
<?php
namespace WprAddons\Modules\BeforeAfter\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
use Elementor\Group_Control_Image_Size;
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Utils;
use WprAddons\Classes\Utilities;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Wpr_Before_After extends Widget_Base {
public function get_name() {
return 'wpr-before-after';
}
public function get_title() {
return esc_html__( 'Before After', 'wpr-addons' );
}
public function get_icon() {
return 'wpr-icon eicon-image-before-after';
}
public function get_categories() {
return [ 'wpr-widgets'];
}
public function get_keywords() {
return [ 'royal', 'image compare', 'image comparison', 'before after image' ];
}
public function has_widget_inner_wrapper(): bool {
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
}
public function get_script_depends() {
return [ 'jquery-event-move' ];
}
public function get_custom_help_url() {
if ( empty(get_option('wpr_wl_plugin_links')) )
// return 'https://royal-elementor-addons.com/contact/?ref=rea-plugin-panel-before-after-help-btn';
return 'https://wordpress.org/support/plugin/royal-elementor-addons/';
}
public function add_control_direction() {
$this->add_control(
'direction',
[
'label' => esc_html__( 'Direction', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'horizontal' => esc_html__( 'Horizontal', 'wpr-addons' ),
'pro-vr' => esc_html__( 'Vertical (Pro)', 'wpr-addons' ),
],
'default' => 'horizontal',
'separator' => 'before',
]
);
}
public function add_control_trigger() {
$this->add_control(
'trigger',
[
'label' => esc_html__( 'Trigger', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'drag' => esc_html__( 'Click & Drag', 'wpr-addons' ),
'pro-ms' => esc_html__( 'Mouse Hover (Pro)', 'wpr-addons' ),
],
'default' => 'drag',
]
);
}
public function add_control_divider_position() {}
public function add_control_label_display() {
$this->add_control(
'label_display',
[
'label' => esc_html__( 'Display', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'none' => esc_html__( 'None', 'wpr-addons' ),
'default' => esc_html__( 'by Default', 'wpr-addons' ),
'pro-hv' => esc_html__( 'on Hover (Pro)', 'wpr-addons' ),
],
'default' => 'default',
]
);
}
protected function register_controls() {
// Tab: Content ==============
// Section: General ----------
$this->start_controls_section(
'section_general',
[
'label' => esc_html__( 'General', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
Utilities::wpr_library_buttons( $this, Controls_Manager::RAW_HTML );
$this->add_control(
'image_upload_1',
[
'label' => esc_html__( 'Upload Image 1', 'wpr-addons' ),
'type' => Controls_Manager::MEDIA,
'dynamic' => [
'active' => true,
],
'default' => [
'url' => Utils::get_placeholder_image_src(),
],
]
);
$this->add_control(
'image_upload_2',
[
'label' => esc_html__( 'Upload Image 2', 'wpr-addons' ),
'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' => 'image_size',
'default' => 'full',
]
);
$this->add_control_direction();
// Upgrade to Pro Notice
Utilities::upgrade_pro_notice( $this, Controls_Manager::RAW_HTML, 'before-after', 'direction', ['pro-vr'] );
$this->add_control_trigger();
// Upgrade to Pro Notice
Utilities::upgrade_pro_notice( $this, Controls_Manager::RAW_HTML, 'before-after', 'trigger', ['pro-ms'] );
$this->add_control(
'divider_icon',
[
'label' => esc_html__( 'Select Icon', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'default' => 'fa-angle',
'options' => [
'fa-caret' => esc_html__( 'Caret', 'wpr-addons' ),
'fa-angle' => esc_html__( 'Angle', 'wpr-addons' ),
'fa-arrow' => esc_html__( 'Arrow', 'wpr-addons' ),
'fa-long-arrow-alt' => esc_html__( 'Long Arrow', 'wpr-addons' ),
'fa-chevron' => esc_html__( 'Chevron', 'wpr-addons' ),
],
]
);
$this->add_control_divider_position();
$this->end_controls_section();
// Tab: Content ==============
// Section: Labels -----------
$this->start_controls_section(
'section_labels',
[
'label' => esc_html__( 'Labels', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control_label_display();
// Upgrade to Pro Notice
Utilities::upgrade_pro_notice( $this, Controls_Manager::RAW_HTML, 'before-after', 'label_display', ['pro-hv'] );
$this->add_control(
'label_image_1',
[
'label' => esc_html__( 'Image 1 Label', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'default' => 'After',
'placeholder'=> esc_html__( 'After', 'wpr-addons' ),
'separator' => 'before',
'condition' => [
'label_display!' => 'none',
]
]
);
$this->add_control(
'label_image_2',
[
'label' => esc_html__( 'Image 2 Label', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'default' => 'Before',
'placeholder'=> esc_html__( 'Before', 'wpr-addons' ),
'condition' => [
'label_display!' => 'none',
]
]
);
$this->add_control(
'label_position',
[
'label' => esc_html__( 'Position', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'flex-start' => [
'icon' => 'eicon-text-align-left',
],
'center' => [
'icon' => 'eicon-text-align-center',
],
'flex-end' => [
'icon' => 'eicon-text-align-right',
],
],
'default' => 'flex-end',
'selectors' => [
'{{WRAPPER}} .wpr-ba-label' => 'align-items: {{VALUE}}; justify-content: {{VALUE}}',
],
'condition' => [
'label_display!' => 'none',
]
]
);
$this->end_controls_section();
// Styles ====================
// Section: Divider ----------
$this->start_controls_section(
'section_style_divider',
[
'label' => esc_html__( 'Divider', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
'show_label' => false,
]
);
$this->add_control(
'divider_line_color',
[
'label' => esc_html__( 'Line Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#605BE5',
'selectors' => [
'{{WRAPPER}} .wpr-ba-divider-icons:before' => 'background-color: {{VALUE}}',
'{{WRAPPER}} .wpr-ba-divider-icons:after' => 'background-color: {{VALUE}}',
],
]
);
$this->add_control(
'divider_icon_color',
[
'label' => esc_html__( 'Icon Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#E8E8E8',
'selectors' => [
'{{WRAPPER}} .wpr-ba-divider-icons .fa' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpr-ba-divider-icons .fa' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'divider_icon_color_bg',
[
'label' => esc_html__( 'Icon Background Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#605BE5',
'selectors' => [
'{{WRAPPER}} .wpr-ba-divider-icons' => 'background-color: {{VALUE}}',
],
]
);
$this->add_control(
'divider_icon_color_border',
[
'label' => esc_html__( 'Icon Border Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#605BE5',
'selectors' => [
'{{WRAPPER}} .wpr-ba-divider-icons' => 'border-color: {{VALUE}}',
],
]
);
$this->add_responsive_control(
'divider_thickness',
[
'label' => esc_html__( 'Line Thickness', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 10,
],
],
'default' => [
'unit' => 'px',
'size' => 2,
],
'selectors' => [
'{{WRAPPER}} .wpr-ba-horizontal .wpr-ba-divider-icons:before' => 'width: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-ba-horizontal .wpr-ba-divider-icons:after' => 'width: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-ba-vertical .wpr-ba-divider-icons:before' => 'height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-ba-vertical .wpr-ba-divider-icons:after' => 'height: {{SIZE}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_responsive_control(
'divider_icon_size',
[
'label' => esc_html__( 'Icon Size', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 10,
'max' => 50,
],
],
'default' => [
'unit' => 'px',
'size' => 18,
],
'selectors' => [
'{{WRAPPER}} .wpr-ba-divider-icons .fa' => 'font-size: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'divider_icon_width_hr',
[
'label' => esc_html__( 'Icon Width', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 10,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 20,
],
'selectors' => [
'{{WRAPPER}} .wpr-ba-horizontal .wpr-ba-divider-icons .fa' => 'width: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-ba-horizontal .wpr-ba-divider' => 'margin-left: calc(-{{SIZE}}{{UNIT}} - {{divider_icon_bdw.SIZE}}px);',
'{{WRAPPER}} .wpr-ba-horizontal .wpr-ba-divider-icons:before' => 'left: calc({{SIZE}}{{UNIT}} - {{divider_thickness.SIZE}}px / 2 + {{divider_icon_bdw.SIZE}}px);',
'{{WRAPPER}} .wpr-ba-horizontal .wpr-ba-divider-icons:after' => 'left: calc({{SIZE}}{{UNIT}} - {{divider_thickness.SIZE}}px / 2 + {{divider_icon_bdw.SIZE}}px);',
],
'condition' => [
'direction' => ['horizontal', 'pro-vr']
]
]
);
$this->add_responsive_control(
'divider_icon_height_hr',
[
'label' => esc_html__( 'Icon Height', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 10,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 40,
],
'selectors' => [
'{{WRAPPER}} .wpr-ba-horizontal .wpr-ba-divider-icons .fa' => 'height: {{SIZE}}{{UNIT}}; line-height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-ba-horizontal .wpr-ba-divider-icons:before' => 'bottom: calc(50% + {{divider_icon_bdw.SIZE}}px + {{SIZE}}{{UNIT}} / 2 - 0.7px);',
'{{WRAPPER}} .wpr-ba-horizontal .wpr-ba-divider-icons:after' => 'top: calc(50% + {{divider_icon_bdw.SIZE}}px + {{SIZE}}{{UNIT}} / 2 + 0.1px);',
],
'separator' => 'after',
'condition' => [
'direction' => ['horizontal', 'pro-vr']
]
]
);
$this->add_responsive_control(
'divider_icon_width_vr',
[
'label' => esc_html__( 'Icon Width', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 10,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 40,
],
'selectors' => [
'{{WRAPPER}} .wpr-ba-vertical .wpr-ba-divider-icons .fa' => 'width: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-ba-vertical .wpr-ba-divider-icons:before' => 'right: calc(50% + {{SIZE}}{{UNIT}} / 2 + {{divider_icon_bdw.SIZE}}px);',
'{{WRAPPER}} .wpr-ba-vertical .wpr-ba-divider-icons:after' => 'left: calc(50% + {{SIZE}}{{UNIT}} / 2 + {{divider_icon_bdw.SIZE}}px);',
],
'condition' => [
'direction' => 'vertical'
]
]
);
$this->add_responsive_control(
'divider_icon_height_vr',
[
'label' => esc_html__( 'Icon Height', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 10,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 20,
],
'selectors' => [
'{{WRAPPER}} .wpr-ba-vertical .wpr-ba-divider-icons .fa' => 'height: {{SIZE}}{{UNIT}}; line-height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-ba-vertical .wpr-ba-divider-icons .fa:first-child' => 'line-height: calc({{SIZE}}{{UNIT}} * 1.3);',
'{{WRAPPER}} .wpr-ba-vertical .wpr-ba-divider-icons .fa:last-child' => 'line-height: calc({{SIZE}}{{UNIT}} * 0.8);',
'{{WRAPPER}} .wpr-ba-vertical .wpr-ba-divider' => 'margin-top: calc(-{{SIZE}}{{UNIT}} - {{divider_icon_bdw.SIZE}}px);',
'{{WRAPPER}} .wpr-ba-vertical .wpr-ba-divider-icons:before' => 'top: calc({{SIZE}}{{UNIT}} - {{divider_thickness.SIZE}}px / 2 + {{divider_icon_bdw.SIZE}}px);',
'{{WRAPPER}} .wpr-ba-vertical .wpr-ba-divider-icons:after' => 'top: calc({{SIZE}}{{UNIT}} - {{divider_thickness.SIZE}}px / 2 + {{divider_icon_bdw.SIZE}}px);',
],
'separator' => 'after',
'condition' => [
'direction' => 'vertical'
]
]
);
$this->add_control(
'divider_icon_border_type',
[
'label' => esc_html__( 'Border Type', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'none' => esc_html__( 'None', 'wpr-addons' ),
'solid' => esc_html__( 'Solid', 'wpr-addons' ),
'double' => esc_html__( 'Double', 'wpr-addons' ),
'dotted' => esc_html__( 'Dotted', 'wpr-addons' ),
'dashed' => esc_html__( 'Dashed', 'wpr-addons' ),
'groove' => esc_html__( 'Groove', 'wpr-addons' ),
],
'default' => 'solid',
'selectors' => [
'{{WRAPPER}} .wpr-ba-divider-icons' => 'border-style: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->add_control(
'divider_icon_bdw',
[
'label' => esc_html__( 'Border Width', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 10,
],
],
'default' => [
'unit' => 'px',
'size' => 1,
],
'selectors' => [
'{{WRAPPER}} .wpr-ba-divider-icons' => 'border-width: {{SIZE}}{{UNIT}};',
],
'condition' => [
'divider_icon_border_type!' => 'none',
],
]
);
$this->add_control(
'divider_icon_radius',
[
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%' ],
'default' => [
'top' => 50,
'right' => 50,
'bottom' => 50,
'left' => 50,
],
'selectors' => [
'{{WRAPPER}} .wpr-ba-divider-icons' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_section();
// Section: Request New Feature
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
// Section: Pro Features
Utilities::pro_features_list_section( $this, '', Controls_Manager::RAW_HTML, 'before-after', [
'Vertical Image Comparison',
'Move Images on Mouse Move (Hover)',
'Set Default Divider Position (% After Image to show)',
'Show Labels on Image Hover',
] );
// Styles ====================
// Section: Labels -----------
$this->start_controls_section(
'section_style_labels',
[
'label' => esc_html__( 'Labels', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
'show_label' => false,
'condition' => [
'label_display!' => 'none',
]
]
);
$this->add_control(
'labels_color',
[
'label' => esc_html__( 'Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#FFFFFF',
'selectors' => [
'{{WRAPPER}} .wpr-ba-label > div' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'labels_bg_color',
[
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#605BE5',
'selectors' => [
'{{WRAPPER}} .wpr-ba-label > div' => 'background-color: {{VALUE}}',
]
]
);
$this->add_control(
'labels_border_color',
[
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#E8E8E8',
'selectors' => [
'{{WRAPPER}} .wpr-ba-label > div' => 'border-color: {{VALUE}}',
]
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'labels_box_shadow',
'selector' => '{{WRAPPER}} .wpr-ba-label > div',
]
);
$this->add_control(
'labels_box_shadow_divider',
[
'type' => Controls_Manager::DIVIDER,
'style' => 'thick',
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'labels_typography',
'selector' => '{{WRAPPER}} .wpr-ba-label > div'
]
);
$this->add_control(
'labels_border_type',
[
'label' => esc_html__( 'Border Type', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'none' => esc_html__( 'None', 'wpr-addons' ),
'solid' => esc_html__( 'Solid', 'wpr-addons' ),
'double' => esc_html__( 'Double', 'wpr-addons' ),
'dotted' => esc_html__( 'Dotted', 'wpr-addons' ),
'dashed' => esc_html__( 'Dashed', 'wpr-addons' ),
'groove' => esc_html__( 'Groove', 'wpr-addons' ),
],
'default' => 'none',
'selectors' => [
'{{WRAPPER}} .wpr-ba-label > div' => 'border-style: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->add_control(
'labels_border_width',
[
'label' => esc_html__( 'Border Width', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'default' => [
'top' => 1,
'right' => 1,
'bottom' => 1,
'left' => 1,
],
'selectors' => [
'{{WRAPPER}} .wpr-ba-label > div' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'labels_border_type!' => 'none',
],
]
);
$this->add_responsive_control(
'labels_padding',
[
'label' => esc_html__( 'Padding', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', ],
'default' => [
'top' => 7,
'right' => 15,
'bottom' => 7,
'left' => 15,
],
'selectors' => [
'{{WRAPPER}} .wpr-ba-label > div' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_control(
'labels_radius',
[
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%' ],
'default' => [
'top' => 0,
'right' => 0,
'bottom' => 0,
'left' => 0,
],
'selectors' => [
'{{WRAPPER}} .wpr-ba-label > div' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->end_controls_section();
}
protected function render() {
// Get Settings
$settings = $this->get_settings();
$settings_new = $this->get_settings_for_display();
if ( !defined('WPR_ADDONS_PRO_VERSION') || !wpr_fs()->can_use_premium_code() ) {
$settings['direction'] = 'horizontal';
$settings['trigger'] = 'drag';
$settings['divider_position'] = 50;
$settings['label_display'] = 'pro-hv' == $settings['label_display'] ? 'none' : $settings['label_display'];
}
// Class
$class = ' wpr-ba-'. $settings['direction'];
$class .= ' wpr-ba-labels-'. $settings['label_display'];
// Icon Direction
$icon_dir_first = 'horizontal' === $settings['direction'] ? 'left' : 'up';
$icon_dir_second = 'horizontal' === $settings['direction'] ? 'right' : 'down';
// Image Source
$image_1_src = !empty($settings_new['image_upload_1']['id']) ? Group_Control_Image_Size::get_attachment_image_src( $settings_new['image_upload_1']['id'], 'image_size', $settings_new ) : $settings_new['image_upload_1']['url'];
$image_2_src = !empty($settings_new['image_upload_2']['id']) ? Group_Control_Image_Size::get_attachment_image_src( $settings_new['image_upload_2']['id'], 'image_size', $settings_new ) : $settings_new['image_upload_2']['url'];
// Divider
echo '<div class="wpr-ba-image-container'. esc_attr($class) .'" data-position="'. esc_attr($settings['divider_position']) .'" data-trigger="'. esc_attr($settings['trigger']) .'">';
// Defaults
// if ( '' !== $settings['image_upload_1']['url'] ) {
// $image_1_src = $settings['image_upload_1']['url'];
// }
// if ( '' !== $settings['image_upload_2']['url'] ) {
// $image_2_src = $settings['image_upload_2']['url'];
// }
// Image 1
echo '<div class="wpr-ba-image-1">';
echo '<img src="'. esc_url( $image_1_src ) .'">';
echo '</div>';
// Image 2
echo '<div class="wpr-ba-image-2">';
echo '<img src="'. esc_url( $image_2_src ) .'">';
echo '</div>';
// Divider
echo '<div class="wpr-ba-divider">';
echo '<div class="wpr-ba-divider-icons">';
echo '<i class="fa '. esc_attr($settings['divider_icon'] .'-'. $icon_dir_first) .'"></i>';
echo '<i class="fa '. esc_attr($settings['divider_icon'] .'-'. $icon_dir_second) .'"></i>';
echo '</div>';
echo '</div>';
// Label 1
if ( '' !== $settings['label_image_1'] ) {
echo '<div class="wpr-ba-label wpr-ba-label-1">';
echo '<div>'. esc_html($settings['label_image_1']) .'</div>';
echo '</div>';
}
// Label 2
if ( '' !== $settings['label_image_2'] ) {
echo '<div class="wpr-ba-label wpr-ba-label-2">';
echo '<div>'. esc_html($settings['label_image_2']) .'</div>';
echo '</div>';
}
echo '</div>';
}
}
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\BusinessHours;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_widgets() {
return [
'Wpr_Business_Hours',
];
}
public function get_name() {
return 'wpr-business-hours';
}
}
@@ -0,0 +1,642 @@
<?php
namespace WprAddons\Modules\BusinessHours\Widgets;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
use Elementor\Group_Control_Background;
use Elementor\Group_Control_Image_Size;
use Elementor\Group_Control_Css_Filter;
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Repeater;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use Elementor\Widget_Base;
use Elementor\Utils;
use Elementor\Icons;
use WprAddons\Classes\Utilities;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Wpr_Business_Hours extends Widget_Base {
public function get_name() {
return 'wpr-business-hours';
}
public function get_title() {
return esc_html__( 'Business Hours', 'wpr-addons' );
}
public function get_icon() {
return 'wpr-icon eicon-clock-o';
}
public function get_categories() {
return [ 'wpr-widgets'];
}
public function get_keywords() {
return [ 'royal', 'business hours', 'opening Hours', 'opening times', 'currently Open' ];
}
public function has_widget_inner_wrapper(): bool {
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
}
public function get_custom_help_url() {
if ( empty(get_option('wpr_wl_plugin_links')) )
// return 'https://royal-elementor-addons.com/contact/?ref=rea-plugin-panel-business-hours-help-btn';
return 'https://wordpress.org/support/plugin/royal-elementor-addons/';
}
public function add_repeater_args_icon() {
return [
'type' => Controls_Manager::HIDDEN,
'default' => [
'value' => '',
'library' => '',
],
];
}
public function add_repeater_args_highlight() {
return [
'label' => sprintf( __( 'Highlight this Item %s', 'wpr-addons' ), '<i class="eicon-pro-icon"></i>' ),
'type' => Controls_Manager::SWITCHER,
'separator' => 'before',
'classes' => 'wpr-pro-control no-distance'
];
}
public function add_repeater_args_highlight_color() {
return [
'type' => Controls_Manager::HIDDEN,
'default' => ''
];
}
public function add_repeater_args_highlight_bg_color() {
return [
'type' => Controls_Manager::HIDDEN,
'default' => ''
];
}
public function add_control_general_even_bg() {
$this->add_control(
'general_even_bg',
[
'label' => sprintf( __( 'Enable Even Color %s', 'wpr-addons' ), '<i class="eicon-pro-icon"></i>' ),
'type' => Controls_Manager::SWITCHER,
'classes' => 'wpr-pro-control'
]
);
}
public function add_control_general_even_bg_color() {}
public function add_control_general_icon_color() {}
public function add_control_general_hover_icon_color() {}
public function add_control_general_icon_size() {}
protected function register_controls() {
// Section: Business Hours ---
$this->start_controls_section(
'wpr__section_business_hours_items',
[
'label' => esc_html__( 'Business Hours', 'wpr-addons' ),
]
);
Utilities::wpr_library_buttons( $this, Controls_Manager::RAW_HTML );
$repeater = new Repeater();
$repeater->start_controls_tabs( 'tabs_business_hours_item' );
$repeater->add_control(
'day',
[
'label' => esc_html__( 'Day', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'default' => 'Monday',
]
);
$repeater->add_control( 'icon', $this->add_repeater_args_icon() );
$repeater->add_control(
'time',
[
'label' => esc_html__( 'Time', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'default' => '08:00 AM - 05:00 PM',
'separator' => 'before'
]
);
$repeater->add_control( 'highlight', $this->add_repeater_args_highlight() );
$repeater->add_control( 'highlight_color', $this->add_repeater_args_highlight_color() );
$repeater->add_control( 'highlight_bg_color', $this->add_repeater_args_highlight_bg_color() );
$repeater->add_control(
'closed',
[
'label' => esc_html__( 'Closed', 'wpr-addons' ),
'type' => Controls_Manager::SWITCHER,
'render_type' => 'template',
'separator' => 'before'
]
);
$repeater->add_control(
'closed_text',
[
'label' => esc_html__( 'Closed Text', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'default' => 'Closed',
'condition' => [
'closed' => 'yes',
],
]
);
if ( !defined('WPR_ADDONS_PRO_VERSION') || !wpr_fs()->can_use_premium_code() ) {
$repeater->add_control(
'business_hours_pro_notice',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => '<span style="color:#2a2a2a;">Custom Icon and Even/Odd Item Background Color</span> options are available in the <strong><a href="https://royal-elementor-addons.com/?ref=rea-plugin-panel-business-hours-upgrade-pro#purchasepro" target="_blank">Pro version</a></strong>',
// 'raw' => '<span style="color:#2a2a2a;">Custom Icon and Even/Odd Item Background Color</span> options are available in the <strong><a href="'. admin_url('admin.php?page=wpr-addons-pricing') .'" target="_blank">Pro version</a></strong>',
'content_classes' => 'wpr-pro-notice',
]
);
}
$this->add_control(
'hours_items',
[
'type' => Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [
[
'day' => 'Monday',
],
[
'day' => 'Tuesday',
],
[
'day' => 'Wednesday',
],
[
'day' => 'Thursday',
],
[
'day' => 'Friday',
],
[
'day' => 'Saturday',
'time' => '08:00 AM - 01:00 PM',
],
[
'day' => 'Sunday',
'closed' => 'yes',
],
],
'title_field' => '{{{ day }}}',
]
);
$this->end_controls_section(); // End Controls Section
// Section: Request New Feature
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
// Section: Pro Features
Utilities::pro_features_list_section( $this, '', Controls_Manager::RAW_HTML, 'business-hours', [
'List Item Custom Icon options',
'List Item Custom Text & Background Color options',
'List Item Even/Odd Background Color option',
] );
// Styles
// Section: General ----------
$this->start_controls_section(
'wpr__section_style_general',
[
'label' => esc_html__( 'General', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->start_controls_tabs( 'tabs_general_colors' );
$this->start_controls_tab(
'tab_general_normal_colors',
[
'label' => esc_html__( 'Normal', 'wpr-addons' ),
]
);
$this->add_control(
'general_day_color',
[
'label' => esc_html__( 'Day Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#333333',
'selectors' => [
'{{WRAPPER}} .wpr-business-day' => 'color: {{VALUE}}',
],
]
);
$this->add_control_general_icon_color();
$this->add_control(
'general_time_color',
[
'label' => esc_html__( 'Time Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#333333',
'selectors' => [
'{{WRAPPER}} .wpr-business-time' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'general_bg_color',
[
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#ffffff',
'selectors' => [
'{{WRAPPER}} .wpr-business-hours-item' => 'background-color: {{VALUE}}',
'{{WRAPPER}} .wpr-business-hours' => 'background-color: {{VALUE}}',
],
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'tab_general_hover_colors',
[
'label' => esc_html__( 'Hover', 'wpr-addons' ),
]
);
$this->add_control(
'general_hover_day_color',
[
'label' => esc_html__( 'Day Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpr-business-hours .wpr-business-hours-item:not(.wpr-business-hours-item-closed):hover .wpr-business-day' => 'color: {{VALUE}}',
],
]
);
$this->add_control_general_hover_icon_color();
$this->add_control(
'general_hover_time_color',
[
'label' => esc_html__( 'Time Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpr-business-hours .wpr-business-hours-item:not(.wpr-business-hours-item-closed):hover .wpr-business-time' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'general_hover_bg_color',
[
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#f7f7f7',
'selectors' => [
'{{WRAPPER}} .wpr-business-hours .wpr-business-hours-item:not(.wpr-business-hours-item-closed):hover' => 'background-color: {{VALUE}}',
],
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->add_control_general_even_bg();
$this->add_control_general_even_bg_color();
$this->add_control(
'general_closed_section',
[
'label' => esc_html__( 'Closed', 'wpr-addons' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_control(
'general_closed_bg_color',
[
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#605BE5',
'selectors' => [
'{{WRAPPER}} .wpr-business-hours-item-closed' => 'background-color: {{VALUE}}',
],
]
);
$this->add_control(
'general_closed_day_color',
[
'label' => esc_html__( 'Day Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#ffffff',
'selectors' => [
'{{WRAPPER}} .wpr-business-hours-item-closed .wpr-business-day' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'general_closed_color',
[
'label' => esc_html__( 'Text Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#ffffff',
'selectors' => [
'{{WRAPPER}} .wpr-business-hours-item-closed .wpr-business-closed' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'general_day_typography_divider',
[
'type' => Controls_Manager::DIVIDER,
'style' => 'thick',
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'label' => esc_html__( 'Day Typography', 'wpr-addons' ),
'name' => 'general_day_typography',
'selector' => '{{WRAPPER}} .wpr-business-day',
]
);
$this->add_control_general_icon_size();
$this->add_control(
'general_time_typography_divider',
[
'type' => Controls_Manager::DIVIDER,
'style' => 'thick',
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'label' => esc_html__( 'Time Typography', 'wpr-addons' ),
'name' => 'general_time_typography',
'selector' => '{{WRAPPER}} .wpr-business-time,{{WRAPPER}} .wpr-business-closed',
'separator' => 'before',
]
);
$this->add_control(
'general_divider',
[
'label' => esc_html__( 'Divider', 'wpr-addons' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'separator' => 'before',
]
);
$this->add_control(
'general_divider_color',
[
'label' => esc_html__( 'Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#E8E8E8',
'selectors' => [
'{{WRAPPER}} .wpr-business-hours-item:after' => 'border-bottom-color: {{VALUE}};',
],
'condition' => [
'general_divider' => 'yes',
],
]
);
$this->add_control(
'general_divider_type',
[
'label' => esc_html__( 'Style', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'solid' => esc_html__( 'Solid', 'wpr-addons' ),
'double' => esc_html__( 'Double', 'wpr-addons' ),
'dotted' => esc_html__( 'Dotted', 'wpr-addons' ),
'dashed' => esc_html__( 'Dashed', 'wpr-addons' ),
'groove' => esc_html__( 'Groove', 'wpr-addons' ),
],
'default' => 'solid',
'selectors' => [
'{{WRAPPER}} .wpr-business-hours-item:after' => 'border-bottom-style: {{VALUE}};',
],
'condition' => [
'general_divider' => 'yes',
],
]
);
$this->add_control(
'general_divider_weight',
[
'label' => esc_html__( 'Weight', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 1,
'max' => 20,
],
],
'default' => [
'size' => 1,
],
'selectors' => [
'{{WRAPPER}} .wpr-business-hours-item:after' => 'border-bottom-width: {{SIZE}}{{UNIT}};',
],
'condition' => [
'general_divider' => 'yes',
],
]
);
$this->add_control(
'general_padding',
[
'label' => esc_html__( 'Padding', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'default' => [
'top' => 15,
'right' => 15,
'bottom' => 15,
'left' => 15,
],
'size_units' => [ 'px', ],
'selectors' => [
'{{WRAPPER}} .wpr-business-hours-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_control(
'general_wrapper_padding',
[
'label' => esc_html__( 'Wrapper Padding', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'default' => [
'top' => 0,
'right' => 0,
'bottom' => 0,
'left' => 0,
],
'size_units' => [ 'px', ],
'selectors' => [
'{{WRAPPER}} .wpr-business-hours' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'general_border',
'fields_options' => [
'border' => [
'default' => 'solid',
],
'width' => [
'default' => [
'top' => '1',
'right' => '1',
'bottom' => '1',
'left' => '1',
'isLinked' => true,
],
],
'color' => [
'default' => '#E8E8E8',
],
],
'selector' => '{{WRAPPER}} .wpr-business-hours',
'separator' => 'before',
]
);
$this->add_control(
'general_border_radius',
[
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%' ],
'selectors' => [
'{{WRAPPER}} .wpr-business-hours' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'default' => [
'top' => 10,
'right' => 10,
'bottom' => 10,
'left' => 10,
],
'separator' => 'before',
]
);
$this->end_controls_section(); // End Controls Section
}
protected function render() {
// Get Settings
$settings = $this->get_settings();
$item_count = 0;
?>
<div class="wpr-business-hours">
<?php
foreach ( $settings['hours_items'] as $item ) :
if ( '' !== $item['day'] || '' !== $item['time'] ) :
$this->add_render_attribute( 'hours_item_attribute'. $item_count, 'class', 'wpr-business-hours-item elementor-repeater-item-'.esc_attr( $item['_id'] ) );
if ( 'yes' === $item['closed'] ) {
$this->add_render_attribute( 'hours_item_attribute'. $item_count, 'class', 'wpr-business-hours-item-closed' );
}
?>
<div <?php echo $this->get_render_attribute_string( 'hours_item_attribute'. $item_count ); ?>>
<?php if ( '' !== $item['day'] ) : ?>
<span class="wpr-business-day">
<?php echo '' !== $item['icon']['value'] ? '<i class="'. esc_attr($item['icon']['value']) .'"></i>' : ''; ?>
<?php echo esc_html($item['day']); ?>
</span>
<?php endif; ?>
<?php if ( 'yes' === $item['closed'] ) : ?>
<span class="wpr-business-closed"><?php echo esc_html($item['closed_text']); ?></span>
<?php elseif ( '' !== $item['time'] ) : ?>
<span class="wpr-business-time"><?php echo esc_html($item['time']); ?></span>
<?php endif; ?>
</div>
<?php
endif;
$item_count++;
endforeach;
?>
</div>
<?php
}
}
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\Button;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_widgets() {
return [
'Wpr_Button',
];
}
public function get_name() {
return 'wpr-button';
}
}
@@ -0,0 +1,727 @@
<?php
namespace WprAddons\Modules\Button\Widgets;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
use Elementor\Group_Control_Background;
use Elementor\Group_Control_Image_Size;
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Repeater;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use Elementor\Widget_Base;
use Elementor\Utils;
use Elementor\Icons;
use WprAddons\Classes\Utilities;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Wpr_Button extends Widget_Base {
public function get_name() {
return 'wpr-button';
}
public function get_title() {
return esc_html__( 'Button', 'wpr-addons' );
}
public function get_icon() {
return 'wpr-icon eicon-button';
}
public function get_categories() {
return [ 'wpr-widgets'];
}
public function get_keywords() {
return [ 'royal', 'button' ];
}
public function has_widget_inner_wrapper(): bool {
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
}
public function get_style_depends() {
return [ 'wpr-button-animations-css' ];
}
public function get_custom_help_url() {
if ( empty(get_option('wpr_wl_plugin_links')) )
// return 'https://royal-elementor-addons.com/contact/?ref=rea-plugin-panel-button-help-btn';
return 'https://wordpress.org/support/plugin/royal-elementor-addons/';
}
public function add_control_icon_style() {
$this->add_control(
'icon_style',
[
'label' => esc_html__( 'Select Style', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'default' => 'inline',
'options' => [
'inline' => esc_html__( 'Inline', 'wpr-addons' ),
'pro-bk' => esc_html__( 'Block (Pro)', 'wpr-addons' ),
'pro-ibk' => esc_html__( 'Inline Block (Pro)', 'wpr-addons' ),
],
'prefix_class' => 'wpr-button-icon-style-',
'separator' => 'before',
]
);
}
public function add_control_icon_width() {}
public function add_section_style_icon() {}
public function add_section_tooltip() {}
public function add_section_style_tooltip() {}
public function render_pro_element_tooltip( $settings ) {}
protected function register_controls() {
// Section: Button ----------
$this->start_controls_section(
'section_button',
[
'label' => esc_html__( 'Button', 'wpr-addons' ),
]
);
Utilities::wpr_library_buttons( $this, Controls_Manager::RAW_HTML );
$this->add_control(
'button_text',
[
'label' => esc_html__( 'Text', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'default' => 'Click here',
]
);
$this->add_control(
'button_url',
[
'type' => Controls_Manager::URL,
'dynamic' => [
'active' => true,
],
'placeholder' => esc_html__( 'https://your-link.com', 'wpr-addons' ),
'default' => [
'url' => '#link',
],
'separator' => 'after',
]
);
$this->add_control(
'button_hover_animation',
[
'label' => esc_html__( 'Select Animation', 'wpr-addons' ),
'type' => 'wpr-button-animations',
'default' => 'wpr-button-none',
]
);
// Upgrade to Pro Notice
Utilities::upgrade_pro_notice( $this, Controls_Manager::RAW_HTML, 'button', 'button_hover_animation', ['pro-wnt','pro-rlt','pro-rrt'] );
$this->add_control(
'button_hover_anim_duration',
[
'label' => esc_html__( 'Effect Duration', 'wpr-addons' ),
'type' => Controls_Manager::NUMBER,
'default' => 0.4,
'min' => 0,
'max' => 5,
'step' => 0.1,
'selectors' => [
'{{WRAPPER}} .wpr-button' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s;-webkit-animation-duration: {{VALUE}}s;animation-duration: {{VALUE}}s;',
'{{WRAPPER}} .wpr-button::before' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s;-webkit-animation-duration: {{VALUE}}s;animation-duration: {{VALUE}}s;',
'{{WRAPPER}} .wpr-button::after' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s;-webkit-animation-duration: {{VALUE}}s;animation-duration: {{VALUE}}s;',
'{{WRAPPER}} .wpr-button::after' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s;-webkit-animation-duration: {{VALUE}}s;animation-duration: {{VALUE}}s;',
'{{WRAPPER}} .wpr-button .wpr-button-icon' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s;',
'{{WRAPPER}} .wpr-button .wpr-button-icon svg' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s;',
'{{WRAPPER}} .wpr-button .wpr-button-text' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s;-webkit-animation-duration: {{VALUE}}s;animation-duration: {{VALUE}}s;',
'{{WRAPPER}} .wpr-button .wpr-button-content' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s;-webkit-animation-duration: {{VALUE}}s;animation-duration: {{VALUE}}s;',
],
]
);
$this->add_control(
'button_hover_animation_height',
[
'label' => esc_html__( 'Effect Height', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'%' => [
'min' => 0,
'max' => 100,
],
'px' => [
'min' => 0,
'max' => 30,
],
],
'size_units' => [ '%', 'px' ],
'default' => [
'unit' => 'px',
'size' => 3,
],
'selectors' => [
'{{WRAPPER}} [class*="wpr-button-underline"]:before' => 'height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} [class*="wpr-button-overline"]:before' => 'height: {{SIZE}}{{UNIT}};',
],
'condition' => [
'button_hover_animation' => ['wpr-button-underline-from-left','wpr-button-underline-from-center','wpr-button-underline-from-right','wpr-button-underline-reveal','wpr-button-overline-reveal','wpr-button-overline-from-left','wpr-button-overline-from-center','wpr-button-overline-from-right']
],
]
);
$this->add_control(
'button_hover_animation_text',
[
'label' => esc_html__( 'Effect Text', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'default' => 'Go',
'condition' => [
'button_hover_animation' => ['wpr-button-winona','wpr-button-rayen-left','wpr-button-rayen-right']
],
]
);
$this->add_responsive_control(
'button_width',
[
'label' => esc_html__( 'Width', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'%' => [
'min' => 0,
'max' => 100,
],
'px' => [
'min' => 0,
'max' => 500,
],
],
'size_units' => [ '%', 'px' ],
'default' => [
'unit' => 'px',
'size' => 160,
],
'selectors' => [
'{{WRAPPER}} .wpr-button-wrap' => 'max-width: {{SIZE}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_responsive_control(
'button_position',
[
'label' => esc_html__( 'Position', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'center',
'label_block' => false,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'wpr-addons' ),
'icon' => 'eicon-h-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'wpr-addons' ),
'icon' => 'eicon-h-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'wpr-addons' ),
'icon' => 'eicon-h-align-right',
],
],
'selectors' => [
'{{WRAPPER}}' => 'text-align: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->add_responsive_control(
'button_content_align',
[
'label' => esc_html__( 'Alignment', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'center',
'label_block' => false,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'wpr-addons' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'wpr-addons' ),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'wpr-addons' ),
'icon' => 'eicon-text-align-right',
],
],
'selectors_dictionary' => [
'left' => 'flex-start',
'center' => 'center',
'right' => 'flex-end'
],
'selectors' => [
'{{WRAPPER}} .wpr-button-content' => '-webkit-justify-content: {{VALUE}};justify-content: {{VALUE}};',
'{{WRAPPER}} .wpr-button-text' => '-webkit-justify-content: {{VALUE}};justify-content: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->add_control(
'button_id',
[
'label' => esc_html__( 'Button ID', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'title' => esc_html__( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'wpr-addons' ),
'description' => esc_html__( 'Please make sure the ID is unique and not used elsewhere on the page this button is displayed. This field allows <code>A-z 0-9</code> & underscore chars without spaces.', 'wpr-addons' ),
'label_block' => false,
'default' => '',
'separator' => 'before',
]
);
$this->end_controls_section(); // End Controls Section
// Section: Icon -------------
$this->start_controls_section(
'section_icon',
[
'label' => esc_html__( 'Icon', 'wpr-addons' ),
]
);
$this->add_control(
'select_icon',
[
'label' => esc_html__( 'Select Icon', 'wpr-addons' ),
'type' => Controls_Manager::ICONS,
'skin' => 'inline',
'label_block' => false,
'default' => [
'value' => 'fas fa-angle-right',
'library' => 'fa-solid',
],
'separator' => 'before',
]
);
$this->add_control_icon_style();
// Upgrade to Pro Notice
Utilities::upgrade_pro_notice( $this, Controls_Manager::RAW_HTML, 'button', 'icon_style', ['pro-bk', 'pro-ibk'] );
$this->add_control(
'icon_position',
[
'label' => esc_html__( 'Position', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'label_block' => false,
'default' => 'right',
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'wpr-addons' ),
'icon' => 'eicon-h-align-left',
],
'right' => [
'title' => esc_html__( 'Right', 'wpr-addons' ),
'icon' => 'eicon-h-align-right',
],
],
'prefix_class' => 'wpr-button-icon-position-',
'separator' => 'before',
]
);
$this->add_control_icon_width();
$this->add_control(
'icon_size',
[
'label' => esc_html__( 'Size', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 18,
],
'selectors' => [
'{{WRAPPER}} .wpr-button-icon' => 'font-size: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-button-icon svg' => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_control(
'icon_distance',
[
'label' => esc_html__( 'Distance', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 50,
],
],
'default' => [
'unit' => 'px',
'size' => 12,
],
'selectors' => [
'{{WRAPPER}}.wpr-button-icon-position-left .wpr-button-icon' => 'margin-right: {{SIZE}}{{UNIT}};',
'{{WRAPPER}}.wpr-button-icon-position-right .wpr-button-icon' => 'margin-left: {{SIZE}}{{UNIT}};',
],
'condition' => [
'icon_style' => ['inline', 'pro-bk', 'pro-ibk'],
],
]
);
$this->end_controls_section(); // End Controls Section
// Section: Tooltip ---------
$this->add_section_tooltip();
// Section: Request New Feature
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
// Section: Pro Features
Utilities::pro_features_list_section( $this, '', Controls_Manager::RAW_HTML, 'button', [
'Advanced Tooltip options',
'Advanced Button Styles',
'Advanced Hover Animations - Change Text on Hover',
] );
// Styles
// Section: Button -----------
$this->start_controls_section(
'section_style_button',
[
'label' => esc_html__( 'Button', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->start_controls_tabs( 'tabs_button_colors' );
$this->start_controls_tab(
'tab_button_normal_colors',
[
'label' => esc_html__( 'Normal', 'wpr-addons' ),
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'button_bg_color',
'types' => [ 'classic', 'gradient' ],
'fields_options' => [
'color' => [
'default' => '#605BE5',
],
],
'selector' => '{{WRAPPER}} .wpr-button'
]
);
$this->add_control(
'button_color',
[
'label' => esc_html__( 'Text Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#ffffff',
'selectors' => [
'{{WRAPPER}} .wpr-button-text' => 'color: {{VALUE}}',
'{{WRAPPER}}.wpr-button-icon-style-inline .wpr-button-icon' => 'color: {{VALUE}}',
'{{WRAPPER}}.wpr-button-icon-style-inline .wpr-button-icon svg' => 'fill: {{VALUE}}',
],
]
);
$this->add_control(
'button_border_color',
[
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#E8E8E8',
'selectors' => [
'{{WRAPPER}} .wpr-button' => 'border-color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'button_box_shadow',
'selector' => '{{WRAPPER}} .wpr-button',
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'button_typography',
'selector' => '{{WRAPPER}} .wpr-button-text,{{WRAPPER}} .wpr-button::after',
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'tab_button_hover_colors',
[
'label' => esc_html__( 'Hover', 'wpr-addons' ),
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'button_hover_bg_color',
'types' => [ 'classic', 'gradient' ],
'fields_options' => [
'color' => [
'default' => '#4A45D2',
],
],
'selector' => ' {{WRAPPER}} [class*="elementor-animation"]:hover,
{{WRAPPER}} .wpr-button::before,
{{WRAPPER}} .wpr-button::after',
]
);
$this->add_control(
'button_hover_color',
[
'label' => esc_html__( 'Text Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#ffffff',
'selectors' => [
'{{WRAPPER}} .wpr-button:hover .wpr-button-text' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpr-button::after' => 'color: {{VALUE}}',
'{{WRAPPER}}.wpr-button-icon-style-inline .wpr-button:hover .wpr-button-icon' => 'color: {{VALUE}}',
'{{WRAPPER}}.wpr-button-icon-style-inline .wpr-button:hover .wpr-button-icon svg' => 'fill: {{VALUE}}',
],
]
);
$this->add_control(
'button_hover_border_color',
[
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#E8E8E8',
'selectors' => [
'{{WRAPPER}} .wpr-button:hover' => 'border-color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'button_hover_box_shadow',
'selector' => '{{WRAPPER}} .wpr-button:hover',
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->add_responsive_control(
'button_padding',
[
'label' => esc_html__( 'Padding', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'default' => [
'top' => 10,
'right' => 10,
'bottom' => 10,
'left' => 10,
],
'selectors' => [
'{{WRAPPER}}.wpr-button-icon-style-inline .wpr-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}}.wpr-button-icon-style-block .wpr-button-text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}}.wpr-button-icon-style-inline-block .wpr-button-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpr-button::after' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_control(
'button_border_type',
[
'label' => esc_html__( 'Border Type', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'none' => esc_html__( 'None', 'wpr-addons' ),
'solid' => esc_html__( 'Solid', 'wpr-addons' ),
'double' => esc_html__( 'Double', 'wpr-addons' ),
'dotted' => esc_html__( 'Dotted', 'wpr-addons' ),
'dashed' => esc_html__( 'Dashed', 'wpr-addons' ),
'groove' => esc_html__( 'Groove', 'wpr-addons' ),
],
'default' => 'none',
'selectors' => [
'{{WRAPPER}} .wpr-button' => 'border-style: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->add_responsive_control(
'button_border_width',
[
'label' => esc_html__( 'Border Width', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%' ],
'default' => [
'top' => 2,
'right' => 2,
'bottom' => 2,
'left' => 2,
],
'selectors' => [
'{{WRAPPER}} .wpr-button' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'button_border_type!' => 'none',
],
]
);
$this->add_responsive_control(
'button_border_radius',
[
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%' ],
'default' => [
'top' => 2,
'right' => 2,
'bottom' => 2,
'left' => 2,
],
'selectors' => [
'{{WRAPPER}} .wpr-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
]
]
);
$this->end_controls_section(); // End Controls Section
// Styles
// Section: Icon ---------------
$this->add_section_style_icon();
// Styles
// Section: Tooltip ---------------
$this->add_section_style_tooltip();
}
protected function render() {
// Get Settings
$settings = $this->get_settings();
$settings_new = $this->get_settings_for_display();
$settings = array_merge( $settings, $settings_new );
$btn_element = 'div';
$btn_url = $settings['button_url']['url'];
?>
<?php if ( '' !== $settings['button_text'] || '' !== $settings['select_icon']['value'] ) : ?>
<?php
$this->add_render_attribute( 'button_attribute', 'class', 'wpr-button wpr-button-effect '. $settings['button_hover_animation'] );
if ( '' !== $settings['button_hover_animation_text'] ) {
$this->add_render_attribute( 'button_attribute', 'data-text', $settings['button_hover_animation_text'] );
}
if ( '' !== $btn_url ) {
$btn_element = 'a';
$this->add_render_attribute( 'button_attribute', 'href', esc_url( $settings['button_url']['url'] ) );
if ( $settings['button_url']['is_external'] ) {
$this->add_render_attribute( 'button_attribute', 'target', '_blank' );
}
if ( $settings['button_url']['nofollow'] ) {
$this->add_render_attribute( 'button_attribute', 'nofollow', '' );
}
}
if ( '' !== $settings['button_id'] ) {
$this->add_render_attribute( 'button_attribute', 'id', $settings['button_id'] );
}
?>
<div class="wpr-button-wrap elementor-clearfix">
<<?php echo esc_html($btn_element); ?> <?php echo $this->get_render_attribute_string( 'button_attribute' ); ?>>
<span class="wpr-button-content">
<?php if ( '' !== $settings['button_text'] ) : ?>
<span class="wpr-button-text"><?php echo esc_html__( $settings['button_text'] ); ?></span>
<?php endif; ?>
<?php if ( '' !== $settings['select_icon']['value'] ) : ?>
<span class="wpr-button-icon"><?php \Elementor\Icons_Manager::render_icon( $settings['select_icon'] ); ?></span>
<?php endif; ?>
</span>
</<?php echo esc_html($btn_element); ?>>
<?php $this->render_pro_element_tooltip( $settings ); ?>
</div>
<?php endif; ?>
<?php
}
}
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\Charts;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_widgets() {
return [
'Wpr_Charts',
];
}
public function get_name() {
return 'wpr-charts';
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\ContentTicker;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_widgets() {
return [
'Wpr_Content_Ticker',
];
}
public function get_name() {
return 'wpr-content-ticker';
}
}
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\ContentToggle;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_widgets() {
return [
'Wpr_Content_Toggle',
];
}
public function get_name() {
return 'wpr-content-toggle';
}
}
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\Countdown;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_widgets() {
return [
'Wpr_Countdown',
];
}
public function get_name() {
return 'wpr-countdown';
}
}
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\DataTable;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-data-table';
}
public function get_widgets() {
return [
'Wpr_Data_Table', // This should match the widget/element class.
];
}
}
@@ -0,0 +1,20 @@
<?php
namespace WprAddons\Modules\Date;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Module extends Module_Base {
public function get_widgets() {
return [ 'WPR_Date' ];
}
public function get_name() {
return 'wpr-date';
}
}
@@ -0,0 +1,220 @@
<?php
namespace WprAddons\Modules\Date\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class WPR_Date extends Widget_Base {
public function get_name() {
return 'wpr-date';
}
public function get_title() {
return __( 'Date', 'wpr-addons' );
}
public function get_icon() {
return 'wpr-icon eicon-calendar';
}
public function get_categories() {
return [ 'wpr-widgets'];
}
public function get_keywords() {
return [ 'royal', 'date time' ];
}
public function has_widget_inner_wrapper(): bool {
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
}
protected function register_controls() {
$this->start_controls_section(
'section_content',
[
'label' => __( 'General', 'wpr-addons' ),
]
);
$this->add_control(
'date_format',
[
'label' => esc_html__( 'Date Format', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'default' => esc_html__( 'Default', 'wpr-addons' ),
'' => esc_html__( 'None', 'wpr-addons' ),
'Y' => gmdate( 'Y' ),
'F j, Y' => gmdate( 'F j, Y' ),
'Y-m-d' => gmdate( 'Y-m-d' ),
'Y, M, D' => gmdate( 'Y, M, D' ),
'm/d/Y' => gmdate( 'm/d/Y' ),
'd/m/Y' => gmdate( 'd/m/Y' ),
'j. F Y' => gmdate( 'j. F Y' ),
'l, F j, Y' => gmdate( 'l, F j, Y' )
],
'default' => 'default',
]
);
$this->add_control(
'time_format',
[
'label' => esc_html__( 'Time Format', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'default' => esc_html__( 'Default', 'wpr-addons' ),
'' => esc_html__( 'None', 'wpr-addons' ),
'g:i a' => gmdate( 'g:i a' ),
'g:i A' => gmdate( 'g:i A' ),
'H:i' => gmdate( 'H:i' ),
],
'default' => 'default',
]
);
$this->add_control(
'extra_text_before',
[
'label' => esc_html__( 'Extra Text (Before)', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Before Text - ', 'wpr-addons' ),
]
);
$this->add_control(
'extra_text_after',
[
'label' => esc_html__( 'Extra Text (After)', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( ' - After Text', 'wpr-addons' ),
]
);
$this->add_control(
'text_align',
[
'label' => esc_html__( 'Text Alignment', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'wpr-addons' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'wpr-addons' ),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'wpr-addons' ),
'icon' => 'eicon-text-align-right',
],
],
'default' => 'left',
'toggle' => true,
'selectors' => [
'{{WRAPPER}} .wpr-date' => 'text-align: {{VALUE}};',
],
]
);
$this->end_controls_section();
// Start Style Section
$this->start_controls_section(
'section_style',
[
'label' => __( 'Style', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'text_color',
[
'label' => __( 'Date Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpr-date' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'extra_text_color',
[
'label' => __( 'Extra Text Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpr-date .wpr-extra-text' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
\Elementor\Group_Control_Typography::get_type(),
[
'name' => 'typography',
'selector' => '{{WRAPPER}} .wpr-date',
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
$date_format = $settings['date_format'];
$time_format = $settings['time_format'];
$extra_text_before = $settings['extra_text_before'];
$extra_text_after = $settings['extra_text_after'];
$format = '';
if ( 'default' === $date_format ) {
$date_format = get_option( 'date_format' );
}
if ( 'default' === $time_format ) {
$time_format = get_option( 'time_format' );
}
if ( $date_format ) {
$format = $date_format;
$has_date = true;
} else {
$has_date = false;
}
if ( $time_format ) {
if ( $has_date ) {
$format .= ' ';
}
$format .= $time_format;
}
$value = date_i18n( $format );
// Build output with extra text before/after
$output = '<div class="wpr-date">';
if (!empty($extra_text_before)) {
$output .= '<span class="wpr-extra-text">'. $extra_text_before .'</span>';
}
$output .= $value;
if (!empty($extra_text_after)) {
$output .= '<span class="wpr-extra-text">'. $extra_text_after .'</span>';
}
$output .= '</div>';
echo wp_kses_post( $output );
}
}
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\DualButton;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_widgets() {
return [
'Wpr_Dual_Button',
];
}
public function get_name() {
return 'wpr-dual-button';
}
}
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\DualColorHeading;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-dual-color-heading';
}
public function get_widgets() {
return [
'Wpr_Dual_Color_Heading', // This should match the widget/element class.
];
}
}
@@ -0,0 +1,751 @@
<?php
namespace WprAddons\Modules\DualColorHeading\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Scheme_Color;
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
use Elementor\Icons_Manager;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Group_Control_Text_Shadow;
use Elementor\Group_Control_Background;
use Elementor\Group_Control_Typography;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use WprAddons\Classes\Utilities;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Wpr_Dual_Color_Heading extends Widget_Base {
public function get_name() {
return 'wpr-dual-color-heading';
}
public function get_title() {
return esc_html__('Dual Color Heading', 'wpr-addons');
}
public function get_icon() {
return 'wpr-icon eicon-heading';
}
public function get_categories() {
return ['wpr-widgets'];
}
public function get_keywords() {
return ['royal', 'Dual Color Heading'];
}
public function has_widget_inner_wrapper(): bool {
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
}
public function get_custom_help_url() {
if ( empty(get_option('wpr_wl_plugin_links')) )
// return 'https://royal-elementor-addons.com/contact/?ref=rea-plugin-panel-grid-help-btn';
return 'https://wordpress.org/support/plugin/royal-elementor-addons/';
}
protected function register_controls() {
$this->start_controls_section(
'section_content',
[
'label' => __('Settings', 'wpr-addons'),
]
);
Utilities::wpr_library_buttons( $this, Controls_Manager::RAW_HTML );
$this->add_control(
'dual_heading_tag',
[
'label' => esc_html__( 'HTML Tag', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'h1' => 'H1',
'h2' => 'H2',
'h3' => 'H3',
'h4' => 'H4',
'h5' => 'H5',
'h6' => 'H6',
'div' => 'div',
'span' => 'span',
'p' => 'p'
],
'default' => 'h2'
]
);
$this->add_control(
'content_style',
[
'label' => esc_html__('Select Layout', 'wpr-addons'),
'type' => Controls_Manager::SELECT,
'default' => 'icon-top',
'options' => [
'default' => esc_html__('Default', 'wpr-addons'),
'icon-top' => esc_html__('Icon Top', 'wpr-addons'),
'desc-top' => esc_html__('Desccription Top', 'wpr-addons'),
'icon-and-desc-top' => esc_html__('Heading Bottom', 'wpr-addons'),
],
'prefix_class' => 'wpr-dual-heading-',
]
);
$this->add_responsive_control(
'text_align',
[
'label' => __('Alignment', 'wpr-addons'),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => __('Left', 'wpr-addons'),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => __('Center', 'wpr-addons'),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => __('Right', 'wpr-addons'),
'icon' => 'eicon-text-align-right',
],
],
'default' => 'center',
'selectors' => [
'{{WRAPPER}} .wpr-dual-heading-wrap' => 'text-align: {{VALUE}}',
]
]
);
$this->add_control(
'primary_heading',
[
'label' => __('Primary Heading', 'wpr-addons'),
'type' => Controls_Manager::TEXT,
'default' => __('Dual Color', 'wpr-addons'),
'separator' => 'before',
'label_block' => true,
'dynamic' => [
'active' => true,
],
]
);
$this->add_control(
'secondary_heading',
[
'label' => __('Secondary Heading', 'wpr-addons'),
'type' => Controls_Manager::TEXT,
'default' => __('Heading', 'wpr-addons'),
'label_block' => true,
'dynamic' => [
'active' => true,
],
]
);
$this->add_control(
'show_description',
[
'label' => __('Show Description', 'wpr-addons'),
'type' => Controls_Manager::SWITCHER,
'label_on' => __('Show', 'wpr-addons'),
'label_off' => __('Hide', 'wpr-addons'),
'return_value' => 'yes',
'default' => 'yes',
'separator' => 'before'
]
);
$this->add_control(
'description',
[
'label' => __('', 'wpr-addons'),
'type' => Controls_Manager::TEXTAREA,
'default' => __('Description text or Sub Heading', 'wpr-addons'),
'dynamic' => [
'active' => true,
],
'condition' => [
'show_description' => 'yes'
]
]
);
$this->add_control(
'show_icon',
[
'label' => __('Show Icon', 'wpr-addons'),
'type' => Controls_Manager::SWITCHER,
'label_on' => __('Show', 'wpr-addons'),
'label_off' => __('Hide', 'wpr-addons'),
'return_value' => 'yes',
'default' => 'yes',
'separator' => 'before'
]
);
$this->add_control(
'feature_list_icon',
[
'label' => esc_html__('Select Icon', 'wpr-addons'),
'type' => Controls_Manager::ICONS,
'skin' => 'inline',
'label_block' => false,
'default' => [
'value' => 'fas fa-rocket',
'library' => 'solid',
],
'condition' => [
'show_icon' => 'yes'
]
]
);
$this->end_controls_section();
// Section: Request New Feature
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
$this->start_controls_section(
'primary_heading_styles',
[
'label' => esc_html__('Primary Heading', 'wpr-addons'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'primary_heading_bg_color',
'label' => esc_html__( 'Background', 'wpr-addons' ),
'types' => [ 'classic', 'gradient' ],
'exclude' => ['image'],
'fields_options' => [
'color' => [
'default' => '#434900',
],
],
'selector' => '{{WRAPPER}} .wpr-dual-title .first'
]
);
$this->add_control(
'primary_heading_color',
[
'label' => __('Text Color', 'wpr-addons'),
'type' => Controls_Manager::COLOR,
'default' => '#7B7B7B',
'selectors' => [
'{{WRAPPER}} .wpr-dual-title .first' => 'color: {{VALUE}}',
]
]
);
$this->add_control(
'primary_heading_border_color',
[
'label' => __('Border Color', 'wpr-addons'),
'type' => Controls_Manager::COLOR,
'default' => '#000',
'selectors' => [
'{{WRAPPER}} .wpr-dual-title .first' => 'border-color: {{VALUE}}',
]
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'primary_heading_typography',
'label' => __('Typography', 'wpr-addons'),
'selector' => '{{WRAPPER}} .wpr-dual-title .first',
'fields_options' => [
'typography' => [
'default' => 'custom',
],
'font_weight' => [
'default' => '300',
],
'font_family' => [
'default' => 'Roboto',
],
'font_size' => [
'default' => [
'size' => '32',
'unit' => 'px',
]
]
]
]
);
$this->add_responsive_control(
'primary_heading_padding',
[
'label' => esc_html__( 'Padding', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'default' => [
'top' => '',
'right' => '',
'bottom' => '',
'left' => '',
],
'selectors' => [
'{{WRAPPER}} .wpr-dual-title .first' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before'
]
);
$this->add_control(
'primary_heading_border_type',
[
'label' => esc_html__( 'Border Type', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'none' => esc_html__( 'None', 'wpr-addons' ),
'solid' => esc_html__( 'Solid', 'wpr-addons' ),
'double' => esc_html__( 'Double', 'wpr-addons' ),
'dotted' => esc_html__( 'Dotted', 'wpr-addons' ),
'dashed' => esc_html__( 'Dashed', 'wpr-addons' ),
'groove' => esc_html__( 'Groove', 'wpr-addons' ),
],
'default' => 'none',
'selectors' => [
'{{WRAPPER}} .wpr-dual-title .first' => 'border-style: {{VALUE}};'
],
'separator' => 'before'
]
);
$this->add_control(
'primary_heading_border_width',
[
'label' => esc_html__( 'Border Width', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'default' => [
'top' => 1,
'right' => 1,
'bottom' => 1,
'left' => 1,
],
'selectors' => [
'{{WRAPPER}} .wpr-dual-title .first' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
],
'condition' => [
'primary_heading_border_type!' => 'none',
]
]
);
$this->add_control(
'primary_heading_radius',
[
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%' ],
'default' => [
'top' => '',
'right' => '',
'bottom' => '',
'left' => '',
],
'selectors' => [
'{{WRAPPER}} .wpr-dual-title .first' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
]
]
);
$this->add_responsive_control(
'feature_list_title_distance',
[
'label' => esc_html__( 'Distance', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 15,
],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .wpr-dual-title-wrap' => 'margin-bottom: {{SIZE}}px;',
],
'separator' => 'before'
]
);
$this->add_responsive_control(
'feature_list_title_gutter',
[
'label' => esc_html__( 'Gutter', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 0,
],
'range' => [
'px' => [
'min' => 0,
'max' => 25,
],
],
'selectors' => [
'{{WRAPPER}} .wpr-dual-title .first' => 'margin-right: {{SIZE}}px;',
]
]
);
$this->end_controls_section();
$this->start_controls_section(
'secondary_heading_styles',
[
'label' => esc_html__('Secondary Heading', 'wpr-addons'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'secondary_heading_bg_color',
'label' => esc_html__( 'Background', 'wpr-addons' ),
'types' => [ 'classic', 'gradient' ],
'exclude' => ['image'],
'fields_options' => [
'color' => [
'default' => '#434900',
],
],
'selector' => '{{WRAPPER}} .wpr-dual-title .second'
]
);
$this->add_control(
'secondary_heading_color',
[
'label' => __('Text Color', 'wpr-addons'),
'type' => Controls_Manager::COLOR,
'default' => '#9E5BE5',
'selectors' => [
'{{WRAPPER}} .wpr-dual-title .second' => 'color: {{VALUE}}',
]
]
);
$this->add_control(
'secondary_heading_border_color',
[
'label' => __('Border Color', 'wpr-addons'),
'type' => Controls_Manager::COLOR,
'default' => '#000',
'selectors' => [
'{{WRAPPER}} .wpr-dual-title .second' => 'border-color: {{VALUE}}',
]
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'secondary_heading_typography',
'label' => __('Typography', 'wpr-addons'),
'selector' => '{{WRAPPER}} .wpr-dual-title .second',
'fields_options' => [
'typography' => [
'default' => 'custom',
],
'font_weight' => [
'default' => '600',
],
'font_family' => [
'default' => 'Roboto',
],
'font_size' => [
'default' => [
'size' => '32',
'unit' => 'px',
]
]
]
]
);
$this->add_responsive_control(
'secondary_heading_padding',
[
'label' => esc_html__( 'Padding', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'default' => [
'top' => '',
'right' => '',
'bottom' => '',
'left' => '',
],
'selectors' => [
'{{WRAPPER}} .wpr-dual-title .second' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before'
]
);
$this->add_control(
'secondary_heading_border_type',
[
'label' => esc_html__( 'Border Type', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'none' => esc_html__( 'None', 'wpr-addons' ),
'solid' => esc_html__( 'Solid', 'wpr-addons' ),
'double' => esc_html__( 'Double', 'wpr-addons' ),
'dotted' => esc_html__( 'Dotted', 'wpr-addons' ),
'dashed' => esc_html__( 'Dashed', 'wpr-addons' ),
'groove' => esc_html__( 'Groove', 'wpr-addons' ),
],
'default' => 'none',
'selectors' => [
'{{WRAPPER}} .wpr-dual-title .second' => 'border-style: {{VALUE}};'
],
'separator' => 'before'
]
);
$this->add_control(
'secondary_heading_border_width',
[
'label' => esc_html__( 'Border Width', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'default' => [
'top' => 1,
'right' => 1,
'bottom' => 1,
'left' => 1,
],
'selectors' => [
'{{WRAPPER}} .wpr-dual-title .second' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
],
'condition' => [
'secondary_heading_border_type!' => 'none',
]
]
);
$this->add_control(
'secondary_heading_radius',
[
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%' ],
'default' => [
'top' => '',
'right' => '',
'bottom' => '',
'left' => '',
],
'selectors' => [
'{{WRAPPER}} .wpr-dual-title .second' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
]
]
);
$this->end_controls_section();
$this->start_controls_section(
'general_styles_description',
[
'label' => esc_html__('Description', 'wpr-addons'),
'tab' => Controls_Manager::TAB_STYLE,
'condition' => [
'show_description' => 'yes'
]
]
);
$this->add_control(
'description_color',
[
'label' => __('Color', 'wpr-addons'),
'type' => Controls_Manager::COLOR,
'default' => '#989898',
'selectors' => [
'{{WRAPPER}} .wpr-dual-heading-description' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'description_typography',
'label' => __('Typography', 'wpr-addons'),
'selector' => '{{WRAPPER}} .wpr-dual-heading-description',
'fields_options' => [
'typography' => [
'default' => 'custom',
],
'font_weight' => [
'default' => '400',
],
'font_family' => [
'default' => 'Roboto',
],
'font_size' => [
'default' => [
'size' => '14',
'unit' => 'px',
]
]
]
]
);
$this->add_responsive_control(
'feature_list_description_distance',
[
'label' => esc_html__( 'Distance', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 15,
],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .wpr-dual-heading-description' => 'margin-bottom: {{SIZE}}px;',
]
]
);
$this->end_controls_section();
$this->start_controls_section(
'general_styles_icon',
[
'label' => esc_html__('Icon', 'wpr-addons'),
'tab' => Controls_Manager::TAB_STYLE,
'condition' => [
'show_icon' => 'yes'
]
]
);
$this->add_control(
'icon_color',
[
'label' => __('Color', 'wpr-addons'),
'type' => Controls_Manager::COLOR,
'default' => '#605BE5',
'selectors' => [
'{{WRAPPER}} .wpr-dual-heading-icon-wrap' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpr-dual-heading-icon-wrap svg' => 'fill: {{VALUE}}',
]
]
);
$this->add_responsive_control(
'icon_size',
[
'label' => esc_html__('Size', 'wpr-addons'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'size' => 35,
'unit' => 'px'
],
'selectors' => [
'{{WRAPPER}} .wpr-dual-heading-icon-wrap' => 'font-size: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-dual-heading-icon-wrap svg' => 'width: {{SIZE}}{{UNIT}};'
],
'separator' => 'before'
]
);
$this->add_responsive_control(
'feature_list_icon_distance',
[
'label' => esc_html__( 'Distance', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 10,
],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .wpr-dual-heading-icon-wrap' => 'margin-bottom: {{SIZE}}px;',
]
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
$this->add_inline_editing_attributes('title', 'none');
$this->add_inline_editing_attributes('description', 'basic');
$this->add_inline_editing_attributes('content', 'advanced');
$tags_whitelist = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'span', 'p'];
$dual_heading_tag = $settings['dual_heading_tag'];
if ( !in_array( $dual_heading_tag, $tags_whitelist ) ) {
$dual_heading_tag = 'h2';
}
?>
<div class="wpr-dual-heading-wrap">
<div class="wpr-dual-title-wrap">
<<?php echo esc_attr($dual_heading_tag); ?> class="wpr-dual-title">
<?php if (!empty($settings['primary_heading'])) : ?>
<span class="first"><?php echo esc_html($settings['primary_heading']); ?></span>
<?php endif; ?>
<?php if (!empty($settings['secondary_heading'])) : ?>
<span class="second"><?php echo esc_html($settings['secondary_heading']); ?></span>
<?php endif; ?>
</<?php echo esc_attr($dual_heading_tag); ?>>
</div>
<?php if ('yes' == $settings['show_description']) { ?>
<div class="wpr-dual-heading-description" <?php echo $this->get_render_attribute_string('description'); ?>><?php echo esc_html($settings['description']); ?></div>
<?php } ?>
<?php if ('yes' == $settings['show_icon']) { ?>
<div class="wpr-dual-heading-icon-wrap">
<?php \Elementor\Icons_Manager::render_icon($settings['feature_list_icon'], ['aria-hidden' => 'true']); ?>
</div>
<?php } ?>
</div>
<?php
}
}
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\ElementorTemplate;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_widgets() {
return [
'Wpr_Elementor_Template',
];
}
public function get_name() {
return 'wpr-elementor-template';
}
}
@@ -0,0 +1,97 @@
<?php
namespace WprAddons\Modules\ElementorTemplate\Widgets;
use Elementor\Controls_Manager;
use Elementor\Widget_Base;
use WprAddons\Classes\Utilities;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Wpr_Elementor_Template extends Widget_Base {
public function get_name() {
return 'wpr-elementor-template';
}
public function get_title() {
return esc_html__( 'Template', 'wpr-addons' );
}
public function get_icon() {
return 'wpr-icon eicon-document-file';
}
public function get_categories() {
return [ 'wpr-widgets'];
}
public function get_keywords() {
return [ 'royal', 'elementor', 'template', 'load' ];
}
public function has_widget_inner_wrapper(): bool {
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
}
public function get_custom_help_url() {
if ( empty(get_option('wpr_wl_plugin_links')) )
// return 'https://royal-elementor-addons.com/contact/?ref=rea-plugin-panel-elementor-template-help-btn';
return 'https://wordpress.org/support/plugin/royal-elementor-addons/';
}
protected function register_controls() {
// Section: General ----------
$this->start_controls_section(
'section_general',
[
'label' => esc_html__( 'General', 'wpr-addons' ),
]
);
$this->add_control(
'select_template' ,
[
'label' => esc_html__( 'Select Template', 'wpr-addons' ),
'type' => 'wpr-ajax-select2',
'options' => 'ajaxselect2/get_elementor_templates',
'label_block' => true,
]
);
// Restore original Post Data
wp_reset_postdata();
$this->end_controls_section(); // End Controls Section
// Section: Request New Feature
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
}
protected function render() {
// Get Settings
$settings = $this->get_settings();
if ( '' !== $settings['select_template'] ) {
$id = $settings['select_template'];
if ( defined('ICL_LANGUAGE_CODE') ) {
$default_language_code = apply_filters('wpml_default_language', null);
if ( ICL_LANGUAGE_CODE !== $default_language_code ) {
$id = icl_object_id($id, 'elementor_library', false, ICL_LANGUAGE_CODE);
}
}
$edit_link = '<span class="wpr-template-edit-btn" data-permalink="'. esc_url(get_permalink($id)) .'">Edit Template</span>';
$type = get_post_meta(get_the_ID(), '_wpr_template_type', true) || get_post_meta($id, '_elementor_template_type', true);
$has_css = 'internal' === get_option( 'elementor_css_print_method' ) || '' !== $type;
echo \Elementor\Plugin::instance()->frontend->get_builder_content_for_display( $id, $has_css ) . $edit_link; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
}
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\FacebookFeed;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-facebook-feed';
}
public function get_widgets() {
return [
'Wpr_Facebook_Feed', // This should match the widget/element class.
];
}
}
@@ -0,0 +1,118 @@
<?php
namespace WprAddons\Modules\FacebookFeed\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Group_Control_Text_Shadow;
use Elementor\Group_Control_Background;
use Elementor\Group_Control_Typography;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
use Elementor\Repeater;
use Elementor\Group_Control_Image_Size;
use WprAddons\Classes\Utilities;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Wpr_Facebook_Feed extends Widget_Base {
public function get_name() {
return 'wpr-facebook-feed';
}
public function get_title() {
return esc_html__( 'Facebook Feed', 'wpr-addons' );
}
public function get_icon() {
return 'wpr-icon eicon-facebook';
}
public function get_categories() {
return [ 'wpr-widgets'];
}
public function get_keywords() {
return [ 'royal', 'facebook feed' ];
}
public function has_widget_inner_wrapper(): bool {
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
}
public function get_custom_help_url() {
if ( empty(get_option('wpr_wl_plugin_links')) )
// return 'https://royal-elementor-addons.com/contact/?ref=rea-plugin-panel-grid-help-btn';
return 'https://wordpress.org/support/plugin/royal-elementor-addons/';
}
protected function register_controls() {
// Tab: Content ==============
// Section: General ------------
$this->start_controls_section(
'section_general',
[
'label' => esc_html__( 'General', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
Utilities::wpr_library_buttons( $this, Controls_Manager::RAW_HTML );
$this->add_control(
'instagram_login',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => '<form onsubmit="connectInstagramInit(this);" action="javascript:void(0); class="wpr-facebook-login elementor-button" data-type="reviews"><input type="submit" value="Log in with Facebook" style="background-color: #3b5998; color: #fff;"></form>',
'label_block' => true,
]
);
}
protected function render() {
$settings = $this->get_settings_for_display();
// // Start Posts
// // Set the access token
// $access_token = "YOUR_ACCESS_TOKEN";
// // Make a GET request to the Facebook Graph API using Wordpress HTTP API
// $response = wp_remote_get( "https://graph.facebook.com/v7.0/PAGE_ID/posts?access_token=$access_token" );
// // Check for errors
// if ( is_wp_error( $response ) ) {
// echo 'Error: ' . $response->get_error_message();
// exit;
// }
// // Decode the response
// $response = json_decode( wp_remote_retrieve_body( $response ), true );
// // Iterate over each post
// foreach ( $response['data'] as $post ) {
// // Display the post on the profile
// echo "<div class='post'>".$post['message']."</div>";
// }
// // End posts
echo '<div class="wpr-facebook-feed">';
echo '<a target="_blank" class="wpr-login-to-facebook" href="https://www.facebook.com/v13.0/dialog/oauth?client_id=1184287221975469&redirect_uri=https://reastats.kinsta.cloud/token/social-network-fb.php">Log In</a>';
?>
<div
class="fb-like"
data-share="true"
data-width="450"
data-show-faces="true">
</div>
<?php
echo '<div>';
}
}
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\FeatureList;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_widgets() {
return [
'Wpr_Feature_List',
];
}
public function get_name() {
return 'wpr-feature-list';
}
}
@@ -0,0 +1,943 @@
<?php
namespace WprAddons\Modules\FeatureList\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Utils;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Group_Control_Text_Shadow;
use Elementor\Group_Control_Background;
use Elementor\Group_Control_Typography;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
use Elementor\Repeater;
use Elementor\Group_Control_Image_Size;
use WprAddons\Classes\Utilities;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Wpr_Feature_List extends Widget_Base {
public function get_name() {
return 'wpr-feature-list';
}
public function get_title() {
return esc_html__( 'Feature List', 'wpr-addons' );
}
public function get_icon() {
return 'wpr-icon eicon-editor-list-ul';
}
public function get_categories() {
return [ 'wpr-widgets'];
}
public function get_keywords() {
return [ 'royal', 'features', 'feature list', 'icon list' ];
}
public function has_widget_inner_wrapper(): bool {
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
}
public function get_custom_help_url() {
if ( empty(get_option('wpr_wl_plugin_links')) )
// return 'https://royal-elementor-addons.com/contact/?ref=rea-plugin-panel-grid-help-btn';
return 'https://wordpress.org/support/plugin/royal-elementor-addons/';
}
protected function register_controls() {
// Tab: Content ==============
// Section: General ----------
$this->start_controls_section(
'section_feature_list_general',
[
'label' => esc_html__( 'General', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
Utilities::wpr_library_buttons( $this, Controls_Manager::RAW_HTML );
$this->add_responsive_control(
'list_layout',
[
'label' => esc_html__( 'Layout', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'label_block' => false,
'default' => 'left',
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'wpr-addons' ),
'icon' => 'eicon-h-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'wpr-addons' ),
'icon' => 'eicon-h-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'wpr-addons' ),
'icon' => 'eicon-h-align-right',
]
],
'prefix_class' => 'wpr-feature-list-',
'render_type' => 'template',
'selectors' => [
'{{WRAPPER}} .wpr-feature-list-item' => 'justify-content: {{VALUE}}',
],
'separator' => 'before',
]
);
$this->add_control(
'icon_vertical_align',
[
'label' => esc_html__( 'Vertical Align', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'label_block' => false,
'default' => 'center',
'options' => [
'flex-start' => [
'title' => esc_html__( 'Top', 'wpr-addons' ),
'icon' => 'eicon-v-align-top',
],
'center' => [
'title' => esc_html__( 'Middle', 'wpr-addons' ),
'icon' => 'eicon-v-align-middle',
],
'flex-end' => [
'title' => esc_html__( 'Bottom', 'wpr-addons' ),
'icon' => 'eicon-v-align-bottom',
]
],
'render_type' => 'template',
'selectors' => [
'{{WRAPPER}}.wpr-feature-list-left .wpr-feature-list-item' => 'align-items: {{VALUE}}',
'{{WRAPPER}}.wpr-feature-list-right .wpr-feature-list-item' => 'align-items: {{VALUE}}'
],
'condition' => [
'list_layout!' => 'center',
]
]
);
$this->add_control(
'feature_list_content_alignment',
[
'label' => esc_html__( 'Alignment', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'flex-start' => [
'title' => esc_html__( 'Left', 'wpr-addons' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'wpr-addons' ),
'icon' => 'eicon-text-align-center',
],
'flex-end' => [
'title' => esc_html__( 'Right', 'wpr-addons' ),
'icon' => 'eicon-text-align-right',
]
],
'prefix_class' => 'wpr-feature-list-align-',
'render_type' => 'template',
'default' => 'center',
'selectors' => [
'{{WRAPPER}} .wpr-feature-list-item' => 'align-items: {{VALUE}};',
],
'condition' => [
'list_layout' => 'center',
]
]
);
$this->add_control(
'feature_list_icon_shape',
[
'label' => esc_html__( 'Icon Shape', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'default' => 'square',
'label_block' => false,
'options' => [
'square' => esc_html__( 'Square', 'wpr-addons' ),
'rhombus' => esc_html__( 'Rhombus', 'wpr-addons' )
],
'separator' => 'before',
'prefix_class' => 'wpr-feature-list-'
]
);
$this->add_group_control(
\Elementor\Group_Control_Image_Size::get_type(),
[
'name' => 'thumbnail',
'exclude' => [ 'custom' ],
'include' => [],
'default' => 'large',
]
);
$this->add_control(
'feature_list_title_tag',
[
'label' => esc_html__( 'Title HTML Tag', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'h1' => 'H1',
'h2' => 'H2',
'h3' => 'H3',
'h4' => 'H4',
'h5' => 'H5',
'h6' => 'H6',
'div' => 'div',
'span' => 'span',
'p' => 'p'
],
'default' => 'h2'
]
);
$this->add_control(
'feature_list_line',
[
'label' => esc_html__( 'Show Line', 'wpr-addons' ),
'type' => Controls_Manager::SWITCHER,
'render_type' => 'template',
'prefix_class' => 'wpr-feature-list-line-',
'separator' => 'before',
'default' => 'yes',
'condition' => [
'list_layout' => ['left', 'right']
]
]
);
$this->add_responsive_control(
'list_item_spacing_v',
[
'label' => esc_html__( 'Vertical Spacing', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 35,
],
'selectors' => [
'{{WRAPPER}} .wpr-feature-list-item:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}};',
],
'render_type' => 'template',
'separator' => 'before'
]
);
$this->add_responsive_control(
'list_item_spacing_h',
[
'label' => esc_html__( 'Horizontal Spacing', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 20,
],
'selectors' => [
'{{WRAPPER}}.wpr-feature-list-left .wpr-feature-list-icon-wrap' => 'margin-right: {{SIZE}}{{UNIT}};',
'{{WRAPPER}}.wpr-feature-list-right .wpr-feature-list-icon-wrap' => 'margin-left: {{SIZE}}{{UNIT}};',
],
'condition' => [
'list_layout!' => 'center'
]
]
);
$this->add_responsive_control(
'list_item_title_distance',
[
'label' => esc_html__( 'Title Distance', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 5,
],
'selectors' => [
'{{WRAPPER}} .wpr-feature-list-title' => 'margin-bottom: {{SIZE}}{{UNIT}};',
],
'render_type' => 'template'
]
);
$this->add_control(
'list_item_media_distance',
[
'label' => esc_html__( 'Media Distance', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 0,
],
'selectors' => [
'{{WRAPPER}} .wpr-feature-list-icon-wrap' => 'margin-bottom: {{SIZE}}{{UNIT}};',
],
'condition' => [
'list_layout' => 'center'
]
]
);
$this->end_controls_section();
// Tab: Content ==============
// Section: Content ----------
$this->start_controls_section(
'content_section',
[
'label' => esc_html__( 'Content', 'wpr-addons' ),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
]
);
$repeater = new \Elementor\Repeater();
$repeater->start_controls_tabs(
'list_tabs'
);
$repeater->start_controls_tab(
'content_tab',
[
'label' => __( 'Content', 'wpr-addons' ),
]
);
$repeater->add_control(
'feature_list_media_type',
[
'label' => esc_html__( 'Media Type', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'icon' => esc_html__( 'Icon', 'wpr-addons' ),
'image' => esc_html__( 'Image', 'wpr-addons' )
],
'default' => 'icon',
'label_block' => false,
]
);
$repeater->add_control(
'list_icon',
[
'label' => esc_html__( 'Select Icon', 'wpr-addons' ),
'type' => \Elementor\Controls_Manager::ICONS,
'default' => [
'value' => 'fas fa-star',
'library' => 'solid',
],
'label_block' => false,
'skin' => 'inline',
'condition' => [
'feature_list_media_type' => 'icon'
]
]
);
$repeater->add_control(
'list_image',
[
'label' => esc_html__( 'Choose Image', 'plugin-name' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'skin' => 'inline',
'dynamic' => [
'active' => true,
],
'condition' => [
'feature_list_media_type' => 'image'
]
]
);
$repeater->add_control(
'list_title', [
'label' => esc_html__( 'Title', 'wpr-addons' ),
'type' => \Elementor\Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'default' => esc_html__( 'List Title' , 'wpr-addons' ),
'separator' => 'before',
'label_block' => true,
]
);
$repeater->add_control(
'list_title_url',
[
'label' => esc_html__( 'Title Link', 'wpr-addons' ),
'type' => \Elementor\Controls_Manager::URL,
'dynamic' => [
'active' => true,
],
'placeholder' => esc_html__( 'https://your-link.com', 'wpr-addons' ),
'default' => [
'url' => '',
'is_external' => true,
'nofollow' => true,
'custom_attributes' => '',
],
'label_block' => true,
]
);
$repeater->add_control(
'list_content',
[
'label' => esc_html__( 'Content', 'wpr-addons' ),
'type' => \Elementor\Controls_Manager::TEXTAREA,
'dynamic' => [
'active' => true,
],
'default' => esc_html__( 'List Content', 'wpr-addons' ),
'placeholder' => esc_html__( 'Type your description here', 'wpr-addons' ),
'rows' => 10,
]
);
$repeater->end_controls_tab();
$repeater->start_controls_tab(
'styles_tab',
[
'label' => __( 'Style', 'wpr-addons' ),
]
);
$repeater->add_control(
'feature_list_custom_styles',
[
'label' => esc_html__( 'Custom Styles', 'wpr-addons' ),
'type' => Controls_Manager::SWITCHER,
]
);
$repeater->add_control(
'feature_list_title_color_unique',
[
'label' => esc_html__( 'Title Color', 'wpr-addons' ),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} {{CURRENT_ITEM}} .wpr-feature-list-title a.wpr-feature-list-url' => 'color: {{VALUE}}',
'{{WRAPPER}} {{CURRENT_ITEM}} .wpr-feature-list-title' => 'color: {{VALUE}}'
],
'condition' => [
'feature_list_custom_styles' => 'yes'
]
]
);
$repeater->add_control(
'feature_list_icon_color_unique',
[
'label' => esc_html__( 'Icon Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#ffffff',
'selectors' => [
'{{WRAPPER}} {{CURRENT_ITEM}} .wpr-feature-list-icon-inner-wrap i' => 'color: {{VALUE}}',
'{{WRAPPER}} {{CURRENT_ITEM}} .wpr-feature-list-icon-inner-wrap svg' => 'fill: {{VALUE}}',
],
'condition' => [
'feature_list_custom_styles' => 'yes'
]
]
);
$repeater->add_control(
'feature_list_icon_wrapper_bg_color_unique',
[
'label' => esc_html__( 'Icon Bg Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#966CE6',
'selectors' => [
'{{WRAPPER}} {{CURRENT_ITEM}} .wpr-feature-list-icon-inner-wrap' => 'background-color: {{VALUE}}',
],
'condition' => [
'feature_list_custom_styles' => 'yes'
]
]
);
$repeater->add_control(
'feature_list_icon_wrapper_border_color_unique',
[
'label' => esc_html__( 'Icon Border Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#6A65FF',
'selectors' => [
'{{WRAPPER}} {{CURRENT_ITEM}} .wpr-feature-list-icon-inner-wrap' => 'border-color: {{VALUE}}',
],
'condition' => [
'feature_list_custom_styles' => 'yes'
]
]
);
$repeater->end_controls_tab();
$repeater->end_controls_tabs();
$this->add_control(
'list',
[
'label' => esc_html__( 'Repeater List', 'wpr-addons' ),
'type' => \Elementor\Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [
[
'list_title' => esc_html__( 'Feature List', 'wpr-addons' ),
'list_content' => esc_html__( 'Add multiple feature items, set different icons or images for each feature and also give custom links if needed.', 'wpr-addons' ),
'list_icon' => [
'value' => 'fas fa-rocket',
'library' => 'solid'
],
],
[
'list_title' => esc_html__( 'Key Features', 'wpr-addons' ),
'list_content' => esc_html__( 'Choose your style from three different layouts and two unique icon background shapes.', 'wpr-addons' ),
'list_icon' => [
'value' => 'far fa-flag',
'library' => 'solid'
],
'feature_list_custom_styles' => 'yes',
'feature_list_icon_wrapper_bg_color_unique' => '#966CE6'
],
[
'list_title' => esc_html__( 'Connector Line', 'wpr-addons' ),
'list_content' => esc_html__( 'Show a connector line between each icon, changes its color and style to fit your unique design. ', 'wpr-addons' ),
'list_icon' => [
'value' => 'fas fa-grip-lines-vertical',
'library' => 'solid'
],
],
[
'list_title' => esc_html__( 'Custom Styles', 'wpr-addons' ),
'list_content' => esc_html__( 'Easily customize every aspect of your list from widget styles but also you can give custom colors to each item as well.', 'wpr-addons' ),
'list_icon' => [
'value' => 'fas fa-paint-brush',
'library' => 'solid'
],
],
],
'title_field' => '{{{ list_title }}}',
]
);
$this->end_controls_section();
// Section: Request New Feature
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
// Tab: STYLE ==============
// Section: Icon ----------
$this->start_controls_section(
'section_feature_list_icon_styles',
[
'label' => esc_html__( 'Media', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'feature_list_icon_color',
[
'label' => esc_html__( 'Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#FFF',
'selectors' => [
'{{WRAPPER}} .wpr-feature-list-icon-inner-wrap i' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpr-feature-list-icon-inner-wrap svg' => 'fill: {{VALUE}}',
],
]
);
$this->add_control(
'feature_list_icon_wrapper_bg_color',
[
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#6A65FF',
'selectors' => [
'{{WRAPPER}} .wpr-feature-list-icon-inner-wrap' => 'background-color: {{VALUE}}',
],
]
);
$this->add_control(
'feature_list_icon_wrapper_border_color',
[
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .wpr-feature-list-icon-inner-wrap' => 'border-color: {{VALUE}}',
],
]
);
$this->add_responsive_control(
'feature_list_icon_size',
[
'label' => esc_html__( 'Icon Size', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 5,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 25,
],
'selectors' => [
'{{WRAPPER}} .wpr-feature-list-icon-wrap i' => 'font-size: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-feature-list-icon-wrap svg' => 'width: {{SIZE}}{{UNIT}}; height: auto;',
],
'separator' => 'before',
]
);
$this->add_responsive_control(
'feature_list_icon_wrapper_size',
[
'label' => esc_html__( 'Box Size', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'render_type' => 'template',
'range' => [
'px' => [
'min' => 5,
'max' => 200,
],
],
'default' => [
'unit' => 'px',
'size' => 75,
],
'selectors' => [
'{{WRAPPER}} .wpr-feature-list-icon-inner-wrap' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}'
]
]
);
$this->add_control(
'feature_list_icon_wrapper_border_type',
[
'label' => esc_html__( 'Border Type', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'none' => esc_html__( 'None', 'wpr-addons' ),
'solid' => esc_html__( 'Solid', 'wpr-addons' ),
'double' => esc_html__( 'Double', 'wpr-addons' ),
'dotted' => esc_html__( 'Dotted', 'wpr-addons' ),
'dashed' => esc_html__( 'Dashed', 'wpr-addons' ),
'groove' => esc_html__( 'Groove', 'wpr-addons' ),
],
'default' => 'none',
'selectors' => [
'{{WRAPPER}} .wpr-feature-list-icon-inner-wrap' => 'border-style: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->add_control(
'feature_list_icon_wrapper_border_width',
[
'label' => esc_html__( 'Border Width', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'default' => [
'top' => 1,
'right' => 1,
'bottom' => 1,
'left' => 1,
],
'selectors' => [
'{{WRAPPER}} .wpr-feature-list-icon-inner-wrap' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'feature_list_icon_wrapper_border_type!' => 'none',
]
]
);
$this->add_control(
'feature_list_icon_wrapper_border_radius',
[
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'default' => [
'top' => 5,
'right' => 5,
'bottom' => 5,
'left' => 5,
],
'selectors' => [
'{{WRAPPER}} .wpr-feature-list-icon-inner-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
]
]
);
$this->end_controls_section();
// Tab: STYLE ==============
// Section: Line ----------
$this->start_controls_section(
'section_feature_list_line_styles',
[
'label' => esc_html__( 'Line', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
'condition' => [
'feature_list_line' => 'yes'
]
]
);
$this->add_control(
'feature_list_line_color',
[
'label' => esc_html__( 'Color', 'wpr-addons' ),
'type' => \Elementor\Controls_Manager::COLOR,
'default' => '#6A65FF',
'selectors' => [
// '{{WRAPPER}} .wpr-feature-list-icon-wrap::before' => 'border-color: {{VALUE}}',
'{{WRAPPER}} .wpr-feature-list-line' => 'border-color: {{VALUE}}'
],
]
);
$this->add_control(
'feature_list_line_width',
[
'label' => esc_html__( 'Width', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 1,
'max' => 10,
],
],
'default' => [
'unit' => 'px',
'size' => 2,
],
'selectors' => [
// '{{WRAPPER}} .wpr-feature-list-icon-wrap::before' => 'border-width: {{SIZE}}{{UNIT}}; height: calc({{feature_list_icon_wrapper_size.SIZE}}px + {{list_item_spacing_v.SIZE}}px + {{list_item_title_distance.SIZE}}px)',
'{{WRAPPER}} .wpr-feature-list-line' => 'border-left-width: {{SIZE}}{{UNIT}};',
],
'separator' => 'before'
]
);
$this->add_control(
'feature_list_line_border_type',
[
'label' => esc_html__( 'Type', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'default' => 'solid',
'label_block' => false,
'options' => [
'solid' => esc_html__( 'Solid', 'wpr-addons' ),
'dashed' => esc_html__( 'Dashed', 'wpr-addons' ),
'dotted' => esc_html__( 'Dotted', 'wpr-addons' ),
],
'selectors' => [
// '{{WRAPPER}} .wpr-feature-list-icon-wrap::before' => 'border-style: {{VALUE}};',
'{{WRAPPER}} .wpr-feature-list-line' => 'border-left-style: {{VALUE}};',
]
]
);
$this->end_controls_section();
// Tab: STYLE ==============
// Section: Title & Description ----------
$this->start_controls_section(
'section_feature_list_title_&_description_styles',
[
'label' => esc_html__( 'Title & Description', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'title_heading',
[
'label' => esc_html__( 'Title', 'wpr-addons' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before'
]
);
$this->add_control(
'feature_list_title_color',
[
'label' => esc_html__( 'Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#000',
'selectors' => [
'{{WRAPPER}} .wpr-feature-list-title' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpr-feature-list-title a.wpr-feature-list-url' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'feature_list_title',
'selector' => '{{WRAPPER}} .wpr-feature-list-title',
'fields_options' => [
'typography' => [
'default' => 'custom',
],
'font_weight' => [
'default' => '500',
],
'font_family' => [
'default' => 'Roboto',
],
'font_size' => [
'default' => [
'size' => '20',
'unit' => 'px',
]
]
]
]
);
$this->add_control(
'description_heading',
[
'label' => esc_html__( 'Description', 'wpr-addons' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before'
]
);
$this->add_control(
'feature_list_description_color',
[
'label' => esc_html__( 'Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#6E6B6B',
'selectors' => [
'{{WRAPPER}} .wpr-feature-list-description' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'feature_list_description',
'selector' => '{{WRAPPER}} .wpr-feature-list-description',
'fields_options' => [
'typography' => [
'default' => 'custom',
],
'font_weight' => [
'default' => '400',
],
'font_family' => [
'default' => 'Roboto',
],
'font_size' => [
'default' => [
'size' => '14',
'unit' => 'px',
]
]
]
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
if ( $settings['list'] ) {
$tags_whitelist = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'span', 'p'];
$feature_list_title_tag = Utilities::validate_html_tags_wl( $settings['feature_list_title_tag'], 'h2', $tags_whitelist );
$count_items = 0;
echo '<div class="wpr-feature-list-wrap">';
echo '<ul class="wpr-feature-list">';
foreach ( $settings['list'] as $item ) {
$this->add_link_attributes( 'list_title_url'. $count_items, $item['list_title_url'] );
echo '<li class="wpr-feature-list-item elementor-repeater-item-' . esc_attr( $item['_id'] ) .'">';
echo '<div class="wpr-feature-list-icon-wrap">';
echo '<span class="wpr-feature-list-line"></span>';
echo '<div class="wpr-feature-list-icon-inner-wrap">';
if ( 'icon' === $item['feature_list_media_type'] ) {
\Elementor\Icons_Manager::render_icon( $item['list_icon'], [ 'aria-hidden' => 'true' ] );
} else {
$src = \Elementor\Group_Control_Image_Size::get_attachment_image_src( $item['list_image']['id'], 'thumbnail', $settings );
echo '<img src="'. esc_url($src) .'">';
}
echo '</div>';
echo '</div>';
echo '<div class="wpr-feature-list-content-wrap">';
if ( empty($item['list_title_url']) ) {
echo '<'. esc_attr($feature_list_title_tag) .' class="wpr-feature-list-title">'. wp_kses_post($item['list_title']) .'</'. esc_attr($feature_list_title_tag) .'>';
} else {
echo '<'. esc_attr($feature_list_title_tag) .' class="wpr-feature-list-title"><a class="wpr-feature-list-url" '. $this->get_render_attribute_string( 'list_title_url'. $count_items ) .'>'. wp_kses_post($item['list_title']) .'</a></'. esc_attr($feature_list_title_tag) .'>';
}
echo '<p class="wpr-feature-list-description">'. wp_kses_post($item['list_content']) .'</p>';
echo '</div>';
echo '</li>';
$count_items++;
}
echo '</ul>';
echo '</div>';
}
}
}
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\FlipBox;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_widgets() {
return [
'Wpr_Flip_Box',
];
}
public function get_name() {
return 'wpr-flip-box';
}
}
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\FlipCarousel;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-flip-carousel';
}
public function get_widgets() {
return [
'Wpr_Flip_Carousel', // This should match the widget/element class.
];
}
}
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\FormBuilder;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-form-builder';
}
public function get_widgets() {
return [
'Wpr_Form_Builder', // This should match the widget/element class.
];
}
}
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\Forms;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-forms';
}
public function get_widgets() {
return [
'Wpr_Forms', // This should match the widget/element class.
];
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\GoogleMaps;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-google-maps';
}
public function get_widgets() {
return [
'Wpr_Google_Maps', // This should match the widget/element class.
];
}
}
@@ -0,0 +1,804 @@
<?php
namespace WprAddons\Modules\GoogleMaps\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Repeater;
use Elementor\Group_Control_Text_Shadow;
use Elementor\Group_Control_Typography;
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use WprAddons\Classes\Utilities;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Wpr_Google_Maps extends Widget_Base {
public function get_name() {
return 'wpr-google-maps';
}
public function get_title() {
return esc_html__( 'Google Maps', 'wpr-addons' );
}
public function get_icon() {
return 'wpr-icon eicon-google-maps';
}
public function get_categories() {
return [ 'wpr-widgets'];
}
public function get_keywords() {
return [ 'royal', 'google maps', 'location', 'gmap', 'cluster' ];
}
public function has_widget_inner_wrapper(): bool {
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
}
public function get_script_depends() {
return [ 'wpr-google-maps', 'wpr-google-maps-clusters' ];
}
public function get_custom_help_url() {
if ( empty(get_option('wpr_wl_plugin_links')) )
// return 'https://royal-elementor-addons.com/contact/?ref=rea-plugin-panel-google-maps-help-btn';
return 'https://wordpress.org/support/plugin/royal-elementor-addons/';
}
protected function register_controls() {
// Tab: Content ==============
// Section: General ----------
$this->start_controls_section(
'section_google_map_general',
[
'label' => esc_html__( 'General', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
Utilities::wpr_library_buttons( $this, Controls_Manager::RAW_HTML );
if ( '' == get_option('wpr_google_map_api_key') ) {
$this->add_control(
'gm_api_notice',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => sprintf( __( 'Please enter <strong>Google Map API Key</strong> from <br><a href="%s" target="_blank">Dashboard > %s > Settings</a> tab to get this widget working.', 'wpr-addons' ), admin_url( 'admin.php?page=wpr-addons&tab=wpr_tab_settings' ), Utilities::get_plugin_name() ),
'separator' => 'after',
'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
]
);
}
$this->add_control(
'gm_integration',
[
'label' => esc_html__( 'Map Integration', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'api_key' => esc_html__( 'API Key', 'wpr-addons' ),
'without_api_key' => esc_html__( 'Without API Key', 'wpr-addons' )
],
'default' => 'api_key',
'render_type' => 'template',
]
);
$this->add_control(
'gm_latitude',
[
'label' => esc_html__( 'Latitude', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'default' => '40.782864',
'dynamic' => [
'active' => true,
],
'condition' => [
'gm_integration' => 'without_api_key',
]
]
);
$this->add_control(
'gm_longtitude',
[
'label' => esc_html__( 'Longtitude', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'default' => '-73.965355',
'dynamic' => [
'active' => true,
],
'condition' => [
'gm_integration' => 'without_api_key',
]
]
);
$this->add_control(
'gm_location_title',
[
'label' => esc_html__( 'Location Title', 'wpr-addons' ),
'description' => esc_html__( 'Enter a location name or address to display the map. For example: "Central Park, New York, USA". (Works if long/lat Fields Empty)', 'wpr-addons' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'default' => 'Central Park, New York, USA',
'dynamic' => [
'active' => true,
],
'condition' => [
'gm_integration' => 'without_api_key',
]
]
);
$this->add_control(
'gm_type',
[
'label' => esc_html__( 'Select Map Type', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'roadmap' => esc_html__( 'Road Map', 'wpr-addons' ),
'satellite' => esc_html__( 'Satellite', 'wpr-addons' ),
'hybrid' => esc_html__( 'Hybrid', 'wpr-addons' ),
'terrain' => esc_html__( 'Terrain', 'wpr-addons' ),
],
'default' => 'roadmap',
'condition' => [
'gm_integration' => 'api_key',
],
]
);
$this->add_control(
'gm_color_scheme',
[
'label' => esc_html__( 'Color Scheme', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'default' => esc_html__( 'Default', 'wpr-addons' ),
'simple' => esc_html__( 'Simple', 'wpr-addons' ),
'white-black' => esc_html__( 'White Black', 'wpr-addons' ),
'light-silver' => esc_html__( 'Light Silver', 'wpr-addons' ),
'light-grayscale' => esc_html__( 'Light Grayscale', 'wpr-addons' ),
'subtle-grayscale' => esc_html__( 'Subtle Grayscale', 'wpr-addons' ),
'mostly-white' => esc_html__( 'Mostly White', 'wpr-addons' ),
'mostly-green' => esc_html__( 'Mostly Green', 'wpr-addons' ),
'neutral-blue' => esc_html__( 'Neutral Blue', 'wpr-addons' ),
'blue-water' => esc_html__( 'Blue Water', 'wpr-addons' ),
'blue-essense' => esc_html__( 'Blue Essense', 'wpr-addons' ),
'golden-brown' => esc_html__( 'Golden Brown', 'wpr-addons' ),
'midnight-commander' => esc_html__( 'Midnight Commander', 'wpr-addons' ),
'shades-of-grey' => esc_html__( 'Shades of Grey', 'wpr-addons' ),
'yellow-black' => esc_html__( 'Yellow Black', 'wpr-addons' ),
'custom' => esc_html__( 'Custom', 'wpr-addons' ),
],
'default' => 'default',
'condition' => [
'gm_integration' => 'api_key',
'gm_type!' => 'satellite',
]
]
);
$this->add_control(
'gm_custom_color_scheme',
[
'label' => esc_html__( 'Custom Style', 'wpr-addons' ),
'description' => __( 'Get custom map style code from <a href="https://snazzymaps.com/explore" target="_blank">Snazzy Maps</a> or <a href="https://mapstyle.withgoogle.com/" target="_blank">GM Styling Wizard</a> and copy/paste in this field.', 'wpr-addons' ),
'type' => Controls_Manager::TEXTAREA,
'dynamic' => [
'active' => true,
],
'condition' => [
'gm_integration' => 'api_key',
'gm_color_scheme' => 'custom',
]
]
);
$this->add_responsive_control(
'gm_height',
[
'label' => esc_html__( 'Map Height', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 500,
],
'range' => [
'px' => [
'min' => 100,
'max' => 1000,
],
],
'selectors' => [
'{{WRAPPER}} .wpr-google-map' => 'height: {{SIZE}}px;',
],
'frontend_available' => true,
'render_type' => 'template',
'separator' => 'before'
]
);
$this->add_control(
'gm_zoom_depth',
[
'label' => esc_html__( 'Zoom Depth', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 10,
],
'range' => [
'px' => [
'min' => 1,
'max' => 20,
],
],
'frontend_available' => true,
'render_type' => 'template',
]
);
$this->add_control(
'gm_zoom_on_scroll',
[
'label' => esc_html__( 'Disable Zoom on Scroll', 'wpr-addons' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'return_value' => 'cooperative',
'separator' => 'before',
'condition' => [
'gm_integration' => 'api_key',
]
]
);
$this->add_control(
'gm_cluster_markers',
[
'label' => esc_html__( 'Cluster Markers', 'wpr-addons' ),
'description' => esc_html__( 'Combine markers of close proximity into clusters, and simplify the display of markers on the map.', 'wpr-addons' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'condition' => [
'gm_integration' => 'api_key',
]
]
);
$this->end_controls_section(); // End Controls Section
// Tab: Content ==============
// Section: Locations --------
$this->start_controls_section(
'section_google_map_locations',
[
'label' => esc_html__( 'Locations', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_CONTENT,
'condition' => [
'gm_integration' => 'api_key',
]
]
);
$this->add_control(
'gm_location_helper',
[
'type' => \Elementor\Controls_Manager::RAW_HTML,
'raw' => '<a href="https://www.latlong.net/" target="_blank">'. esc_html__( 'Click Here', 'wpr-addons' ) .'</a> '. esc_html__( 'to find Coordinates of your location.', 'wpr-addons' ),
'separator' => 'after'
]
);
$repeater = new Repeater();
$repeater->add_control(
'gm_latitude',
[
'label' => esc_html__( 'Latitude', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
]
);
$repeater->add_control(
'gm_longtitude',
[
'label' => esc_html__( 'Longtitude', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
]
);
$repeater->add_control(
'gm_show_info_window',
[
'label' => esc_html__( 'Show Info Window', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'none' => esc_html__( 'None', 'wpr-addons' ),
'load' => esc_html__( 'on Load', 'wpr-addons' ),
'click' => esc_html__( 'on Click', 'wpr-addons' ),
],
'default' => 'load',
'separator' => 'before'
]
);
$repeater->add_control(
'gm_location_title',
[
'label' => esc_html__( 'Location Title', 'wpr-addons' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'condition' => [
'gm_show_info_window!' => 'none',
]
]
);
$repeater->add_control(
'gm_location_description',
[
'label' => esc_html__( 'Location Description', 'wpr-addons' ),
'type' => Controls_Manager::TEXTAREA,
'dynamic' => [
'active' => true,
],
'condition' => [
'gm_show_info_window!' => 'none',
]
]
);
$repeater->add_control(
'gm_info_window_width',
[
'label' => esc_html__( 'Info Window Width', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 300,
],
'range' => [
'px' => [
'min' => 50,
'max' => 500,
],
],
'condition' => [
'gm_show_info_window!' => 'none',
]
]
);
$repeater->add_control(
'gm_marker_animation',
[
'label' => esc_html__( 'Marker Animation', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'none' => esc_html__( 'None', 'wpr-addons' ),
'DROP' => esc_html__( 'Drop', 'wpr-addons' ),
'BOUNCE' => esc_html__( 'Bounce', 'wpr-addons' ),
],
'default' => 'none',
'separator' => 'before'
]
);
$repeater->add_control(
'gm_custom_marker',
[
'label' => esc_html__( 'Use Custom Marker', 'wpr-addons' ),
'type' => Controls_Manager::SWITCHER,
'separator' => 'before'
]
);
$repeater->add_control(
'gm_marker_icon',
[
'label' => esc_html__( 'Upload Marker Icon', 'wpr-addons' ),
'type' => Controls_Manager::MEDIA,
'dynamic' => [
'active' => true,
],
'condition' => [
'gm_custom_marker' => 'yes',
]
]
);
$repeater->add_control(
'gm_marker_icon_size_width',
[
'label' => esc_html__( 'Marker Icon Size Width', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 35,
],
'range' => [
'px' => [
'min' => 10,
'max' => 150,
],
],
'condition' => [
'gm_custom_marker' => 'yes',
]
]
);
$repeater->add_control(
'gm_marker_icon_size_height',
[
'label' => esc_html__( 'Marker Icon Size Height', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 35,
],
'range' => [
'px' => [
'min' => 10,
'max' => 150,
],
],
'condition' => [
'gm_custom_marker' => 'yes',
]
]
);
$this->add_control(
'google_map_locations',
[
'type' => Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [
[
'gm_location_title' => 'Central Park, New York, USA',
'gm_latitude' => '40.782864',
'gm_longtitude' => '-73.965355',
],
],
'title_field' => '{{{ gm_location_title }}}',
]
);
$this->end_controls_section(); // End Controls Section
// Tab: Content ==============
// Section: Controls ---------
$this->start_controls_section(
'section_google_map_controls',
[
'label' => esc_html__( 'Controls', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_CONTENT,
'condition' => [
'gm_integration' => 'api_key',
]
]
);
$this->add_control(
'gm_controls_map_type',
[
'label' => esc_html__( 'Show Map Type Control', 'wpr-addons' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes'
]
);
$this->add_control(
'gm_controls_fullscreen',
[
'label' => esc_html__( 'Show FullScreen Control', 'wpr-addons' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes'
]
);
$this->add_control(
'gm_controls_zoom',
[
'label' => esc_html__( 'Show Zoom Control', 'wpr-addons' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes'
]
);
$this->add_control(
'gm_controls_street_view',
[
'label' => esc_html__( 'Show Street View Control', 'wpr-addons' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes'
]
);
$this->end_controls_section(); // End Controls Section
// Section: Request New Feature
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
// Styles ====================
// Section: Info Window ------
$this->start_controls_section(
'section_style_info_window',
[
'label' => esc_html__( 'Info Window', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
'show_label' => false,
'condition' => [
'gm_integration' => 'api_key',
]
]
);
$this->add_control(
'infow_window_align',
[
'label' => esc_html__( 'Alignment', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'wpr-addons' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'wpr-addons' ),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'wpr-addons' ),
'icon' => 'eicon-text-align-right',
],
'justify' => [
'title' => esc_html__( 'Justified', 'wpr-addons' ),
'icon' => 'eicon-text-align-justify',
],
],
'default' => 'center',
'selectors' => [
'{{WRAPPER}} .wpr-google-map .gm-style-iw-c' => 'text-align: {{VALUE}}',
],
'separator' => 'after',
]
);
$this->add_control(
'infow_window_title_color',
[
'label' => esc_html__( 'Title Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpr-google-map .gm-style-iw-c .wpr-gm-iwindow h3' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'infow_window_description_color',
[
'label' => esc_html__( 'Description Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpr-google-map .gm-style-iw-c .wpr-gm-iwindow p' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'infow_window_background_color',
[
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpr-google-map .gm-style-iw-d' => 'background-color: {{VALUE}}',
'{{WRAPPER}} .wpr-google-map .gm-style .gm-style-iw-c' => 'background-color: {{VALUE}}',
'{{WRAPPER}} .wpr-google-map .gm-style-iw-t:after' => 'background: {{VALUE}}',
'{{WRAPPER}} .wpr-google-map .gm-style-iw-tc:after' => 'background: {{VALUE}}'
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'infow_window_title_typography',
'label' => esc_html__( 'Title Typography', 'wpr-addons' ),
'selector' => '{{WRAPPER}} .wpr-google-map .gm-style-iw-c .wpr-gm-iwindow h3'
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'infow_window_desc_typography',
'label' => esc_html__( 'Description Typography', 'wpr-addons' ),
'selector' => '{{WRAPPER}} .wpr-google-map .gm-style-iw-c .wpr-gm-iwindow p'
]
);
$this->add_responsive_control(
'infow_window_padding',
[
'label' => esc_html__( 'Padding', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'default' => [
'top' => 15,
'right' => 15,
'bottom' => 15,
'left' => 15,
],
'selectors' => [
'{{WRAPPER}} .wpr-google-map .gm-style-iw-c .wpr-gm-iwindow' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_control(
'infow_window_radius',
[
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'default' => [
'top' => 5,
'right' => 5,
'bottom' => 5,
'left' => 5,
],
'selectors' => [
'{{WRAPPER}} .wpr-google-map .gm-style-iw-c' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'map_radius',
[
'label' => esc_html__( 'Map Border Radius', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'default' => [
'top' => 0,
'right' => 0,
'bottom' => 0,
'left' => 0,
],
'selectors' => [
'{{WRAPPER}} .wpr-google-map' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'infow_window_distance',
[
'label' => esc_html__( 'Distance from Marker', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 10,
],
'range' => [
'px' => [
'min' => 0,
'max' => 30,
],
],
'selectors' => [
'{{WRAPPER}} .wpr-google-map .gm-style-iw-a' => 'transform: translateY(-{{SIZE}}px);',
],
'separator' => 'before'
]
);
$this->end_controls_section(); // End Controls Section
}
public function get_map_settings( $settings ) {
$map_settings = [
'type' => $settings['gm_type'],
'style' => $settings['gm_color_scheme'],
'zoom_depth' => $settings['gm_zoom_depth']['size'],
'zoom_on_scroll' => $settings['gm_zoom_on_scroll'],
'cluster_markers' => $settings['gm_cluster_markers'],
'clusters_url' => WPR_ADDONS_URL . 'assets/js/lib/gmap/clusters/m',
];
if ( !is_array($settings['gm_custom_color_scheme']) ) {
$map_settings['custom_style'] = preg_replace( '/\s/', '', strip_tags($settings['gm_custom_color_scheme']) );
}
return $map_settings;
}
public function get_map_controls( $settings ) {
return [
'type' => $settings['gm_controls_map_type'],
'fullscreen' => $settings['gm_controls_fullscreen'],
'zoom' => $settings['gm_controls_zoom'],
'streetview' => $settings['gm_controls_street_view'],
];
}
protected function render() {
// Get Settings
$settings = $this->get_settings();
if ( '' == get_option('wpr_google_map_api_key') && 'without_api_key' === $settings['gm_integration'] ) {
$latitude = $settings['gm_latitude'] ?? '';
$longitude = $settings['gm_longtitude'] ?? '';
$gm_location_title = $settings['gm_location_title'] ?? '';
$zoom = !empty($settings['gm_zoom_depth']['size']) ? intval($settings['gm_zoom_depth']['size']) : 14;
if ($latitude && $longitude) {
$map_src = "https://www.google.com/maps?q={$latitude},{$longitude}&z={$zoom}&output=embed";
} else {
$map_src = "https://www.google.com/maps?q=" . rawurlencode($gm_location_title) . "&z={$zoom}&output=embed";
}
echo '<div class="wpr-google-map" data-integration-type ="'. esc_attr($settings['gm_integration']) .'">';
echo '<iframe
src="' . esc_url($map_src) . '"
width="100%"
height="'. $settings['gm_height']['size'] .'"
style="border:0;"
allowfullscreen=""
loading="lazy"
referrerpolicy="no-referrer-when-downgrade">
</iframe>';
echo '</div>';
} else {
// Access and sanitize gm_location_title
$google_map_locations = $settings['google_map_locations'];
// Sanitize: Remove <img>, <script> tags and any attributes like onerror
$gm_location_title = $google_map_locations[0]['gm_location_title'];
$gm_location_title = preg_replace('/<\s*(img|script)[^>]*>/i', '', $gm_location_title); // Remove <img> and <script>
$gm_location_title = preg_replace('/\s*on\w+="[^"]*"/i', '', $gm_location_title); // Remove inline event handlers
// Final encode to escape any remaining HTML entities or unsafe characters
$gm_location_title = htmlspecialchars($gm_location_title, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
// Assign sanitized title back to location data
$google_map_locations[0]['gm_location_title'] = $gm_location_title;
// Encode data for output, ensuring JSON strings are sanitized and properly escaped
$map_settings = json_encode($this->get_map_settings($settings), JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT);
$map_locations = json_encode($google_map_locations, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT);
$map_controls = json_encode($this->get_map_controls($settings), JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT);
// Set sanitized attributes
$attributes = ' data-settings="'. esc_attr($map_settings) .'"';
$attributes .= ' data-locations="'. esc_attr($map_locations) .'"';
$attributes .= ' data-controls="'. esc_attr($map_controls) .'"';
// Output the sanitized HTML container
echo '<div class="wpr-google-map" '. $attributes .'></div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
// Additional admin notice for missing API key
if (current_user_can('manage_options') && 'api_key' === $settings['gm_integration'] && '' == get_option('wpr_google_map_api_key')) {
echo '<p class="wpr-api-key-missing">Please go to plugin <a href='. esc_url(admin_url( 'admin.php?page=wpr-addons&tab=wpr_tab_settings' )) .' target="_blank">Settings</a> and Insert Google Map API Key in order to make Google Maps work</p>';
}
}
}
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\Grid;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-grid';
}
public function get_widgets() {
return [
'Wpr_Grid', // This should match the widget/element class.
];
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\ImageAccordion;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-image-accordion';
}
public function get_widgets() {
return [
'Wpr_Image_Accordion', // This should match the widget/element class.
];
}
}
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\ImageHotspots;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_widgets() {
return [
'Wpr_Image_Hotspots',
];
}
public function get_name() {
return 'wpr-image-hotspots';
}
}
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\ImageScroll;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-image-scroll';
}
public function get_widgets() {
return [
'Wpr_Image_Scroll', // This should match the widget/element class.
];
}
}
@@ -0,0 +1,997 @@
<?php
namespace WprAddons\Modules\ImageScroll\Widgets;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
use Elementor\Group_Control_Background;
use Elementor\Group_Control_Image_Size;
use Elementor\Group_Control_Css_Filter;
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Repeater;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use Elementor\Widget_Base;
use Elementor\Utils;
use Elementor\Icons;
use WprAddons\Classes\Utilities;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Wpr_Image_Scroll extends Widget_Base {
public function get_name() {
return 'wpr-image-scroll';
}
public function get_title() {
return esc_html__( 'Image Scroll', 'wpr-addons' );
}
public function get_icon() {
return 'wpr-icon eicon-image-rollover';
}
public function get_categories() {
return [ 'wpr-widgets'];
}
public function get_keywords() {
return [ 'royal', 'image scroll' ];
}
public function has_widget_inner_wrapper(): bool {
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
}
public function get_custom_help_url() {
if ( empty(get_option('wpr_wl_plugin_links')) )
// return 'https://royal-elementor-addons.com/contact/?ref=rea-plugin-panel-image-scroll-help-btn';
return 'https://wordpress.org/support/plugin/royal-elementor-addons/';
}
public function is_reload_preview_required() {
return true;
}
protected function register_controls() {
// Image Section
$this->start_controls_section(
'section_image_scroll',
[
'label' => esc_html__('Settings', 'wpr-addons'),
]
);
$this->add_control(
'image',
[
'label' => esc_html__('Choose Image', 'wpr-addons'),
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => Utils::get_placeholder_image_src(),
],
]
);
$this->add_group_control(
Group_Control_Image_Size::get_type(),
[
'name' => 'image',
'default' => 'full',
]
);
$this->add_control(
'scroll_direction',
[
'label' => esc_html__('Direction', 'wpr-addons'),
'type' => Controls_Manager::SELECT,
'default' => 'vertical',
'options' => [
'vertical' => esc_html__('Vertical', 'wpr-addons'),
'horizontal' => esc_html__('Horizontal', 'wpr-addons'),
],
'render_type' => 'template',
'prefix_class' => 'wpr-scroll-',
]
);
$this->add_control(
'image_fit',
[
'label' => esc_html__('Image Fit', 'wpr-addons'),
'type' => Controls_Manager::SELECT,
'default' => 'cover',
'options' => [
'cover' => esc_html__('Cover', 'wpr-addons'),
'fill' => esc_html__('Contain', 'wpr-addons'),
'auto' => esc_html__('Auto', 'wpr-addons'),
],
'selectors' => [
'{{WRAPPER}} .wpr-image-scroll-wrap img' => 'object-fit: {{VALUE}};',
],
'condition' => [
'scroll_direction' => 'horizontal',
],
]
);
$this->add_control(
'image_position',
[
'label' => esc_html__('Image Position', 'wpr-addons'),
'type' => Controls_Manager::SELECT,
'default' => 'center center',
'options' => [
'top left' => esc_html__('Top Left', 'wpr-addons'),
'top center' => esc_html__('Top Center', 'wpr-addons'),
'top right' => esc_html__('Top Right', 'wpr-addons'),
'center left' => esc_html__('Center Left', 'wpr-addons'),
'center center' => esc_html__('Center Center', 'wpr-addons'),
'center right' => esc_html__('Center Right', 'wpr-addons'),
'bottom left' => esc_html__('Bottom Left', 'wpr-addons'),
'bottom center' => esc_html__('Bottom Center', 'wpr-addons'),
'bottom right' => esc_html__('Bottom Right', 'wpr-addons'),
],
'selectors' => [
'{{WRAPPER}} .wpr-image-scroll-wrap img' => 'object-position: {{VALUE}};',
],
'condition' => [
'scroll_direction' => 'horizontal',
'image_fit!' => 'auto',
],
]
);
// $this->end_controls_section();
// // Advanced Settings
// $this->start_controls_section(
// 'section_advanced_settings',
// [
// 'label' => esc_html__('Advanced Settings', 'wpr-addons'),
// ]
// );
$this->add_control(
'reverse_direction',
[
'label' => esc_html__('Reverse Direction', 'wpr-addons'),
'type' => Controls_Manager::SWITCHER,
'render_type' => 'template',
'separator' => 'before',
'prefix_class' => 'wpr-direction-',
]
);
$this->add_control(
'trigger_type',
[
'label' => esc_html__('Trigger', 'wpr-addons'),
'type' => Controls_Manager::SELECT,
'default' => 'hover',
'options' => [
'hover' => esc_html__('Hover', 'wpr-addons'),
'scroll' => esc_html__('Mouse Scroll', 'wpr-addons'),
],
'prefix_class' => 'wpr-trigger-',
]
);
$this->add_control(
'scroll_speed',
[
'label' => esc_html__('Animation Speed', 'wpr-addons'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0.1,
'max' => 5,
'step' => 0.1,
],
],
'default' => [
'unit' => 'px',
'size' => 2,
],
'separator' => 'before',
]
);
$this->add_responsive_control(
'height',
[
'label' => esc_html__('Height', 'wpr-addons'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', 'vh'],
'range' => [
'px' => [
'min' => 0,
'max' => 1000,
],
'vh' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 300,
],
'selectors' => [
'{{WRAPPER}} .wpr-image-scroll-wrap' => 'height: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'image_width',
[
'label' => esc_html__('Width', 'wpr-addons'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', '%', 'vw'],
'range' => [
'px' => [
'min' => 0,
'max' => 3000,
'step' => 5,
],
'%' => [
'min' => 100,
'max' => 300,
],
'vw' => [
'min' => 100,
'max' => 300,
],
],
'default' => [
'unit' => '%',
'size' => 200,
],
'selectors' => [
'{{WRAPPER}} .wpr-scroll-horizontal img' => 'width: {{SIZE}}{{UNIT}};',
],
'condition' => [
'scroll_direction' => 'horizontal',
],
]
);
$this->add_control(
'enable_mask',
[
'label' => esc_html__('Enable Mask', 'wpr-addons'),
'type' => Controls_Manager::SWITCHER,
'default' => 'no',
'separator' => 'before',
]
);
$this->add_control(
'mask_image',
[
'label' => esc_html__('Choose Mask Image', 'wpr-addons'),
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => '',
],
'selectors' => [
'{{WRAPPER}} .wpr-image-scroll-wrap' => '-webkit-mask-image: url({{URL}}); mask-image: url({{URL}}); -webkit-mask-position: center center; mask-position: center center; -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;',
],
'condition' => [
'enable_mask' => 'yes',
],
]
);
$this->add_control(
'mask_size',
[
'label' => esc_html__('Mask Size', 'wpr-addons'),
'type' => Controls_Manager::SELECT,
'default' => 'contain',
'options' => [
'auto' => esc_html__('Auto', 'wpr-addons'),
'contain' => esc_html__('Contain', 'wpr-addons'),
'cover' => esc_html__('Cover', 'wpr-addons'),
'custom' => esc_html__('Custom', 'wpr-addons'),
],
'selectors' => [
'{{WRAPPER}} .wpr-image-scroll-wrap' => '-webkit-mask-size: {{VALUE}}; mask-size: {{VALUE}};',
],
'condition' => [
'enable_mask' => 'yes',
'mask_image[url]!' => '',
],
]
);
$this->add_control(
'mask_position',
[
'label' => esc_html__('Mask Position', 'wpr-addons'),
'type' => Controls_Manager::SELECT,
'default' => 'center center',
'options' => [
'center center' => esc_html__('Center Center', 'wpr-addons'),
'center left' => esc_html__('Center Left', 'wpr-addons'),
'center right' => esc_html__('Center Right', 'wpr-addons'),
'top center' => esc_html__('Top Center', 'wpr-addons'),
'top left' => esc_html__('Top Left', 'wpr-addons'),
'top right' => esc_html__('Top Right', 'wpr-addons'),
'bottom center' => esc_html__('Bottom Center', 'wpr-addons'),
'bottom left' => esc_html__('Bottom Left', 'wpr-addons'),
'bottom right' => esc_html__('Bottom Right', 'wpr-addons'),
],
'selectors' => [
'{{WRAPPER}} .wpr-image-scroll-wrap' => '-webkit-mask-position: {{VALUE}}; mask-position: {{VALUE}};',
],
'condition' => [
'enable_mask' => 'yes',
'mask_image[url]!' => '',
],
]
);
$this->add_control(
'mask_repeat',
[
'label' => esc_html__('Mask Repeat', 'wpr-addons'),
'type' => Controls_Manager::SELECT,
'default' => 'no-repeat',
'options' => [
'no-repeat' => esc_html__('No-repeat', 'wpr-addons'),
'repeat' => esc_html__('Repeat', 'wpr-addons'),
'repeat-x' => esc_html__('Repeat-x', 'wpr-addons'),
'repeat-y' => esc_html__('Repeat-y', 'wpr-addons'),
],
'selectors' => [
'{{WRAPPER}} .wpr-image-scroll-wrap' => '-webkit-mask-repeat: {{VALUE}}; mask-repeat: {{VALUE}};',
],
'condition' => [
'enable_mask' => 'yes',
'mask_image[url]!' => '',
],
]
);
$this->add_responsive_control(
'mask_size_custom',
[
'label' => esc_html__('Custom Size', 'wpr-addons'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', '%', 'vw'],
'range' => [
'px' => [
'min' => 0,
'max' => 1000,
],
'%' => [
'min' => 0,
'max' => 100,
],
'vw' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'size' => 100,
'unit' => '%',
],
'selectors' => [
'{{WRAPPER}} .wpr-image-scroll-wrap' => '-webkit-mask-size: {{SIZE}}{{UNIT}}; mask-size: {{SIZE}}{{UNIT}};',
],
'condition' => [
'enable_mask' => 'yes',
'mask_image[url]!' => '',
'mask_size' => 'custom',
],
]
);
$this->add_control(
'enable_wrapper_link',
[
'label' => esc_html__('Enable Wrapper Link', 'wpr-addons'),
'type' => Controls_Manager::SWITCHER,
'default' => 'no',
'separator' => 'before',
]
);
$this->add_control(
'wrapper_link',
[
'label' => esc_html__('Link', 'wpr-addons'),
'type' => Controls_Manager::URL,
'dynamic' => [
'active' => true,
],
'placeholder' => esc_html__('https://your-link.com', 'wpr-addons'),
'condition' => [
'enable_wrapper_link' => 'yes',
],
]
);
$this->add_control(
'heading_icon',
[
'label' => esc_html__('Icon', 'wpr-addons'),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_control(
'show_icon',
[
'label' => esc_html__('Show Icon', 'wpr-addons'),
'type' => Controls_Manager::SWITCHER,
'default' => 'no',
]
);
$this->add_control(
'icon',
[
'label' => esc_html__('Select Icon', 'wpr-addons'),
'type' => Controls_Manager::ICONS,
'default' => [
'value' => 'fas fa-arrow-down',
'library' => 'fa-solid',
],
'condition' => [
'show_icon' => 'yes',
],
]
);
// Add icon style controls
$this->add_control(
'icon_color',
[
'label' => esc_html__('Color', 'wpr-addons'),
'type' => Controls_Manager::COLOR,
'default' => '#ffffff',
'selectors' => [
'{{WRAPPER}} .wpr-image-scroll-icon' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpr-image-scroll-icon svg' => 'fill: {{VALUE}}',
],
'condition' => [
'show_icon' => 'yes',
],
]
);
$this->add_responsive_control(
'icon_size',
[
'label' => esc_html__('Size', 'wpr-addons'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 5,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 25,
],
'selectors' => [
'{{WRAPPER}} .wpr-image-scroll-icon' => 'font-size: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-image-scroll-icon svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
],
'condition' => [
'show_icon' => 'yes',
],
]
);
$this->add_control(
'icon_animation',
[
'label' => esc_html__('Animation', 'wpr-addons'),
'type' => Controls_Manager::SELECT,
'default' => 'none',
'options' => [
'none' => esc_html__('None', 'wpr-addons'),
'horizontal' => esc_html__('Horizontal', 'wpr-addons'),
'vertical' => esc_html__('Vertical', 'wpr-addons'),
],
'condition' => [
'show_icon' => 'yes',
],
'prefix_class' => 'wpr-icon-animation-',
]
);
$this->add_control(
'icon_animation_duration',
[
'label' => esc_html__('Animation Duration', 'wpr-addons'),
'type' => Controls_Manager::NUMBER,
'default' => 2,
'min' => 0.1,
'max' => 10,
'step' => 0.1,
'condition' => [
'show_icon' => 'yes',
'icon_animation!' => 'none',
],
'selectors' => [
'{{WRAPPER}} .wpr-image-scroll-icon' => 'animation-duration: {{VALUE}}s; animation-iteration-count: infinite; animation-timing-function: ease-in-out;',
],
]
);
$this->add_control(
'heading_overlay',
[
'label' => esc_html__('Overlay', 'wpr-addons'),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_control(
'show_overlay',
[
'label' => esc_html__('Show Overlay', 'wpr-addons'),
'type' => Controls_Manager::SWITCHER,
'default' => 'no',
]
);
$this->add_control(
'transition_duration',
[
'label' => esc_html__('Transition Duration', 'wpr-addons'),
'type' => Controls_Manager::NUMBER,
'default' => 0.3,
'min' => 0.1,
'max' => 5,
'step' => 0.1,
'selectors' => [
'{{WRAPPER}} .wpr-image-scroll-wrap' => 'transition-duration: {{VALUE}}s;',
'{{WRAPPER}} .wpr-image-scroll-overlay' => 'transition-duration: {{VALUE}}s;',
'{{WRAPPER}} .wpr-image-scroll-overlay img' => 'transition-duration: {{VALUE}}s;',
'{{WRAPPER}} .wpr-image-scroll-icon' => 'transition-duration: {{VALUE}}s;',
'{{WRAPPER}} .wpr-image-scroll-icon-hidden' => 'transition-duration: {{VALUE}}s;'
],
'separator' => 'before',
]
);
$this->add_control(
'transition_timing',
[
'label' => esc_html__('Transition Timing', 'wpr-addons'),
'type' => Controls_Manager::SELECT,
'default' => 'ease',
'options' => [
'linear' => esc_html__('Linear', 'wpr-addons'),
'ease' => esc_html__('Ease', 'wpr-addons'),
'ease-in' => esc_html__('Ease In', 'wpr-addons'),
'ease-out' => esc_html__('Ease Out', 'wpr-addons'),
'ease-in-out' => esc_html__('Ease In Out', 'wpr-addons'),
],
'selectors' => [
'{{WRAPPER}} .wpr-image-scroll-wrap' => 'transition-timing-function: {{VALUE}};',
'{{WRAPPER}} .wpr-image-scroll-wrap img' => 'transition-timing-function: {{VALUE}};',
'{{WRAPPER}} .wpr-image-scroll-overlay' => 'transition-timing-function: {{VALUE}};',
'{{WRAPPER}} .wpr-image-scroll-icon' => 'transition-timing-function: {{VALUE}};',
'{{WRAPPER}} .wpr-image-scroll-icon-hidden' => 'transition-timing-function: {{VALUE}};'
],
]
);
$this->end_controls_section();
// Style Section
$this->start_controls_section(
'section_style',
[
'label' => esc_html__('Image', 'wpr-addons'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->start_controls_tabs('image_style_tabs');
$this->start_controls_tab(
'image_normal_tab',
[
'label' => esc_html__('Normal', 'wpr-addons'),
]
);
$this->add_control(
'image_opacity',
[
'label' => esc_html__('Opacity', 'wpr-addons'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'max' => 1,
'min' => 0,
'step' => 0.01,
],
],
'default' => [
'size' => 1,
],
'selectors' => [
'{{WRAPPER}} .wpr-image-scroll-wrap img' => 'opacity: {{SIZE}};',
],
]
);
$this->add_group_control(
Group_Control_Css_Filter::get_type(),
[
'name' => 'image_css_filters',
'selector' => '{{WRAPPER}} .wpr-image-scroll-wrap img',
]
);
$this->add_control(
'image_blend_mode',
[
'label' => esc_html__('Blend Mode', 'wpr-addons'),
'type' => Controls_Manager::SELECT,
'options' => [
'' => esc_html__('Normal', 'wpr-addons'),
'multiply' => 'Multiply',
'screen' => 'Screen',
'overlay' => 'Overlay',
'darken' => 'Darken',
'lighten' => 'Lighten',
'color-dodge' => 'Color Dodge',
'color-burn' => 'Color Burn',
'hard-light' => 'Hard Light',
'soft-light' => 'Soft Light',
'difference' => 'Difference',
'exclusion' => 'Exclusion',
'hue' => 'Hue',
'saturation' => 'Saturation',
'color' => 'Color',
'luminosity' => 'Luminosity',
],
'selectors' => [
'{{WRAPPER}} .wpr-image-scroll-wrap img' => 'mix-blend-mode: {{VALUE}};',
],
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'image_hover_tab',
[
'label' => esc_html__('Hover', 'wpr-addons'),
]
);
$this->add_control(
'image_opacity_hover',
[
'label' => esc_html__('Opacity', 'wpr-addons'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'max' => 1,
'min' => 0,
'step' => 0.01,
],
],
'default' => [
'size' => 1,
],
'selectors' => [
'{{WRAPPER}} .wpr-image-scroll-wrap:hover img' => 'opacity: {{SIZE}};',
],
]
);
$this->add_group_control(
Group_Control_Css_Filter::get_type(),
[
'name' => 'image_css_filters_hover',
'selector' => '{{WRAPPER}} .wpr-image-scroll-wrap:hover img',
]
);
$this->add_control(
'image_blend_mode_hover',
[
'label' => esc_html__('Blend Mode', 'wpr-addons'),
'type' => Controls_Manager::SELECT,
'options' => [
'' => esc_html__('Normal', 'wpr-addons'),
'multiply' => 'Multiply',
'screen' => 'Screen',
'overlay' => 'Overlay',
'darken' => 'Darken',
'lighten' => 'Lighten',
'color-dodge' => 'Color Dodge',
'color-burn' => 'Color Burn',
'hard-light' => 'Hard Light',
'soft-light' => 'Soft Light',
'difference' => 'Difference',
'exclusion' => 'Exclusion',
'hue' => 'Hue',
'saturation' => 'Saturation',
'color' => 'Color',
'luminosity' => 'Luminosity',
],
'selectors' => [
'{{WRAPPER}} .wpr-image-scroll-wrap:hover img' => 'mix-blend-mode: {{VALUE}};',
],
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->add_control(
'heading_wrapper_style',
[
'label' => esc_html__('Wrapper', 'wpr-addons'),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->start_controls_tabs( 'tab_style' );
$this->start_controls_tab(
'tab_normal_style',
[
'label' => esc_html__( 'Normal', 'wpr-addons' )
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'image_border',
'selector' => '{{WRAPPER}} .wpr-image-scroll-wrap'
]
);
$this->add_responsive_control(
'image_border_radius',
[
'label' => esc_html__('Border Radius', 'wpr-addons'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', '%'],
'selectors' => [
'{{WRAPPER}} .wpr-image-scroll-wrap' => '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}} .wpr-image-scroll-wrap',
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'tab_hover_style',
[
'label' => esc_html__( 'Hover', 'wpr-addons' )
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'image_border_hover',
'selector' => '{{WRAPPER}} .wpr-image-scroll-wrap:hover',
]
);
$this->add_responsive_control(
'image_border_radius_hover',
[
'label' => esc_html__('Border Radius', 'wpr-addons'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', '%'],
'selectors' => [
'{{WRAPPER}} .wpr-image-scroll-wrap:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'image_box_shadow_hover',
'selector' => '{{WRAPPER}} .wpr-image-scroll-wrap:hover',
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->add_control(
'heading_overlay_style',
[
'label' => esc_html__('Overlay', 'wpr-addons'),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
'condition' => [
'show_overlay' => 'yes',
],
]
);
$this->start_controls_tabs('overlay_style_tabs');
$this->start_controls_tab(
'overlay_normal_tab',
[
'label' => esc_html__('Normal', 'wpr-addons'),
'condition' => [
'show_overlay' => 'yes',
],
]
);
$this->add_control(
'overlay_color',
[
'label' => esc_html__('Background Color', 'wpr-addons'),
'type' => Controls_Manager::COLOR,
'default' => 'rgba(0, 0, 0, 0.3)',
'selectors' => [
'{{WRAPPER}} .wpr-image-scroll-overlay' => 'background-color: {{VALUE}}',
],
'condition' => [
'show_overlay' => 'yes',
],
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'overlay_hover_tab',
[
'label' => esc_html__('Hover', 'wpr-addons'),
'condition' => [
'show_overlay' => 'yes',
],
]
);
$this->add_control(
'overlay_color_hover',
[
'label' => esc_html__('Background Color', 'wpr-addons'),
'type' => Controls_Manager::COLOR,
'default' => 'rgba(0, 0, 0, 0.5)',
'selectors' => [
'{{WRAPPER}} .wpr-image-scroll-wrap:hover .wpr-image-scroll-overlay' => 'background-color: {{VALUE}}',
],
'condition' => [
'show_overlay' => 'yes',
],
]
);
$this->end_controls_tab();
$this->end_controls_tabs();// Add after your existing controls in register_controls()
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
if (empty($settings['image']['url'])) {
return;
}
$this->add_render_attribute('wrapper', 'class', [
'wpr-image-scroll-wrap',
'wpr-scroll-' . esc_attr($settings['scroll_direction']),
'wpr-trigger-' . esc_attr($settings['trigger_type']),
$settings['reverse_direction'] === 'yes' ? 'wpr-direction-reverse' : ''
]);
$this->add_render_attribute('wrapper', 'data-speed', floatval($settings['scroll_speed']['size']));
// Add link wrapper if enabled
if ('yes' === $settings['enable_wrapper_link'] && !empty($settings['wrapper_link']['url'])) {
$this->add_link_attributes('link', $settings['wrapper_link']);
$this->add_render_attribute('link', 'class', 'wpr-image-scroll-link');
}
?>
<?php if ('yes' === $settings['enable_wrapper_link'] && !empty($settings['wrapper_link']['url'])) : ?>
<a <?php echo $this->get_render_attribute_string('link'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Already escaped by Elementor ?>>
<?php endif; ?>
<div <?php echo $this->get_render_attribute_string('wrapper'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Already escaped by Elementor ?>>
<?php
// Image is handled by Elementor's Group_Control_Image_Size which includes security measures
echo Group_Control_Image_Size::get_attachment_image_html($settings); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Already escaped by Elementor
?>
<?php if ('yes' === $settings['show_overlay']) : ?>
<div class="wpr-image-scroll-overlay"></div>
<?php endif; ?>
<?php if ('yes' === $settings['show_icon']) : ?>
<div class="wpr-image-scroll-icon">
<?php
// Icons are handled by Elementor's Icons_Manager which includes security measures
\Elementor\Icons_Manager::render_icon($settings['icon'], ['aria-hidden' => 'true']); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Already escaped by Elementor
?>
</div>
<?php endif; ?>
</div>
<?php if ('yes' === $settings['enable_wrapper_link'] && !empty($settings['wrapper_link']['url'])) : ?>
</a>
<?php endif;
}
protected function content_template() {
?>
<# if ( settings.image.url ) {
var image = {
id: settings.image.id,
url: settings.image.url,
size: settings.image_size,
dimension: settings.image_custom_dimension,
model: view.getEditModel()
};
var image_url = elementor.imagesManager.getImageUrl( image );
var reverseClass = settings.reverse_direction === 'yes' ? 'wpr-direction-reverse' : '';
view.addRenderAttribute( 'wrapper', 'class', [
'wpr-image-scroll-wrap',
'wpr-scroll-' + settings.scroll_direction,
'wpr-trigger-' + settings.trigger_type,
reverseClass
]);
view.addRenderAttribute( 'wrapper', 'data-speed', settings.scroll_speed.size );
#>
<div {{{ view.getRenderAttributeString( 'wrapper' ) }}}>
<img src="{{ image_url }}" />
<# if ( settings.show_icon == 'yes' ) { #>
<div class="wpr-image-scroll-icon">
<# var iconHTML = elementor.helpers.renderIcon( view, settings.icon, { 'aria-hidden': true }, 'i', 'object' ); #>
{{{ iconHTML.value }}}
</div>
<# } #>
<# if ( settings.show_overlay == 'yes' ) { #>
<div class="wpr-image-scroll-overlay"></div>
<# } #>
</div>
<# } #>
<?php
}
}
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\InstagramFeed;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-instagram-feed';
}
public function get_widgets() {
return [
'Wpr_Instagram_Feed', // This should match the widget/element class.
];
}
}
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\Logo;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_widgets() {
return [
'Wpr_Logo',
];
}
public function get_name() {
return 'wpr-logo';
}
}
@@ -0,0 +1,713 @@
<?php
namespace WprAddons\Modules\Logo\Widgets;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
use Elementor\Group_Control_Background;
use Elementor\Group_Control_Image_Size;
use Elementor\Group_Control_Css_Filter;
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Repeater;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use Elementor\Widget_Base;
use Elementor\Utils;
use Elementor\Icons;
use WprAddons\Classes\Utilities;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Wpr_Logo extends Widget_Base {
public function get_name() {
return 'wpr-logo';
}
public function get_title() {
return esc_html__( 'Logo', 'wpr-addons' );
}
public function get_icon() {
return 'wpr-icon eicon-logo';
}
public function get_categories() {
return [ 'wpr-widgets'];
}
public function get_keywords() {
return [ 'royal', 'site logo', 'image' ];
}
public function has_widget_inner_wrapper(): bool {
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
}
public function get_custom_help_url() {
if ( empty(get_option('wpr_wl_plugin_links')) )
// return 'https://royal-elementor-addons.com/contact/?ref=rea-plugin-panel-logo-help-btn';
return 'https://wordpress.org/support/plugin/royal-elementor-addons/';
}
protected function register_controls() {
// Section: Logo -------------
$this->start_controls_section(
'section_general',
[
'label' => esc_html__( 'General', 'wpr-addons' ),
]
);
$this->add_control(
'image',
[
'label' => esc_html__( 'Image', 'wpr-addons' ),
'type' => Controls_Manager::MEDIA,
'dynamic' => [
'active' => true,
],
'default' => [
'url' => Utils::get_placeholder_image_src(),
],
]
);
$this->add_control(
'retina_image',
[
'label' => esc_html__( 'Retina Image', 'wpr-addons' ),
'type' => Controls_Manager::MEDIA,
'dynamic' => [
'active' => true,
]
]
);
$this->add_control(
'mobile_image',
[
'label' => esc_html__( 'Mobile Image', 'wpr-addons' ),
'type' => Controls_Manager::MEDIA,
'dynamic' => [
'active' => true,
]
]
);
$this->add_control(
'title_type',
[
'label' => esc_html__( 'Site Title', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'default' => 'custom',
'options' => [
'none' => esc_html__( 'None', 'wpr-addons' ),
'default' => esc_html__( 'Default', 'wpr-addons' ),
'custom' => esc_html__( 'Custom', 'wpr-addons' ),
],
'separator' => 'before',
]
);
$this->add_control(
'custom_title',
[
'label' => esc_html__( 'Title Text', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'default' => 'My Custom Logo',
'condition' => [
'title_type' => 'custom',
],
]
);
$this->add_control(
'description_type',
[
'label' => esc_html__( 'Tagline', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'default' => 'none',
'options' => [
'none' => esc_html__( 'None', 'wpr-addons' ),
'default' => esc_html__( 'Default', 'wpr-addons' ),
'custom' => esc_html__( 'Custom', 'wpr-addons' ),
],
'separator' => 'before',
]
);
$this->add_control(
'custom_description',
[
'label' => esc_html__( 'Tagline Text', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'default' => 'Tagline',
'condition' => [
'description_type' => 'custom',
],
]
);
$this->add_responsive_control(
'align',
[
'label' => esc_html__( 'Alignment', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'left',
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'wpr-addons' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'wpr-addons' ),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'wpr-addons' ),
'icon' => 'eicon-text-align-right',
],
],
'selectors' => [
'{{WRAPPER}}' => 'text-align: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->add_control(
'url_type',
[
'label' => esc_html__( 'Logo URL', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'default' => 'default',
'options' => [
'none' => esc_html__( 'None', 'wpr-addons' ),
'default' => esc_html__( 'Default', 'wpr-addons' ),
'custom' => esc_html__( 'Custom', 'wpr-addons' ),
],
]
);
$this->add_control(
'custom_url',
[
'type' => Controls_Manager::URL,
'dynamic' => [
'active' => true,
],
'placeholder' => esc_html__( 'https://www.your-link.com', 'wpr-addons' ),
'condition' => [
'url_type' => 'custom',
],
]
);
$this->add_control(
'remove_front_page_url',
[
'label' => esc_html__( 'Disable Link on Front Page', 'wpr-addons' ),
'type' => Controls_Manager::SWITCHER,
'condition' => [
'url_type!' => 'none',
],
]
);
$this->end_controls_section(); // End Controls Section
// Section: Request New Feature
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
// Styles
// Section: General ----------
$this->start_controls_section(
'section_style_general',
[
'label' => esc_html__( 'General', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'bg_color',
[
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpr-logo' => 'background-color: {{VALUE}};',
],
]
);
$this->add_responsive_control(
'padding',
[
'label' => esc_html__( 'Padding', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'default' => [
'top' => 0,
'right' => 0,
'bottom' => 0,
'left' => 0,
],
'size_units' => [ 'px', '%' ],
'selectors' => [
'{{WRAPPER}} .wpr-logo' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_control(
'image_section',
[
'label' => esc_html__( 'Image', 'wpr-addons' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_responsive_control(
'width',
[
'label' => esc_html__( 'Width', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 1,
'max' => 500,
],
],
'default' => [
'unit' => 'px',
'size' => 150,
],
'selectors' => [
'{{WRAPPER}} .wpr-logo-image' => 'max-width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'position',
[
'label' => esc_html__( 'Alignment', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'label_block' => false,
'default' => 'center',
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'wpr-addons' ),
'icon' => 'eicon-h-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'wpr-addons' ),
'icon' => 'eicon-h-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'wpr-addons' ),
'icon' => 'eicon-h-align-right',
]
],
'prefix_class' => 'wpr-logo-position-',
]
);
$this->add_responsive_control(
'image_distance',
[
'label' => esc_html__( 'Distance', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 50,
],
],
'default' => [
'unit' => 'px',
'size' => 0,
],
'selectors' => [
'{{WRAPPER}}.wpr-logo-position-left .wpr-logo-image' => 'margin-right:{{SIZE}}{{UNIT}};',
'{{WRAPPER}}.wpr-logo-position-right .wpr-logo-image' => 'margin-left:{{SIZE}}{{UNIT}};',
'{{WRAPPER}}.wpr-logo-position-center .wpr-logo-image' => 'margin-bottom:{{SIZE}}{{UNIT}};',
],
]
);
$this->start_controls_tabs( 'logo_img_effects' );
$this->start_controls_tab( 'normal',
[
'label' => esc_html__( 'Normal', 'wpr-addons' ),
]
);
$this->add_control(
'opacity',
[
'label' => esc_html__( 'Opacity', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'max' => 1,
'min' => 0.10,
'step' => 0.01,
],
],
'selectors' => [
'{{WRAPPER}} .wpr-logo-image img' => 'opacity: {{SIZE}};',
],
]
);
$this->add_group_control(
Group_Control_Css_Filter::get_type(),
[
'name' => 'css_filters',
'selector' => '{{WRAPPER}} .wpr-logo-image img',
]
);
$this->end_controls_tab();
$this->start_controls_tab( 'hover',
[
'label' => esc_html__( 'Hover', 'wpr-addons' ),
]
);
$this->add_control(
'opacity_hv',
[
'label' => esc_html__( 'Opacity', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'max' => 1,
'min' => 0.10,
'step' => 0.01,
],
],
'selectors' => [
'{{WRAPPER}} .wpr-logo:hover img' => 'opacity: {{SIZE}};',
],
]
);
$this->add_group_control(
Group_Control_Css_Filter::get_type(),
[
'name' => 'css_filters_hv',
'selector' => '{{WRAPPER}} .wpr-logo:hover img',
]
);
$this->add_control(
'bg_hv_duration',
[
'label' => esc_html__( 'Transition Duration', 'wpr-addons' ),
'type' => Controls_Manager::NUMBER,
'default' => 0.7,
'min' => 0,
'max' => 5,
'step' => 0.1,
'selectors' => [
'{{WRAPPER}} .wpr-logo-image img' => '-webkit-transition-duration: {{VALUE}}s;transition-duration: {{VALUE}}s',
],
]
);
$this->add_control(
'hv_animation',
[
'label' => esc_html__( 'Hover Animation', 'wpr-addons' ),
'type' => Controls_Manager::HOVER_ANIMATION,
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->add_control(
'title_section',
[
'label' => esc_html__( 'Site Title', 'wpr-addons' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_control(
'title_color',
[
'label' => esc_html__( 'Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#605BE5',
'selectors' => [
'{{WRAPPER}} .wpr-logo-title' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'title_typography',
'selector' => '{{WRAPPER}} .wpr-logo-title',
]
);
$this->add_responsive_control(
'title_distance',
[
'label' => esc_html__( 'Distance', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 50,
],
],
'default' => [
'unit' => 'px',
'size' => 0,
],
'selectors' => [
'{{WRAPPER}} .wpr-logo-title' => 'margin: 0 0 {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'description_section',
[
'label' => esc_html__( 'Tagline', 'wpr-addons' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_control(
'description_color',
[
'label' => esc_html__( 'Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#888888',
'selectors' => [
'{{WRAPPER}} .wpr-logo-description' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'description_typography',
'selector' => '{{WRAPPER}} .wpr-logo-description',
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'border',
'label' => esc_html__( 'Border', 'wpr-addons' ),
'fields_options' => [
'border' => [
'default' => 'solid',
],
'width' => [
'default' => [
'top' => '1',
'right' => '1',
'bottom' => '1',
'left' => '1',
'isLinked' => true,
],
],
'color' => [
'default' => '#E8E8E8',
],
],
'selector' => '{{WRAPPER}} .wpr-logo',
'separator' => 'before',
]
);
$this->add_responsive_control(
'border_radius',
[
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%' ],
'default' => [
'top' => 2,
'right' => 2,
'bottom' => 2,
'left' => 2,
],
'selectors' => [
'{{WRAPPER}} .wpr-logo' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'box_shadow',
'selector' => '{{WRAPPER}} .wpr-logo'
]
);
$this->end_controls_section(); // End Controls Section
}
public function logo_is_linked() {
$settings = $this->get_settings();
if ( 'none' === $settings['url_type'] ) {
return false;
}
if ( 'yes' === $settings['remove_front_page_url'] && is_front_page() ) {
return false;
}
return true;
}
protected function render() {
$settings = $this->get_settings();
$image_src = esc_url( $settings['image']['url'] );
$mobile_image_src = esc_url( $settings['mobile_image']['url'] );
// Title
$title = '';
if ( 'default' === $settings['title_type'] ) {
$title = get_bloginfo( 'name' );
} elseif ( 'custom' === $settings['title_type'] ) {
$title = $settings['custom_title'];
}
// Description
$description = '';
if ( 'default' === $settings['description_type'] ) {
$description = get_bloginfo( 'description' );
} elseif ( 'custom' === $settings['description_type'] ) {
$description = $settings['custom_description'];
}
// Retrieve Image Alt Text
$image_alt = '';
if ( ! empty( $image_src ) ) {
// Get the attachment ID from the image source URL
$attachment_id = attachment_url_to_postid( $image_src );
if ( $attachment_id ) {
$image_alt = get_post_meta( $attachment_id, '_wp_attachment_image_alt', true );
}
}
// Fallback to title if alt is empty
if ( empty( $image_alt ) ) {
$image_alt = $title;
}
// Image hover animation
$this->add_render_attribute( 'image_attr', 'class', 'wpr-logo-image' );
if ( $settings['hv_animation'] ) {
$this->add_render_attribute( 'image_attr', 'class', 'elementor-animation-'. $settings['hv_animation'] );
}
// Logo URL
$this->add_render_attribute( 'url_attr', 'class', 'wpr-logo-url' );
$this->add_render_attribute( 'url_attr', 'rel', 'home' );
$this->add_render_attribute( 'url_attr', 'aria-label', $image_alt );
if ( 'default' === $settings['url_type'] ) {
$this->add_render_attribute( 'url_attr', 'href', home_url( '/' ) );
} elseif ( 'custom' === $settings['url_type'] ) {
if ( $settings['custom_url']['is_external'] ) {
$this->add_render_attribute( 'url_attr', 'target', '_blank' );
}
if ( $settings['custom_url']['nofollow'] ) {
$this->add_render_attribute( 'url_attr', 'nofollow', '' );
}
$this->add_render_attribute( 'url_attr', 'href', esc_url( $settings['custom_url']['url'] ) );
}
?>
<div class="wpr-logo elementor-clearfix">
<?php if ( !empty( $image_src ) ) : ?>
<picture <?php echo $this->get_render_attribute_string( 'image_attr' ); ?>>
<?php if ( ! empty( $mobile_image_src ) ) : ?>
<source media="(max-width: 767px)" srcset="<?php echo esc_attr( $mobile_image_src ); ?>">
<?php endif; ?>
<?php if ( ! empty( $settings['retina_image']['url'] ) ) : ?>
<source srcset="<?php echo esc_attr( $image_src ); ?> 1x, <?php echo esc_attr( $settings['retina_image']['url'] ); ?> 2x">
<?php endif; ?>
<img src="<?php echo esc_url( $image_src ); ?>" alt="<?php echo esc_attr( $image_alt ); ?>">
<?php if ( $this->logo_is_linked() ) : ?>
<a <?php echo $this->get_render_attribute_string( 'url_attr' ); ?>></a>
<?php endif; ?>
</picture>
<?php endif; ?>
<?php if ( ! empty( $title ) || ! empty( $description ) ) : ?>
<div class="wpr-logo-text">
<?php if ( ! empty( $title ) ) : ?>
<?php if ( is_home() || is_front_page() ) : ?>
<h1 class="wpr-logo-title"><?php echo esc_html__( $title ); ?></h1>
<?php else : ?>
<p class="wpr-logo-title"><?php echo esc_html__( $title ); ?></p>
<?php endif; ?>
<?php endif; ?>
<?php
if ( ! empty( $description ) ) : ?>
<p class="wpr-logo-description"><?php echo esc_html__( $description ); ?></p>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ( $this->logo_is_linked() ) : ?>
<a <?php echo $this->get_render_attribute_string( 'url_attr' ); ?>></a>
<?php endif; ?>
</div>
<?php
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\LottieAnimations;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_widgets() {
return [
'Wpr_Lottie_Animations',
];
}
public function get_name() {
return 'wpr-lottie-animations';
}
}
@@ -0,0 +1,499 @@
<?php
namespace WprAddons\Modules\LottieAnimations\Widgets;
use Elementor\Controls_Manager;
use Elementor\Widget_Base;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Css_Filter;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Core\Base\Document;
use Elementor\Plugin;
use WprAddons\Classes\Utilities;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Wpr_Lottie_Animations extends Widget_Base {
public function get_name() {
return 'wpr-lottie-animations';
}
public function get_title() {
return esc_html__( 'Lottie Animations', 'wpr-addons' );
}
public function get_icon() {
return 'wpr-icon eicon-lottie';
}
public function get_categories() {
return [ 'wpr-widgets'];
}
public function get_keywords() {
return [ 'royal', 'lottie', 'animation', 'animations', 'svg' ];
}
public function has_widget_inner_wrapper(): bool {
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
}
public function get_script_depends() {
return [ 'wpr-lottie-animations' ];
}
public function get_custom_help_url() {
if ( empty(get_option('wpr_wl_plugin_links')) )
// return 'https://royal-elementor-addons.com/contact/?ref=rea-plugin-panel-lottie-animations-help-btn';
return 'https://wordpress.org/support/plugin/royal-elementor-addons/';
}
protected function register_controls() {
// Section: Settings ---------
$this->start_controls_section(
'section_settings',
[
'label' => esc_html__( 'Settings', 'wpr-addons' ),
]
);
Utilities::wpr_library_buttons( $this, Controls_Manager::RAW_HTML );
$this->add_control(
'source',
[
'label' => __( 'File Source', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'url' => __( 'External URL', 'wpr-addons' ),
'file' => __( 'Media File', 'wpr-addons' ),
],
'default' => 'url',
]
);
$this->add_control(
'json_url',
[
'label' => __( 'Animation JSON URL', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'default' => 'https://assets3.lottiefiles.com/packages/lf20_ghs9bkkc.json',
'description' => 'Get JSON code URL from <a href="https://lottiefiles.com/" target="_blank">here</a>',
'label_block' => true,
'condition' => [
'source' => 'url',
],
]
);
$this->add_control(
'json_file',
array(
'label' => __( 'Upload JSON File', 'wpr-addons' ),
'type' => Controls_Manager::MEDIA,
'media_type' => 'application/json',
'frontend_available' => true,
'condition' => [
'source' => 'file',
]
)
);
$this->add_control(
'autoplay',
[
'label' => esc_html__( 'Autoplay', 'wpr-addons' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'return_value' => 'yes',
'separator' => 'before',
]
);
$this->add_control(
'loop',
[
'label' => esc_html__( 'Loop', 'wpr-addons' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'return_value' => 'yes',
]
);
$this->add_control(
'reverse',
[
'label' => __( 'Reverse', 'wpr-addons' ),
'type' => Controls_Manager::SWITCHER,
'return_value' => 'true',
'condition' => [
'trigger!' => 'scroll'
]
]
);
$this->add_control(
'speed',
array(
'label' => __( 'Animation Speed', 'wpr-addons' ),
'type' => Controls_Manager::NUMBER,
'default' => 1,
'min' => 0.1,
'max' => 3,
'step' => 0.1,
)
);
$this->add_control(
'trigger',
[
'label' => __( 'Trigger', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'default' => 'none',
'options' => array(
'none' => __( 'None', 'wpr-addons' ),
'viewport' => __( 'Viewport', 'wpr-addons' ),
'hover' => __( 'Hover', 'wpr-addons' ),
'scroll' => __( 'Scroll', 'wpr-addons' ),
),
'frontend_available' => true,
]
);
$this->add_control(
'animate_view',
array(
'label' => __( 'Viewport', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'default' => array(
'sizes' => array(
'start' => 0,
'end' => 100,
),
'unit' => '%',
),
'labels' => array(
__( 'Bottom', 'wpr-addons' ),
__( 'Top', 'wpr-addons' ),
),
'scales' => 1,
'handles' => 'range',
'condition' => array(
'trigger' => array( 'scroll', 'viewport' ),
// 'lottie_reverse!' => 'true',
),
)
);
$this->add_responsive_control(
'animation_size',
array(
'label' => __( 'Size', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => array( 'px', '%' ),
'default' => array(
'unit' => '%',
'size' => 50,
),
'range' => array(
'px' => array(
'min' => 1,
'max' => 800,
),
'em' => array(
'min' => 1,
'max' => 30,
),
),
'render_type' => 'template',
'separator' => 'before',
'selectors' => array(
'{{WRAPPER}} .wpr-lottie-animations svg' => 'width: 100% !important; height: 100% !important;',
'{{WRAPPER}} .wpr-lottie-animations' => 'width: {{SIZE}}{{UNIT}} !important; height: {{SIZE}}{{UNIT}} !important;',
),
)
);
$this->add_responsive_control(
'rotate',
array(
'label' => __( 'Rotate (degrees)', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'description' => __( 'Set rotation value in degrees', 'wpr-addons' ),
'range' => array(
'px' => array(
'min' => -180,
'max' => 180,
),
),
'default' => array(
'size' => 0,
),
'selectors' => array(
'{{WRAPPER}} .wpr-lottie-animations' => 'transform: rotate({{SIZE}}deg)',
),
)
);
$this->add_responsive_control(
'animation_align',
array(
'label' => __( 'Alignment', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'options' => array(
'left' => array(
'title' => __( 'Left', 'wpr-addons' ),
'icon' => 'eicon-text-align-left',
),
'center' => array(
'title' => __( 'Center', 'wpr-addons' ),
'icon' => 'eicon-text-align-center',
),
'right' => array(
'title' => __( 'Right', 'wpr-addons' ),
'icon' => 'eicon-text-align-right',
),
),
'default' => 'center',
'toggle' => false,
'separator' => 'before',
'selectors' => array(
'{{WRAPPER}} .wpr-lottie-animations-wrapper' => 'display: flex; justify-content: {{VALUE}}; align-items: {{VALUE}};',
),
)
);
$this->add_control(
'lottie_renderer',
[
'label' => __( 'Render As', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => array(
'svg' => __( 'SVG', 'wpr-addons' ),
'canvas' => __( 'Canvas', 'wpr-addons' ),
),
'default' => 'svg',
'prefix_class' => 'wpr-lottie-',
'render_type' => 'template',
'separator' => 'before',
]
);
$this->add_control(
'render_notice',
[
'raw' => __( 'Set render type to canvas if you\'re having performance issues on the page.', 'premium-addons-for-elemeentor' ),
'type' => Controls_Manager::RAW_HTML,
'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
]
);
$this->add_control(
'link_switcher',
[
'label' => __( 'Wrapper Link', 'wpr-addons' ),
'type' => Controls_Manager::SWITCHER,
]
);
$this->add_control(
'link_selection',
[
'label' => __( 'Link Type', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => array(
'url' => __( 'URL', 'wpr-addons' ),
'link' => __( 'Existing Page', 'wpr-addons' ),
),
'default' => 'url',
'label_block' => true,
'condition' => array(
'link_switcher' => 'yes',
),
]
);
$this->add_control(
'link',
array(
'label' => __( 'Link', 'wpr-addons' ),
'type' => Controls_Manager::URL,
'dynamic' => [
'active' => true,
],
'default' => array(
'url' => '#',
),
'placeholder' => 'https://royal-elementor-addons.com/',
'label_block' => true,
'condition' => array(
'link_switcher' => 'yes',
'link_selection' => 'url',
),
)
);
$this->add_control(
'existing_link',
array(
'label' => __( 'Existing Page', 'wpr-addons' ),
'type' => 'wpr-ajax-select2',
'options' => 'ajaxselect2/get_posts_by_post_type',
'query_slug' => 'page',
'multiple' => false,
'label_block' => true,
'condition' => array(
'link_switcher' => 'yes',
'link_selection' => 'link',
),
)
);
$this->end_controls_section(); // End Controls Section
// Section: Request New Feature
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
$this->start_controls_section(
'lottie_styles',
[
'label' => __( 'Animation', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->start_controls_tabs( 'tabs_lottie' );
$this->start_controls_tab(
'tab_lottie_normal',
[
'label' => __( 'Normal', 'wpr-addons' ),
]
);
$this->add_control(
'opacity',
[
'label' => __( 'Opacity', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'range' => array(
'px' => array(
'max' => 1,
'min' => 0.10,
'step' => 0.01,
),
),
'selectors' => array(
'{{WRAPPER}} .wpr-lottie-animations' => 'opacity: {{SIZE}}',
),
]
);
$this->add_control(
'hover_transition',
[
'label' => esc_html__( 'Transition Duration', 'wpr-addons' ),
'type' => Controls_Manager::NUMBER,
'default' => 0.3,
'min' => 0,
'max' => 5,
'step' => 0.1,
'selectors' => [
'{{WRAPPER}} .wpr-lottie-animations' => 'transition-duration: {{VALUE}}s;'
],
]
);
$this->add_group_control(
Group_Control_Css_Filter::get_type(),
array(
'name' => 'css_filters',
'selector' => '{{WRAPPER}} .wpr-lottie-animations',
)
);
$this->end_controls_tab();
$this->start_controls_tab(
'tab_lottie_hover',
[
'label' => __( 'Hover', 'wpr-addons' ),
]
);
$this->add_control(
'hover_opacity',
array(
'label' => __( 'Opacity', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'range' => array(
'px' => array(
'max' => 1,
'min' => 0.10,
'step' => 0.01,
),
),
'selectors' => array(
'{{WRAPPER}} .wpr-lottie-animations:hover' => 'opacity: {{SIZE}}',
),
)
);
$this->add_group_control(
Group_Control_Css_Filter::get_type(),
[
'name' => 'hover_css_filters',
'selector' => '{{WRAPPER}} .wpr-lottie-animations:hover',
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->end_controls_section(); // End Controls Section
}
public function lottie_attributes($settings) {
$attributes = [
'loop' => $settings['loop'],
'autoplay' => $settings['autoplay'],
/// TODO: reverse
'speed' => $settings['speed'],
'trigger' => $settings['trigger'],
'reverse' => $settings['reverse'],
'scroll_start' => isset( $settings['animate_view']['sizes']['start'] ) ? $settings['animate_view']['sizes']['start'] : '0',
'scroll_end' => isset( $settings['animate_view']['sizes']['end'] ) ? $settings['animate_view']['sizes']['end'] : '100',
'lottie_renderer' => $settings['lottie_renderer']
];
return json_encode($attributes);
}
protected function render() {
// Get Settings
$settings = $this->get_settings_for_display();
$lottie_json = 'url' === $settings['source'] ? esc_url($settings['json_url']) : $settings['json_file']['url'];
$lottie_link = 'url' === $settings['link_selection'] ? $settings['link']['url'] : get_permalink($settings['existing_link']);
if ( '' === $lottie_json ) {
$lottie_json = WPR_ADDONS_URL .'modules/lottie-animations/assets/default.json';
}
$lottie_animation = 'yes' === $settings['link_switcher']
? '<a href="'. esc_url($lottie_link) .'"><div class="wpr-lottie-animations" data-settings="'. esc_attr($this->lottie_attributes($settings)) .'" data-json-url="'. esc_url($lottie_json) .'"></div></a>'
: '<div class="wpr-lottie-animations" data-settings="'. esc_attr($this->lottie_attributes($settings)) .'" data-json-url="'. esc_url($lottie_json) .'"></div>';
echo '<div class="wpr-lottie-animations-wrapper">';
echo ''. $lottie_animation; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo '</div>';
}
}
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\MagazineGrid;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-magazine-grid';
}
public function get_widgets() {
return [
'Wpr_Magazine_Grid', // This should match the widget/element class.
];
}
}
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\Mailchimp;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-mailchimp';
}
public function get_widgets() {
return [
'Wpr_Mailchimp', // This should match the widget/element class.
];
}
}
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\MediaGrid;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-media-grid';
}
public function get_widgets() {
return [
'Wpr_Media_Grid', // This should match the widget/element class.
];
}
}
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\MegaMenu;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-mega-menu';
}
public function get_widgets() {
return [
'WPR_Mega_Menu', // This should match the widget/element class.
];
}
}
@@ -0,0 +1,237 @@
<?php
class Wpr_Main_Menu_Walker extends \Walker_Nav_Menu {
public function __construct( $menu_item_highlight ) {
$this->menu_item_highlight = $menu_item_highlight;
}
public function start_lvl( &$output, $depth = 0, $args = array() ) {
if ( 'mega-content' === $this->get_menu_item_type() ) {
return;
}
if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) {
$t = '';
$n = '';
} else {
$t = "\t";
$n = "\n";
}
$indent = str_repeat( $t, $depth );
// Default class.
$classes = array( 'sub-menu', 'wpr-sub-menu' );
$class_names = join( ' ', apply_filters( 'nav_menu_submenu_css_class', $classes, $args, $depth ) );
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
$output .= "{$n}{$indent}<ul $class_names>{$n}";
}
public function end_lvl( &$output, $depth = 0, $args = array() ) {
if ( 'mega-content' === $this->get_menu_item_type() ) {
return;
}
if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) {
$t = '';
$n = '';
} else {
$t = "\t";
$n = "\n";
}
$indent = str_repeat( $t, $depth );
$output .= "$indent</ul>{$n}";
}
public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$this->set_menu_item_type( $item->ID, $depth );
if ( 'mega-content' === $this->get_menu_item_type() && 0 < $depth ) {
return;
}
// Get Settings
$settings = $this->get_mega_menu_settings($item->ID);
if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) {
$t = '';
$n = '';
} else {
$t = "\t";
$n = "\n";
}
$indent = ( $depth ) ? str_repeat( $t, $depth ) : '';
$id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args, $depth );
$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$classes[] = 'menu-item-' . $item->ID;
if ( $this->has_mega_menu( $item->ID ) ) {
$classes[] = 'menu-item-has-children';
}
$id_attr = '';
$custom_width_attr = '';
if ( $settings ) {
if ( 'true' === $settings['wpr_mm_enable'] ) {
$classes[] = 'wpr-mega-menu-'. $settings['wpr_mm_enable'];
$classes[] = 'wpr-mega-menu-pos-'. $settings['wpr_mm_position'];
$classes[] = 'wpr-mega-menu-width-'. $settings['wpr_mm_width'];
$id_attr = ' data-id="'. $item->ID .'"';
$custom_width_attr = 'custom' === $settings['wpr_mm_width'] ? ' data-custom-width="'. $settings['wpr_mm_custom_width'] .'"' : '';
}
}
$item_li_class = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ) );
$item_li_class = $item_li_class ? ' class="' . esc_attr( $item_li_class ) . '"' : '';
$item_a_class = 'wpr-menu-item wpr-pointer-item';
if ( in_array( 'current-menu-item', $item->classes ) && ('yes' === $this->menu_item_highlight) ) {
$item_a_class .= ' wpr-active-menu-item';
}
if ( in_array( 'current-menu-item', $item->classes ) && ('yes' === $this->menu_item_highlight) ) {
$item_li_class .= ' wpr-active-menu-item';
}
$output .= $indent .'<li'. $id . $item_li_class . $custom_width_attr . $id_attr .'>';
$item_output = $args->before;
$submenu_icon = '';
// Parent Item
if ( in_array( 'menu-item-has-children', $item->classes ) || $this->has_mega_menu( $item->ID ) ) {
if ( ( in_array( 'current-menu-item', $item->classes ) || in_array( 'current-menu-ancestor', $item->classes ) ) && ('yes' === $this->menu_item_highlight) ) {
$item_a_class .= ' wpr-active-menu-item';
}
// Add Sub Menu Icon
if ( $depth > 0 ) {
$submenu_icon .='<i class="wpr-sub-icon fas wpr-sub-icon-rotate" aria-hidden="true"></i>';
} else {
$submenu_icon .='<i class="wpr-sub-icon fas" aria-hidden="true"></i>';
}
}
// Sub Menu Classes
if ( $depth > 0 ) {
$item_a_class = 'wpr-sub-menu-item';
if ( ( in_array( 'current-menu-item', $item->classes ) || in_array( 'current-menu-ancestor', $item->classes ) ) && ('yes' === $this->menu_item_highlight) ) {
$item_a_class .= ' wpr-active-menu-item';
}
}
$item_icon_html = '';
$item_badge_html = '';
// If has Settings
if ( $settings ) {
// Icon
if ( defined('WPR_ADDONS_PRO_VERSION') && wpr_fs()->can_use_premium_code() && '' !== $settings['wpr_mm_icon_picker'] ) {
$color = '' !== $settings['wpr_mm_icon_color'] ? ' color: '. $settings['wpr_mm_icon_color'] : ';';
$font_size = '' !== $settings['wpr_mm_icon_size'] ? 'font-size: '. $settings['wpr_mm_icon_size'] .'px;' : '';
$item_icon_style = ( '' !== $font_size || '' !== $color || '' !== $distance ) ? ' style="'. $font_size . $color .'"' : '';
$item_icon_html = '<i class="wpr-mega-menu-icon '. $settings['wpr_mm_icon_picker'] .'"'. $item_icon_style .'></i>';
}
// Badge
if ( defined('WPR_ADDONS_PRO_VERSION') && wpr_fs()->can_use_premium_code() && '' !== $settings['wpr_mm_badge_text'] ) {
$item_badge_class = 'true' === $settings['wpr_mm_badge_animation'] ? ' wpr-mega-menu-badge-animation' : '';
$item_badge_style = 'color: '. $settings['wpr_mm_badge_color'] .';';
$item_badge_style .= 'background-color: '. $settings['wpr_mm_badge_bg_color'] .';';
$item_badge_style .= 'border-color: '. $settings['wpr_mm_badge_bg_color'] .';';
$item_badge_html = '<span class="wpr-mega-menu-badge'. $item_badge_class .'" style="'. $item_badge_style .'">'. $settings['wpr_mm_badge_text'] .'</span>';
}
}
// Link Attributes
$atts = [];
$atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : '';
$atts['target'] = ! empty( $item->target ) ? $item->target : '';
$atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
$atts['href'] = ! empty( $item->url ) ? $item->url : '#';
$atts['class'] = $item_a_class;
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth );
$attributes = '';
foreach ( $atts as $attr => $value ) {
if ( ! empty( $value ) ) {
$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
$attributes .= ' ' . $attr . '="' . $value . '"';
}
}
// Link Output
$item_output .= '<a'. $attributes .'>';
$item_output .= $item_icon_html;
$item_output .= $args->link_before;
$item_output .= '<span>'. apply_filters( 'the_title', $item->title, $item->ID ) .'</span>';
$item_output .= $args->link_after;
$item_output .= $item_badge_html;
$item_output .= $submenu_icon;
$item_output .= '</a>';
$item_output .= $args->after;
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
public function end_el( &$output, $item, $depth = 0, $args = array() ) {
if ( 'mega-content' === $this->get_menu_item_type() && 0 < $depth ) {
return;
}
if ( $depth === 0 ) {
if ( $this->has_mega_menu($item->ID) ) {
$elementor = \Elementor\Plugin::instance();
$mega_id = get_post_meta( $item->ID, 'wpr-mega-menu-item', true);
$type = get_post_meta(get_the_ID(), '_wpr_template_type', true) || get_post_meta($mega_id, '_elementor_template_type', true);
$has_css = 'internal' === get_option( 'elementor_css_print_method' ) || '' !== $type;
$content = $elementor->frontend->get_builder_content_for_display($mega_id, $has_css);
$output .= '<div class="wpr-sub-mega-menu">'. $content .'</div>';
}
$output .= "</li>\n";
}
}
public function set_menu_item_type( $item_id = 0, $depth = 0 ) {
if ( 0 < $depth ) {
return;
}
$item_type = 'default-content';
if ( $this->has_mega_menu( $item_id ) ) {
$item_type = 'mega-content';
}
wp_cache_set( 'menu-item-type', $item_type, 'wpr-mega-menu' );
}
public function get_menu_item_type() {
return wp_cache_get( 'menu-item-type', 'wpr-mega-menu' );
}
public function has_mega_menu( $item_id ) {
$settings = get_post_meta( $item_id, 'wpr-mega-menu-settings', true);
return isset($settings['wpr_mm_enable']) && 'true' === $settings['wpr_mm_enable'] ? true : false;
}
public function get_mega_menu_settings( $item_id ) {
$settings = get_post_meta( $item_id, 'wpr-mega-menu-settings', true);
return ! empty($settings) ? $settings : false;
}
}
@@ -0,0 +1,250 @@
<?php
class Wpr_Mobile_Menu_Walker extends \Walker_Nav_Menu {
public function __construct( $mobile_menu_highlight ) {
$this->mobile_menu_highlight = $mobile_menu_highlight;
}
public function start_lvl( &$output, $depth = 0, $args = array() ) {
if ( 'mega-content' === $this->get_menu_item_type() ) {
return;
}
if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) {
$t = '';
$n = '';
} else {
$t = "\t";
$n = "\n";
}
$indent = str_repeat( $t, $depth );
// Default class.
$classes = array( 'sub-menu', 'wpr-mobile-sub-menu' );
$class_names = join( ' ', apply_filters( 'nav_menu_submenu_css_class', $classes, $args, $depth ) );
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
$output .= "{$n}{$indent}<ul $class_names>{$n}";
if ( defined('WPR_ADDONS_PRO_VERSION') && wpr_fs()->can_use_premium_code() && $depth === 0 ) {
$output .= '<li class="wpr-menu-offcanvas-back-wrap">';
$output .= '<div class="wpr-menu-offcanvas-back">';
$output .= '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 499.6 320.6" style="enable-background:new 0 0 499.6 320.6;" xml:space="preserve"><g><path class="st0" d="M499.6,159.3c0.3,7-2.4,13.2-7,17.9c-4.3,4.3-10.4,7-16.9,7H81.6l95.6,95.6c9.3,9.3,9.3,24.4,0,33.8c-4.6,4.6-10.8,7-16.9,7c-6.1,0-12.3-2.4-16.9-7L6.9,177.2c-9.3-9.3-9.3-24.4,0-33.8l16.9-16.9l0,0L143.3,6.9c9.3-9.3,24.4-9.3,33.8,0c4.6,4.6,7,10.8,7,16.9s-2.4,12.3-7,16.9l-95.6,95.6h393.7C488.3,136.3,499.1,146.4,499.6,159.3z"/></g></svg>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped';
// $output .= '<h3></h3>';
$output .= '</div>';
$output .= '</li>';
}
}
public function end_lvl( &$output, $depth = 0, $args = array() ) {
if ( 'mega-content' === $this->get_menu_item_type() ) {
return;
}
if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) {
$t = '';
$n = '';
} else {
$t = "\t";
$n = "\n";
}
$indent = str_repeat( $t, $depth );
$output .= "$indent</ul>{$n}";
}
public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$this->set_menu_item_type( $item->ID, $depth );
if ( 'mega-content' === $this->get_menu_item_type() && 0 < $depth ) {
return;
}
// Get Settings
$settings = $this->get_mega_menu_settings($item->ID);
if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) {
$t = '';
$n = '';
} else {
$t = "\t";
$n = "\n";
}
$indent = ( $depth ) ? str_repeat( $t, $depth ) : '';
$id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args, $depth );
$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$classes[] = 'menu-item-' . $item->ID;
if ( $this->has_mega_menu( $item->ID ) ) {
$classes[] = 'menu-item-has-children';
}
$id_attr = '';
if ( $settings ) {
if ( 'true' === $settings['wpr_mm_enable'] ) {
$classes[] = 'wpr-mega-menu-'. $settings['wpr_mm_enable'];
$id_attr = ' data-id="'. $item->ID .'"';
if ( defined('WPR_ADDONS_PRO_VERSION') && wpr_fs()->can_use_premium_code() && 'ajax' === $settings['wpr_mm_render'] && 'mega' === $settings['wpr_mm_mobile_content'] ) {
$classes[] = 'wpr-mega-menu-ajax';
}
}
}
$item_li_class = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ) );
$item_li_class = $item_li_class ? ' class="' . esc_attr( $item_li_class ) . '"' : '';
$item_a_class = 'wpr-mobile-menu-item';
if ( in_array( 'current-menu-item', $item->classes ) && ('yes' === $this->mobile_menu_highlight) ) {
$item_a_class .= ' wpr-active-menu-item';
}
$output .= $indent .'<li'. $id . $item_li_class . $id_attr .'>';
$item_output = $args->before;
// Parent Item
if ( in_array( 'menu-item-has-children', $item->classes ) ) {
if ( ( in_array( 'current-menu-item', $item->classes ) || in_array( 'current-menu-ancestor', $item->classes ) ) && ('yes' === $this->mobile_menu_highlight) ) {
$item_a_class .= ' wpr-active-menu-item';
}
}
// Sub Menu Classes
if ( $depth > 0 ) {
$item_a_class = 'wpr-mobile-sub-menu-item';
if ( ( in_array( 'current-menu-item', $item->classes ) || in_array( 'current-menu-ancestor', $item->classes ) ) && ('yes' === $this->mobile_menu_highlight) ) {
$item_a_class .= ' wpr-active-menu-item';
}
}
$item_icon_html = '';
$item_badge_html = '';
// If has Settings
if ( $settings ) {
// Icon
if ( defined('WPR_ADDONS_PRO_VERSION') && wpr_fs()->can_use_premium_code() && '' !== $settings['wpr_mm_icon_picker'] ) {
$font_size = '' !== $settings['wpr_mm_icon_size'] ? $settings['wpr_mm_icon_size'] .'px' : 'inherit';
$color = '' !== $settings['wpr_mm_icon_color'] ? $settings['wpr_mm_icon_color'] : 'inherit';
$item_icon_style = 'style="font-size: '. $font_size .'; color: '. $color .'"';
$item_icon_html = '<i class="wpr-mega-menu-icon '. $settings['wpr_mm_icon_picker'] .'" '. $item_icon_style .'></i>';
}
// Badge
if ( defined('WPR_ADDONS_PRO_VERSION') && wpr_fs()->can_use_premium_code() && '' !== $settings['wpr_mm_badge_text'] ) {
$item_badge_style = 'color: '. $settings['wpr_mm_badge_color'] .';';
$item_badge_style .= 'background-color: '. $settings['wpr_mm_badge_bg_color'] .';';
$item_badge_html = '<span class="wpr-mega-menu-badge" style="'. $item_badge_style .'">'. $settings['wpr_mm_badge_text'] .'</span>';
}
}
// Link Attributes
$atts = [];
$atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : '';
$atts['target'] = ! empty( $item->target ) ? $item->target : '';
$atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
$atts['href'] = ! empty( $item->url ) ? $item->url : '#';
$atts['class'] = $item_a_class;
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth );
$attributes = '';
foreach ( $atts as $attr => $value ) {
if ( ! empty( $value ) ) {
$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
$attributes .= ' ' . $attr . '="' . $value . '"';
}
}
// Link Output
$item_output .= '<a'. $attributes .'>';
$item_output .= $item_icon_html;
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
$item_output .= $item_badge_html;
$item_output .= in_array( 'menu-item-has-children', $item->classes ) || $this->has_mega_menu($item->ID) ? '<i class="wpr-mobile-sub-icon"></i>' : '';
$item_output .= '</a>';
$item_output .= $args->after;
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
public function end_el( &$output, $item, $depth = 0, $args = array() ) {
if ( 'mega-content' === $this->get_menu_item_type() && 0 < $depth ) {
return;
}
if ( $depth === 0 ) {
if ( $this->has_mega_menu($item->ID) ) {
// Get Settings
$settings = $this->get_mega_menu_settings($item->ID);
if ( 'ajax' === $settings['wpr_mm_render'] ) {
$output .= '<div class="wpr-mobile-sub-mega-menu">';
if ( defined('WPR_ADDONS_PRO_VERSION') && wpr_fs()->can_use_premium_code() ) {
$output .= '<div class="wpr-menu-offcanvas-back">';
$output .= '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 499.6 320.6" style="enable-background:new 0 0 499.6 320.6;" xml:space="preserve"><g><path class="st0" d="M499.6,159.3c0.3,7-2.4,13.2-7,17.9c-4.3,4.3-10.4,7-16.9,7H81.6l95.6,95.6c9.3,9.3,9.3,24.4,0,33.8c-4.6,4.6-10.8,7-16.9,7c-6.1,0-12.3-2.4-16.9-7L6.9,177.2c-9.3-9.3-9.3-24.4,0-33.8l16.9-16.9l0,0L143.3,6.9c9.3-9.3,24.4-9.3,33.8,0c4.6,4.6,7,10.8,7,16.9s-2.4,12.3-7,16.9l-95.6,95.6h393.7C488.3,136.3,499.1,146.4,499.6,159.3z"/></g></svg>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped';
// $output .= '<h3></h3>';
$output .= '</div>';
}
$output .= '</div>';
} else {
$elementor = \Elementor\Plugin::instance();
$mega_id = get_post_meta( $item->ID, 'wpr-mega-menu-item', true);
$content = $elementor->frontend->get_builder_content_for_display($mega_id);
$output .= '<div class="wpr-mobile-sub-mega-menu">';
if ( defined('WPR_ADDONS_PRO_VERSION') && wpr_fs()->can_use_premium_code() ) {
$output .= '<div class="wpr-menu-offcanvas-back">';
$output .= '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 499.6 320.6" style="enable-background:new 0 0 499.6 320.6;" xml:space="preserve"><g><path class="st0" d="M499.6,159.3c0.3,7-2.4,13.2-7,17.9c-4.3,4.3-10.4,7-16.9,7H81.6l95.6,95.6c9.3,9.3,9.3,24.4,0,33.8c-4.6,4.6-10.8,7-16.9,7c-6.1,0-12.3-2.4-16.9-7L6.9,177.2c-9.3-9.3-9.3-24.4,0-33.8l16.9-16.9l0,0L143.3,6.9c9.3-9.3,24.4-9.3,33.8,0c4.6,4.6,7,10.8,7,16.9s-2.4,12.3-7,16.9l-95.6,95.6h393.7C488.3,136.3,499.1,146.4,499.6,159.3z"/></g></svg>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped';
// $output .= '<h3></h3>';
$output .= '</div>';
}
$output .= ''. $content;
$output .= '</div>';
}
}
$output .= "</li>\n";
}
}
public function set_menu_item_type( $item_id = 0, $depth = 0 ) {
if ( 0 < $depth ) {
return;
}
$item_type = 'default-content';
if ( $this->has_mega_menu( $item_id ) ) {
$item_type = 'mega-content';
}
wp_cache_set( 'menu-item-type', $item_type, 'wpr-mega-menu' );
}
public function get_menu_item_type() {
return wp_cache_get( 'menu-item-type', 'wpr-mega-menu' );
}
public function has_mega_menu( $item_id ) {
$settings = get_post_meta( $item_id, 'wpr-mega-menu-settings', true);
$mega_content = defined('WPR_ADDONS_PRO_VERSION') && wpr_fs()->can_use_premium_code() && isset($settings['wpr_mm_mobile_content']) ? $settings['wpr_mm_mobile_content'] : 'mega';
return isset($settings['wpr_mm_enable']) && 'true' === $settings['wpr_mm_enable'] && 'mega' === $mega_content ? true : false;
}
public function get_mega_menu_settings( $item_id ) {
$settings = get_post_meta( $item_id, 'wpr-mega-menu-settings', true);
return ! empty($settings) ? $settings : false;
}
}
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\NavMenu;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-nav-menu';
}
public function get_widgets() {
return [
'WPR_Nav_Menu', // This should match the widget/element class.
];
}
}
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\Offcanvas;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-offcanvas';
}
public function get_widgets() {
return [
'WPR_Offcanvas', // This should match the widget/element class.
];
}
}
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\OnepageNav;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_widgets() {
return [
'Wpr_OnepageNav',
];
}
public function get_name() {
return 'wpr-onepage-nav';
}
}
@@ -0,0 +1,778 @@
<?php
namespace WprAddons\Modules\OnepageNav\Widgets;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
use Elementor\Group_Control_Background;
use Elementor\Group_Control_Image_Size;
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Repeater;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use Elementor\Widget_Base;
use Elementor\Utils;
use Elementor\Icons;
use WprAddons\Classes\Utilities;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Wpr_OnepageNav extends Widget_Base {
public function get_name() {
return 'wpr-onepage-nav';
}
public function get_title() {
return esc_html__( 'Onepage Nav', 'wpr-addons' );
}
public function get_icon() {
return 'wpr-icon eicon-navigator';
}
public function get_categories() {
return [ 'wpr-widgets'];
}
public function get_keywords() {
return [ 'royal', 'one page', 'onepage', 'navigation', 'one page scroll', 'scroll navigation', 'floating menu', 'sticky menu', 'page scroll' ];
}
public function has_widget_inner_wrapper(): bool {
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
}
public function get_custom_help_url() {
if ( empty(get_option('wpr_wl_plugin_links')) )
// return 'https://royal-elementor-addons.com/contact/?ref=rea-plugin-panel-one-page-navigation-help-btn';
return 'https://wordpress.org/support/plugin/royal-elementor-addons/';
}
public function add_section_settings() {
$this->start_controls_section(
'section_settings',
[
'label' => esc_html__( 'Settings', 'wpr-addons' ),
]
);
$this->add_control(
'nav_consider_header',
[
'label' => esc_html__( 'Consider Sticky Header', 'wpr-addons' ),
'type' => Controls_Manager::SWITCHER,
'default' => '',
'description' => esc_html__( 'Enable this to account for Royal Sticky Header when scrolling to sections.', 'wpr-addons' ),
]
);
$this->add_control(
'nav_item_show_tooltip',
[
'label' => sprintf( __( 'Show Tooltip %s', 'wpr-addons' ), '<i class="eicon-pro-icon"></i>' ),
'type' => Controls_Manager::SWITCHER,
'classes' => 'wpr-pro-control no-distance',
'separator' => 'before'
]
);
$this->add_control(
'nav_item_highlight',
[
'label' => sprintf( __( 'Highlight Active Item %s', 'wpr-addons' ), '<i class="eicon-pro-icon"></i>' ),
'type' => Controls_Manager::SWITCHER,
'classes' => 'wpr-pro-control no-distance'
]
);
$this->end_controls_section(); // End Controls Section
}
public function add_control_nav_item_stretch() {
$this->add_control(
'nav_item_stretch',
[
'label' => sprintf( __( 'Stretch Vertically %s', 'wpr-addons' ), '<i class="eicon-pro-icon"></i>' ),
'type' => Controls_Manager::SWITCHER,
'classes' => 'wpr-pro-control no-distance'
]
);
}
public function add_condition_nav_item_stretch() {
return [];
}
public function add_repeater_args_nav_item_tooltip() {
return [
'type' => Controls_Manager::HIDDEN,
'default' => ''
];
}
public function add_repeater_args_nav_item_icon_color() {
return [
'type' => Controls_Manager::HIDDEN,
'default' => ''
];
}
public function add_section_nav_tooltip() {}
protected function register_controls() {
// Section: Navigation -------
$this->start_controls_section(
'section_nav',
[
'label' => 'Navigation <a href="#" onclick="window.open(\'https://youtu.be/0hM4l2UKzXs\',\'_blank\').focus()">Video Tutorial <span class="dashicons dashicons-video-alt3"></span></a>',
]
);
Utilities::wpr_library_buttons( $this, Controls_Manager::RAW_HTML );
$repeater = new Repeater();
$repeater->add_control(
'nav_item_id',
[
'label' => esc_html__( 'Section ID', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'default' => 'section-one',
]
);
$repeater->add_control( 'nav_item_tooltip', $this->add_repeater_args_nav_item_tooltip() );
$repeater->add_control(
'nav_item_icon',
[
'label' => esc_html__( 'Select Icon', 'wpr-addons' ),
'type' => Controls_Manager::ICONS,
'skin' => 'inline',
'label_block' => false,
'default' => [
'value' => 'fas fa-home',
'library' => 'fa-solid',
],
]
);
$repeater->add_control( 'nav_item_icon_color', $this->add_repeater_args_nav_item_icon_color() );
$this->add_control(
'nav_items',
[
'label' => esc_html__( 'Navigation Items', 'wpr-addons' ),
'type' => Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [
[
'nav_item_id' => 'section-one',
'nav_item_tooltip' => 'Section 1',
'nav_item_icon' => [
'value' => 'fas fa-home',
'library' => 'fa-solid',
],
],
[
'nav_item_id' => 'section-two',
'nav_item_tooltip' => 'Section 2',
'nav_item_icon' => [
'value' => 'far fa-envelope',
'library' => 'fa-regular',
],
],
[
'nav_item_id' => 'section-three',
'nav_item_tooltip' => 'Section 3',
'nav_item_icon' => [
'value' => 'fas fa-info-circle',
'library' => 'fa-solid',
],
],
],
'title_field' => '{{{ nav_item_tooltip }}}',
]
);
if ( !defined('WPR_ADDONS_PRO_VERSION') || !wpr_fs()->can_use_premium_code() ) {
$this->add_control(
'opnepage_pro_notice',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => '<span style="color:#2a2a2a;">Custom Icon Color, Item Tooltip, Highlight Active Menu Item and Scroll Speed</span> options are available in the <strong><a href="https://royal-elementor-addons.com/?ref=rea-plugin-panel-onepage-nav-upgrade-pro#purchasepro" target="_blank">Pro version</a><br><a href="https://youtu.be/0hM4l2UKzXs?t=253" target="_blank" class="wpr-pro-notice-video">Watch Video <span class="dashicons dashicons-video-alt3"></span></a></strong>',
// 'raw' => '<span style="color:#2a2a2a;">Custom Icon Color, Item Tooltip, Highlight Active Menu Item and Scroll Speed</span> options are available in the <strong><a href="'. admin_url('admin.php?page=wpr-addons-pricing') .'" target="_blank">Pro version</a></strong>',
'content_classes' => 'wpr-pro-notice',
]
);
}
$this->end_controls_section(); // End Controls Section
// Section: Layout -----------
$this->start_controls_section(
'section_layout',
[
'label' => esc_html__( 'Layout', 'wpr-addons' ),
]
);
$this->add_control_nav_item_stretch();
$this->add_control(
'nav_item_position_hr',
[
'label' => esc_html__( 'Horizontal Position', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'right',
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'wpr-addons' ),
'icon' => 'eicon-h-align-left',
],
'right' => [
'title' => esc_html__( 'Right', 'wpr-addons' ),
'icon' => 'eicon-h-align-right',
]
],
'prefix_class' => 'wpr-onepage-nav-hr-'
]
);
$this->add_control(
'nav_item_position_vr',
[
'label' => esc_html__( 'Vertical Position', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'middle',
'options' => [
'top' => [
'title' => esc_html__( 'Top', 'wpr-addons' ),
'icon' => 'eicon-v-align-top',
],
'middle' => [
'title' => esc_html__( 'Middle', 'wpr-addons' ),
'icon' => 'eicon-v-align-middle',
],
'bottom' => [
'title' => esc_html__( 'Bottom', 'wpr-addons' ),
'icon' => 'eicon-v-align-bottom',
],
],
'prefix_class' => 'wpr-onepage-nav-vr-',
'separator' => 'after',
'condition' => $this->add_condition_nav_item_stretch(),
]
);
$this->end_controls_section(); // End Controls Section
// Section: Settings ---------
$this->add_section_settings();
// Section: Request New Feature
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
// Section: Pro Features
Utilities::pro_features_list_section( $this, '', Controls_Manager::RAW_HTML, 'onepage-nav', [
'Highlight Active Nav Icon',
'Nav Icon Custom Color',
'Nav Icon Advanced Tooltip',
'Scrolling Animation Speed',
'Navigation Full-height (Sidebar) option',
] );
// Styles ====================
// Section: Nav Wrap ---------
$this->start_controls_section(
'section_nav_wrap',
[
'label' => esc_html__( 'Navigation Wrapper', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
'show_label' => false,
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'nav_wrap_bg_color',
'types' => [ 'classic', 'gradient' ],
'fields_options' => [
'color' => [
'default' => '#605BE5',
],
],
'selector' => '{{WRAPPER}} .wpr-onepage-nav'
]
);
$this->add_control(
'nav_wrap_border_color',
[
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#232323',
'selectors' => [
'{{WRAPPER}} .wpr-onepage-nav' => 'border-color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'nav_wrap_box_shadow',
'selector' => '{{WRAPPER}} .wpr-onepage-nav',
]
);
$this->add_responsive_control(
'nav_wrap_gutter',
[
'label' => esc_html__( 'Gutter', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 25,
],
],
'default' => [
'unit' => 'px',
'size' => 10,
],
'selectors' => [
'{{WRAPPER}} .wpr-onepage-nav-item' => 'margin-bottom: {{SIZE}}{{UNIT}};',
],
'separator' => 'before'
]
);
$this->add_responsive_control(
'nav_wrap_padding',
[
'label' => esc_html__( 'Padding', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'default' => [
'top' => 15,
'right' => 15,
'bottom' => 15,
'left' => 15,
],
'size_units' => [ 'px', ],
'selectors' => [
'{{WRAPPER}} .wpr-onepage-nav' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'nav_wrap_margin',
[
'label' => esc_html__( 'Margin', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'default' => [
'top' => 0,
'right' => 0,
'bottom' => 0,
'left' => 0,
],
'size_units' => [ 'px', ],
'selectors' => [
'{{WRAPPER}} .wpr-onepage-nav' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'nav_item_stretch!' => 'yes',
],
]
);
$this->add_control(
'nav_wrap_border_type',
[
'label' => esc_html__( 'Border Type', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'none' => esc_html__( 'None', 'wpr-addons' ),
'solid' => esc_html__( 'Solid', 'wpr-addons' ),
'double' => esc_html__( 'Double', 'wpr-addons' ),
'dotted' => esc_html__( 'Dotted', 'wpr-addons' ),
'dashed' => esc_html__( 'Dashed', 'wpr-addons' ),
'groove' => esc_html__( 'Groove', 'wpr-addons' ),
],
'default' => 'none',
'selectors' => [
'{{WRAPPER}} .wpr-onepage-nav' => 'border-style: {{VALUE}};',
],
'separator' => 'before'
]
);
$this->add_responsive_control(
'nav_wrap_border_width',
[
'label' => esc_html__( 'Border Width', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'default' => [
'top' => 1,
'right' => 1,
'bottom' => 1,
'left' => 1,
],
'selectors' => [
'{{WRAPPER}} .wpr-onepage-nav' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'nav_wrap_border_type!' => 'none',
],
]
);
$this->add_control(
'nav_wrap_border_radius',
[
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'default' => [
'top' => 3,
'right' => 0,
'bottom' => 0,
'left' => 3,
],
'selectors' => [
'{{WRAPPER}} .wpr-onepage-nav' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before'
]
);
$this->end_controls_section(); // End Controls Section
// Styles ====================
// Section: Nav Item ---------
$this->start_controls_section(
'section_nav_item',
[
'label' => esc_html__( 'Navigation Item', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
'show_label' => false,
]
);
$this->start_controls_tabs( 'nav_item_style' );
$this->start_controls_tab(
'nav_item_normal',
[
'label' => esc_html__( 'Normal', 'wpr-addons' ),
]
);
$this->add_control(
'nav_item_color',
[
'label' => esc_html__( 'Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#ffffff',
'selectors' => [
'{{WRAPPER}} .wpr-onepage-nav-item i' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpr-onepage-nav-item svg' => 'color: {{VALUE}};', // GOGA - shesacvlelia mgoni
],
]
);
$this->add_control(
'nav_item_bg_color',
[
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .wpr-onepage-nav-item i' => 'background-color: {{VALUE}};',
'{{WRAPPER}} .wpr-onepage-nav-item svg' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'nav_item_border_color',
[
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#E8E8E8',
'selectors' => [
'{{WRAPPER}} .wpr-onepage-nav-item i' => 'border-color: {{VALUE}};',
'{{WRAPPER}} .wpr-onepage-nav-item svg' => 'border-color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'nav_item_box_shadow',
'selector' => '{{WRAPPER}} .wpr-onepage-nav-item i',
'selector' => '{{WRAPPER}} .wpr-onepage-nav-item svg',
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'nav_item_hover',
[
'label' => esc_html__( 'Hover', 'wpr-addons' ),
]
);
$this->add_control(
'nav_item_hover_color',
[
'label' => esc_html__( 'Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#FFEC00',
'selectors' => [
'{{WRAPPER}} .wpr-onepage-nav-item:hover i' => 'color: {{VALUE}};',
'{{WRAPPER}} .wpr-onepage-active-item i' => 'color: {{VALUE}} !important;',
'{{WRAPPER}} .wpr-onepage-nav-item:hover svg' => 'fill: {{VALUE}};',
'{{WRAPPER}} .wpr-onepage-active-item svg' => 'fill: {{VALUE}};',
],
]
);
$this->add_control(
'nav_item_hover_bg_color',
[
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .wpr-onepage-nav-item:hover i' => 'background-color: {{VALUE}};',
'{{WRAPPER}} .wpr-onepage-active-item i' => 'background-color: {{VALUE}} !important;',
'{{WRAPPER}} .wpr-onepage-nav-item:hover svg' => 'background-color: {{VALUE}};',
'{{WRAPPER}} .wpr-onepage-active-item svg' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'nav_item_hover_border_color',
[
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#E8E8E8',
'selectors' => [
'{{WRAPPER}} .wpr-onepage-nav-item:hover i' => 'border-color: {{VALUE}};',
'{{WRAPPER}} .wpr-onepage-active-item i' => 'border-color: {{VALUE}} !important;',
'{{WRAPPER}} .wpr-onepage-nav-item:hover svg' => 'border-color: {{VALUE}};',
'{{WRAPPER}} .wpr-onepage-active-item svg' => 'border-color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'nav_item_hover_box_shadow',
'selector' => '{{WRAPPER}} .wpr-onepage-nav-item:hover i, {{WRAPPER}} .wpr-onepage-active-item i, {{WRAPPER}} .wpr-onepage-nav-item:hover svg, {{WRAPPER}} .wpr-onepage-active-item svg',
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->add_control(
'nav_item_transition_duration',
[
'label' => esc_html__( 'Transition Duration', 'wpr-addons' ),
'type' => Controls_Manager::NUMBER,
'default' => 0.1,
'min' => 0,
'max' => 5,
'step' => 0.1,
'selectors' => [
'{{WRAPPER}} .wpr-onepage-nav-item' => 'transition-duration: {{VALUE}}s',
'{{WRAPPER}} .wpr-onepage-nav-item i' => 'transition-duration: {{VALUE}}s',
'{{WRAPPER}} .wpr-onepage-nav-item svg' => 'transition-duration: {{VALUE}}s',
],
'separator' => 'before'
]
);
$this->add_responsive_control(
'nav_item_icon_size',
[
'label' => esc_html__( 'Icon Size', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 5,
'max' => 50,
],
],
'default' => [
'unit' => 'px',
'size' => 17,
],
'selectors' => [
'{{WRAPPER}} .wpr-onepage-nav-item i' => 'font-size: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-onepage-nav-item svg' => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};',
],
'separator' => 'before'
]
);
$this->add_responsive_control(
'nav_item_icon_size_active',
[
'label' => esc_html__( 'Active Icon Size', 'wpr-addons' ),
'type' => Controls_Manager::NUMBER,
'default' => 1.5,
'min' => 1,
'max' => 2,
'step' => 0.1,
'selectors' => [
'{{WRAPPER}} .wpr-onepage-active-item i' => 'transform: scale({{SIZE}}); -webkit-transform: scale({{SIZE}});',
'{{WRAPPER}} .wpr-onepage-active-item i:before' => 'transform: scale({{SIZE}}); -webkit-transform: scale({{SIZE}});',
'{{WRAPPER}} .wpr-onepage-active-item svg' => 'transform: scale({{SIZE}}); -webkit-transform: scale({{SIZE}});',
],
'condition' => [
'nav_item_highlight' => 'yes',
],
]
);
$this->add_responsive_control(
'nav_item_padding',
[
'label' => esc_html__( 'Padding', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'default' => [
'top' => 3,
'right' => 3,
'bottom' => 3,
'left' => 3,
],
'size_units' => [ 'px', ],
'selectors' => [
'{{WRAPPER}} .wpr-onepage-nav-item i' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpr-onepage-nav-item svg' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_control(
'nav_item_border_type',
[
'label' => esc_html__( 'Border Type', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'none' => esc_html__( 'None', 'wpr-addons' ),
'solid' => esc_html__( 'Solid', 'wpr-addons' ),
'double' => esc_html__( 'Double', 'wpr-addons' ),
'dotted' => esc_html__( 'Dotted', 'wpr-addons' ),
'dashed' => esc_html__( 'Dashed', 'wpr-addons' ),
'groove' => esc_html__( 'Groove', 'wpr-addons' ),
],
'default' => 'none',
'selectors' => [
'{{WRAPPER}} .wpr-onepage-nav-item i' => 'border-style: {{VALUE}};',
'{{WRAPPER}} .wpr-onepage-nav-item svg' => 'border-style: {{VALUE}};',
],
'separator' => 'before'
]
);
$this->add_responsive_control(
'nav_item_border_width',
[
'label' => esc_html__( 'Border Width', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'default' => [
'top' => 1,
'right' => 1,
'bottom' => 1,
'left' => 1,
],
'selectors' => [
'{{WRAPPER}} .wpr-onepage-nav-item i' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .wpr-onepage-nav-item svg' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'nav_item_border_type!' => 'none',
],
]
);
$this->add_responsive_control(
'nav_item_border_radius',
[
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 50,
],
],
'default' => [
'top' => 0,
'right' => 0,
'bottom' => 0,
'left' => 0,
],
'selectors' => [
'{{WRAPPER}} .wpr-onepage-nav-item i' => 'border-radius: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-onepage-nav-item svg' => 'border-radius: {{SIZE}}{{UNIT}};',
],
'separator' => 'before'
]
);
$this->end_controls_section(); // End Controls Section
// Styles ======================
// Section: Nav Tooltip --------
$this->add_section_nav_tooltip();
}
protected function render() {
// Get Settings
$settings = $this->get_settings();
// Pro Options
if ( !defined('WPR_ADDONS_PRO_VERSION') || !wpr_fs()->can_use_premium_code() ) {
$settings['nav_item_scroll_speed'] = '';
$settings['nav_item_highlight'] = '';
$settings['nav_item_show_tooltip'] = '';
}
echo '<div class="wpr-onepage-nav" data-speed="'. esc_attr($settings['nav_item_scroll_speed']) .'" data-highlight="'. esc_attr($settings['nav_item_highlight']) .'" data-consider-header="'. esc_attr($settings['nav_consider_header']) .'">';
// Nav Items
foreach ( $settings['nav_items'] as $item ) {
echo '<div class="wpr-onepage-nav-item elementor-repeater-item-'. esc_attr($item['_id']) .'">';
echo '<a href="#'. esc_attr($item['nav_item_id']) .'">';
echo ( defined('WPR_ADDONS_PRO_VERSION') && wpr_fs()->can_use_premium_code() && 'yes' === $settings['nav_item_show_tooltip'] ) ? '<span class="wpr-tooltip">'. esc_html($item['nav_item_tooltip']) .'</span>' : '';
\Elementor\Icons_Manager::render_icon( $item['nav_item_icon'] );
echo '</a>';
echo '</div>';
}
echo '</div>';
}
}
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\PageList;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-page-list';
}
public function get_widgets() {
return [
'Wpr_Page_List', // This should match the widget/element class.
];
}
}
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\PhoneCall;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-phone-call';
}
public function get_widgets() {
return [
'Wpr_Phone_call', // This should match the widget/element class.
];
}
}
@@ -0,0 +1,664 @@
<?php
namespace WprAddons\Modules\PhoneCall\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use WprAddons\Classes\Utilities;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Wpr_Phone_Call extends Widget_Base {
public function get_name() {
return 'wpr-phone-call';
}
public function get_title() {
return esc_html__( 'Phone Call', 'wpr-addons' );
}
public function get_icon() {
return 'wpr-icon eicon-tel-field';
}
public function get_categories() {
return [ 'wpr-widgets'];
}
public function get_keywords() {
return [ 'royal', 'Phone', 'call','phone','Phone call' ];
}
public function has_widget_inner_wrapper(): bool {
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
}
public function get_custom_help_url() {
if ( empty(get_option('wpr_wl_plugin_links')) )
// return 'https://royal-elementor-addons.com/contact/?ref=rea-plugin-panel-phone-call-help-btn';
return 'https://wordpress.org/support/plugin/royal-elementor-addons/';
}
protected function register_controls() {
// Section: General ----------
$this->start_controls_section(
'section_general',
[
'label' => esc_html__( 'General', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
Utilities::wpr_library_buttons( $this, Controls_Manager::RAW_HTML );
$this->add_control(
'telnumber',
[
'label' => esc_html__( 'Phone Number', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'default' => '123456789',
]
);
$this->add_control(
'button_position',
[
'label' => esc_html__( 'Button Position', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'default' => 'fixed',
'label_block' => false,
'render_type' => 'template',
'options' => [
'fixed' => esc_html__( 'Fixed', 'wpr-addons' ),
'inline' => esc_html__( 'Inline', 'wpr-addons' ),
],
'prefix_class' => 'wpr-pc-btn-align-',
'separator' => 'before',
]
);
$this->add_responsive_control(
'button_position_inline',
[
'label' => esc_html__( 'Inline Position', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'center',
'label_block' => false,
'options' => [
'flex-start' => [
'title' => esc_html__( 'Left', 'wpr-addons' ),
'icon' => 'eicon-h-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'wpr-addons' ),
'icon' => 'eicon-h-align-center',
],
'flex-end' => [
'title' => esc_html__( 'Right', 'wpr-addons' ),
'icon' => 'eicon-h-align-right',
],
],
'selectors' => [
'{{WRAPPER}} .wpr-pc-wrapper' => 'justify-content: {{VALUE}}',
],
'separator' => 'before',
'condition' => [
'button_position' => 'inline',
],
]
);
$this->add_responsive_control(
'button_position_fixed',
[
'label' => esc_html__( 'Fixed Position', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'right',
'label_block' => false,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'wpr-addons' ),
'icon' => 'eicon-h-align-left',
],
'right' => [
'title' => esc_html__( 'Right', 'wpr-addons' ),
'icon' => 'eicon-h-align-right',
],
],
'separator' => 'before',
'default' => 'right',
'condition' => [
'button_position' => 'fixed',
],
'prefix_class' => 'wpr-pc-btn-align-fixed-',
]
);
$this->add_responsive_control(
'distance_x_right',
[
'label' => esc_html__( 'Distance Right', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 30,
],
'selectors' => [
'{{WRAPPER}}.wpr-pc-btn-align-fixed-right .wpr-pc-btn' => 'right: {{SIZE}}{{UNIT}};',
],
'condition' => [
'button_position' => 'fixed',
'button_position_fixed' => 'right',
],
]
);
$this->add_responsive_control(
'distance_y_right',
[
'label' => esc_html__( 'Distance Bottom', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 30,
],
'selectors' => [
'{{WRAPPER}}.wpr-pc-btn-align-fixed-right .wpr-pc-btn' => 'bottom: {{SIZE}}{{UNIT}};',
],
'condition' => [
'button_position' => 'fixed',
'button_position_fixed' => 'right',
],
]
);
$this->add_responsive_control(
'distance_x_left',
[
'label' => esc_html__( 'Distance Left', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 30,
],
'selectors' => [
'{{WRAPPER}}.wpr-pc-btn-align-fixed-left .wpr-pc-btn' => 'left: {{SIZE}}{{UNIT}};',
],
'condition' => [
'button_position' => 'fixed',
'button_position_fixed' => 'left',
],
]
);
$this->add_responsive_control(
'distance_y_left',
[
'label' => esc_html__( 'Distance Bottom', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 30,
],
'selectors' => [
'{{WRAPPER}}.wpr-pc-btn-align-fixed-left .wpr-pc-btn' => 'bottom: {{SIZE}}{{UNIT}};',
],
'condition' => [
'button_position' => 'fixed',
'button_position_fixed' => 'left',
],
]
);
$this->add_control(
'pc_icon',
[
'label' => esc_html__( 'Select Icon', 'wpr-addons' ),
'type' => Controls_Manager::ICONS,
'skin' => 'inline',
'label_block' => false,
'default' => [
'value' => 'fas fa-phone',
'library' => 'fa-solid',
],
'separator' => 'before',
'recommended' => [
'fa-solid' => [
'phone',
'phone-alt',
'search',
],
],
]
);
$this->add_control(
'button_txt_show',
[
'label' => __( 'Button Text', 'wpr-addons' ),
'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __( 'Show', 'wpr-addons' ),
'label_off' => __( 'Hide', 'wpr-addons' ),
'return_value' => 'yes',
'default' => 'yes',
]
);
$this->add_control(
'pc_icon_layout_select',
[
'label' => esc_html__( 'Icon Align', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'default' => 'right',
'label_block' => false,
'options' => [
'top' => esc_html__( 'Top', 'wpr-addons' ),
'bottom' => esc_html__( 'Bottom', 'wpr-addons' ),
'right' => esc_html__( 'Right', 'wpr-addons' ),
'left' => esc_html__( 'Left', 'wpr-addons' ),
],
'condition' => [
'pc_icon[value]!' => '',
'button_txt_show' => 'yes',
],
'prefix_class' => 'wpr-pc-btn-icon-',
]
);
$this->add_control(
'button_text',
[
'label' => esc_html__( 'Text', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'default' => 'Call Now',
'condition' => [
'button_txt_show' => 'yes',
],
]
);
$this->end_controls_section();
// Section: Request New Feature
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
// Section Button ------------
$this->start_controls_section(
'section_style_button',
[
'label' => esc_html__( 'Button', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->start_controls_tabs( 'tabs_pc_button_colors' );
// Normal Tab ------------
$this->start_controls_tab(
'tab_pc_button_normal_colors',
[
'label' => esc_html__( 'Normal', 'wpr-addons' ),
]
);
$this->add_control(
'button_text_color',
[
'label' => esc_html__( ' Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#ffffff',
'selectors' => [
'{{WRAPPER}} .wpr-pc-content' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpr-pc-btn-icon' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpr-pc-btn-icon svg' => 'fill: {{VALUE}}',
],
]
);
$this->add_control(
'button_bg_color',
[
'label' => esc_html__( 'Background', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#39B54A',
'selectors' => [
'{{WRAPPER}} .wpr-pc-btn' => 'background-color: {{VALUE}}',
],
]
);
$this->add_control(
'button_border_color',
[
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#E8E8E8',
'selectors' => [
'{{WRAPPER}} .wpr-pc-btn' => 'border-color: {{VALUE}}',
],
'condition' =>[
'border_switcher' => 'yes',
],
]
);
$this->add_group_control(
\Elementor\Group_Control_Box_Shadow::get_type(),
[
'name' => 'button_box_shadow',
'label' => __( 'Box Shadow', 'wpr-addons' ),
'selector' => '{{WRAPPER}} .wpr-pc-btn',
]
);
$this->end_controls_tab();// normal tab end
// Hover Tab -------------
$this->start_controls_tab(
'tab_button_hover_colors',
[
'label' => esc_html__( 'Hover', 'wpr-addons' ),
]
);
$this->add_control(
'button_texte_color_hover',
[
'label' => esc_html__( 'Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#fff',
'selectors' => [
'{{WRAPPER}} .wpr-pc-btn:hover > .wpr-pc-btn-icon' => 'Color: {{VALUE}}',
'{{WRAPPER}} .wpr-pc-btn:hover svg' => 'fill: {{VALUE}}',
],
]
);
$this->add_control(
'button_bg_color_hover',
[
'label' => esc_html__( 'Background', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#1FD538',
'selectors' => [
'{{WRAPPER}} .wpr-pc-btn:hover' => 'background-color: {{VALUE}}',
],
]
);
$this->add_control(
'button_border_color_hover',
[
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#E8E8E8',
'selectors' => [
'{{WRAPPER}} .wpr-pc-btn:hover' => 'border-color: {{VALUE}}',
],
'condition' =>[
'border_switcher' => 'yes',
],
]
);
$this->add_group_control(
\Elementor\Group_Control_Box_Shadow::get_type(),
[
'name' => 'button_box_shadow_hover',
'label' => __( 'Box Shadow', 'wpr-addons' ),
'selector' => '{{WRAPPER}} .wpr-pc-btn:hover',
]
);
$this->end_controls_tab();// hover tab end
$this->end_controls_tabs();// End tabs
$this->add_control(
'hover_animation_hover_duration',
[
'label' => __( 'Hover Animation Duration', 'wpr-addons' ),
'type' => \Elementor\Controls_Manager::NUMBER,
'min' => 0,
'max' => 5,
'step' => 0.1,
'default' => 0.3,
'selectors' => [
'{{WRAPPER}} .wpr-pc-btn' => 'transition: all {{VALUE}}s ease-in-out 0s;',
],
'separator' => 'before',
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'button_typography',
'selector' => '{{WRAPPER}} .wpr-pc-content,{{WRAPPER}} .wpr-pc-content::after',
'separator' => 'before',
'condition' => [
'button_txt_show' => 'yes',
],
]
);
$this->add_control(
'icon_size',
[
'label' => esc_html__( 'Icon Size', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => 13,
],
'selectors' => [
'{{WRAPPER}} .wpr-pc-btn-icon' => 'font-size: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-pc-btn-icon svg' => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};',
],
'separator' => 'before',
'condition' => [
'pc_icon[value]!' => '',
],
]
);
$this->add_control(
'pc_icon_distance',
[
'label' => esc_html__( 'Icon Distance', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 25,
],
],
'default' => [
'unit' => 'px',
'size' => 7,
],
'selectors' => [
'{{WRAPPER}}.wpr-pc-btn-icon-top .wpr-pc-btn-icon' => 'margin-bottom: {{SIZE}}{{UNIT}};',
'{{WRAPPER}}.wpr-pc-btn-icon-left .wpr-pc-btn-icon' => 'margin-right: {{SIZE}}{{UNIT}};',
'{{WRAPPER}}.wpr-pc-btn-icon-right .wpr-pc-btn-icon' => 'margin-left: {{SIZE}}{{UNIT}};',
'{{WRAPPER}}.wpr-pc-btn-icon-bottom .wpr-pc-btn-icon' => 'margin-top: {{SIZE}}{{UNIT}};',
],
'separator' => 'before',
'condition' => [
'pc_icon[value]!' => '',
'button_txt_show' => 'yes',
],
]
);
$this->add_responsive_control(
'button_padding',
[
'label' => esc_html__( 'Padding', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'default' => [
'top' => 13,
'right' => 14,
'bottom' => 13,
'left' => 14,
],
'selectors' => [
'{{WRAPPER}} .wpr-pc-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_control(
'border_switcher',
[
'label' => esc_html__( 'Border', 'wpr-addons' ),
'type' => Controls_Manager::SWITCHER,
'separator' => 'before',
'return_value' => 'yes',
'label_block' => false,
'default' => 'yes',
]
);
$this->add_control(
'button_border_type',
[
'label' => esc_html__( 'Border Type', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'none' => esc_html__( 'None', 'wpr-addons' ),
'solid' => esc_html__( 'Solid', 'wpr-addons' ),
'double' => esc_html__( 'Double', 'wpr-addons' ),
'dotted' => esc_html__( 'Dotted', 'wpr-addons' ),
'dashed' => esc_html__( 'Dashed', 'wpr-addons' ),
'groove' => esc_html__( 'Groove', 'wpr-addons' ),
],
'default' => 'none',
'selectors' => [
'{{WRAPPER}} .wpr-pc-btn' => 'border-style: {{VALUE}};',
],
'condition' =>[
'border_switcher' => 'yes',
],
]
);
$this->add_responsive_control(
'border_width',
[
'label' => esc_html__( 'Border Width', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'default' => [
'top' => 1,
'right' => 1,
'bottom' => 1,
'left' => 1,
],
'selectors' => [
'{{WRAPPER}} .wpr-pc-btn' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before',
'condition' =>[
'border_switcher' => 'yes',
'button_border_type!' => 'none',
],
]
);
$this->add_responsive_control(
'button_border_radius',
[
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%' ],
'default' => [
'top' => 2,
'right' => 2,
'bottom' => 2,
'left' => 2,
],
'selectors' => [
'{{WRAPPER}} .wpr-pc-btn' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'after',
]
);
$this->end_controls_section();
}
protected function render() {
// Get Settings
$settings = $this->get_settings();
echo '<div class="wpr-pc-wrapper">';
echo '<a href="tel:'. esc_attr($settings['telnumber']) .'" class="wpr-pc-btn">';
echo '<div class="wpr-pc-content">';
if ( '' !== $settings['button_text'] && $settings['button_txt_show'] == 'yes' ) {
echo '<span class="wpr-pc-text">'. esc_html($settings ['button_text']) .'</span>';
}
if ( '' !== $settings['pc_icon']['value'] ) {
echo '<span class="wpr-pc-btn-icon">';
\Elementor\Icons_Manager::render_icon( $settings['pc_icon'] );
echo '</span>';
}
echo '</div>';
echo '</a>';
echo '</div>';
}
}
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\PopupTrigger;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-popup-trigger';
}
public function get_widgets() {
return [
'Wpr_Popup_Trigger', // This should match the widget/element class.
];
}
}
@@ -0,0 +1,573 @@
<?php
namespace WprAddons\Modules\PopupTrigger\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Group_Control_Text_Shadow;
use Elementor\Group_Control_Typography;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use Elementor\Group_Control_Background;
use WprAddons\Classes\Utilities;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Wpr_Popup_Trigger extends Widget_Base {
public function get_name() {
return 'wpr-popup-trigger';
}
public function get_title() {
return esc_html__( 'Popup Trigger', 'wpr-addons' );
}
public function get_icon() {
return 'wpr-icon eicon-button';
}
public function get_categories() {
return [ 'wpr-widgets'];
}
public function get_keywords() {
return [ 'royal', 'popup', 'trigger', 'button', 'action', 'close' ];
}
public function has_widget_inner_wrapper(): bool {
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
}
public function add_control_popup_trigger_show_again_delay() {
$this->add_control(
'popup_trigger_show_again_delay',
[
'label' => esc_html__( 'Show Again Delay', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'default' => '0',
'options' => [
'0' => esc_html__( 'No Delay', 'wpr-addons' ),
'60000' => esc_html__( '1 Minute', 'wpr-addons' ),
'180000' => esc_html__( '3 Minute', 'wpr-addons' ),
'300000' => esc_html__( '5 Minute', 'wpr-addons' ),
'pro-60' => esc_html__( '10 Minute (Pro)', 'wpr-addons' ),
'pro-180' => esc_html__( '30 Minute (Pro)', 'wpr-addons' ),
'pro-360' => esc_html__( '1 Hour (Pro)', 'wpr-addons' ),
'pro-1080' => esc_html__( '3 Hour (Pro)', 'wpr-addons' ),
'pro-2160' => esc_html__( '6 Hour (Pro)', 'wpr-addons' ),
'pro-4320' => esc_html__( '12 Hour (Pro)', 'wpr-addons' ),
'pro-8640' => esc_html__( '1 Day (Pro)', 'wpr-addons' ),
'pro-25920' => esc_html__( '3 Days (Pro)', 'wpr-addons' ),
'pro-43200' => esc_html__( '5 Days (Pro)', 'wpr-addons' ),
'pro-60480' => esc_html__( '7 Days (Pro)', 'wpr-addons' ),
'pro-864000' => esc_html__( '10 Days (Pro)', 'wpr-addons' ),
'pro-1296000' => esc_html__( '15 Days (Pro)', 'wpr-addons' ),
'pro-1728000' => esc_html__( '20 Days (Pro)', 'wpr-addons' ),
'pro-262800' => esc_html__( '1 Month (Pro)', 'wpr-addons' ),
],
'description' => esc_html__( 'This option determines when to show popup again to a visitor after it is closed.', 'wpr-addons' ),
'separator' => 'before',
'condition' => [
'popup_trigger_type!' => 'close-permanently'
]
]
);
}
protected function register_controls() {
// Tab: Content ==============
// Section: Settings ---------
$this->start_controls_section(
'section_popup_trigger',
[
'label' => esc_html__( 'Settings', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'countdown_editor_notice',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => '<strong>Please Note:</strong> this widget only works if it is placed inside a Popup. To create a Popup, please navigate to the WordPress <a href="'. admin_url('admin.php?page=wpr-popups') .'">Dashboard > Royal Addons > Popups.</a>',
'separator' => 'after',
'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
]
);
$this->add_control(
'popup_trigger_type',
[
'label' => esc_html__( 'Button Action', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'default' => 'close',
'options' => [
'close' => esc_html__( 'Close Popup', 'wpr-addons' ),
'close-permanently' => esc_html__( 'Close Permanently', 'wpr-addons' ),
'back' => esc_html__( 'Go Back to Referrer', 'wpr-addons' ),
]
]
);
$this->add_control_popup_trigger_show_again_delay();
// Upgrade to Pro Notice
Utilities::upgrade_pro_notice( $this, Controls_Manager::RAW_HTML, 'popup', 'popup_trigger_show_again_delay', [
'pro-6',
'pro-18',
'pro-30',
'pro-60',
'pro-180',
'pro-360',
'pro-1080',
'pro-2160',
'pro-4320',
'pro-8640',
'pro-25920',
'pro-43200',
'pro-60480',
'pro-864000',
'pro-1296000',
'pro-1728000',
'pro-262800'
] );
$this->add_control(
'popup_trigger_redirect',
[
'label' => esc_html__( 'Redirect to URL when Closed', 'wpr-addons' ),
'type' => Controls_Manager::SWITCHER,
'return_value' => 'yes',
'condition' => [
'popup_trigger_type!' => 'back'
]
]
);
$this->add_control(
'popup_trigger_redirect_url',
[
'type' => Controls_Manager::URL,
'dynamic' => [
'active' => true,
],
'condition' => [
'popup_trigger_redirect' => 'yes',
'popup_trigger_type!' => 'back'
]
]
);
$this->add_control(
'popup_trigger_text',
[
'label' => esc_html__( 'Button Text', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'default' => 'Close Popup',
'separator' => 'before'
]
);
$this->add_control(
'popup_trigger_extra_icon_pos',
[
'label' => esc_html__( 'Icon Position', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'none' => esc_html__( 'None', 'wpr-addons' ),
'before' => esc_html__( 'Before Element', 'wpr-addons' ),
'after' => esc_html__( 'After Element', 'wpr-addons' ),
],
'default' => 'none',
]
);
$this->add_control(
'popup_trigger_extra_icon',
[
'label' => esc_html__( 'Select Icon', 'wpr-addons' ),
'type' => Controls_Manager::ICONS,
'skin' => 'inline',
'label_block' => false,
'default' => [
'value' => 'fas fa-times',
'library' => 'fa-solid',
],
'condition' => [
'popup_trigger_extra_icon_pos!' => 'none'
]
]
);
$this->add_responsive_control(
'popup_trigger_align',
[
'label' => esc_html__( 'Button Align', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'label_block' => false,
'default' => 'center',
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'wpr-addons' ),
'icon' => 'eicon-h-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'wpr-addons' ),
'icon' => 'eicon-h-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'wpr-addons' ),
'icon' => 'eicon-h-align-right',
]
],
'selectors' => [
'{{WRAPPER}}' => 'text-align: {{VALUE}}',
],
'separator' => 'before'
]
);
$this->end_controls_section(); // End Controls Section
// Section: Request New Feature
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
// Tab: Styles ===============
// Section: General ----------
$this->start_controls_section(
'section_popup_trigger_styles',
[
'label' => esc_html__( 'General', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->start_controls_tabs( 'tabs_popup_trigger_style' );
$this->start_controls_tab(
'tab_popup_trigger_normal',
[
'label' => esc_html__( 'Normal', 'wpr-addons' ),
]
);
$this->add_control(
'popup_trigger_color',
[
'label' => esc_html__( 'Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#ffffff',
'selectors' => [
'{{WRAPPER}} .wpr-popup-trigger-button' => 'color: {{VALUE}}',
'{{WRAPPER}} .wpr-popup-trigger-button svg' => 'fill: {{VALUE}}'
],
]
);
$this->add_control(
'popup_trigger_bg_color',
[
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#605BE5',
'selectors' => [
'{{WRAPPER}} .wpr-popup-trigger-button' => 'background-color: {{VALUE}}',
]
]
);
$this->add_control(
'popup_trigger_border_color',
[
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpr-popup-trigger-button' => 'border-color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'popup_trigger_box_shadow',
'selector' => '{{WRAPPER}} .wpr-popup-trigger-button',
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'tab_popup_trigger_hover',
[
'label' => esc_html__( 'Hover', 'wpr-addons' ),
]
);
$this->add_control(
'popup_trigger_color_hr',
[
'label' => esc_html__( 'Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#ffffff',
'selectors' => [
'{{WRAPPER}} .wpr-popup-trigger-button:hover' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'popup_trigger_bg_color_hr',
[
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'default' => '#4A45D2',
'selectors' => [
'{{WRAPPER}} .wpr-popup-trigger-button:hover' => 'background-color: {{VALUE}}',
]
]
);
$this->add_control(
'popup_trigger_border_color_hr',
[
'label' => esc_html__( 'Border Color', 'wpr-addons' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .wpr-popup-trigger-button:hover' => 'border-color: {{VALUE}}',
]
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'popup_trigger_box_shadow_hr',
'selector' => '{{WRAPPER}} .wpr-popup-trigger-button:hover',
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->add_control(
'popup_trigger_divider',
[
'type' => Controls_Manager::DIVIDER,
'style' => 'thick',
]
);
$this->add_control(
'popup_trigger_transition_duration',
[
'label' => esc_html__( 'Transition Duration', 'wpr-addons' ),
'type' => Controls_Manager::NUMBER,
'default' => 0.1,
'min' => 0,
'max' => 5,
'step' => 0.1,
'selectors' => [
'{{WRAPPER}} .wpr-popup-trigger-button' => 'transition-duration: {{VALUE}}s',
],
'separator' => 'after',
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'popup_trigger_typography',
'selector' => '{{WRAPPER}} .wpr-popup-trigger-button'
]
);
$this->add_control(
'popup_trigger_border_type',
[
'label' => esc_html__( 'Border Type', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'none' => esc_html__( 'None', 'wpr-addons' ),
'solid' => esc_html__( 'Solid', 'wpr-addons' ),
'double' => esc_html__( 'Double', 'wpr-addons' ),
'dotted' => esc_html__( 'Dotted', 'wpr-addons' ),
'dashed' => esc_html__( 'Dashed', 'wpr-addons' ),
'groove' => esc_html__( 'Groove', 'wpr-addons' ),
],
'default' => 'none',
'selectors' => [
'{{WRAPPER}} .wpr-popup-trigger-button' => 'border-style: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->add_control(
'popup_trigger_border_width',
[
'label' => esc_html__( 'Border Width', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'default' => [
'top' => 1,
'right' => 1,
'bottom' => 1,
'left' => 1,
],
'selectors' => [
'{{WRAPPER}} .wpr-popup-trigger-button' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'popup_trigger_border_type!' => 'none',
],
]
);
$this->add_control(
'popup_trigger_svg_icon_size',
[
'label' => esc_html__( 'SVG Icon Size', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 50,
],
],
'default' => [
'unit' => 'px',
'size' => 10,
],
'selectors' => [
'{{WRAPPER}} .wpr-popup-trigger-button svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
],
'separator' => 'before'
]
);
$this->add_control(
'popup_trigger_icon_spacing',
[
'label' => esc_html__( 'Extra Icon Spacing', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 25,
],
],
'default' => [
'unit' => 'px',
'size' => 10,
],
'selectors' => [
'{{WRAPPER}} .wpr-popup-trigger-button .wpr-extra-icon-left' => 'padding-right: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .wpr-popup-trigger-button .wpr-extra-icon-right' => 'padding-left: {{SIZE}}{{UNIT}};',
],
'separator' => 'before'
]
);
$this->add_responsive_control(
'popup_trigger_padding',
[
'label' => esc_html__( 'Padding', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', ],
'default' => [
'top' => 6,
'right' => 15,
'bottom' => 6,
'left' => 15,
],
'selectors' => [
'{{WRAPPER}} .wpr-popup-trigger-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_responsive_control(
'popup_trigger_margin',
[
'label' => esc_html__( 'Margin', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', ],
'default' => [
'top' => 0,
'right' => 0,
'bottom' => 0,
'left' => 0,
],
'selectors' => [
'{{WRAPPER}} .wpr-popup-trigger-button' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'popup_trigger_radius',
[
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%' ],
'default' => [
'top' => 3,
'right' => 3,
'bottom' => 3,
'left' => 3,
],
'selectors' => [
'{{WRAPPER}} .wpr-popup-trigger-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->end_controls_section();
}
protected function render() {
// Get Settings
$settings = $this->get_settings();
// Get Icon HTML
ob_start();
\Elementor\Icons_Manager::render_icon( $settings['popup_trigger_extra_icon'], [ 'aria-hidden' => 'true' ] );
$icon_html = ob_get_clean();
$popup_show_delay = $settings['popup_trigger_show_again_delay'];
if ( 'close-permanently' === $settings['popup_trigger_type'] ) {
$popup_show_delay = 10000000000000;
}
echo '<div class="wpr-popup-trigger-button" data-trigger="'. esc_attr($settings['popup_trigger_type']) .'" data-show-delay="'. esc_attr($popup_show_delay) .'" data-redirect="'. esc_attr($settings['popup_trigger_redirect']) .'" data-redirect-url="'. esc_url($settings['popup_trigger_redirect_url']['url']) .'">';
// Icon: Before
if ( 'before' === $settings['popup_trigger_extra_icon_pos'] && '' !== $settings['popup_trigger_extra_icon']['value'] ) {
echo '<span class="wpr-extra-icon-left">'. $icon_html .'</span>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
echo '<span>'. esc_html($settings['popup_trigger_text']) .'</span>';
// Icon: After
if ( 'after' === $settings['popup_trigger_extra_icon_pos'] ) {
echo '<span class="wpr-extra-icon-right">'. $icon_html .'</span>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
echo '</div>';
}
}
@@ -0,0 +1,49 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
// Elementor Instance
$elementor_plugin = \Elementor\Plugin::$instance;
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<?php if ( ! current_theme_supports( 'title-tag' ) ) : ?>
<title><?php echo esc_html(wp_get_document_title()); ?></title>
<?php endif; ?>
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div class="wpr-template-popup">
<div class="wpr-template-popup-inner">
<!-- Popup Overlay & Close Button -->
<div class="wpr-popup-overlay"></div>
<!-- Template Container -->
<div class="wpr-popup-container">
<!-- Popup Close Button -->
<div class="wpr-popup-close-btn"><i class="eicon-close"></i></div>
<div class="wpr-popup-container-inner">
<?php $elementor_plugin->modules_manager->get_modules( 'page-templates' )->print_content(); ?>
</div>
</div>
</div>
</div>
<?php wp_footer(); ?>
</body>
</html>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\PostsTimeline;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-posts-timeline';
}
public function get_widgets() {
return [
'Wpr_Posts_Timeline', // This should match the widget/element class.
];
}
}
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\PriceList;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_widgets() {
return [
'Wpr_Price_List',
];
}
public function get_name() {
return 'wpr-price-list';
}
}
@@ -0,0 +1,883 @@
<?php
namespace WprAddons\Modules\PriceList\Widgets;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
use Elementor\Group_Control_Background;
use Elementor\Group_Control_Image_Size;
use Elementor\Group_Control_Css_Filter;
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Repeater;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use Elementor\Widget_Base;
use Elementor\Utils;
use Elementor\Icons;
use WprAddons\Classes\Utilities;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Wpr_Price_List extends Widget_Base {
public function get_name() {
return 'wpr-price-list';
}
public function get_title() {
return esc_html__( 'Price List', 'wpr-addons' );
}
public function get_icon() {
return 'wpr-icon eicon-price-list';
}
public function get_categories() {
return [ 'wpr-widgets'];
}
public function get_keywords() {
return [ 'royal', 'pricing list', 'price list', 'price menu', 'pricing menu', 'food menu', 'restaurant menu' ];
}
public function has_widget_inner_wrapper(): bool {
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
}
public function get_custom_help_url() {
if ( empty(get_option('wpr_wl_plugin_links')) )
// return 'https://royal-elementor-addons.com/contact/?ref=rea-plugin-panel-price-list-help-btn';
return 'https://wordpress.org/support/plugin/royal-elementor-addons/';
}
public function add_repeater_args_prlist_image() {
return [
'type' => Controls_Manager::HIDDEN,
'default' => ''
];
}
public function add_repeater_args_prlist_link() {
return [
'type' => Controls_Manager::HIDDEN,
'default' => ''
];
}
public function add_control_prlist_position() {}
public function add_control_prlist_vr_position() {}
public function add_section_style_image() {}
protected function register_controls() {
// Section: Items -----------
$this->start_controls_section(
'section_price_list_items',
[
'label' => esc_html__( 'Items', 'wpr-addons' ),
]
);
Utilities::wpr_library_buttons( $this, Controls_Manager::RAW_HTML );
$repeater = new Repeater();
$repeater->add_control(
'prlist_title',
[
'label' => esc_html__( 'Title', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'default' => 'Sweet Cakes',
]
);
$repeater->add_control(
'prlist_price',
[
'label' => esc_html__( 'Price', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'default' => '$30',
]
);
$repeater->add_control(
'prlist_old_price',
[
'label' => esc_html__( 'Old Price', 'wpr-addons' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'default' => '',
]
);
$repeater->add_control(
'prlist_description',
[
'label' => esc_html__( 'Description', 'wpr-addons' ),
'type' => Controls_Manager::TEXTAREA,
'dynamic' => [
'active' => true,
],
'default' => 'Lorem ipsum dolor sit amet, mea ei viderer probatus consequuntur, sonet vocibus lobortis has ad. Eos erant indoctum an, dictas invidunt est ex, et sea consulatu torquatos. Best pricing list widget.',
]
);
$repeater->add_control( 'prlist_image', $this->add_repeater_args_prlist_image() );
$repeater->add_control( 'prlist_link', $this->add_repeater_args_prlist_link() );
if ( !defined('WPR_ADDONS_PRO_VERSION') || !wpr_fs()->can_use_premium_code() ) {
$repeater->add_control(
'price_list_pro_notice',
[
'type' => Controls_Manager::RAW_HTML,
'raw' => '<span style="color:#2a2a2a;">Custom Image, Image Position and Custom Link</span> options are available<br> in the <strong><a href="https://royal-elementor-addons.com/?ref=rea-plugin-panel-price-list-upgrade-pro#purchasepro" target="_blank">Pro version</a></strong>',
// 'raw' => '<span style="color:#2a2a2a;">Custom Image, Image Position and Custom Link</span> options are available<br> in the <strong><a href="'. admin_url('admin.php?page=wpr-addons-pricing') .'" target="_blank">Pro version</a></strong>',
'content_classes' => 'wpr-pro-notice',
]
);
}
$this->add_control(
'prlist_items',
[
'type' => Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [
[
'prlist_title' => 'Sweet Cakes',
'prlist_price' => '$30',
'prlist_description' => 'Lorem ipsum dolor sit amet, mea ei viderer probatus consequuntur, sonet vocibus lobortis has ad. Eos erant indoctum an, dictas invidunt est ex, et sea consulatu torquatos. Best pricing list widget.',
'prlist_image' => [
'url' => Utils::get_placeholder_image_src(),
],
],
[
'prlist_title' => 'Fresh Vegetables',
'prlist_price' => '$50',
'prlist_description' => 'Lorem ipsum dolor sit amet, mea ei viderer probatus consequuntur, sonet vocibus lobortis has ad. Eos erant indoctum an, dictas invidunt est ex, et sea consulatu torquatos. Best pricing list widget.',
'prlist_image' => [
'url' => Utils::get_placeholder_image_src(),
],
],
[
'prlist_title' => 'White Potatoes',
'prlist_price' => '$27',
'prlist_old_price' => '35',
'prlist_description' => 'Lorem ipsum dolor sit amet, mea ei viderer probatus consequuntur, sonet vocibus lobortis has ad. Eos erant indoctum an, dictas invidunt est ex, et sea consulatu torquatos. Best pricing list widget.',
'prlist_image' => [
'url' => Utils::get_placeholder_image_src(),
],
],
],
'title_field' => '{{{ prlist_title }}}',
]
);
$this->add_control_prlist_position();
$this->add_control_prlist_vr_position();
$this->end_controls_section(); // End Controls Section
// Section: Request New Feature
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
// Section: Pro Features
Utilities::pro_features_list_section( $this, '', Controls_Manager::RAW_HTML, 'price-list', [
'Add Images to Menu Items',
'Add Custom Links to Menu Items',
'Advanced Layout Options',
] );
// Styles
// Section: General ----------
$this->start_controls_section(
'section_style_general',
[
'label' => esc_html__( 'General', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'general_bg_color',
'types' => [ 'classic', 'gradient' ],
'selector' => '{{WRAPPER}} .wpr-price-list-item'
]
);
$this->add_responsive_control(
'general_gutter',
[
'type' => Controls_Manager::SLIDER,
'label' => esc_html__( 'Gutter', 'wpr-addons' ),
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 50,
]
],
'default' => [
'unit' => 'px',
'size' => 5,
],
'selectors' => [
'{{WRAPPER}} .wpr-price-list-item' => 'margin-bottom: {{SIZE}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_responsive_control(
'general_padding',
[
'label' => esc_html__( 'Padding', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'default' => [
'top' => 10,
'right' => 10,
'bottom' => 10,
'left' => 10,
],
'size_units' => [ 'px' ],
'selectors' => [
'{{WRAPPER}} .wpr-price-list-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'general_border',
'label' => esc_html__( 'Border', 'wpr-addons' ),
'fields_options' => [
'color' => [
'default' => '#E8E8E8',
'width' => [
'default' => [
'top' => '1',
'right' => '1',
'bottom' => '1',
'left' => '1',
'isLinked' => true,
],
],
],
],
'selector' => '{{WRAPPER}} .wpr-price-list-item',
'separator' => 'before',
]
);
$this->add_control(
'general_border_radius',
[
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%' ],
'selectors' => [
'{{WRAPPER}} .wpr-price-list-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'default' => [
'top' => 2,
'right' => 2,
'bottom' => 2,
'left' => 2,
],
'separator' => 'before',
]
);
$this->add_control(
'general_box_shadow_divider',
[
'type' => Controls_Manager::DIVIDER,
'style' => 'thick',
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'general_box_shadow',
'selector' => '{{WRAPPER}} .wpr-price-list-item',
]
);
$this->end_controls_section(); // End Controls Section
// Styles
// Section: Image ------------
$this->add_section_style_image();
// Styles
// Section: Title ------------
$this->start_controls_section(
'section_style_title',
[
'label' => esc_html__( 'Title', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
'show_label' => false,
]
);
$this->add_control(
'title_color',
[
'type' => Controls_Manager::COLOR,
'label' => esc_html__( 'Color', 'wpr-addons' ),
'default' => '#605BE5',
'selectors' => [
'{{WRAPPER}} .wpr-price-list-title' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'title_typography',
'selector' => '{{WRAPPER}} .wpr-price-list-title',
]
);
$this->add_responsive_control(
'title_distance',
[
'type' => Controls_Manager::SLIDER,
'label' => esc_html__( 'Distance', 'wpr-addons' ),
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 50,
]
],
'default' => [
'unit' => 'px',
'size' => 5,
],
'selectors' => [
'{{WRAPPER}} .wpr-price-list-title' => 'margin-bottom: {{SIZE}}{{UNIT}};',
],
'separator' => 'before',
'condition' => [
'prlist_position' => 'center',
],
]
);
$this->end_controls_section(); // End Controls Section
// Styles
// Section: Separator ------------
$this->start_controls_section(
'section_style_separator',
[
'label' => esc_html__( 'Separator', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
'show_label' => false,
]
);
$this->add_control(
'separator_color',
[
'type' => Controls_Manager::COLOR,
'label' => esc_html__( 'Color', 'wpr-addons' ),
'default' => '#a8a8a8',
'selectors' => [
'{{WRAPPER}} .wpr-price-list-separator' => 'border-color: {{VALUE}};',
],
'separator' => 'after',
]
);
$this->add_control(
'separator_style',
[
'label' => esc_html__( 'Style', 'wpr-addons' ),
'type' => Controls_Manager::SELECT,
'options' => [
'none' => esc_html__( 'None', 'wpr-addons' ),
'solid' => esc_html__( 'Solid', 'wpr-addons' ),
'double' => esc_html__( 'Double', 'wpr-addons' ),
'dotted' => esc_html__( 'Dotted', 'wpr-addons' ),
'dashed' => esc_html__( 'Dashed', 'wpr-addons' ),
'groove' => esc_html__( 'Groove', 'wpr-addons' ),
],
'default' => 'dotted',
'selectors' => [
'{{WRAPPER}} .wpr-price-list-separator' => 'border-bottom-style: {{VALUE}};',
],
'render_type' => 'template',
]
);
$this->add_responsive_control(
'separator_weight',
[
'type' => Controls_Manager::SLIDER,
'label' => esc_html__( 'Weight', 'wpr-addons' ),
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 1,
'max' => 10,
]
],
'default' => [
'unit' => 'px',
'size' => 2,
],
'selectors' => [
'{{WRAPPER}} .wpr-price-list-separator' => 'border-bottom-width: {{SIZE}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_responsive_control(
'separator_spacing',
[
'type' => Controls_Manager::SLIDER,
'label' => esc_html__( 'Spacing', 'wpr-addons' ),
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 50,
]
],
'default' => [
'unit' => 'px',
'size' => 15,
],
'selectors' => [
'{{WRAPPER}} .wpr-price-list-separator' => 'margin-left: {{SIZE}}{{UNIT}};margin-right: {{SIZE}}{{UNIT}};',
],
]
);
$this->end_controls_section(); // End Controls Section
// Styles
// Section: Price ------------
$this->start_controls_section(
'section_style_price',
[
'label' => esc_html__( 'Price', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
'show_label' => false,
]
);
$this->add_control(
'price_color',
[
'type' => Controls_Manager::COLOR,
'label' => esc_html__( 'Color', 'wpr-addons' ),
'default' => '#605BE5',
'selectors' => [
'{{WRAPPER}} .wpr-price-list-price' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'price_bg_color',
[
'type' => Controls_Manager::COLOR,
'label' => esc_html__( 'Background Color', 'wpr-addons' ),
'selectors' => [
'{{WRAPPER}} .wpr-price-list-price-wrap' => 'background-color: {{VALUE}};',
],
]
);
$this->add_responsive_control(
'price_width',
[
'type' => Controls_Manager::SLIDER,
'label' => esc_html__( 'Min Width', 'wpr-addons' ),
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
]
],
'default' => [
'unit' => 'px',
'size' => 20,
],
'selectors' => [
'{{WRAPPER}} .wpr-price-list-price-wrap' => 'min-width: {{SIZE}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_control(
'price_typography_divider',
[
'type' => Controls_Manager::DIVIDER,
'style' => 'thick',
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'price_typography',
'selector' => '{{WRAPPER}} .wpr-price-list-price, {{WRAPPER}} .wpr-price-list-old-price',
]
);
$this->add_control(
'old_price_section',
[
'label' => esc_html__( 'Old Price', 'wpr-addons' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_control(
'old_price_color',
[
'type' => Controls_Manager::COLOR,
'label' => esc_html__( 'Color', 'wpr-addons' ),
'default' => '#f75959',
'selectors' => [
'{{WRAPPER}} .wpr-price-list-old-price' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'old_price_size',
[
'type' => Controls_Manager::SLIDER,
'label' => esc_html__( 'Font Size', 'wpr-addons' ),
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 10,
'max' => 50,
]
],
'default' => [
'unit' => 'px',
'size' => 11,
],
'selectors' => [
'{{WRAPPER}} .wpr-price-list-old-price' => 'font-size: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'old_price_hr_position',
[
'label' => esc_html__( 'Alignment', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'label_block' => false,
'default' => 'before',
'options' => [
'before' => [
'title' => esc_html__( 'Before', 'wpr-addons' ),
'icon' => 'eicon-h-align-left',
],
'after' => [
'title' => esc_html__( 'After', 'wpr-addons' ),
'icon' => 'eicon-h-align-right',
],
],
'prefix_class' => 'wpr-price-list-old-position-',
'render_type' => 'template',
]
);
$this->add_control(
'old_price_vr_position',
[
'label' => esc_html__( 'Vertical Position', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'label_block' => false,
'options' => [
'top' => [
'title' => esc_html__( 'Top', 'wpr-addons' ),
'icon' => 'eicon-v-align-top',
],
'middle' => [
'title' => esc_html__( 'Middle', 'wpr-addons' ),
'icon' => 'eicon-v-align-middle',
],
'bottom' => [
'title' => esc_html__( 'Bottom', 'wpr-addons' ),
'icon' => 'eicon-v-align-bottom',
],
],
'default' => 'top',
'selectors_dictionary' => [
'top' => 'flex-start',
'middle' => 'center',
'bottom' => 'flex-end',
],
'selectors' => [
'{{WRAPPER}} .wpr-price-list-old-price' => '-webkit-align-self: {{VALUE}}; align-self: {{VALUE}};',
],
]
);
$this->add_responsive_control(
'price_padding',
[
'label' => esc_html__( 'Padding', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'default' => [
'top' => 0,
'right' => 0,
'bottom' => 0,
'left' => 0,
],
'size_units' => [ 'px' ],
'selectors' => [
'{{WRAPPER}} .wpr-price-list-price-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'price_border',
'label' => esc_html__( 'Border', 'wpr-addons' ),
'fields_options' => [
'color' => [
'default' => '#E8E8E8',
'width' => [
'default' => [
'top' => '1',
'right' => '1',
'bottom' => '1',
'left' => '1',
'isLinked' => true,
],
],
],
],
'selector' => '{{WRAPPER}} .wpr-price-list-price-wrap',
'separator' => 'before',
]
);
$this->add_control(
'price_border_radius',
[
'label' => esc_html__( 'Border Radius', 'wpr-addons' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%' ],
'selectors' => [
'{{WRAPPER}} .wpr-price-list-price-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'default' => [
'top' => 1,
'right' => 1,
'bottom' => 1,
'left' => 1,
],
'separator' => 'before',
]
);
$this->add_control(
'price_box_shadow_divider',
[
'type' => Controls_Manager::DIVIDER,
'style' => 'thick',
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'price_box_shadow',
'selector' => '{{WRAPPER}} .wpr-price-list-price-wrap',
]
);
$this->end_controls_section(); // End Controls Section
// Styles
// Section: Description ------
$this->start_controls_section(
'section_style_description',
[
'label' => esc_html__( 'Description', 'wpr-addons' ),
'tab' => Controls_Manager::TAB_STYLE,
'show_label' => false,
]
);
$this->add_control(
'description_color',
[
'type' => Controls_Manager::COLOR,
'label' => esc_html__( 'Color', 'wpr-addons' ),
'default' => '#757575',
'selectors' => [
'{{WRAPPER}} .wpr-price-list-description' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'description_typography',
'selector' => '{{WRAPPER}} .wpr-price-list-description',
]
);
$this->add_control(
'description_align',
[
'label' => esc_html__( 'Alignment', 'wpr-addons' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'left',
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'wpr-addons' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'wpr-addons' ),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'wpr-addons' ),
'icon' => 'eicon-text-align-right',
],
'justify' => [
'title' => esc_html__( 'Justify', 'wpr-addons' ),
'icon' => 'eicon-text-align-justify',
],
],
'selectors' => [
'{{WRAPPER}} .wpr-price-list-description' => 'text-align: {{VALUE}};',
],
'separator' => 'before',
]
);
$this->add_responsive_control(
'description_distance',
[
'type' => Controls_Manager::SLIDER,
'label' => esc_html__( 'Distance', 'wpr-addons' ),
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 50,
]
],
'default' => [
'unit' => 'px',
'size' => 7,
],
'selectors' => [
'{{WRAPPER}} .wpr-price-list-description' => 'margin-top: {{SIZE}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->end_controls_section(); // End Controls Section
}
public function render_pro_element_image($item, $item_count) {}
protected function render() {
$settings = $this->get_settings();
$item_count = 0;
?>
<div class="wpr-price-list">
<?php foreach ( $settings['prlist_items'] as $item ) : ?>
<div class="wpr-price-list-item elementor-repeater-item-<?php echo esc_attr( $item['_id'] ); ?> elementor-clearfix">
<?php $this->render_pro_element_image($item, $item_count); ?>
<div class="wpr-price-list-content">
<div class="wpr-price-list-heading">
<?php if ( '' !== $item['prlist_title'] ) : ?>
<span class="wpr-price-list-title"><?php echo esc_html( $item['prlist_title'] ); ?></span>
<?php endif; ?>
<?php if ( 'none' !== $settings['separator_style'] ) : ?>
<span class="wpr-price-list-separator"></span>
<?php endif ?>
<?php if ( '' !== $item['prlist_price'] || '' !== $item['prlist_old_price'] ) : ?>
<span class="wpr-price-list-price-wrap">
<?php if ( '' !== $item['prlist_price'] ) : ?>
<span class="wpr-price-list-price"><?php echo esc_html( $item['prlist_price'] ); ?></span>
<?php endif; ?>
<?php if ( '' !== $item['prlist_old_price'] ) : ?>
<span class="wpr-price-list-old-price"><?php echo esc_html( $item['prlist_old_price'] ); ?></span>
<?php endif; ?>
</span>
<?php endif; ?>
</div>
<?php if ( '' !== $item['prlist_description'] ) : ?>
<div class="wpr-price-list-description"><?php echo wp_kses_post( $item['prlist_description'] ); ?></div>
<?php endif; ?>
</div>
</div>
<?php
$item_count++;
endforeach;
?>
</div>
<?php
}
}
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\PricingTable;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_widgets() {
return [
'Pricing_Table',
];
}
public function get_name() {
return 'wpr-pricing-table';
}
}
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\ProgressBar;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_widgets() {
return [
'Wpr_Progress_Bar',
];
}
public function get_name() {
return 'wpr-progress-bar';
}
}
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\PromoBox;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_widgets() {
return [
'Wpr_Promo_Box',
];
}
public function get_name() {
return 'wpr-promo-box';
}
}
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\ReadingProgressBar;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_widgets() {
return [
'Wpr_Reading_Progress_Bar',
];
}
public function get_name() {
return 'wpr-reading-progress-bar';
}
}
@@ -0,0 +1,201 @@
<?php
namespace WprAddons\Modules\ReadingProgressBar\Widgets;
// Elementor classes
use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
use Elementor\Group_Control_Background;
use Elementor\Group_Control_Image_Size;
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Repeater;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use Elementor\Widget_Base;
use Elementor\Icons;
use Elementor\Utils;
use WprAddons\Classes\Utilities;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Wpr_Reading_Progress_Bar extends Widget_Base {
public function get_name() {
return 'wpr-reading-progress-bar';
}
public function get_title() {
return esc_html__( 'Reading Progress Bar', 'wpr-addons' );
}
public function get_icon() {
return 'wpr-icon eicon-skill-bar';
}
public function get_categories() {
return [ 'wpr-widgets'];
}
public function get_keywords() {
return [ 'royal', 'reading progress bar', 'skills bar', 'percentage bar', 'scroll' ];
}
public function has_widget_inner_wrapper(): bool {
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
}
public function get_custom_help_url() {
if ( empty(get_option('wpr_wl_plugin_links')) )
// return 'https://royal-elementor-addons.com/contact/?ref=rea-plugin-panel-progress-bar-help-btn';
return 'https://wordpress.org/support/plugin/royal-elementor-addons/';
}
public function is_reload_preview_required() {
return true;
}
public function register_controls() {
$this->start_controls_section(
'reading_progress_bar',
[
'tab' => Controls_Manager::TAB_CONTENT,
'label' => __( 'Reading Progress Bar - Royal Addons', 'wpr-addons' ),
]
);
Utilities::wpr_library_buttons( $this, Controls_Manager::RAW_HTML );
$this->add_control(
'rpb_info',
[
'raw' => esc_html__( 'Please scroll down a page to see how Progress Bar in works action.', 'wpr-addons' ),
'type' => Controls_Manager::RAW_HTML,
'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
]
);
$this->add_control(
'rpb_height',
[
'label' => __( 'Height', 'wpr-addons' ),
'type' => Controls_Manager::SLIDER,
'render_type' => 'template',
'range' => [
'px' => [
'min' => 1,
'max' => 100,
'step' => 1,
],
],
'default' => [
'unit' => 'px',
'size' => 10,
],
'selectors' => [
'.wpr-reading-progress-bar-container' => 'height: {{SIZE}}{{UNIT}} !important',
'.wpr-reading-progress-bar-container .wpr-reading-progress-bar' => 'height: {{SIZE}}{{UNIT}} !important',
],
'separator' => 'before'
]
);
$this->add_control(
'progress_bar_position',
[
'label' => __( 'Position', 'wpr-addons' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'top',
'render_type' => 'template',
'separator' => 'before',
'options' => [
'top' => __( 'Top', 'wpr-addons' ),
'bottom' => __( 'Bottom', 'wpr-addons' ),
],
'selectors_dictionary' => [
'top' => 'top: 0px; bottom: auto;',
'bottom' => 'bottom: 0px; top: auto;',
],
'selectors' => [
'{{WRAPPER}} .wpr-reading-progress-bar-container' => '{{VALUE}}',
]
]
);
$this->add_control(
'rpb_background_type',
[
'label' => __( 'Background Type', 'wpr-addons' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'transparent',
'render_type' => 'template',
'options' => [
'transparent' => __( 'Transparent', 'wpr-addons' ),
'colored' => __( 'Colored', 'wpr-addons' ),
]
]
);
$this->add_control(
'rpb_background_color',
[
'label' => __( 'Background Color', 'wpr-addons' ),
'type' => \Elementor\Controls_Manager::COLOR,
'default' => '#C5C5C6',
'selectors' => [
'.wpr-reading-progress-bar-container' => 'background-color: {{VALUE}};'
],
'condition' => [
'background_type' => 'colored'
]
]
);
$this->add_control(
'rpb_fill_color',
[
'label' => __( 'Fill Color', 'wpr-addons' ),
'type' => \Elementor\Controls_Manager::COLOR,
'default' => '#6A63DA',
'selectors' => [
'.wpr-reading-progress-bar-container .wpr-reading-progress-bar' => 'background-color: {{VALUE}};'
]
]
);
$this->add_control(
'rpb_transition_duration',
[
'label' => esc_html__( 'Animation Duration', 'wpr-addons' ),
'type' => Controls_Manager::NUMBER,
'default' => 0.1,
'min' => 0,
'max' => 5,
'step' => 0.1,
'separator' => 'before',
'selectors' => [
'{{WRAPPER}} .wpr-reading-progress-bar' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s;',
]
]
);
$this->end_controls_section();
// Section: Request New Feature
Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' );
}
protected function render() {
$settings = $this->get_settings_for_display();
$this->add_render_attribute( 'wpr-rpb-attrs', [
'class' => 'wpr-reading-progress-bar-container',
'data-background-type' => $settings['rpb_background_type'],
] );
echo '<div '. $this->get_render_attribute_string('wpr-rpb-attrs') .'><div class="wpr-reading-progress-bar"></div></div>';
}
}
@@ -0,0 +1,21 @@
<?php
namespace WprAddons\Modules\Search;
use WprAddons\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function get_widgets() {
return [
'Wpr_Search',
];
}
public function get_name() {
return 'wpr-search';
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,24 @@
<?php
namespace WprAddons\Modules\SharingButtons;
use WprAddons\Base\Module_Base;
class Module extends Module_Base {
public function __construct() {
parent::__construct();
// This is here for extensibility purposes - go to town and make things happen!
}
public function get_name() {
return 'wpr-sharing-buttons';
}
public function get_widgets() {
return [
'Wpr_Sharing_Buttons', // This should match the widget/element class.
];
}
}

Some files were not shown because too many files have changed in this diff Show More