PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.6
ShopBuilder – WooCommerce Builder For Elementor v3.2.6
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
shopbuilder / app / Elementor / Widgets / General / ProgressBar / ProgressBar.php

ProgressBar.php in ShopBuilder – WooCommerce Builder For Elementor 3.2.6, at app/Elementor/Widgets/General/ProgressBar/ProgressBar.php

138 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * AdvancedHeading class.
4 *
5 * @package RadiusTheme\SB
6 */
7
8 namespace RadiusTheme\SB\Elementor\Widgets\General\ProgressBar;
9
10 use RadiusTheme\SB\Helpers\Fns;
11 use RadiusTheme\SB\Abstracts\ElementorWidgetBase;
12
13 // Do not allow directly accessing this file.
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit( 'This script cannot be accessed directly.' );
16 }
17
18 /**
19 * Dropcaps class.
20 *
21 * @package RadiusTheme\SB
22 */
23 class ProgressBar extends ElementorWidgetBase {
24 /**
25 * Construct function
26 *
27 * @param array $data default array.
28 * @param mixed $args default arg.
29 */
30 public function __construct( $data = [], $args = null ) {
31 $this->rtsb_name = esc_html__( 'Progress Bar', 'shopbuilder' );
32 $this->rtsb_base = 'rtsb-progress-bar-addon';
33
34 parent::__construct( $data, $args );
35
36 $this->rtsb_category = 'rtsb-shopbuilder-general';
37 }
38 /**
39 * Whether the element returns dynamic content.
40 *
41 * @return bool
42 */
43 protected function is_dynamic_content(): bool {
44 return false;
45 }
46 /**
47 * Widget Field
48 *
49 * @return array
50 */
51 public function widget_fields() {
52 return array_merge(
53 Controls::content( $this ),
54 Controls::style( $this )
55 );
56 }
57 /**
58 * Set Widget Keyword.
59 *
60 * @return array
61 */
62 public function get_keywords() {
63 return [ 'Progress Bar','Progress' ] + parent::get_keywords();
64 }
65 /**
66 * Style dependencies.
67 *
68 * @return array
69 */
70 public function get_style_depends() {
71 return [
72 'rtsb-general-addons',
73 ];
74 }
75
76 /**
77 * Addon Render.
78 *
79 * @return void
80 */
81 protected function render() {
82 $settings = $this->get_settings_for_display();
83
84 $template = 'progress-bar';
85 $template = apply_filters( 'rtsb/general_widget/progress_bar/template', $template, $settings );
86 $data = [
87 'template' => 'elementor/general/progress-bar/' . $template,
88 'id' => $this->get_id(),
89 'unique_name' => $this->get_unique_name(),
90 'layout' => $settings['layout_style'],
91 'settings' => $settings,
92 'is_carousel' => false,
93 'container_class' => '',
94 'content_class' => '',
95 ];
96
97 // Render initialization.
98 $this->theme_support();
99
100 // Call the template rendering method.
101 Fns::print_html( ( new Render() )->display_content( $data, $settings ), true );
102 $this->edit_mode_progress_bar_script();
103 $this->theme_support( 'render_reset' );
104 }
105
106 /**
107 * Edit mode progress bar script.
108 *
109 * @return void
110 */
111 private function edit_mode_progress_bar_script() {
112 if ( ! $this->is_edit_mode() ) {
113 return;
114 }
115 ?>
116 <script>
117 if (!'<?php echo esc_attr( Fns::is_optimization_enabled() ); ?>') {
118 setTimeout(function() {
119 rtsbProgressBarAnimationInit();
120 }, 1000);
121 } else {
122 if (typeof elementorFrontend !== 'undefined') {
123 elementorFrontend.hooks.addAction(
124 'frontend/element_ready/rtsb-progress-bar-addon.default',
125 () => {
126 window.waitForRTSB((RTSB) => {
127 RTSB.modules.get('progressBar')?.refresh();
128 });
129 }
130 );
131 }
132 }
133 </script>
134
135 <?php
136 }
137 }
138