PluginProbe ʕ •ᴥ•ʔ
Premium Addons for Elementor – Powerful Elementor Templates & Widgets / 4.10.79
Premium Addons for Elementor – Powerful Elementor Templates & Widgets v4.10.79
4.11.79 4.11.78 4.11.77 4.11.76 4.11.75 3.20.5 4.11.69 3.20.6 4.11.7 3.20.7 4.11.70 3.20.8 4.11.71 3.20.9 4.11.72 3.21.1 4.11.73 3.21.2 4.11.74 3.21.3 4.11.8 3.21.4 4.11.9 3.21.5 4.2.0 3.21.6 4.2.1 3.3.0 4.2.2 3.3.1 4.2.3 3.3.2 4.2.4 3.3.3 4.2.5 3.3.4 4.2.6 3.3.5 4.2.7 3.3.6 4.2.8 3.3.7 4.2.9 3.3.8 4.3.0 3.3.9 4.3.1 3.4.0 4.3.2 3.4.1 4.3.3 3.4.2 4.3.4 3.4.3 4.3.5 3.4.4 4.3.6 3.4.5 4.3.7 3.4.6 4.3.8 3.4.7 4.3.9 3.4.8 4.4.0 3.4.9 4.4.1 3.5.0 4.4.2 3.5.1 4.4.3 3.5.2 4.4.4 3.5.3 4.4.5 3.5.4 4.4.6 3.5.5 4.4.7 3.5.6 4.4.8 3.5.7 4.4.9 3.5.8 4.5.0 3.5.9 4.5.1 3.6.0 4.5.2 3.6.1 4.5.3 3.6.2 4.5.4 3.6.3 4.5.5 3.6.4 4.5.6 3.6.5 4.5.7 3.6.6 4.5.8 3.6.7 4.5.9 3.6.8 4.6.0 3.6.9 4.6.1 3.7.0 4.7.0 3.7.1 4.7.1 3.7.2 4.7.2 3.7.3 4.7.3 3.7.4 4.7.4 3.7.5 4.7.5 3.7.6 4.7.6 3.7.7 4.7.7 3.7.8 4.7.8 3.7.9 4.7.9 3.8.0 4.8.0 3.8.1 4.8.1 3.8.2 4.8.10 3.8.3 4.8.11 3.8.4 4.8.2 3.8.5 4.8.3 3.8.6 4.8.4 3.8.7 4.8.5 3.8.8 4.8.6 3.8.9 4.8.7 3.9.0 4.8.8 3.9.1 4.8.9 3.9.2 4.9.0 3.9.3 4.9.0-beta1 3.9.4 4.9.0-beta2 3.9.5 4.9.1 3.9.6 4.9.10 3.9.7 4.9.11 3.9.8 4.9.12 3.9.9 4.9.13 4.0.1 4.9.14 4.0.3 4.9.15 4.0.4 4.9.16 4.0.5 4.9.17 4.0.6 4.9.18 4.0.7 4.9.19 4.0.8 4.9.2 4.0.9 4.9.20 4.1.0 4.9.21 4.1.1 4.9.22 4.1.2 4.9.23 4.1.3 4.9.24 trunk 4.1.4 4.9.25 1.0 4.1.5 4.9.26 1.01 4.1.6 4.9.27 1.02 4.1.7 4.9.28 1.03 4.1.8 4.9.29 1.04 4.1.9 4.9.3 1.05 4.10.0 4.9.30 1.06 4.10.1 4.9.31 1.07 4.10.10 4.9.32 1.08 4.10.11 4.9.33 1.09 4.10.12 4.9.34 2.0 4.10.13 4.9.35 2.0.1 4.10.14 4.9.36 2.0.2 4.10.15 4.9.37 2.0.3 4.10.16 4.9.38 2.0.4 4.10.17 4.9.39 2.0.5 4.10.18 4.9.4 2.0.6 4.10.19 4.9.40 2.0.7 4.10.2 4.9.41 2.0.8 4.10.20 4.9.42 2.0.9 4.10.21 4.9.43 2.1.0 4.10.22 4.9.45 2.1.1 4.10.23 4.9.46 2.1.2 4.10.24 4.9.47 2.1.3 4.10.25 4.9.48 2.1.4 4.10.26 4.9.49 2.1.5 4.10.27 4.9.5 2.1.5-beta1 4.10.28 4.9.50 2.1.6 4.10.29 4.9.51 2.1.7 4.10.3 4.9.52 2.1.8 4.10.30 4.9.53 2.1.9 4.10.31 4.9.54 2.2.0 4.10.32 4.9.55 2.2.1 4.10.33 4.9.56 2.2.2 4.10.34 4.9.57 2.2.3 4.10.35 4.9.6 2.2.4 4.10.36 4.9.7 2.2.5 4.10.37 4.9.8 2.2.6 4.10.38 4.9.9 2.2.7 4.10.39 2.2.8 4.10.4 2.2.9 4.10.40 2.3.0 4.10.41 2.3.1 4.10.42 2.3.2 4.10.43 2.3.3 4.10.44 2.3.4 4.10.45 2.3.5 4.10.46 2.3.6 4.10.47 2.3.7 4.10.48 2.3.8 4.10.49 2.3.9 4.10.5 2.4.0 4.10.50 2.4.1 4.10.51 2.5.0 4.10.52 2.5.1 4.10.53 2.5.2 4.10.54 2.5.3 4.10.55 2.5.4 4.10.56 2.5.5 4.10.57 2.5.6 4.10.58 2.5.7 4.10.59 2.5.8 4.10.6 2.5.9 4.10.60 2.6.0 4.10.61 2.6.1 4.10.62 2.6.2 4.10.63 2.6.3 4.10.64 2.6.4 4.10.65 2.6.5 4.10.66 2.6.6 4.10.67 2.6.7 4.10.68 2.6.8 4.10.69 2.6.9 4.10.7 2.7.0 4.10.70 2.7.1 4.10.71 2.7.2 4.10.72 2.7.3 4.10.73 2.7.4 4.10.74 2.7.5 4.10.75 2.7.6 4.10.76 2.7.7 4.10.77 2.7.8 4.10.78 2.7.9 4.10.79 2.8.0 4.10.8 2.8.1 4.10.80 2.8.2 4.10.81 2.8.3 4.10.82 2.8.4 4.10.83 2.8.5 4.10.84 2.8.6 4.10.85 2.8.7 4.10.86 2.8.8 4.10.87 2.8.9 4.10.88 2.9.0 4.10.89 2.9.1 4.10.9 2.9.2 4.10.90 2.9.3 4.11.0 2.9.4 4.11.1 2.9.5 4.11.10 2.9.6 4.11.11 2.9.7 4.11.12 2.9.8 4.11.13 2.9.9 4.11.14 3.0.0 4.11.15 3.0.1 4.11.16 3.0.2 4.11.17 3.0.3 4.11.18 3.0.4 4.11.19 3.0.5 4.11.2 3.0.6 4.11.20 3.0.7 4.11.21 3.0.8 4.11.22 3.0.9 4.11.23 3.1.0 4.11.24 3.1.1 4.11.25 3.1.2 4.11.26 3.1.3 4.11.27 3.1.4 4.11.28 3.1.5 4.11.29 3.1.6 4.11.3 3.1.7 4.11.30 3.1.8 4.11.31 3.1.9 4.11.32 3.10.0 4.11.33 3.10.1 4.11.34 3.10.2 4.11.35 3.10.3 4.11.36 3.10.4 4.11.37 3.10.5 4.11.38 3.10.6 4.11.39 3.10.7 4.11.4 3.10.8 4.11.40 3.10.9 4.11.41 3.11.0 4.11.42 3.11.1 4.11.43 3.11.2 4.11.44 3.11.3 4.11.45 3.11.4 4.11.46 3.11.5 4.11.47 3.11.6 4.11.48 3.11.7 4.11.49 3.11.8 4.11.5 3.11.9 4.11.50 3.12.0 4.11.51 3.12.1 4.11.52 3.12.2 4.11.53 3.12.3 4.11.54 3.2.0 4.11.55 3.2.1 4.11.56 3.2.2 4.11.57 3.2.3 4.11.58 3.2.4 4.11.59 3.2.5 4.11.6 3.2.6 4.11.60 3.2.7 4.11.61 3.2.8 4.11.62 3.2.9 4.11.63 3.20.0 4.11.64 3.20.1 4.11.65 3.20.2 4.11.66 3.20.3 4.11.67 3.20.4 4.11.68
premium-addons-for-elementor / widgets / premium-weather.php
premium-addons-for-elementor / widgets Last commit date
dep 1 year ago premium-banner.php 1 year ago premium-blog.php 1 year ago premium-button.php 1 year ago premium-carousel.php 1 year ago premium-contactform.php 1 year ago premium-countdown.php 1 year ago premium-counter.php 1 year ago premium-dual-header.php 1 year ago premium-fancytext.php 1 year ago premium-grid.php 1 year ago premium-icon-list.php 1 year ago premium-image-button.php 1 year ago premium-image-scroll.php 1 year ago premium-image-separator.php 1 year ago premium-lottie.php 1 year ago premium-maps.php 1 year ago premium-media-wheel.php 1 year ago premium-mobile-menu.php 1 year ago premium-modalbox.php 1 year ago premium-nav-menu.php 1 year ago premium-notifications.php 1 year ago premium-person.php 1 year ago premium-pinterest-feed.php 1 year ago premium-post-ticker.php 1 year ago premium-pricing-table.php 1 year ago premium-progressbar.php 1 year ago premium-search-form.php 1 year ago premium-svg-drawer.php 1 year ago premium-tcloud.php 1 year ago premium-testimonials.php 1 year ago premium-textual-showcase.php 1 year ago premium-tiktok-feed.php 1 year ago premium-title.php 1 year ago premium-videobox.php 1 year ago premium-vscroll.php 1 year ago premium-weather.php 1 year ago premium-world-clock.php 1 year ago
premium-weather.php
4833 lines
1 <?php
2 /**
3 * Premium Weather.
4 */
5
6 namespace PremiumAddons\Widgets;
7
8 // Elementor Classes.
9 use Elementor\Utils;
10 use Elementor\Plugin;
11 use Elementor\Widget_Base;
12 use Elementor\Icons_Manager;
13 use Elementor\Controls_Manager;
14 use Elementor\Group_Control_Border;
15 use Elementor\Group_Control_Background;
16 use Elementor\Group_Control_Typography;
17 use Elementor\Group_Control_Box_Shadow;
18 use Elementor\Group_Control_Text_Shadow;
19 use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
20
21 // PremiumAddons Classes.
22 use PremiumAddons\Includes\Helper_Functions;
23 use PremiumAddons\Admin\Includes\Admin_Helper;
24
25 if ( ! defined( 'ABSPATH' ) ) {
26 exit; // If this file is called directly, abort.
27 }
28
29 /**
30 * Class Premium_Weather.
31 */
32 class Premium_Weather extends Widget_Base {
33
34 /**
35 * Options
36 *
37 * @var options
38 */
39 private $options = null;
40
41 /**
42 * Settings
43 *
44 * @var settings
45 */
46 public $settings = null;
47
48 /**
49 * Check Icon Draw Option.
50 *
51 * @since 4.9.26
52 * @access public
53 */
54 public function check_icon_draw() {
55 $is_enabled = Admin_Helper::check_svg_draw( 'premium-weather' );
56 return $is_enabled;
57 }
58
59 /**
60 * Retrieve Widget Name.
61 *
62 * @since 1.0.0
63 * @access public
64 */
65 public function get_name() {
66 return 'premium-weather';
67 }
68
69 /**
70 * Retrieve Widget Title.
71 *
72 * @since 1.0.0
73 * @access public
74 */
75 public function get_title() {
76 return __( 'Weather', 'premium-addons-for-elementor' );
77 }
78
79 /**
80 * Retrieve Widget Icon.
81 *
82 * @since 1.0.0
83 * @access public
84 *
85 * @return string widget icon.
86 */
87 public function get_icon() {
88 return 'pa-weather';
89 }
90
91 /**
92 * Retrieve Widget Keywords.
93 *
94 * @since 1.0.0
95 * @access public
96 *
97 * @return string Widget keywords.
98 */
99 public function get_keywords() {
100 return array( 'pa', 'premium', 'premium weather', 'magazine', 'news', 'weather', 'forecast' );
101 }
102
103 /**
104 * Retrieve Widget Categories.
105 *
106 * @since 1.5.1
107 * @access public
108 *
109 * @return array Widget categories.
110 */
111 public function get_categories() {
112 return array( 'premium-elements' );
113 }
114
115 /**
116 * Widget preview refresh button.
117 *
118 * @since 1.0.0
119 * @access public
120 */
121 public function is_reload_preview_required() {
122 return true;
123 }
124
125 /**
126 * Retrieve Widget Dependent CSS.
127 *
128 * @since 1.0.0
129 * @access public
130 *
131 * @return array CSS style handles.
132 */
133 public function get_style_depends() {
134
135 return array(
136 'font-awesome-5-all',
137 'pa-slick',
138 'premium-addons',
139 );
140 }
141
142 /**
143 * Retrieve Widget Dependent JS.
144 *
145 * @since 1.0.0
146 * @access public
147 *
148 * @return array JS script handles.
149 */
150 public function get_script_depends() {
151
152 $draw_scripts = $this->check_icon_draw() ? array(
153 // 'pa-fontawesome-all',
154 'pa-tweenmax',
155 'pa-motionpath',
156 ) : array();
157
158 return array_merge(
159 $draw_scripts,
160 array(
161 'pa-slick',
162 'pa-slimscroll',
163 'lottie-js',
164 'premium-addons',
165 )
166 );
167 }
168
169 /**
170 * Retrieve Widget Support URL.
171 *
172 * @access public
173 *
174 * @return string support URL.
175 */
176 public function get_custom_help_url() {
177 return 'https://premiumaddons.com/support/';
178 }
179
180 public function has_widget_inner_wrapper(): bool {
181 return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
182 }
183
184 /**
185 * Register Smart Post Listing controls.
186 *
187 * @since 1.0.0
188 * @access protected
189 */
190 protected function register_controls() {
191
192 $this->options = apply_filters(
193 'pa_weather_options',
194 array(
195 'source' => array(
196 'name' => __( 'City Name', 'premium-addons-for-elementor' ),
197 'coords' => __( 'City Coordinates (Pro)', 'premium-addons-for-elementor' ),
198 ),
199 'layouts' => array(
200 'layout-1' => __( 'Layout 1', 'premium-addons-for-elementor' ),
201 'layout-2' => __( 'Layout 2', 'premium-addons-for-elementor' ),
202 'layout-3' => __( 'Layout 3 (Pro)', 'premium-addons-for-elementor' ),
203 ),
204 'source_condition' => array( 'coords' ),
205 'dailyf_condition' => array(
206 'enable_forecast' => 'yes',
207 ),
208 'custom_icons_condition' => array(
209 'enable_custom_icon' => 'yes',
210 ),
211 )
212 );
213
214 $this->register_content_tab_controls();
215 $this->register_style_tab_controls();
216 }
217
218 /**
219 * Adds content tab controls.
220 *
221 * @access private
222 * @since 4.9.37
223 */
224 private function register_content_tab_controls() {
225
226 $this->add_general_section_controls();
227 $this->add_display_options_section();
228 $this->add_hourly_forecast_section();
229 $this->add_daily_forecast_section();
230 $this->add_custom_icons_section();
231 $this->add_helpful_info_section();
232 }
233
234 /**
235 * Adds style tab controls.
236 *
237 * @access private
238 * @since 4.9.37
239 */
240 private function register_style_tab_controls() {
241
242 $this->add_city_style();
243 $this->add_current_weather_style();
244 $this->add_hourly_style();
245 $this->add_forecast_style();
246 $this->add_tabs_style();
247 $this->add_navigation_style();
248 $this->add_outer_container_style();
249 }
250
251 /**
252 * Adds General controls.
253 *
254 * @access private
255 * @since 4.9.37
256 */
257 private function add_general_section_controls() {
258
259 $papro_activated = apply_filters( 'papro_activated', false );
260
261 $this->start_controls_section(
262 'pa_weather_general_section',
263 array(
264 'label' => __( 'General Settings', 'premium-addons-for-elementor' ),
265 )
266 );
267
268 $this->add_control(
269 'api_key',
270 array(
271 'label' => __( 'API Key', 'premium-addons-for-elementor' ),
272 'type' => Controls_Manager::TEXT,
273 'label_block' => true,
274 'description' => 'Get your OpenWeatherMap API Key by signing up <a href="https://openweathermap.org/" target="_blank">here</a>',
275 )
276 );
277
278 $this->add_control(
279 'location_type',
280 array(
281 'label' => __( 'Location', 'premium-addons-for-elementor' ),
282 'type' => Controls_Manager::SELECT,
283 'render_type' => 'template',
284 'label_block' => true,
285 'options' => array(
286 'current' => __( 'Current Location', 'premium-addons-for-elementor' ),
287 'custom' => __( 'Custom Location', 'premium-addons-for-elementor' ),
288 ),
289 'default' => 'custom',
290 )
291 );
292
293 $this->add_control(
294 'custom_location_type',
295 array(
296 'label' => __( 'Get By:', 'premium-addons-for-elementor' ),
297 'type' => Controls_Manager::SELECT,
298 'render_type' => 'template',
299 'label_block' => true,
300 'options' => $this->options['source'],
301 'default' => 'name',
302 'condition' => array(
303 'location_type' => 'custom',
304 ),
305 )
306 );
307
308 $this->add_control(
309 'city_name',
310 array(
311 'label' => __( 'City Name', 'premium-addons-for-elementor' ),
312 'type' => Controls_Manager::TEXT,
313 'dynamic' => array( 'active' => true ),
314 'label_block' => true,
315 'default' => 'London',
316 'condition' => array(
317 'location_type' => 'custom',
318 'custom_location_type' => 'name',
319 ),
320 )
321 );
322
323 if ( ! $papro_activated ) {
324
325 $get_pro = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/pro', 'weather-widget', 'wp-editor', 'get-pro' );
326
327 $this->add_control(
328 'weather_notice',
329 array(
330 'type' => Controls_Manager::RAW_HTML,
331 'raw' => __( 'This option is available in Premium Addons Pro. ', 'premium-addons-for-elementor' ) . '<a href="' . esc_url( $get_pro ) . '" target="_blank">' . __( 'Upgrade now!', 'premium-addons-for-elementor' ) . '</a>',
332 'content_classes' => 'papro-upgrade-notice',
333 'condition' => array(
334 'custom_location_type' => $this->options['source_condition'],
335 ),
336 )
337 );
338
339 } else {
340 do_action( 'pa_weather_source_controls', $this );
341 }
342
343 $this->add_control(
344 'unit',
345 array(
346 'label' => __( 'Unit', 'premium-addons-for-elementor' ),
347 'type' => Controls_Manager::SELECT,
348 'render_type' => 'template',
349 'label_block' => true,
350 'options' => array(
351 'metric' => __( 'Metric', 'premium-addons-for-elementor' ),
352 'imperial' => __( 'Imperial', 'premium-addons-for-elementor' ),
353 ),
354 'default' => 'metric',
355 )
356 );
357
358 $this->add_control(
359 'lang',
360 array(
361 'label' => __( 'Language', 'premium-addons-for-elementor' ),
362 'type' => Controls_Manager::SELECT,
363 'description' => __( 'Please note that this affects only the city name and weather description', 'premium-addons-for-elementor' ),
364 'render_type' => 'template',
365 'label_block' => true,
366 'options' => array(
367 'af' => __( 'Afrikaans', 'premium-addons-for-elementor' ),
368 'al' => __( 'Albanian', 'premium-addons-for-elementor' ),
369 'ar' => __( 'Arabic', 'premium-addons-for-elementor' ),
370 'az' => __( 'Azerbaijani', 'premium-addons-for-elementor' ),
371 'bg' => __( 'Bulgarian', 'premium-addons-for-elementor' ),
372 'ca' => __( 'Catalan', 'premium-addons-for-elementor' ),
373 'cz' => __( 'Czech', 'premium-addons-for-elementor' ),
374 'da' => __( 'Danish', 'premium-addons-for-elementor' ),
375 'de' => __( 'German', 'premium-addons-for-elementor' ),
376 'el' => __( 'Greek', 'premium-addons-for-elementor' ),
377 'en' => __( 'English', 'premium-addons-for-elementor' ),
378 'eu' => __( 'Basque', 'premium-addons-for-elementor' ),
379 'fa' => __( 'Persian (Farsi)', 'premium-addons-for-elementor' ),
380 'fi' => __( 'Finnish', 'premium-addons-for-elementor' ),
381 'fr' => __( 'French', 'premium-addons-for-elementor' ),
382 'gl' => __( 'Galician', 'premium-addons-for-elementor' ),
383 'he' => __( 'Hebrew', 'premium-addons-for-elementor' ),
384 'hi' => __( 'Hindi', 'premium-addons-for-elementor' ),
385 'hr' => __( 'Croatian', 'premium-addons-for-elementor' ),
386 'hu' => __( 'Hungarian', 'premium-addons-for-elementor' ),
387 'id' => __( 'Indonesian', 'premium-addons-for-elementor' ),
388 'it' => __( 'Italian', 'premium-addons-for-elementor' ),
389 'ja' => __( 'Japanese', 'premium-addons-for-elementor' ),
390 'kr' => __( 'Korean', 'premium-addons-for-elementor' ),
391 'la' => __( 'Latvian', 'premium-addons-for-elementor' ),
392 'lt' => __( 'Lithuanian', 'premium-addons-for-elementor' ),
393 'mk' => __( 'Macedonian', 'premium-addons-for-elementor' ),
394 'no' => __( 'Norwegian', 'premium-addons-for-elementor' ),
395 'nl' => __( 'Dutch', 'premium-addons-for-elementor' ),
396 'pl' => __( 'Polish', 'premium-addons-for-elementor' ),
397 'pt' => __( 'Portuguese', 'premium-addons-for-elementor' ),
398 'pt' => __( 'br Português Brasil', 'premium-addons-for-elementor' ),
399 'ro' => __( 'Romanian', 'premium-addons-for-elementor' ),
400 'ru' => __( 'Russian', 'premium-addons-for-elementor' ),
401 'se' => __( 'Swedish', 'premium-addons-for-elementor' ),
402 'sk' => __( 'Slovak', 'premium-addons-for-elementor' ),
403 'sl' => __( 'Slovenian', 'premium-addons-for-elementor' ),
404 'es' => __( 'Spanish', 'premium-addons-for-elementor' ),
405 'sr' => __( 'Serbian', 'premium-addons-for-elementor' ),
406 'th' => __( 'Thai', 'premium-addons-for-elementor' ),
407 'tr' => __( 'Turkish', 'premium-addons-for-elementor' ),
408 'uk' => __( 'Ukrainian', 'premium-addons-for-elementor' ),
409 'vi' => __( 'Vietnamese', 'premium-addons-for-elementor' ),
410 'zh_cn' => __( 'cn Chinese Simplified', 'premium-addons-for-elementor' ),
411 'zh_tw' => __( 'Chinese Traditional', 'premium-addons-for-elementor' ),
412 'zu' => __( 'Zulu', 'premium-addons-for-elementor' ),
413 ),
414 'default' => 'en',
415 )
416 );
417
418 $this->add_control(
419 'reload',
420 array(
421 'label' => __( 'Reload Data Once Every', 'premium-addons-for-elementor' ),
422 'type' => Controls_Manager::SELECT,
423 'separator' => 'before',
424 'options' => array(
425 1 => __( 'Hour', 'premium-addons-for-elementor' ),
426 3 => __( '3 Hours', 'premium-addons-for-elementor' ),
427 6 => __( '6 Hours', 'premium-addons-for-elementor' ),
428 12 => __( '12 Hours', 'premium-addons-for-elementor' ),
429 24 => __( 'Day', 'premium-addons-for-elementor' ),
430 ),
431 'default' => 6,
432 'condition' => array(
433 'location_type' => 'custom',
434 ),
435 )
436 );
437
438 $this->end_controls_section();
439 }
440
441 private function add_display_options_section() {
442
443 $this->start_controls_section(
444 'pa_weather_display_section',
445 array(
446 'label' => __( 'Current Weather', 'premium-addons-for-elementor' ),
447 )
448 );
449
450 $this->add_control(
451 'layout',
452 array(
453 'label' => __( 'Choose Layout', 'premium-addons-for-elementor' ),
454 'type' => Controls_Manager::SELECT,
455 'prefix_class' => 'premium-weather__',
456 'render_type' => 'template',
457 'label_block' => true,
458 'options' => $this->options['layouts'],
459 'default' => 'layout-1',
460 )
461 );
462
463 $this->add_control(
464 'show_temp_icon',
465 array(
466 'label' => __( 'Show Temperature Icon', 'premium-addons-for-elementor' ),
467 'type' => Controls_Manager::SWITCHER,
468 'label_on' => __( 'Show', 'premium-addons-for-elementor' ),
469 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ),
470 )
471 );
472
473 $this->add_control(
474 'current_weather_heading',
475 array(
476 'label' => esc_html__( 'Current Weather', 'premium-addons-for-elementor' ),
477 'separator' => 'before',
478 'type' => Controls_Manager::HEADING,
479 )
480 );
481
482 $this->add_control(
483 'show_current_weather',
484 array(
485 'label' => __( 'Current Weather', 'premium-addons-for-elementor' ),
486 'type' => Controls_Manager::SWITCHER,
487 'label_on' => __( 'Show', 'premium-addons-for-elementor' ),
488 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ),
489 'default' => 'yes',
490 )
491 );
492
493 $this->add_control(
494 'show_curr_weather_desc',
495 array(
496 'label' => __( 'Weather State', 'premium-addons-for-elementor' ),
497 'type' => Controls_Manager::SWITCHER,
498 'label_on' => __( 'Show', 'premium-addons-for-elementor' ),
499 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ),
500 'default' => 'yes',
501 'condition' => array(
502 'show_current_weather' => 'yes',
503 ),
504 )
505 );
506
507 $this->add_control(
508 'show_city',
509 array(
510 'label' => __( 'Title', 'premium-addons-for-elementor' ),
511 'type' => Controls_Manager::SWITCHER,
512 'label_on' => __( 'Show', 'premium-addons-for-elementor' ),
513 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ),
514 'default' => 'yes',
515 'condition' => array(
516 'show_current_weather' => 'yes',
517 ),
518 )
519 );
520
521 $this->add_control(
522 'title',
523 array(
524 'label' => __( 'Title', 'premium-addons-for-elementor' ),
525 'type' => Controls_Manager::TEXT,
526 'description' => __( 'Use this option to add a title of your choice, and use the {{city_name}} placeholder to add your city name.', 'premium-addons-for-elementor' ),
527 'label_block' => true,
528 'dynamic' => array( 'active' => true ),
529 'default' => '{{city_name}}',
530 'condition' => array(
531 'show_city' => 'yes',
532 'show_current_weather' => 'yes',
533 ),
534 )
535 );
536
537 $this->add_control(
538 'display_options_heading',
539 array(
540 'label' => esc_html__( 'Display Options', 'premium-addons-for-elementor' ),
541 'separator' => 'before',
542 'type' => Controls_Manager::HEADING,
543 'condition' => array(
544 'show_current_weather' => 'yes',
545 ),
546 )
547 );
548
549 $this->add_responsive_control(
550 'current_weather_display',
551 array(
552 'label' => __( 'Current Weather Display', 'premium-addons-for-elementor' ),
553 'type' => Controls_Manager::CHOOSE,
554 'prefix_class' => 'premium-cw%s-',
555 'options' => array(
556 'inline' => array(
557 'title' => __( 'Inline', 'premium-addons-for-elementor' ),
558 'icon' => 'eicon-ellipsis-h',
559 ),
560 'block' => array(
561 'title' => __( 'Block', 'premium-addons-for-elementor' ),
562 'icon' => 'eicon-ellipsis-v',
563 ),
564 ),
565 'default' => 'block',
566 'toggle' => false,
567 'condition' => array(
568 'layout' => 'layout-1',
569 'show_current_weather' => 'yes',
570 ),
571 )
572 );
573
574 $this->add_responsive_control(
575 'current_align',
576 array(
577 'label' => __( 'Current Weather Alignment', 'premium-addons-for-elementor' ),
578 'type' => Controls_Manager::CHOOSE,
579 'options' => array(
580 'flex-start' => array(
581 'title' => __( 'Left', 'premium-addons-for-elementor' ),
582 'icon' => 'eicon-h-align-left',
583 ),
584 'center' => array(
585 'title' => __( 'Center', 'premium-addons-for-elementor' ),
586 'icon' => 'eicon-h-align-center',
587 ),
588 'flex-end' => array(
589 'title' => __( 'Right', 'premium-addons-for-elementor' ),
590 'icon' => 'eicon-h-align-right',
591 ),
592 ),
593 'default' => 'center',
594 'toggle' => false,
595 'selectors' => array(
596 '{{WRAPPER}} .premium-weather__basic-weather' => 'justify-content: {{VALUE}}',
597 ),
598 'condition' => array(
599 'layout' => 'layout-1',
600 'show_current_weather' => 'yes',
601 ),
602 )
603 );
604
605 $this->add_responsive_control(
606 'city_align',
607 array(
608 'label' => __( 'Title Alignment', 'premium-addons-for-elementor' ),
609 'type' => Controls_Manager::CHOOSE,
610 'description' => __( 'Note: this options works only if the "Current Weather Alignment" is set to <b>block</b>', 'premium-addons-for-elementor' ),
611 'options' => array(
612 'left' => array(
613 'title' => __( 'Left', 'premium-addons-for-elementor' ),
614 'icon' => 'eicon-text-align-left',
615 ),
616 'center' => array(
617 'title' => __( 'Center', 'premium-addons-for-elementor' ),
618 'icon' => 'eicon-text-align-center',
619 ),
620 'right' => array(
621 'title' => __( 'Right', 'premium-addons-for-elementor' ),
622 'icon' => 'eicon-text-align-right',
623 ),
624 ),
625 'default' => 'center',
626 'toggle' => false,
627 'conditions' => array(
628 'terms' => array(
629 array(
630 'name' => 'show_current_weather',
631 'value' => 'yes',
632 ),
633 array(
634 'name' => 'show_city',
635 'value' => 'yes',
636 ),
637 array(
638 'name' => 'layout',
639 'operator' => '!==',
640 'value' => 'layout-3',
641 ),
642 ),
643 ),
644 'selectors' => array(
645 '{{WRAPPER}} .premium-weather__city-wrapper' => 'text-align: {{VALUE}};',
646 ),
647 )
648 );
649
650 $this->add_responsive_control(
651 'cur_weather_sec_display',
652 array(
653 'label' => __( 'Container Display', 'premium-addons-for-elementor' ),
654 'type' => Controls_Manager::CHOOSE,
655 'prefix_class' => 'premium-cw-sec%s-',
656 'options' => array(
657 'inline' => array(
658 'title' => __( 'Inline', 'premium-addons-for-elementor' ),
659 'icon' => 'eicon-ellipsis-h',
660 ),
661 'block' => array(
662 'title' => __( 'Block', 'premium-addons-for-elementor' ),
663 'icon' => 'eicon-ellipsis-v',
664 ),
665 ),
666 'default' => 'block',
667 'toggle' => false,
668 'condition' => array(
669 'layout' => 'layout-1',
670 'show_current_weather' => 'yes',
671 'show_extra_info' => 'yes',
672 ),
673 'selectors' => array(
674 '{{WRAPPER}} .premium-weather__current-weather' => '{{VALUE}}',
675 ),
676 )
677 );
678
679 $this->add_responsive_control(
680 'cur_weather_sec_align',
681 array(
682 'label' => __( 'Container Alignment', 'premium-addons-for-elementor' ),
683 'type' => Controls_Manager::CHOOSE,
684 'label_block' => true,
685 'options' => array(
686 'flex-start' => array(
687 'title' => __( 'Left', 'premium-addons-for-elementor' ),
688 'icon' => 'eicon-h-align-left',
689 ),
690 'center' => array(
691 'title' => __( 'Center', 'premium-addons-for-elementor' ),
692 'icon' => 'eicon-h-align-center',
693 ),
694 'flex-end' => array(
695 'title' => __( 'Right', 'premium-addons-for-elementor' ),
696 'icon' => 'eicon-h-align-right',
697 ),
698 'space-between' => array(
699 'title' => __( 'Strech', 'premium-addons-for-elementor' ),
700 'icon' => 'eicon-h-align-stretch',
701 ),
702 ),
703 'default' => 'space-between',
704 'toggle' => false,
705 'selectors' => array(
706 '{{WRAPPER}} .premium-weather__current-weather' => 'justify-content: {{VALUE}}',
707 ),
708 'condition' => array(
709 'layout' => 'layout-1',
710 'show_current_weather' => 'yes',
711 'show_extra_info' => 'yes',
712 'cur_weather_sec_display' => 'inline',
713 ),
714 )
715 );
716
717 $this->add_control(
718 'cur_weather_sec_order',
719 array(
720 'label' => __( 'Extra Weather Order', 'premium-addons-for-elementor' ),
721 'type' => Controls_Manager::CHOOSE,
722 'toggle' => false,
723 'options' => array(
724 '0' => array(
725 'title' => __( 'First', 'premium-addons-for-elementor' ),
726 'icon' => 'eicon-order-start',
727 ),
728 '2' => array(
729 'title' => __( 'Last', 'premium-addons-for-elementor' ),
730 'icon' => 'eicon-order-end',
731 ),
732 ),
733 'default' => '0',
734 'condition' => array(
735 'layout' => 'layout-1',
736 'show_current_weather' => 'yes',
737 'show_extra_info' => 'yes',
738 'cur_weather_sec_display' => 'inline',
739 ),
740 'selectors' => array(
741 '{{WRAPPER}} .premium-weather__current-weather .premium-weather__extra-weather' => 'order: {{VALUE}}',
742 ),
743 )
744 );
745
746 $this->add_responsive_control(
747 'cur_weather_sec_spacing',
748 array(
749 'label' => __( 'Section Spacing', 'premium-addons-for-elementor' ),
750 'type' => Controls_Manager::SLIDER,
751 'size_units' => array( 'px', 'em' ),
752 'condition' => array(
753 'layout' => 'layout-1',
754 'show_current_weather' => 'yes',
755 'show_extra_info' => 'yes',
756 'cur_weather_sec_display' => 'inline',
757 ),
758 'selectors' => array(
759 '{{WRAPPER}} .premium-weather__current-weather' => 'column-gap: {{SIZE}}{{UNIT}}',
760 ),
761 )
762 );
763
764 $this->add_control(
765 'show_extra_info',
766 array(
767 'label' => __( 'Additional Weather Info', 'premium-addons-for-elementor' ),
768 'type' => Controls_Manager::SWITCHER,
769 'default' => 'yes',
770 'separator' => 'before',
771 'condition' => array(
772 'show_current_weather' => 'yes',
773 ),
774 )
775 );
776
777 $this->add_control(
778 'pa_extra_weather',
779 array(
780 'label' => __( 'Weather Data', 'premium-addons-for-elementor' ),
781 'type' => Controls_Manager::SELECT2,
782 'options' => array(
783 'wind' => __( 'Wind Speed', 'premium-addons-for-elementor' ),
784 'pressure' => __( 'Pressure', 'premium-addons-for-elementor' ),
785 'humidity' => __( 'Humidity', 'premium-addons-for-elementor' ),
786 'rain' => __( 'Rain', 'premium-addons-for-elementor' ),
787 'snow' => __( 'Snow', 'premium-addons-for-elementor' ),
788 ),
789 'default' => array( 'wind', 'pressure', 'humidity' ),
790 'multiple' => true,
791 'label_block' => true,
792 'description' => __( 'Please note that if you do not see some of the parameters displayed, it means that these weather phenomena have just not happened for the time of measurement for the city or location chosen', 'premium-addons-for-elementor' ),
793 'condition' => array(
794 'show_extra_info' => 'yes',
795 'show_current_weather' => 'yes',
796 ),
797 )
798 );
799
800 $this->add_responsive_control(
801 'extra_weather_display',
802 array(
803 'label' => __( 'Display', 'premium-addons-for-elementor' ),
804 'type' => Controls_Manager::CHOOSE,
805 'options' => array(
806 'row' => array(
807 'title' => __( 'Inline', 'premium-addons-for-elementor' ),
808 'icon' => 'eicon-ellipsis-h',
809 ),
810 'column' => array(
811 'title' => __( 'Block', 'premium-addons-for-elementor' ),
812 'icon' => 'eicon-ellipsis-v',
813 ),
814 ),
815 'default' => 'column',
816 'toggle' => false,
817 'selectors' => array(
818 '{{WRAPPER}}.premium-weather__layout-2:not(.premium-weather__hourly-yes) .premium-weather__extra-weather' => 'flex-direction: {{VALUE}}',
819 ),
820 'condition' => array(
821 'show_extra_info' => 'yes',
822 'enable_hourly!' => 'yes',
823 'show_current_weather' => 'yes',
824 ),
825 )
826 );
827
828 $this->add_responsive_control(
829 'extra_weather_alignment',
830 array(
831 'label' => __( 'ًWeather Alignment', 'premium-addons-for-elementor' ),
832 'type' => Controls_Manager::CHOOSE,
833 'options' => array(
834 'flex-start' => array(
835 'title' => __( 'Left', 'premium-addons-for-elementor' ),
836 'icon' => 'eicon-h-align-left',
837 ),
838 'center' => array(
839 'title' => __( 'Center', 'premium-addons-for-elementor' ),
840 'icon' => 'eicon-h-align-center',
841 ),
842 'flex-end' => array(
843 'title' => __( 'Right', 'premium-addons-for-elementor' ),
844 'icon' => 'eicon-h-align-right',
845 ),
846 ),
847 'default' => 'center',
848 'toggle' => false,
849 'selectors' => array(
850 '{{WRAPPER}}.premium-weather__layout-1 .premium-weather__extra-weather,{{WRAPPER}}.premium-weather__layout-2:not(.premium-weather__hourly-yes) .premium-weather__extra-outer-wrapper' => 'justify-content: {{VALUE}}',
851 ),
852 'condition' => array(
853 'show_extra_info' => 'yes',
854 'layout!' => 'layout-3',
855 'show_current_weather' => 'yes',
856 ),
857 )
858 );
859
860 $this->add_responsive_control(
861 'extra_weather_icon_size',
862 array(
863 'label' => __( 'Icon Size', 'premium-addons-for-elementor' ),
864 'type' => Controls_Manager::SLIDER,
865 'size_units' => array( 'px' ),
866 'range' => array(
867 'px' => array(
868 'min' => 0,
869 'max' => 1000,
870 ),
871 ),
872 'selectors' => array(
873 '{{WRAPPER}} .premium-weather__extra-weather i' => 'font-size: {{SIZE}}{{UNIT}}',
874 '{{WRAPPER}} .premium-weather__extra-weather svg' => 'width: {{SIZE}}{{UNIT}}; height:{{SIZE}}{{UNIT}};',
875 ),
876 'condition' => array(
877 'show_extra_info' => 'yes',
878 'show_current_weather' => 'yes',
879 ),
880 )
881 );
882
883 $this->add_responsive_control(
884 'extra_weather_icon_spacing',
885 array(
886 'label' => __( 'Icon Spacing', 'premium-addons-for-elementor' ),
887 'type' => Controls_Manager::SLIDER,
888 'size_units' => array( 'px', 'em', '%' ),
889 'selectors' => array(
890 '{{WRAPPER}} .premium-weather__extra-weather > div' => 'gap: {{SIZE}}{{UNIT}}',
891 ),
892 'condition' => array(
893 'show_extra_info' => 'yes',
894 'show_current_weather' => 'yes',
895 ),
896 )
897 );
898
899 $this->add_responsive_control(
900 'extra_weather_spacing',
901 array(
902 'label' => __( 'Spacing Between', 'premium-addons-for-elementor' ),
903 'type' => Controls_Manager::SLIDER,
904 'size_units' => array( 'px', 'em', '%' ),
905 'selectors' => array(
906 '{{WRAPPER}} .premium-weather__extra-weather' => 'gap: {{SIZE}}{{UNIT}}',
907 ),
908 'condition' => array(
909 'show_extra_info' => 'yes',
910 'show_current_weather' => 'yes',
911 ),
912 )
913 );
914
915 $this->end_controls_section();
916 }
917
918 private function add_daily_forecast_section() {
919
920 $papro_activated = apply_filters( 'papro_activated', false );
921
922 $this->start_controls_section(
923 'pa_daily_forecast_section',
924 array(
925 'label' => __( 'Daily Forecast', 'premium-addons-for-elementor' ),
926 )
927 );
928
929 $this->add_control(
930 'enable_forecast',
931 array(
932 'label' => __( 'Daily Forecast', 'premium-addons-for-elementor' ),
933 'type' => Controls_Manager::SWITCHER,
934 'label_on' => __( 'Show', 'premium-addons-for-elementor' ),
935 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ),
936 'description' => __( 'This option allows you to add daily forecast up to 7 days', 'premium-addons-for-elementor' ),
937 )
938 );
939
940 if ( ! $papro_activated ) {
941
942 $get_pro = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/pro', 'weather-widget', 'wp-editor', 'get-pro' );
943
944 $this->add_control(
945 'weather_notice2',
946 array(
947 'type' => Controls_Manager::RAW_HTML,
948 'raw' => __( 'This option is available in Premium Addons Pro. ', 'premium-addons-for-elementor' ) . '<a href="' . esc_url( $get_pro ) . '" target="_blank">' . __( 'Upgrade now!', 'premium-addons-for-elementor' ) . '</a>',
949 'content_classes' => 'papro-upgrade-notice',
950 'condition' => $this->options['dailyf_condition'],
951 )
952 );
953
954 } else {
955 do_action( 'pa_weather_daily_forecast_controls', $this );
956 }
957
958 $this->end_controls_section();
959 }
960
961 private function add_hourly_forecast_section() {
962
963 $this->start_controls_section(
964 'pa_hourly_forecast_section',
965 array(
966 'label' => __( 'Hourly Forecast', 'premium-addons-for-elementor' ),
967 )
968 );
969
970 $this->add_control(
971 'enable_hourly',
972 array(
973 'label' => __( 'Hourly Forecast', 'premium-addons-for-elementor' ),
974 'prefix_class' => 'premium-weather__hourly-',
975 'render_type' => 'template',
976 'type' => Controls_Manager::SWITCHER,
977 'label_on' => __( 'Show', 'premium-addons-for-elementor' ),
978 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ),
979 'description' => __( 'This option allows you to add hourly weather condition.', 'premium-addons-for-elementor' ),
980 'default' => 'yes',
981 )
982 );
983
984 $this->add_control(
985 'hourly_layout',
986 array(
987 'label' => __( 'Choose Layout', 'premium-addons-for-elementor' ),
988 'type' => Controls_Manager::SELECT,
989 'prefix_class' => 'premium-hours-',
990 'render_type' => 'template',
991 'label_block' => true,
992 'options' => array(
993 'default' => __( 'Layout 1', 'premium-addons-for-elementor' ),
994 'vertical' => __( 'Layout 2', 'premium-addons-for-elementor' ),
995 ),
996 'default' => 'default',
997 'condition' => array(
998 'enable_hourly' => 'yes',
999 'layout!' => 'layout-2',
1000 ),
1001 )
1002 );
1003
1004 $this->add_control(
1005 'hourly_max',
1006 array(
1007 'label' => __( 'Max Number of Hours', 'premium-addons-for-elementor' ),
1008 'type' => Controls_Manager::NUMBER,
1009 'description' => __( 'Set a maximum number of hours to display', 'premium-addons-for-elementor' ),
1010 'default' => 12,
1011 'max' => 24,
1012 'min' => 1,
1013 'condition' => array(
1014 'enable_hourly' => 'yes',
1015 ),
1016 )
1017 );
1018
1019 $this->add_responsive_control(
1020 'slides_to_show',
1021 array(
1022 'label' => __( 'Hours To Show', 'premium-addons-for-elementor' ),
1023 'type' => Controls_Manager::NUMBER,
1024 'devices' => array( 'desktop', 'tablet', 'mobile' ),
1025 'default' => 8,
1026 'max' => 24,
1027 'min' => 1,
1028 'condition' => array(
1029 'enable_hourly' => 'yes',
1030 ),
1031 )
1032 );
1033
1034 $this->add_responsive_control(
1035 'slides_to_scroll',
1036 array(
1037 'label' => __( 'Slides To Scroll', 'premium-addons-for-elementor' ),
1038 'type' => Controls_Manager::NUMBER,
1039 'devices' => array( 'desktop', 'tablet', 'mobile' ),
1040 'default' => 2,
1041 'max' => 24,
1042 'condition' => array(
1043 'enable_hourly' => 'yes',
1044 'hourly_layout' => 'default',
1045 ),
1046 )
1047 );
1048
1049 $this->add_control(
1050 'show_arrows_on_hover',
1051 array(
1052 'label' => __( 'Display Arrows On Hover', 'premium-addons-for-elementor' ),
1053 'prefix_class' => 'premium-weather-hidden-arrows-',
1054 'type' => Controls_Manager::SWITCHER,
1055 'default' => 'yes',
1056 'condition' => array(
1057 'enable_hourly' => 'yes',
1058 ),
1059 )
1060 );
1061
1062 $this->add_control(
1063 'hourly_ele_min_width',
1064 array(
1065 'label' => __( 'Element Minimum Width', 'premium-addons-for-elementor' ),
1066 'type' => Controls_Manager::SLIDER,
1067 'size_units' => array( 'px' ),
1068 'selectors' => array(
1069 '{{WRAPPER}}.premium-hours-vertical .premium-weather__hourly-data > *' => 'min-width: {{SIZE}}px;',
1070 ),
1071 'range' => array(
1072 'px' => array(
1073 'min' => 0,
1074 'max' => 1000,
1075 ),
1076 ),
1077 'condition' => array(
1078 'enable_hourly' => 'yes',
1079 'hourly_layout' => 'vertical',
1080 ),
1081 )
1082 );
1083
1084 $this->add_control(
1085 'hourly_weather_data',
1086 array(
1087 'label' => __( 'Weather Data', 'premium-addons-for-elementor' ),
1088 'type' => Controls_Manager::SELECT2,
1089 'label_block' => true,
1090 'options' => array(
1091 'temp' => __( 'Temperature', 'premium-addons-for-elementor' ),
1092 'desc' => __( 'Description', 'premium-addons-for-elementor' ),
1093 'desc_icon' => __( 'Weather Icon', 'premium-addons-for-elementor' ),
1094 'wind' => __( 'Wind Speed', 'premium-addons-for-elementor' ),
1095 'pressure' => __( 'Pressure', 'premium-addons-for-elementor' ),
1096 'humidity' => __( 'Humidity', 'premium-addons-for-elementor' ),
1097 ),
1098 'default' => array( 'desc_icon', 'temp', 'pressure', 'humidity', 'wind' ),
1099 'multiple' => true,
1100 'condition' => array(
1101 'enable_hourly' => 'yes',
1102 'hourly_layout' => 'vertical',
1103 'layout!' => 'layout-2',
1104 ),
1105 )
1106 );
1107
1108 $this->end_controls_section();
1109 }
1110
1111 private function add_custom_icons_section() {
1112
1113 $papro_activated = apply_filters( 'papro_activated', false );
1114
1115 $this->start_controls_section(
1116 'pa_custom_icon_section',
1117 array(
1118 'label' => __( 'Custom Icons', 'premium-addons-for-elementor' ),
1119 )
1120 );
1121
1122 $this->add_control(
1123 'enable_custom_icon',
1124 array(
1125 'label' => __( 'Use Custom Icons', 'premium-addons-for-elementor' ),
1126 'type' => Controls_Manager::SWITCHER,
1127 )
1128 );
1129
1130 if ( ! $papro_activated ) {
1131
1132 $get_pro = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/pro', 'weather-widget', 'wp-editor', 'get-pro' );
1133
1134 $this->add_control(
1135 'weather_notice3',
1136 array(
1137 'type' => Controls_Manager::RAW_HTML,
1138 'raw' => __( 'This option is available in Premium Addons Pro. ', 'premium-addons-for-elementor' ) . '<a href="' . esc_url( $get_pro ) . '" target="_blank">' . __( 'Upgrade now!', 'premium-addons-for-elementor' ) . '</a>',
1139 'content_classes' => 'papro-upgrade-notice',
1140 'condition' => $this->options['custom_icons_condition'],
1141 )
1142 );
1143
1144 } else {
1145 do_action( 'pa_weather_custom_icons_controls', $this );
1146
1147 $draw_icon = $this->check_icon_draw();
1148
1149 $this->add_control(
1150 'draw_svg',
1151 array(
1152 'label' => __( 'Draw Icon', 'premium-addons-for-elementor' ),
1153 'type' => Controls_Manager::SWITCHER,
1154 'description' => __( 'Enable this option to make the icon drawable. See ', 'premium-addons-for-elementor' ) . '<a href="https://www.youtube.com/watch?v=ZLr0bRe0RAY" target="_blank">tutorial</a>',
1155 'classes' => $draw_icon ? '' : 'editor-pa-control-disabled',
1156 'description' => __( 'Use this option to draw your Font Awesome Custom Icons.', 'premium-addons-for-elementor' ),
1157 'condition' => array(
1158 'enable_custom_icon' => 'yes',
1159 'icons_source' => 'custom',
1160 ),
1161 )
1162 );
1163
1164 if ( $draw_icon ) {
1165
1166 $this->add_control(
1167 'path_width',
1168 array(
1169 'label' => __( 'Path Thickness', 'premium-addons-for-elementor' ),
1170 'type' => Controls_Manager::SLIDER,
1171 'range' => array(
1172 'px' => array(
1173 'min' => 0,
1174 'max' => 50,
1175 'step' => 0.1,
1176 ),
1177 ),
1178 'condition' => array(
1179 'draw_svg' => 'yes',
1180 'enable_custom_icon' => 'yes',
1181 'icons_source' => 'custom',
1182 ),
1183 'selectors' => array(
1184 '{{WRAPPER}} .premium-drawable-icon *' => 'stroke-width: {{SIZE}};',
1185 ),
1186 )
1187 );
1188
1189 $this->add_control(
1190 'stroke_color',
1191 array(
1192 'label' => __( 'Stroke Color', 'premium-addons-for-elementor' ),
1193 'type' => Controls_Manager::COLOR,
1194 'global' => array(
1195 'default' => Global_Colors::COLOR_ACCENT,
1196 ),
1197 'condition' => array(
1198 'draw_svg' => 'yes',
1199 'enable_custom_icon' => 'yes',
1200 'icons_source' => 'custom',
1201 ),
1202 'selectors' => array(
1203 '{{WRAPPER}} .premium-drawable-icon *' => 'stroke: {{VALUE}};',
1204 ),
1205 )
1206 );
1207
1208 $this->add_control(
1209 'svg_color',
1210 array(
1211 'label' => __( 'After Draw Fill Color', 'premium-addons-for-elementor' ),
1212 'type' => Controls_Manager::COLOR,
1213 'global' => false,
1214 'separator' => 'after',
1215 'condition' => array(
1216 'draw_svg' => 'yes',
1217 'enable_custom_icon' => 'yes',
1218 'icons_source' => 'custom',
1219 ),
1220 )
1221 );
1222 } else {
1223 Helper_Functions::get_draw_svg_notice(
1224 $this,
1225 'weather',
1226 array(
1227 'enable_custom_icon' => 'yes',
1228 'icons_source' => 'custom',
1229 )
1230 );
1231 }
1232 }
1233
1234 $this->end_controls_section();
1235 }
1236
1237 private function add_helpful_info_section() {
1238
1239 $this->start_controls_section(
1240 'section_pa_docs',
1241 array(
1242 'label' => __( 'Help & Docs', 'premium-addons-for-elementor' ),
1243 )
1244 );
1245
1246 $docs = array(
1247 'https://premiumaddons.com/docs/elementor-weather-widget/' => __( 'Getting started »', 'premium-addons-for-elementor' ),
1248 'https://premiumaddons.com/docs/how-to-get-api-key-for-elementor-weather-forecast-widget/' => __( 'How to Get an API Key for Weather widget »', 'premium-addons-for-elementor' ),
1249 );
1250
1251 $doc_index = 1;
1252 foreach ( $docs as $url => $title ) {
1253
1254 $doc_url = Helper_Functions::get_campaign_link( $url, 'weather-widget', 'wp-editor', 'get-support' );
1255
1256 $this->add_control(
1257 'doc_' . $doc_index,
1258 array(
1259 'type' => Controls_Manager::RAW_HTML,
1260 'raw' => sprintf( '<a href="%s" target="_blank">%s</a>', $doc_url, $title ),
1261 'content_classes' => 'editor-pa-doc',
1262 )
1263 );
1264
1265 ++$doc_index;
1266
1267 }
1268
1269 $this->end_controls_section();
1270 }
1271
1272 /** Style Controls.*/
1273
1274 /**
1275 * Adds posts title style controls.
1276 *
1277 * @access private
1278 * @since 4.9.37
1279 */
1280 private function add_outer_container_style() {
1281
1282 $this->start_controls_section(
1283 'pa_weather_outer',
1284 array(
1285 'label' => __( 'Container', 'premium-addons-for-elementor' ),
1286 'tab' => Controls_Manager::TAB_STYLE,
1287 )
1288 );
1289
1290 $this->add_group_control(
1291 Group_Control_Box_Shadow::get_type(),
1292 array(
1293 'name' => 'outer_shadow',
1294 'selector' => '{{WRAPPER}} .premium-weather__outer-wrapper',
1295 )
1296 );
1297
1298 $this->add_group_control(
1299 Group_Control_Background::get_type(),
1300 array(
1301 'name' => 'outer_bg',
1302 'types' => array( 'classic', 'gradient' ),
1303 'selector' => '{{WRAPPER}} .premium-weather__outer-wrapper',
1304 )
1305 );
1306
1307 $this->add_group_control(
1308 Group_Control_Border::get_type(),
1309 array(
1310 'name' => 'outer_border',
1311 'selector' => '{{WRAPPER}} .premium-weather__outer-wrapper',
1312 )
1313 );
1314
1315 $this->add_control(
1316 'outer_border_rad',
1317 array(
1318 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
1319 'type' => Controls_Manager::DIMENSIONS,
1320 'size_units' => array( 'px', 'em', '%' ),
1321 'selectors' => array(
1322 '{{WRAPPER}} .premium-weather__outer-wrapper' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};;',
1323 ),
1324 )
1325 );
1326
1327 $this->add_responsive_control(
1328 'outer_padding',
1329 array(
1330 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
1331 'type' => Controls_Manager::DIMENSIONS,
1332 'size_units' => array( 'px', 'em', '%' ),
1333 'selectors' => array(
1334 '{{WRAPPER}} .premium-weather__outer-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1335 ),
1336 )
1337 );
1338
1339 $this->end_controls_section();
1340 }
1341
1342 private function add_city_style() {
1343
1344 $this->start_controls_section(
1345 'pa_weather_city_style',
1346 array(
1347 'label' => __( 'Title', 'premium-addons-for-elementor' ),
1348 'tab' => Controls_Manager::TAB_STYLE,
1349 'condition' => array(
1350 'show_city' => 'yes',
1351 'title!' => '',
1352 'show_current_weather' => 'yes',
1353 ),
1354 )
1355 );
1356
1357 $this->add_group_control(
1358 Group_Control_Typography::get_type(),
1359 array(
1360 'name' => 'city_name',
1361 'selector' => '{{WRAPPER}} .premium-weather__city-name',
1362 )
1363 );
1364
1365 $this->add_control(
1366 'city_color',
1367 array(
1368 'label' => __( 'Color', 'premium-addons-for-elementor' ),
1369 'type' => Controls_Manager::COLOR,
1370 'global' => array(
1371 'default' => Global_Colors::COLOR_SECONDARY,
1372 ),
1373 'selectors' => array(
1374 '{{WRAPPER}} .premium-weather__city-name' => 'color: {{VALUE}};',
1375 ),
1376 )
1377 );
1378
1379 $this->add_group_control(
1380 Group_Control_Text_Shadow::get_type(),
1381 array(
1382 'name' => 'city_shadow',
1383 'selector' => '{{WRAPPER}} .premium-weather__city-name',
1384 )
1385 );
1386
1387 $this->add_group_control(
1388 Group_Control_Background::get_type(),
1389 array(
1390 'name' => 'city_bg',
1391 'types' => array( 'classic', 'gradient' ),
1392 'selector' => '{{WRAPPER}} .premium-weather__city-name',
1393 )
1394 );
1395
1396 $this->add_group_control(
1397 Group_Control_Border::get_type(),
1398 array(
1399 'name' => 'city_border',
1400 'selector' => '{{WRAPPER}} .premium-weather__city-name',
1401 )
1402 );
1403
1404 $this->add_control(
1405 'city_border_rad',
1406 array(
1407 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
1408 'type' => Controls_Manager::SLIDER,
1409 'size_units' => array( 'px', 'em', '%' ),
1410 'selectors' => array(
1411 '{{WRAPPER}} .premium-weather__city-name' => 'border-radius: {{SIZE}}{{UNIT}};',
1412 ),
1413 )
1414 );
1415
1416 $this->add_responsive_control(
1417 'city_padding',
1418 array(
1419 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
1420 'type' => Controls_Manager::DIMENSIONS,
1421 'size_units' => array( 'px', 'em', '%' ),
1422 'selectors' => array(
1423 '{{WRAPPER}} .premium-weather__city-name' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1424 ),
1425 )
1426 );
1427
1428 $this->add_responsive_control(
1429 'city_margin',
1430 array(
1431 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
1432 'type' => Controls_Manager::DIMENSIONS,
1433 'size_units' => array( 'px', 'em', '%' ),
1434 'selectors' => array(
1435 '{{WRAPPER}} .premium-weather__city-name' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1436 ),
1437 )
1438 );
1439
1440 $this->end_controls_section();
1441 }
1442
1443 private function add_current_weather_style() {
1444
1445 $this->start_controls_section(
1446 'pa_weather_current',
1447 array(
1448 'label' => __( 'Current Weather', 'premium-addons-for-elementor' ),
1449 'tab' => Controls_Manager::TAB_STYLE,
1450 'condition' => array(
1451 'show_current_weather' => 'yes',
1452 ),
1453 )
1454 );
1455
1456 $this->start_controls_tabs( 'current_weather_tabs' );
1457
1458 $this->start_controls_tab(
1459 'pa_current_tab',
1460 array(
1461 'label' => __( 'Current', 'premium-addons-for-elementor' ),
1462 )
1463 );
1464
1465 $this->add_control(
1466 'pa_current_temp',
1467 array(
1468 'label' => esc_html__( 'Temperature', 'premium-addons-for-elementor' ),
1469 'type' => Controls_Manager::HEADING,
1470 )
1471 );
1472
1473 $this->add_group_control(
1474 Group_Control_Typography::get_type(),
1475 array(
1476 'name' => 'temp',
1477 'fields_options' => array(
1478 'font_family' => array(
1479 'selectors' => array(
1480 '{{WRAPPER}}:not(.premium-weather__layout-3) .premium-weather__basic-weather .premium-weather__temp-wrapper *,
1481 {{WRAPPER}}.premium-weather__layout-3 .premium-weather__extra-outer-wrapper .premium-weather__temp-wrapper *' => 'font-family:"{{VALUE}}", Sans-serif;',
1482 ),
1483 ),
1484 ),
1485 'selector' => '{{WRAPPER}}:not(.premium-weather__layout-3) .premium-weather__basic-weather .premium-weather__temp-wrapper .premium-weather__temp-val,
1486 {{WRAPPER}}.premium-weather__layout-3 .premium-weather__extra-outer-wrapper .premium-weather__temp-wrapper .premium-weather__temp-val',
1487 )
1488 );
1489
1490 $this->add_control(
1491 'temp_color',
1492 array(
1493 'label' => __( 'Color', 'premium-addons-for-elementor' ),
1494 'type' => Controls_Manager::COLOR,
1495 'global' => array(
1496 'default' => Global_Colors::COLOR_SECONDARY,
1497 ),
1498 'selectors' => array(
1499 '{{WRAPPER}}:not(.premium-weather__layout-3) .premium-weather__basic-weather .premium-weather__temp-wrapper, {{WRAPPER}}.premium-weather__layout-3 .premium-weather__extra-outer-wrapper .premium-weather__temp-wrapper' => 'color: {{VALUE}};',
1500 ),
1501 )
1502 );
1503
1504 $this->add_control(
1505 'current_temp_icon_color',
1506 array(
1507 'label' => __( 'Icon Color', 'premium-addons-for-elementor' ),
1508 'type' => Controls_Manager::COLOR,
1509 'separator' => 'before',
1510 'selectors' => array(
1511 '{{WRAPPER}}:not(.premium-weather__layout-3) .premium-weather__basic-weather .premium-weather__temp-wrapper > svg *,
1512 {{WRAPPER}}.premium-weather__layout-3 .premium-weather__extra-outer-wrapper .premium-weather__temp-wrapper > svg *' => 'fill: {{VALUE}};',
1513 ),
1514 'condition' => array(
1515 'show_temp_icon' => 'yes',
1516 ),
1517 )
1518 );
1519
1520 $this->add_responsive_control(
1521 'current_temp_icon_size',
1522 array(
1523 'label' => __( 'Icon Size', 'premium-addons-for-elementor' ),
1524 'type' => Controls_Manager::SLIDER,
1525 'size_units' => array( 'px' ),
1526 'selectors' => array(
1527 '{{WRAPPER}}:not(.premium-weather__layout-3) .premium-weather__basic-weather .premium-weather__temp-wrapper > svg,
1528 {{WRAPPER}}.premium-weather__layout-3 .premium-weather__extra-outer-wrapper .premium-weather__temp-wrapper > svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
1529 ),
1530 'condition' => array(
1531 'show_temp_icon' => 'yes',
1532 ),
1533 )
1534 );
1535
1536 $this->add_responsive_control(
1537 'current_temp_margin',
1538 array(
1539 'label' => __( 'Icon Margin', 'premium-addons-for-elementor' ),
1540 'type' => Controls_Manager::DIMENSIONS,
1541 'size_units' => array( 'px', 'em', '%' ),
1542 'selectors' => array(
1543 '{{WRAPPER}}:not(.premium-weather__layout-3) .premium-weather__basic-weather .premium-weather__temp-wrapper > svg,
1544 {{WRAPPER}}.premium-weather__layout-3 .premium-weather__extra-outer-wrapper .premium-weather__temp-wrapper > svg' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1545 ),
1546 'condition' => array(
1547 'show_temp_icon' => 'yes',
1548 ),
1549 )
1550 );
1551
1552 $this->add_control(
1553 'pa_current_temp_unit',
1554 array(
1555 'label' => esc_html__( 'Temperature Unit', 'premium-addons-for-elementor' ),
1556 'separator' => 'before',
1557 'type' => Controls_Manager::HEADING,
1558 )
1559 );
1560
1561 $this->add_responsive_control(
1562 'temp_unit_typo',
1563 array(
1564 'label' => __( 'Font Size', 'premium-addons-for-elementor' ),
1565 'type' => Controls_Manager::SLIDER,
1566 'size_units' => array( 'px', 'em' ),
1567 'selectors' => array(
1568 '{{WRAPPER}} .premium-weather__temp-unit' => 'font-size: {{SIZE}}{{UNIT}};',
1569 ),
1570 )
1571 );
1572
1573 $this->add_responsive_control(
1574 'temp_unit_margin',
1575 array(
1576 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
1577 'type' => Controls_Manager::DIMENSIONS,
1578 'size_units' => array( 'px', 'em', '%' ),
1579 'selectors' => array(
1580 '{{WRAPPER}} .premium-weather__temp-unit' => 'top: {{TOP}}{{UNIT}}; right: {{RIGHT}}{{UNIT}}; bottom: {{BOTTOM}}{{UNIT}}; left:{{LEFT}}{{UNIT}};',
1581 ),
1582 )
1583 );
1584
1585 $this->add_control(
1586 'pa_current_desc',
1587 array(
1588 'label' => esc_html__( 'Description', 'premium-addons-for-elementor' ),
1589 'separator' => 'before',
1590 'type' => Controls_Manager::HEADING,
1591 )
1592 );
1593
1594 $this->add_group_control(
1595 Group_Control_Typography::get_type(),
1596 array(
1597 'name' => 'desc_typo',
1598 'selector' => '{{WRAPPER}} .premium-weather__desc',
1599 )
1600 );
1601
1602 $this->add_control(
1603 'desc_color',
1604 array(
1605 'label' => __( 'Description Color', 'premium-addons-for-elementor' ),
1606 'type' => Controls_Manager::COLOR,
1607 'selectors' => array(
1608 '{{WRAPPER}} .premium-weather__desc' => 'color: {{VALUE}};',
1609 ),
1610 )
1611 );
1612
1613 $this->add_group_control(
1614 Group_Control_Typography::get_type(),
1615 array(
1616 'name' => 'desc_feels_typo',
1617 'label' => __( 'Feels Like Typography', 'premium-addons-for-elementor' ),
1618 'selector' => '{{WRAPPER}} .premium-weather__feels-like',
1619 )
1620 );
1621
1622 $this->add_control(
1623 'desc_feels_color',
1624 array(
1625 'label' => __( 'Feels Like Color', 'premium-addons-for-elementor' ),
1626 'type' => Controls_Manager::COLOR,
1627 'global' => array(
1628 'default' => Global_Colors::COLOR_SECONDARY,
1629 ),
1630 'selectors' => array(
1631 '{{WRAPPER}} .premium-weather__feels-like' => 'color: {{VALUE}};',
1632 ),
1633 )
1634 );
1635
1636 $this->add_control(
1637 'temp_icon_color',
1638 array(
1639 'label' => __( 'Icon Color', 'premium-addons-for-elementor' ),
1640 'type' => Controls_Manager::COLOR,
1641 'selectors' => array(
1642 '{{WRAPPER}} .premium-weather__basic-weather .premium-weather__icon-wrapper > svg,
1643 {{WRAPPER}} .premium-weather__basic-weather .premium-weather__icon-wrapper > svg *' => 'fill: {{VALUE}};',
1644 '{{WRAPPER}} .premium-weather__basic-weather .premium-weather__icon-wrapper' => 'color: {{VALUE}}',
1645 ),
1646 )
1647 );
1648
1649 $this->add_responsive_control(
1650 'temp_icon_size',
1651 array(
1652 'label' => __( 'Icon Size', 'premium-addons-for-elementor' ),
1653 'type' => Controls_Manager::SLIDER,
1654 'range' => array(
1655 'px' => array(
1656 'min' => 0,
1657 'max' => 1000,
1658 ),
1659 ),
1660 'size_units' => array( 'px' ),
1661 'selectors' => array(
1662 '{{WRAPPER}} .premium-weather__basic-weather .premium-weather__icon-wrapper > svg,
1663 {{WRAPPER}} .premium-weather__basic-weather .premium-weather__icon-wrapper .premium-lottie-animation,
1664 {{WRAPPER}} .premium-weather__basic-weather .premium-weather__icon-wrapper img' => 'width: {{SIZE}}{{UNIT}}; height:{{SIZE}}{{UNIT}};',
1665 '{{WRAPPER}} .premium-weather__basic-weather .premium-weather__icon-wrapper i' => 'font-size: {{SIZE}}{{UNIT}};',
1666 ),
1667 )
1668 );
1669
1670 $papro_activated = apply_filters( 'papro_activated', false );
1671
1672 if ( $papro_activated ) {
1673 $this->add_control(
1674 'temp_icon_stroke',
1675 array(
1676 'label' => __( 'Stroke Color', 'premium-addons-for-elementor' ),
1677 'type' => Controls_Manager::COLOR,
1678 'selectors' => array(
1679 '{{WRAPPER}} .premium-weather__basic-weather .premium-weather__icon-wrapper .premium-lottie-animation svg *' => 'stroke: {{VALUE}} !important',
1680 ),
1681 'condition' => array(
1682 'enable_custom_icon' => 'yes',
1683 'icons_source' => 'default',
1684 'lottie_type' => 'outlined',
1685 ),
1686 )
1687 );
1688
1689 $this->add_responsive_control(
1690 'temp_stork_width',
1691 array(
1692 'label' => __( 'Stroke Width', 'premium-addons-for-elementor' ),
1693 'type' => Controls_Manager::SLIDER,
1694 'range' => array(
1695 'px' => array(
1696 'min' => 0,
1697 'max' => 1000,
1698 ),
1699 ),
1700 'size_units' => array( 'px' ),
1701 'selectors' => array(
1702 '{{WRAPPER}} .premium-weather__basic-weather .premium-weather__icon-wrapper .premium-lottie-animation svg *' => 'stroke-width: {{SIZE}}{{UNIT}} !important;',
1703 ),
1704 'condition' => array(
1705 'enable_custom_icon' => 'yes',
1706 'icons_source' => 'default',
1707 'lottie_type' => 'outlined',
1708 ),
1709 )
1710 );
1711
1712 }
1713
1714 $this->add_responsive_control(
1715 'temp_icon_margin',
1716 array(
1717 'label' => __( 'Icon Margin', 'premium-addons-for-elementor' ),
1718 'type' => Controls_Manager::DIMENSIONS,
1719 'size_units' => array( 'px', 'em', '%' ),
1720 'selectors' => array(
1721 '{{WRAPPER}} .premium-weather__basic-weather .premium-weather__icon-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1722 ),
1723 )
1724 );
1725
1726 $this->add_responsive_control(
1727 'desc_margin',
1728 array(
1729 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
1730 'type' => Controls_Manager::DIMENSIONS,
1731 'size_units' => array( 'px', 'em', '%' ),
1732 'separator' => 'before',
1733 'selectors' => array(
1734 '{{WRAPPER}}:not(.premium-weather__layout-3) .premium-weather__desc-wrapper, {{WRAPPER}}.premium-weather__layout-3 .premium-weather__feels-like' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1735 ),
1736 )
1737 );
1738
1739 $this->end_controls_tab();
1740
1741 $this->start_controls_tab(
1742 'pa_extra_tab',
1743 array(
1744 'label' => __( 'Extra Weather', 'premium-addons-for-elementor' ),
1745 'condition' => array(
1746 'show_extra_info' => 'yes',
1747 ),
1748 )
1749 );
1750
1751 $this->add_extra_weather_style();
1752
1753 $this->end_controls_tab();
1754
1755 $this->end_controls_tabs();
1756
1757 $this->add_control(
1758 'pa_current_conatainer',
1759 array(
1760 'label' => esc_html__( 'Container', 'premium-addons-for-elementor' ),
1761 'separator' => 'before',
1762 'type' => Controls_Manager::HEADING,
1763 )
1764 );
1765
1766 $this->add_group_control(
1767 Group_Control_Box_Shadow::get_type(),
1768 array(
1769 'name' => 'current_shadow',
1770 'selector' => '{{WRAPPER}} .premium-weather__current-weather',
1771 )
1772 );
1773
1774 $this->add_group_control(
1775 Group_Control_Background::get_type(),
1776 array(
1777 'name' => 'current_bg',
1778 'types' => array( 'classic', 'gradient' ),
1779 'selector' => '{{WRAPPER}} .premium-weather__current-weather',
1780 )
1781 );
1782
1783 $this->add_group_control(
1784 Group_Control_Border::get_type(),
1785 array(
1786 'name' => 'current_border',
1787 'selector' => '{{WRAPPER}} .premium-weather__current-weather',
1788 )
1789 );
1790
1791 $this->add_control(
1792 'current_border_rad',
1793 array(
1794 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
1795 'type' => Controls_Manager::SLIDER,
1796 'size_units' => array( 'px', 'em', '%' ),
1797 'selectors' => array(
1798 '{{WRAPPER}} .premium-weather__current-weather' => 'border-radius: {{SIZE}}{{UNIT}};',
1799 ),
1800 )
1801 );
1802
1803 $this->add_responsive_control(
1804 'current_padding',
1805 array(
1806 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
1807 'type' => Controls_Manager::DIMENSIONS,
1808 'size_units' => array( 'px', 'em', '%' ),
1809 'selectors' => array(
1810 '{{WRAPPER}} .premium-weather__current-weather' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1811 ),
1812 )
1813 );
1814
1815 $this->add_responsive_control(
1816 'current_margin',
1817 array(
1818 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
1819 'type' => Controls_Manager::DIMENSIONS,
1820 'size_units' => array( 'px', 'em', '%' ),
1821 'selectors' => array(
1822 '{{WRAPPER}} .premium-weather__current-weather' => 'Margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1823 ),
1824 )
1825 );
1826
1827 $this->end_controls_section();
1828 }
1829
1830 private function add_extra_weather_style() {
1831 $this->add_group_control(
1832 Group_Control_Typography::get_type(),
1833 array(
1834 'name' => 'extra_weather_name',
1835 'selector' => '{{WRAPPER}} .premium-weather__extra-weather span',
1836 )
1837 );
1838
1839 $this->add_control(
1840 'extra_weather_color',
1841 array(
1842 'label' => __( 'Color', 'premium-addons-for-elementor' ),
1843 'type' => Controls_Manager::COLOR,
1844 'selectors' => array(
1845 '{{WRAPPER}} .premium-weather__extra-weather span' => 'color: {{VALUE}};',
1846 ),
1847 )
1848 );
1849
1850 $this->add_control(
1851 'extra_weather_icon_color',
1852 array(
1853 'label' => __( 'Icons Colors', 'premium-addons-for-elementor' ),
1854 'type' => Controls_Manager::COLOR,
1855 'selectors' => array(
1856 '{{WRAPPER}} .premium-weather__extra-weather i' => 'color: {{VALUE}};',
1857 '{{WRAPPER}} .premium-weather__extra-weather svg, {{WRAPPER}} .premium-weather__extra-weather svg path' => 'fill: {{VALUE}};',
1858 ),
1859 )
1860 );
1861
1862 $this->add_group_control(
1863 Group_Control_Background::get_type(),
1864 array(
1865 'name' => 'extra_weather_bg',
1866 'types' => array( 'classic', 'gradient' ),
1867 'selector' => '{{WRAPPER}} .premium-weather__extra-weather > div',
1868 )
1869 );
1870
1871 $this->add_group_control(
1872 Group_Control_Border::get_type(),
1873 array(
1874 'name' => 'extra_weather_border',
1875 'selector' => '{{WRAPPER}} .premium-weather__extra-weather > div',
1876 )
1877 );
1878
1879 $this->add_control(
1880 'extra_weather_border_rad',
1881 array(
1882 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
1883 'type' => Controls_Manager::SLIDER,
1884 'size_units' => array( 'px', 'em', '%' ),
1885 'selectors' => array(
1886 '{{WRAPPER}} .premium-weather__extra-weather > div' => 'border-radius: {{SIZE}}{{UNIT}};',
1887 ),
1888 )
1889 );
1890
1891 $this->add_responsive_control(
1892 'extra_weather_padding',
1893 array(
1894 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
1895 'type' => Controls_Manager::DIMENSIONS,
1896 'size_units' => array( 'px', 'em', '%' ),
1897 'selectors' => array(
1898 '{{WRAPPER}} .premium-weather__extra-weather > div' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1899 ),
1900 )
1901 );
1902
1903 $this->add_responsive_control(
1904 'extra_weather_margin',
1905 array(
1906 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
1907 'type' => Controls_Manager::DIMENSIONS,
1908 'size_units' => array( 'px', 'em', '%' ),
1909 'selectors' => array(
1910 '{{WRAPPER}} .premium-weather__extra-weather > div' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1911 ),
1912 )
1913 );
1914 }
1915
1916 private function add_forecast_style() {
1917
1918 $this->start_controls_section(
1919 'pa_weather_forecast_style',
1920 array(
1921 'label' => __( 'Daily Forecast', 'premium-addons-for-elementor' ),
1922 'tab' => Controls_Manager::TAB_STYLE,
1923 'conditions' => array(
1924 'terms' => array(
1925 array(
1926 'name' => 'enable_forecast',
1927 'value' => 'yes',
1928 ),
1929 array(
1930 'relation' => 'or',
1931 'terms' => array(
1932 array(
1933 'name' => 'forecast_tabs',
1934 'operator' => '!==',
1935 'value' => 'yes',
1936 ),
1937 array(
1938 'terms' => array(
1939 array(
1940 'name' => 'forecast_tabs',
1941 'value' => 'yes',
1942 ),
1943 array(
1944 'name' => 'forecast_days',
1945 'operator' => 'in',
1946 'value' => array( '1', '6', '7', '8' ),
1947 ),
1948 ),
1949 ),
1950 ),
1951 ),
1952 ),
1953 ),
1954 )
1955 );
1956
1957 $this->add_control(
1958 'pa_forecast_date',
1959 array(
1960 'label' => esc_html__( 'Date', 'premium-addons-for-elementor' ),
1961 'separator' => 'before',
1962 'type' => Controls_Manager::HEADING,
1963 )
1964 );
1965
1966 $this->add_group_control(
1967 Group_Control_Typography::get_type(),
1968 array(
1969 'name' => 'forecast_date',
1970 'selector' => '{{WRAPPER}} .premium-weather__forecast-item-date',
1971 )
1972 );
1973
1974 $this->add_control(
1975 'forecast_date_color',
1976 array(
1977 'label' => __( 'Color', 'premium-addons-for-elementor' ),
1978 'type' => Controls_Manager::COLOR,
1979 'selectors' => array(
1980 '{{WRAPPER}} .premium-weather__forecast-item-date' => 'color: {{VALUE}};',
1981 ),
1982 )
1983 );
1984
1985 $this->add_responsive_control(
1986 'forecast_date_margin',
1987 array(
1988 'label' => __( 'Bottom Spacing', 'premium-addons-for-elementor' ),
1989 'type' => Controls_Manager::SLIDER,
1990 'size_units' => array( 'px' ),
1991 'selectors' => array(
1992 '{{WRAPPER}} .premium-weather__forecast-item-date' => 'margin-bottom: {{SIZE}}{{UNIT}};',
1993 ),
1994 'condition' => array(
1995 'layout' => 'layout-1',
1996 ),
1997 )
1998 );
1999
2000 $this->add_control(
2001 'pa_forecast_temp_max',
2002 array(
2003 'label' => esc_html__( 'Max Temperatrue', 'premium-addons-for-elementor' ),
2004 'separator' => 'before',
2005 'type' => Controls_Manager::HEADING,
2006 )
2007 );
2008
2009 $this->add_group_control(
2010 Group_Control_Typography::get_type(),
2011 array(
2012 'name' => 'pa_forecast_temp_max_typo',
2013 'selector' => '{{WRAPPER}} .premium-weather__forecast-item .premium-weather__temp-max',
2014 )
2015 );
2016
2017 $this->add_control(
2018 'pa_forecast_temp_max_color',
2019 array(
2020 'label' => __( 'Color', 'premium-addons-for-elementor' ),
2021 'type' => Controls_Manager::COLOR,
2022 'selectors' => array(
2023 '{{WRAPPER}} .premium-weather__forecast-item .premium-weather__temp-max' => 'color: {{VALUE}};',
2024 ),
2025 )
2026 );
2027
2028 $this->add_responsive_control(
2029 'max_margin',
2030 array(
2031 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
2032 'type' => Controls_Manager::DIMENSIONS,
2033 'size_units' => array( 'px' ),
2034 'selectors' => array(
2035 '{{WRAPPER}} .premium-weather__forecast-item .premium-weather__temp-max' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2036 ),
2037 )
2038 );
2039
2040 $this->add_control(
2041 'pa_forecast_temp_min',
2042 array(
2043 'label' => esc_html__( 'Min Temepratrue', 'premium-addons-for-elementor' ),
2044 'separator' => 'before',
2045 'type' => Controls_Manager::HEADING,
2046 )
2047 );
2048
2049 $this->add_group_control(
2050 Group_Control_Typography::get_type(),
2051 array(
2052 'name' => 'pa_forecast_temp_min_typo',
2053 'selector' => '{{WRAPPER}} .premium-weather__forecast-item .premium-weather__temp-min',
2054 )
2055 );
2056
2057 $this->add_control(
2058 'pa_forecast_temp_min_color',
2059 array(
2060 'label' => __( 'Color', 'premium-addons-for-elementor' ),
2061 'type' => Controls_Manager::COLOR,
2062 'selectors' => array(
2063 '{{WRAPPER}} .premium-weather__forecast-item .premium-weather__temp-min' => 'color: {{VALUE}};',
2064 ),
2065 )
2066 );
2067
2068 $this->add_control(
2069 'paa_forecast_temp_icon_color',
2070 array(
2071 'label' => __( 'Icon Color', 'premium-addons-for-elementor' ),
2072 'type' => Controls_Manager::COLOR,
2073 'separator' => 'before',
2074 'selectors' => array(
2075 '{{WRAPPER}} .premium-weather__forecast-item-data > span > svg,
2076 {{WRAPPER}} .premium-weather__forecast-item-data > span > svg *' => 'fill: {{VALUE}};',
2077 ),
2078 'condition' => array(
2079 'show_temp_icon' => 'yes',
2080 ),
2081 )
2082 );
2083
2084 $this->add_responsive_control(
2085 'pa_forecast_temp_icon_size',
2086 array(
2087 'label' => __( 'Icon Size', 'premium-addons-for-elementor' ),
2088 'type' => Controls_Manager::SLIDER,
2089 'size_units' => array( 'px' ),
2090 'selectors' => array(
2091 '{{WRAPPER}} .premium-weather__forecast-item-data > span > svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
2092 ),
2093 'condition' => array(
2094 'show_temp_icon' => 'yes',
2095 ),
2096 )
2097 );
2098
2099 $this->add_responsive_control(
2100 'pa_forecast_temp_margin',
2101 array(
2102 'label' => __( 'Icon Margin', 'premium-addons-for-elementor' ),
2103 'type' => Controls_Manager::DIMENSIONS,
2104 'size_units' => array( 'px', 'em', '%' ),
2105 'selectors' => array(
2106 '{{WRAPPER}} .premium-weather__forecast-item-data > span > svg' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2107 ),
2108 'condition' => array(
2109 'show_temp_icon' => 'yes',
2110 ),
2111 )
2112 );
2113
2114 $this->add_control(
2115 'forecast_icon',
2116 array(
2117 'label' => esc_html__( 'Weather Icon', 'premium-addons-for-elementor' ),
2118 'separator' => 'before',
2119 'type' => Controls_Manager::HEADING,
2120 'condition' => array(
2121 'show_forecast_icon' => 'yes',
2122 ),
2123 )
2124 );
2125
2126 $this->add_control(
2127 'forecast_icon_color',
2128 array(
2129 'label' => __( 'Icons Colors', 'premium-addons-for-elementor' ),
2130 'type' => Controls_Manager::COLOR,
2131 'selectors' => array(
2132 '{{WRAPPER}} .premium-weather__forecast-item .premium-weather__icon-wrapper > svg,
2133 {{WRAPPER}} .premium-weather__forecast-item .premium-weather__icon-wrapper > svg *' => 'fill: {{VALUE}};',
2134 '{{WRAPPER}} .premium-weather__forecast-item .premium-weather__icon-wrapper' => 'color: {{VALUE}};',
2135 ),
2136 'condition' => array(
2137 'show_forecast_icon' => 'yes',
2138 ),
2139 )
2140 );
2141
2142 $papro_activated = apply_filters( 'papro_activated', false );
2143
2144 if ( $papro_activated ) {
2145 $this->add_control(
2146 'forecast_icon_stroke',
2147 array(
2148 'label' => __( 'Stroke Color', 'premium-addons-for-elementor' ),
2149 'type' => Controls_Manager::COLOR,
2150 'selectors' => array(
2151 '{{WRAPPER}} .premium-weather__forecast-item .premium-weather__icon-wrapper .premium-lottie-animation svg *' => 'stroke: {{VALUE}} !important',
2152 ),
2153 'condition' => array(
2154 'enable_custom_icon' => 'yes',
2155 'icons_source' => 'default',
2156 'lottie_type' => 'outlined',
2157 ),
2158 )
2159 );
2160
2161 $this->add_responsive_control(
2162 'forecast_stork_width',
2163 array(
2164 'label' => __( 'Stroke Width', 'premium-addons-for-elementor' ),
2165 'type' => Controls_Manager::SLIDER,
2166 'range' => array(
2167 'px' => array(
2168 'min' => 0,
2169 'max' => 1000,
2170 ),
2171 ),
2172 'size_units' => array( 'px' ),
2173 'selectors' => array(
2174 '{{WRAPPER}} .premium-weather__forecast-item .premium-weather__icon-wrapper .premium-lottie-animation svg *' => 'stroke-width: {{SIZE}}{{UNIT}} !important;',
2175 ),
2176 'condition' => array(
2177 'enable_custom_icon' => 'yes',
2178 'icons_source' => 'default',
2179 'lottie_type' => 'outlined',
2180 ),
2181 )
2182 );
2183
2184 }
2185
2186 $this->add_responsive_control(
2187 'forecast_icon_size',
2188 array(
2189 'label' => __( 'Size', 'premium-addons-for-elementor' ),
2190 'type' => Controls_Manager::SLIDER,
2191 'size_units' => array( 'px' ),
2192 'range' => array(
2193 'px' => array(
2194 'min' => 0,
2195 'max' => 1000,
2196 ),
2197 ),
2198 'selectors' => array(
2199 '{{WRAPPER}} .premium-weather__forecast-item .premium-weather__icon-wrapper > svg,
2200 {{WRAPPER}} .premium-weather__forecast-item .premium-weather__icon-wrapper .premium-lottie-animation,
2201 {{WRAPPER}} .premium-weather__forecast-item .premium-weather__icon-wrapper img' => 'width:{{SIZE}}{{UNIT}}; height:{{SIZE}}{{UNIT}};',
2202 '{{WRAPPER}} .premium-weather__forecast-item .premium-weather__icon-wrapper i' => 'font-size:{{SIZE}}px',
2203 ),
2204 'condition' => array(
2205 'show_forecast_icon' => 'yes',
2206 ),
2207 )
2208 );
2209
2210 $this->add_responsive_control(
2211 'icon_margin',
2212 array(
2213 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
2214 'type' => Controls_Manager::DIMENSIONS,
2215 'size_units' => array( 'px', 'em', '%' ),
2216 'selectors' => array(
2217 '{{WRAPPER}} .premium-weather__forecast-item .premium-weather__icon-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2218 ),
2219 'condition' => array(
2220 'layout' => 'layout-1',
2221 'show_forecast_icon' => 'yes',
2222 ),
2223 )
2224 );
2225
2226 $this->add_responsive_control(
2227 'icon_b_spacing',
2228 array(
2229 'label' => __( 'Bottom Spacing', 'premium-addons-for-elementor' ),
2230 'type' => Controls_Manager::SLIDER,
2231 'size_units' => array( 'px' ),
2232 'selectors' => array(
2233 '{{WRAPPER}} .premium-weather__forecast-item .premium-weather__icon-wrapper' => 'margin-bottom: {{SIZE}}{{UNIT}};',
2234 ),
2235 'condition' => array(
2236 'layout' => 'layout-3',
2237 'show_forecast_icon' => 'yes',
2238 ),
2239 )
2240 );
2241
2242 $this->add_control(
2243 'pa_forecast_cont',
2244 array(
2245 'label' => esc_html__( 'Item Container', 'premium-addons-for-elementor' ),
2246 'separator' => 'before',
2247 'type' => Controls_Manager::HEADING,
2248 )
2249 );
2250
2251 $this->add_group_control(
2252 Group_Control_Box_Shadow::get_type(),
2253 array(
2254 'name' => 'pa_forecast_cont_shadow',
2255 'selector' => '{{WRAPPER}} .premium-weather__forecast-item',
2256 )
2257 );
2258
2259 $this->add_group_control(
2260 Group_Control_Background::get_type(),
2261 array(
2262 'name' => 'forecast_bg',
2263 'types' => array( 'classic', 'gradient' ),
2264 'selector' => '{{WRAPPER}} .premium-weather__forecast-item',
2265 )
2266 );
2267
2268 $this->add_group_control(
2269 Group_Control_Border::get_type(),
2270 array(
2271 'name' => 'forecast_border',
2272 'selector' => '{{WRAPPER}} .premium-weather__forecast-item',
2273 )
2274 );
2275
2276 $this->add_control(
2277 'forecast_border_rad',
2278 array(
2279 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
2280 'type' => Controls_Manager::SLIDER,
2281 'size_units' => array( 'px', 'em', '%' ),
2282 'selectors' => array(
2283 '{{WRAPPER}} .premium-weather__forecast-item' => 'border-radius: {{SIZE}}{{UNIT}};',
2284 ),
2285 )
2286 );
2287
2288 $this->add_responsive_control(
2289 'forecast_padding',
2290 array(
2291 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
2292 'type' => Controls_Manager::DIMENSIONS,
2293 'size_units' => array( 'px', 'em', '%' ),
2294 'selectors' => array(
2295 '{{WRAPPER}} .premium-weather__forecast-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2296 ),
2297 )
2298 );
2299
2300 $this->add_responsive_control(
2301 'forecast_margin',
2302 array(
2303 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
2304 'type' => Controls_Manager::DIMENSIONS,
2305 'size_units' => array( 'px', 'em', '%' ),
2306 'selectors' => array(
2307 '{{WRAPPER}} .premium-weather__forecast-item' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2308 ),
2309 )
2310 );
2311
2312 $this->add_control(
2313 'pa_forecast_cont_outer',
2314 array(
2315 'label' => esc_html__( 'Outer Container', 'premium-addons-for-elementor' ),
2316 'separator' => 'before',
2317 'type' => Controls_Manager::HEADING,
2318 )
2319 );
2320
2321 $this->add_group_control(
2322 Group_Control_Box_Shadow::get_type(),
2323 array(
2324 'name' => 'pa_forecast_cont_outer_shadow',
2325 'selector' => '{{WRAPPER}} .premium-weather__forecast',
2326 )
2327 );
2328
2329 $this->add_group_control(
2330 Group_Control_Background::get_type(),
2331 array(
2332 'name' => 'outer_forecast_bg',
2333 'types' => array( 'classic', 'gradient' ),
2334 'selector' => '{{WRAPPER}} .premium-weather__forecast',
2335 )
2336 );
2337
2338 $this->add_group_control(
2339 Group_Control_Border::get_type(),
2340 array(
2341 'name' => 'forecast__outer_border',
2342 'selector' => '{{WRAPPER}} .premium-weather__forecast',
2343 )
2344 );
2345
2346 $this->add_control(
2347 'forecast_border_outer_rad',
2348 array(
2349 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
2350 'type' => Controls_Manager::SLIDER,
2351 'size_units' => array( 'px', 'em', '%' ),
2352 'selectors' => array(
2353 '{{WRAPPER}} .premium-weather__forecast' => 'border-radius: {{SIZE}}{{UNIT}};',
2354 ),
2355 )
2356 );
2357
2358 $this->add_responsive_control(
2359 'forecast_outer_padding',
2360 array(
2361 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
2362 'type' => Controls_Manager::DIMENSIONS,
2363 'size_units' => array( 'px', 'em', '%' ),
2364 'selectors' => array(
2365 '{{WRAPPER}} .premium-weather__forecast' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2366 ),
2367 )
2368 );
2369
2370 $this->add_responsive_control(
2371 'forecast_outer_margin',
2372 array(
2373 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
2374 'type' => Controls_Manager::DIMENSIONS,
2375 'size_units' => array( 'px', 'em', '%' ),
2376 'selectors' => array(
2377 '{{WRAPPER}} .premium-weather__forecast' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2378 ),
2379 )
2380 );
2381
2382 $this->end_controls_section();
2383 }
2384
2385 private function add_hourly_style() {
2386
2387 $this->start_controls_section(
2388 'pa_weather_hourly_style',
2389 array(
2390 'label' => __( 'Hourly Forecast', 'premium-addons-for-elementor' ),
2391 'tab' => Controls_Manager::TAB_STYLE,
2392 'condition' => array(
2393 'enable_hourly' => 'yes',
2394 ),
2395 )
2396 );
2397
2398 $this->add_control(
2399 'pa_hourly_date',
2400 array(
2401 'label' => esc_html__( 'Hours', 'premium-addons-for-elementor' ),
2402 'separator' => 'before',
2403 'type' => Controls_Manager::HEADING,
2404 )
2405 );
2406
2407 $this->add_group_control(
2408 Group_Control_Typography::get_type(),
2409 array(
2410 'name' => 'hourly_date',
2411 'selector' => '{{WRAPPER}} .premium-weather__hourly-item-date',
2412 )
2413 );
2414
2415 $this->add_control(
2416 'hourly_date_color',
2417 array(
2418 'label' => __( 'Color', 'premium-addons-for-elementor' ),
2419 'type' => Controls_Manager::COLOR,
2420 'selectors' => array(
2421 '{{WRAPPER}} .premium-weather__hourly-item-date' => 'color: {{VALUE}};',
2422 ),
2423 )
2424 );
2425
2426 $this->add_responsive_control(
2427 'hourly_date_margin',
2428 array(
2429 'label' => __( 'Bottom Spacing', 'premium-addons-for-elementor' ),
2430 'type' => Controls_Manager::SLIDER,
2431 'size_units' => array( 'px' ),
2432 'selectors' => array(
2433 '{{WRAPPER}} .premium-weather__hourly-item-date' => 'margin-bottom: {{SIZE}}{{UNIT}};',
2434 ),
2435 'condition' => array(
2436 'hourly_layout' => 'default',
2437 ),
2438 )
2439 );
2440
2441 $this->add_control(
2442 'pa_hourly_temp_max',
2443 array(
2444 'label' => esc_html__( 'Weather Details', 'premium-addons-for-elementor' ),
2445 'separator' => 'before',
2446 'type' => Controls_Manager::HEADING,
2447 )
2448 );
2449
2450 $this->add_group_control(
2451 Group_Control_Typography::get_type(),
2452 array(
2453 'name' => 'pa_hourly_temp_max_typo',
2454 'selector' => '{{WRAPPER}} .premium-weather__hourly-item .premium-weather__hourly-data > *:not(.premium-weather__icon-wrapper) > span,
2455 {{WRAPPER}}:not(.premium-hours-vertical) .premium-weather__hourly-item .premium-weather__temp-wrapper > span',
2456 )
2457 );
2458
2459 $this->add_control(
2460 'pa_hourly_temp_max_color',
2461 array(
2462 'label' => __( 'Color', 'premium-addons-for-elementor' ),
2463 'type' => Controls_Manager::COLOR,
2464 'selectors' => array(
2465 '{{WRAPPER}} .premium-weather__hourly-item .premium-weather__hourly-data > *:not(.premium-weather__icon-wrapper) > span,
2466 {{WRAPPER}}:not(.premium-hours-vertical) .premium-weather__hourly-item .premium-weather__temp-wrapper > span' => 'color: {{VALUE}};',
2467 ),
2468 )
2469 );
2470
2471 $this->add_control(
2472 'pa_hourly_temp_icon_color',
2473 array(
2474 'label' => __( 'Icon Color', 'premium-addons-for-elementor' ),
2475 'type' => Controls_Manager::COLOR,
2476 'separator' => 'before',
2477 'selectors' => array(
2478 '{{WRAPPER}} .premium-weather__hourly-item .premium-weather__hourly-data > *:not(.premium-weather__icon-wrapper) svg,
2479 {{WRAPPER}}:not(.premium-hours-vertical) .premium-weather__hourly-item .premium-weather__temp-wrapper svg,
2480 {{WRAPPER}} .premium-weather__hourly-item .premium-weather__hourly-data > *:not(.premium-weather__icon-wrapper) svg *,
2481 {{WRAPPER}}:not(.premium-hours-vertical) .premium-weather__hourly-item .premium-weather__temp-wrapper svg *' => 'fill: {{VALUE}};',
2482 '{{WRAPPER}} .premium-weather__hourly-item .premium-weather__hourly-data i' => 'color: {{VALUE}};',
2483 ),
2484 )
2485 );
2486
2487 $this->add_responsive_control(
2488 'pa_hourly_temp_icon_size',
2489 array(
2490 'label' => __( 'Icon Size', 'premium-addons-for-elementor' ),
2491 'type' => Controls_Manager::SLIDER,
2492 'size_units' => array( 'px' ),
2493 'selectors' => array(
2494 '{{WRAPPER}} .premium-weather__hourly-item .premium-weather__hourly-data > *:not(.premium-weather__icon-wrapper) svg, {{WRAPPER}}:not(.premium-hours-vertical) .premium-weather__hourly-item .premium-weather__temp-wrapper svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
2495 '{{WRAPPER}} .premium-weather__hourly-item .premium-weather__hourly-data i' => 'font-size: {{SIZE}}{{UNIT}};',
2496 ),
2497 )
2498 );
2499
2500 $this->add_responsive_control(
2501 'pa_hourly_temp_margin',
2502 array(
2503 'label' => __( 'Icon Margin', 'premium-addons-for-elementor' ),
2504 'type' => Controls_Manager::DIMENSIONS,
2505 'size_units' => array( 'px', 'em', '%' ),
2506 'selectors' => array(
2507 '{{WRAPPER}} .premium-weather__hourly-item .premium-weather__hourly-data > *:not(.premium-weather__icon-wrapper) svg, {{WRAPPER}} .premium-weather__hourly-item .premium-weather__hourly-data i, {{WRAPPER}}:not(.premium-hours-vertical) .premium-weather__hourly-item .premium-weather__temp-wrapper svg' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2508 ),
2509 )
2510 );
2511
2512 $this->add_control(
2513 'hourly_icon',
2514 array(
2515 'label' => esc_html__( 'Weather Icon', 'premium-addons-for-elementor' ),
2516 'separator' => 'before',
2517 'type' => Controls_Manager::HEADING,
2518 )
2519 );
2520
2521 $this->add_control(
2522 'hourly_icon_color',
2523 array(
2524 'label' => __( 'Icons Colors', 'premium-addons-for-elementor' ),
2525 'type' => Controls_Manager::COLOR,
2526 'selectors' => array(
2527 '{{WRAPPER}} .premium-weather__hourly-item .premium-weather__icon-wrapper > svg,
2528 {{WRAPPER}} .premium-weather__hourly-item .premium-weather__icon-wrapper > svg *' => 'fill: {{VALUE}};',
2529 '{{WRAPPER}} .premium-weather__hourly-item .premium-weather__icon-wrapper' => 'color: {{VALUE}}',
2530 ),
2531 )
2532 );
2533
2534 $papro_activated = apply_filters( 'papro_activated', false );
2535
2536 if ( $papro_activated ) {
2537 $this->add_control(
2538 'hourly_icon_stroke',
2539 array(
2540 'label' => __( 'Stroke Color', 'premium-addons-for-elementor' ),
2541 'type' => Controls_Manager::COLOR,
2542 'selectors' => array(
2543 '{{WRAPPER}} .premium-weather__hourly-item .premium-weather__icon-wrapper .premium-lottie-animation svg *' => 'stroke: {{VALUE}} !important',
2544 ),
2545 'condition' => array(
2546 'enable_custom_icon' => 'yes',
2547 'icons_source' => 'default',
2548 'lottie_type' => 'outlined',
2549 ),
2550 )
2551 );
2552
2553 $this->add_responsive_control(
2554 'hourly_stork_width',
2555 array(
2556 'label' => __( 'Stroke Width', 'premium-addons-for-elementor' ),
2557 'type' => Controls_Manager::SLIDER,
2558 'range' => array(
2559 'px' => array(
2560 'min' => 0,
2561 'max' => 1000,
2562 ),
2563 ),
2564 'size_units' => array( 'px' ),
2565 'selectors' => array(
2566 '{{WRAPPER}} .premium-weather__hourly-item .premium-weather__icon-wrapper .premium-lottie-animation svg *' => 'stroke-width: {{SIZE}}{{UNIT}} !important;',
2567 ),
2568 'condition' => array(
2569 'enable_custom_icon' => 'yes',
2570 'icons_source' => 'default',
2571 'lottie_type' => 'outlined',
2572 ),
2573 )
2574 );
2575 }
2576
2577 $this->add_responsive_control(
2578 'hourly_icon_size',
2579 array(
2580 'label' => __( 'Size', 'premium-addons-for-elementor' ),
2581 'type' => Controls_Manager::SLIDER,
2582 'range' => array(
2583 'px' => array(
2584 'min' => 0,
2585 'max' => 1000,
2586 ),
2587 ),
2588 'size_units' => array( 'px' ),
2589 'selectors' => array(
2590 '{{WRAPPER}} .premium-weather__hourly-item .premium-weather__icon-wrapper > svg,
2591 {{WRAPPER}} .premium-weather__hourly-item .premium-weather__icon-wrapper .premium-lottie-animation,
2592 {{WRAPPER}} .premium-weather__hourly-item .premium-weather__icon-wrapper img' => 'width:{{SIZE}}{{UNIT}}; height:{{SIZE}}{{UNIT}};',
2593 '{{WRAPPER}} .premium-weather__hourly-item .premium-weather__icon-wrapper i' => 'font-size: {{SIZE}}px',
2594 ),
2595 )
2596 );
2597
2598 $this->add_responsive_control(
2599 'hourly_icon_margin',
2600 array(
2601 'label' => __( 'Bottom Spacing', 'premium-addons-for-elementor' ),
2602 'type' => Controls_Manager::SLIDER,
2603 'size_units' => array( 'px', 'em', '%' ),
2604 'selectors' => array(
2605 '{{WRAPPER}} .premium-weather__hourly-item .premium-weather__icon-wrapper' => 'margin-bottom: {{SIZE}}{{UNIT}};',
2606 ),
2607 'condition' => array(
2608 'hourly_layout' => 'default',
2609 ),
2610 )
2611 );
2612
2613 $this->add_control(
2614 'pa_hourly_cont',
2615 array(
2616 'label' => esc_html__( 'Item Container', 'premium-addons-for-elementor' ),
2617 'separator' => 'before',
2618 'type' => Controls_Manager::HEADING,
2619 )
2620 );
2621
2622 $this->add_group_control(
2623 Group_Control_Box_Shadow::get_type(),
2624 array(
2625 'name' => 'pa_hourly_cont_shadow',
2626 'selector' => '{{WRAPPER}} .premium-weather__hourly-item, {{WRAPPER}}.premium-weather__layout-2 .premium-weather__extra-weather',
2627 )
2628 );
2629
2630 $this->add_group_control(
2631 Group_Control_Background::get_type(),
2632 array(
2633 'name' => 'hourly_bg',
2634 'types' => array( 'classic', 'gradient' ),
2635 'selector' => '{{WRAPPER}} .premium-weather__hourly-item, {{WRAPPER}}.premium-weather__layout-2 .premium-weather__extra-weather',
2636 )
2637 );
2638
2639 $this->add_group_control(
2640 Group_Control_Border::get_type(),
2641 array(
2642 'name' => 'hourly_border',
2643 'selector' => '{{WRAPPER}} .premium-weather__hourly-item, {{WRAPPER}}.premium-weather__layout-2 .premium-weather__extra-weather',
2644 )
2645 );
2646
2647 $this->add_control(
2648 'hourly_border_rad',
2649 array(
2650 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
2651 'type' => Controls_Manager::SLIDER,
2652 'size_units' => array( 'px', 'em', '%' ),
2653 'selectors' => array(
2654 '{{WRAPPER}} .premium-weather__hourly-item, {{WRAPPER}}.premium-weather__layout-2 .premium-weather__extra-weather' => 'border-radius: {{SIZE}}{{UNIT}};',
2655 ),
2656 )
2657 );
2658
2659 $this->add_responsive_control(
2660 'hourly_padding',
2661 array(
2662 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
2663 'type' => Controls_Manager::DIMENSIONS,
2664 'size_units' => array( 'px', 'em', '%' ),
2665 'selectors' => array(
2666 '{{WRAPPER}} .premium-weather__hourly-item, {{WRAPPER}}.premium-weather__layout-2 .premium-weather__extra-weather' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2667 ),
2668 )
2669 );
2670
2671 $this->add_responsive_control(
2672 'hourly_margin',
2673 array(
2674 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
2675 'type' => Controls_Manager::DIMENSIONS,
2676 'size_units' => array( 'px', 'em', '%' ),
2677 'selectors' => array(
2678 '{{WRAPPER}} .premium-weather__hourly-item, {{WRAPPER}}.premium-weather__layout-2 .premium-weather__extra-weather' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2679 ),
2680 )
2681 );
2682
2683 $this->add_control(
2684 'pa_hourly_cont_outer',
2685 array(
2686 'label' => esc_html__( 'Outer Container', 'premium-addons-for-elementor' ),
2687 'separator' => 'before',
2688 'type' => Controls_Manager::HEADING,
2689 )
2690 );
2691
2692 $this->add_group_control(
2693 Group_Control_Box_Shadow::get_type(),
2694 array(
2695 'name' => 'pa_hourly_cont_outer_shadow',
2696 'selector' => '{{WRAPPER}}:not(.premium-weather__layout-2) .premium-weather__hourly-forecast-wrapper, {{WRAPPER}}.premium-weather__layout-2 .premium-weather__extra-outer-wrapper',
2697 )
2698 );
2699
2700 $this->add_group_control(
2701 Group_Control_Background::get_type(),
2702 array(
2703 'name' => 'outer_hourly_bg',
2704 'types' => array( 'classic', 'gradient' ),
2705 'selector' => '{{WRAPPER}}:not(.premium-weather__layout-2) .premium-weather__hourly-forecast-wrapper, {{WRAPPER}}.premium-weather__layout-2 .premium-weather__extra-outer-wrapper',
2706 )
2707 );
2708
2709 $this->add_group_control(
2710 Group_Control_Border::get_type(),
2711 array(
2712 'name' => 'hourly__outer_border',
2713 'selector' => '{{WRAPPER}}:not(.premium-weather__layout-2) .premium-weather__hourly-forecast-wrapper, {{WRAPPER}}.premium-weather__layout-2 .premium-weather__extra-outer-wrapper',
2714 )
2715 );
2716
2717 $this->add_control(
2718 'hourly_border_outer_rad',
2719 array(
2720 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
2721 'type' => Controls_Manager::SLIDER,
2722 'size_units' => array( 'px', 'em', '%' ),
2723 'selectors' => array(
2724 '{{WRAPPER}}:not(.premium-weather__layout-2) .premium-weather__hourly-forecast-wrapper, {{WRAPPER}}.premium-weather__layout-2 .premium-weather__extra-outer-wrapper' => 'border-radius: {{SIZE}}{{UNIT}};',
2725 ),
2726 )
2727 );
2728
2729 $this->add_responsive_control(
2730 'hourly_outer_padding',
2731 array(
2732 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
2733 'type' => Controls_Manager::DIMENSIONS,
2734 'size_units' => array( 'px', 'em', '%' ),
2735 'selectors' => array(
2736 '{{WRAPPER}}:not(.premium-weather__layout-2) .premium-weather__hourly-forecast-wrapper, {{WRAPPER}}.premium-weather__layout-2 .premium-weather__extra-outer-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2737 ),
2738 )
2739 );
2740
2741 $this->add_responsive_control(
2742 'hourly_outer_margin',
2743 array(
2744 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
2745 'type' => Controls_Manager::DIMENSIONS,
2746 'size_units' => array( 'px', 'em', '%' ),
2747 'selectors' => array(
2748 '{{WRAPPER}}:not(.premium-weather__layout-2) .premium-weather__hourly-forecast-wrapper, {{WRAPPER}}.premium-weather__layout-2 .premium-weather__extra-outer-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2749 ),
2750 )
2751 );
2752
2753 $this->end_controls_section();
2754 }
2755
2756 private function add_navigation_style() {
2757
2758 $this->start_controls_section(
2759 'pa_nav_style',
2760 array(
2761 'label' => __( 'Carousel Arrows', 'premium-addons-for-elementor' ),
2762 'tab' => Controls_Manager::TAB_STYLE,
2763 'conditions' => array(
2764 'relation' => 'or',
2765 'terms' => array(
2766 array(
2767 'name' => 'enable_hourly',
2768 'value' => 'yes',
2769 ),
2770 array(
2771 'terms' => array(
2772 array(
2773 'name' => 'enable_forecast',
2774 'value' => 'yes',
2775 ),
2776 array(
2777 'name' => 'forecast_carousel_sw',
2778 'value' => 'yes',
2779 ),
2780 array(
2781 'name' => 'forecast_layouts',
2782 'operator' => '!==',
2783 'value' => 'style-4',
2784 ),
2785 ),
2786 ),
2787 ),
2788 ),
2789 )
2790 );
2791
2792 $this->add_responsive_control(
2793 'nav_icon_size',
2794 array(
2795 'label' => __( 'Icon Size', 'premium-addons-for-elementor' ),
2796 'type' => Controls_Manager::SLIDER,
2797 'size_units' => array( 'px', '%', 'em' ),
2798 'selectors' => array(
2799 '{{WRAPPER}} .carousel-arrow i' => 'font-size: {{SIZE}}{{UNIT}};',
2800 '{{WRAPPER}} .carousel-arrow svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
2801 ),
2802 )
2803 );
2804
2805 $this->add_responsive_control(
2806 'nav_arrow_height',
2807 array(
2808 'label' => __( 'Arrow Height', 'premium-addons-for-elementor' ),
2809 'type' => Controls_Manager::SLIDER,
2810 'size_units' => array( 'px', '%', 'em' ),
2811 'selectors' => array(
2812 '{{WRAPPER}} .carousel-arrow' => 'height: {{SIZE}}{{UNIT}};',
2813 ),
2814 'condition' => array(
2815 'relation' => 'or',
2816 'terms' => array(
2817 array(
2818 'name' => 'layout',
2819 'value' => 'layout-2',
2820 ),
2821 array(
2822 'terms' => array(
2823 array(
2824 'name' => 'layout',
2825 'operator' => '!==',
2826 'value' => 'layout-2',
2827 ),
2828 array(
2829 'name' => 'hourly_layout',
2830 'value' => 'default',
2831 ),
2832 ),
2833 ),
2834 ),
2835 ),
2836 )
2837 );
2838
2839 $this->add_responsive_control(
2840 'nav_arrow_pos',
2841 array(
2842 'label' => __( 'Vertical Position', 'premium-addons-for-elementor' ),
2843 'type' => Controls_Manager::SLIDER,
2844 'size_units' => array( 'px' ),
2845 'selectors' => array(
2846 '{{WRAPPER}} .carousel-arrow' => 'top: {{SIZE}}px;',
2847 ),
2848 'condition' => array(
2849 'relation' => 'or',
2850 'terms' => array(
2851 array(
2852 'name' => 'layout',
2853 'value' => 'layout-2',
2854 ),
2855 array(
2856 'terms' => array(
2857 array(
2858 'name' => 'layout',
2859 'operator' => '!==',
2860 'value' => 'layout-2',
2861 ),
2862 array(
2863 'name' => 'hourly_layout',
2864 'value' => 'default',
2865 ),
2866 ),
2867 ),
2868 ),
2869 ),
2870 )
2871 );
2872
2873 $this->start_controls_tabs( 'nav_colors' );
2874
2875 $this->start_controls_tab(
2876 'pa_nav_nomral',
2877 array(
2878 'label' => __( 'Normal', 'premium-addons-for-elementor' ),
2879 )
2880 );
2881
2882 $this->add_control(
2883 'pa_hourly_arrows_heading',
2884 array(
2885 'label' => esc_html__( 'Hourly Forecast Arrows', 'premium-addons-for-elementor' ),
2886 'separator' => 'before',
2887 'type' => Controls_Manager::HEADING,
2888 )
2889 );
2890
2891 $this->add_control(
2892 'pa_nav_color',
2893 array(
2894 'label' => __( 'Color', 'premium-addons-for-elementor' ),
2895 'type' => Controls_Manager::COLOR,
2896 'default' => '#171717',
2897 'selectors' => array(
2898 '{{WRAPPER}} .premium-weather__extra-outer-wrapper .carousel-arrow, {{WRAPPER}} .premium-weather__hourly-forecast-wrapper .carousel-arrow' => 'color: {{VALUE}};',
2899 ),
2900 )
2901 );
2902
2903 $this->add_control(
2904 'pa_nav_bg',
2905 array(
2906 'label' => __( 'Background Color', 'premium-addons-for-elementor' ),
2907 'type' => Controls_Manager::COLOR,
2908 'default' => '#F0F0F0',
2909 'selectors' => array(
2910 '{{WRAPPER}} .premium-weather__extra-outer-wrapper .carousel-arrow, {{WRAPPER}} .premium-weather__hourly-forecast-wrapper .carousel-arrow' => 'background-color: {{VALUE}};',
2911 ),
2912 )
2913 );
2914
2915 $this->add_group_control(
2916 Group_Control_Border::get_type(),
2917 array(
2918 'name' => 'pa_nav_border',
2919 'selector' => '{{WRAPPER}} .premium-weather__extra-outer-wrapper .carousel-arrow, {{WRAPPER}} .premium-weather__hourly-forecast-wrapper .carousel-arrow',
2920 )
2921 );
2922
2923 $this->add_control(
2924 'pa_nav_border_radius',
2925 array(
2926 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
2927 'type' => Controls_Manager::DIMENSIONS,
2928 'size_units' => array( 'px', '%', 'em' ),
2929 'selectors' => array(
2930 '{{WRAPPER}} .premium-weather__extra-outer-wrapper .carousel-prev.carousel-arrow, {{WRAPPER}} .premium-weather__hourly-forecast-wrapper .carousel-prev.carousel-arrow' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2931 '{{WRAPPER}} .premium-weather__extra-outer-wrapper .carousel-next.carousel-arrow, {{WRAPPER}} .premium-weather__hourly-forecast-wrapper .carousel-next.carousel-arrow ' => 'border-radius: {{RIGHT}}{{UNIT}} {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}};',
2932 ),
2933 )
2934 );
2935
2936 $this->add_control(
2937 'pa_daily_arrows_heading',
2938 array(
2939 'label' => esc_html__( 'Daily Forecast Arrows', 'premium-addons-for-elementor' ),
2940 'separator' => 'before',
2941 'type' => Controls_Manager::HEADING,
2942 )
2943 );
2944
2945 $this->add_control(
2946 'pa_daily_nav_color',
2947 array(
2948 'label' => __( 'Color', 'premium-addons-for-elementor' ),
2949 'type' => Controls_Manager::COLOR,
2950 'default' => '#171717',
2951 'selectors' => array(
2952 '{{WRAPPER}} .premium-weather__forecast .carousel-arrow' => 'color: {{VALUE}};',
2953 ),
2954 )
2955 );
2956
2957 $this->add_control(
2958 'pa_daily_nav_bg',
2959 array(
2960 'label' => __( 'Background Color', 'premium-addons-for-elementor' ),
2961 'type' => Controls_Manager::COLOR,
2962 'default' => '#F0F0F0',
2963 'selectors' => array(
2964 '{{WRAPPER}} .premium-weather__forecast .carousel-arrow' => 'background-color: {{VALUE}};',
2965 ),
2966 )
2967 );
2968
2969 $this->add_group_control(
2970 Group_Control_Border::get_type(),
2971 array(
2972 'name' => 'pa_daily_nav_border',
2973 'selector' => '{{WRAPPER}} .premium-weather__forecast .carousel-arrow',
2974 )
2975 );
2976
2977 $this->add_control(
2978 'pa_daily_nav_border_radius',
2979 array(
2980 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
2981 'type' => Controls_Manager::DIMENSIONS,
2982 'size_units' => array( 'px', '%', 'em' ),
2983 'selectors' => array(
2984 '{{WRAPPER}} .premium-weather__forecast .carousel-prev.carousel-arrow' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2985 '{{WRAPPER}} .premium-weather__forecast .carousel-next.carousel-arrow' => 'border-radius: {{RIGHT}}{{UNIT}} {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}};',
2986 ),
2987 )
2988 );
2989
2990 $this->end_controls_tab();
2991
2992 $this->start_controls_tab(
2993 'pa_nav_hover',
2994 array(
2995 'label' => __( 'Hover', 'premium-addons-for-elementor' ),
2996
2997 )
2998 );
2999
3000 $this->add_control(
3001 'pa_arrows_heading_hov',
3002 array(
3003 'label' => esc_html__( 'Hourly Forecast Arrows', 'premium-addons-for-elementor' ),
3004 'separator' => 'before',
3005 'type' => Controls_Manager::HEADING,
3006 )
3007 );
3008
3009 $this->add_control(
3010 'pa_nav_color_hov',
3011 array(
3012 'label' => __( 'Color', 'premium-addons-for-elementor' ),
3013 'type' => Controls_Manager::COLOR,
3014 'selectors' => array(
3015 '{{WRAPPER}} .premium-weather__extra-outer-wrapper .carousel-arrow:hover, {{WRAPPER}} .premium-weather__hourly-forecast-wrapper .carousel-arrow:hover' => 'color: {{VALUE}};',
3016 ),
3017 )
3018 );
3019
3020 $this->add_control(
3021 'pa_nav_bg_hov',
3022 array(
3023 'label' => __( 'Background Color', 'premium-addons-for-elementor' ),
3024 'type' => Controls_Manager::COLOR,
3025 'selectors' => array(
3026 '{{WRAPPER}} .premium-weather__extra-outer-wrapper .carousel-arrow:hover, {{WRAPPER}} .premium-weather__hourly-forecast-wrapper .carousel-arrow:hover' => 'background-color: {{VALUE}};',
3027 ),
3028 )
3029 );
3030
3031 $this->add_group_control(
3032 Group_Control_Border::get_type(),
3033 array(
3034 'name' => 'pa_nav_border_hov',
3035 'selector' => '{{WRAPPER}} .premium-weather__extra-outer-wrapper .carousel-arrow:hover, {{WRAPPER}} .premium-weather__hourly-forecast-wrapper .carousel-arrow:hover',
3036 )
3037 );
3038
3039 $this->add_control(
3040 'pa_nav_border_radius_hov',
3041 array(
3042 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
3043 'type' => Controls_Manager::DIMENSIONS,
3044 'size_units' => array( 'px', '%', 'em' ),
3045 'selectors' => array(
3046 '{{WRAPPER}} .premium-weather__extra-outer-wrapper .carousel-prev.carousel-arrow:hover, {{WRAPPER}} .premium-weather__hourly-forecast-wrapper .carousel-prev.carousel-arrow:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3047 '{{WRAPPER}} .premium-weather__extra-outer-wrapper .carousel-next.carousel-arrow:hover, {{WRAPPER}} .premium-weather__hourly-forecast-wrapper .carousel-next.carousel-arrow:hover' => 'border-radius: {{RIGHT}}{{UNIT}} {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}};',
3048 ),
3049 )
3050 );
3051
3052 $this->add_control(
3053 'pa_daily_arrows_heading_hov',
3054 array(
3055 'label' => esc_html__( 'Daily Forecast Arrows', 'premium-addons-for-elementor' ),
3056 'separator' => 'before',
3057 'type' => Controls_Manager::HEADING,
3058 )
3059 );
3060
3061 $this->add_control(
3062 'pa_daily_nav_color_hov',
3063 array(
3064 'label' => __( 'Color', 'premium-addons-for-elementor' ),
3065 'type' => Controls_Manager::COLOR,
3066 'selectors' => array(
3067 '{{WRAPPER}} .premium-weather__forecast .carousel-arrow:hover' => 'color: {{VALUE}};',
3068 ),
3069 )
3070 );
3071
3072 $this->add_control(
3073 'pa_daily_nav_bg_hov',
3074 array(
3075 'label' => __( 'Background Color', 'premium-addons-for-elementor' ),
3076 'type' => Controls_Manager::COLOR,
3077 'selectors' => array(
3078 '{{WRAPPER}} .premium-weather__forecast .carousel-arrow:hover' => 'background-color: {{VALUE}};',
3079 ),
3080 )
3081 );
3082
3083 $this->add_group_control(
3084 Group_Control_Border::get_type(),
3085 array(
3086 'name' => 'pa_daily_nav_border_hov',
3087 'selector' => '{{WRAPPER}} .premium-weather__forecast .carousel-arrow:hover',
3088 )
3089 );
3090
3091 $this->add_control(
3092 'pa_daily_nav_border_radius_hov',
3093 array(
3094 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
3095 'type' => Controls_Manager::DIMENSIONS,
3096 'size_units' => array( 'px', '%', 'em' ),
3097 'selectors' => array(
3098 '{{WRAPPER}} .premium-weather__forecast .carousel-prev.carousel-arrow:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3099 '{{WRAPPER}} .premium-weather__forecast .carousel-next.carousel-arrow:hover' => 'border-radius: {{RIGHT}}{{UNIT}} {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}};',
3100 ),
3101 )
3102 );
3103
3104 $this->end_controls_tab();
3105
3106 $this->end_controls_tabs();
3107
3108 $this->add_responsive_control(
3109 'pa_nav_padding',
3110 array(
3111 'label' => __( 'Hourly Arrows Padding', 'premium-addons-for-elementor' ),
3112 'type' => Controls_Manager::DIMENSIONS,
3113 'size_units' => array( 'px', 'em', '%' ),
3114 'separator' => 'before',
3115 'selectors' => array(
3116 '{{WRAPPER}} .premium-weather__extra-outer-wrapper .carousel-arrow, {{WRAPPER}} .premium-weather__hourly-forecast-wrapper .carousel-arrow' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3117 ),
3118 )
3119 );
3120
3121 $this->add_responsive_control(
3122 'pa_daily_nav_padding',
3123 array(
3124 'label' => __( 'Daily Arrows Padding', 'premium-addons-for-elementor' ),
3125 'type' => Controls_Manager::DIMENSIONS,
3126 'size_units' => array( 'px', 'em', '%' ),
3127 'separator' => 'before',
3128 'selectors' => array(
3129 '{{WRAPPER}} .premium-weather__forecast .carousel-arrow' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3130 ),
3131 )
3132 );
3133
3134 $this->end_controls_section();
3135 }
3136
3137 private function add_tabs_style() {
3138
3139 $this->start_controls_section(
3140 'pa_weather_tabs_style_section',
3141 array(
3142 'label' => __( 'Forecast Tabs', 'premium-addons-for-elementor' ),
3143 'tab' => Controls_Manager::TAB_STYLE,
3144 'condition' => array(
3145 'enable_forecast' => 'yes',
3146 'forecast_tabs' => 'yes',
3147 'forecast_days!' => array( '1', '6', '7', '8' ),
3148 ),
3149 )
3150 );
3151
3152 $this->add_control(
3153 'pa_weather_tabs',
3154 array(
3155 'label' => esc_html__( 'Tabs', 'premium-addons-for-elementor' ),
3156 'separator' => 'before',
3157 'type' => Controls_Manager::HEADING,
3158 )
3159 );
3160
3161 $this->add_group_control(
3162 Group_Control_Typography::get_type(),
3163 array(
3164 'name' => 'pa_weather_tabs_typo',
3165 'selector' => '{{WRAPPER}} .premium-weather__tab-header',
3166 )
3167 );
3168
3169 $this->start_controls_tabs( 'pa_weather_tabs_style' );
3170
3171 $this->start_controls_tab(
3172 'pa_weather_tabs_style_normal',
3173 array(
3174 'label' => __( 'Normal', 'premium-addons-for-elementor' ),
3175 )
3176 );
3177
3178 $this->add_control(
3179 'pa_weather_tabs_color',
3180 array(
3181 'label' => __( 'Color', 'premium-addons-for-elementor' ),
3182 'type' => Controls_Manager::COLOR,
3183 'selectors' => array(
3184 '{{WRAPPER}} .premium-weather__tab-header' => 'color: {{VALUE}};',
3185 ),
3186 )
3187 );
3188
3189 $this->add_group_control(
3190 Group_Control_Background::get_type(),
3191 array(
3192 'name' => 'pa_weather_tabs_bg',
3193 'types' => array( 'classic', 'gradient' ),
3194 'selector' => '{{WRAPPER}} .premium-weather__tab-header',
3195 )
3196 );
3197
3198 $this->add_group_control(
3199 Group_Control_Border::get_type(),
3200 array(
3201 'name' => 'pa_weather_tabs_border',
3202 'selector' => '{{WRAPPER}} .premium-weather__tab-header',
3203 )
3204 );
3205
3206 $this->add_control(
3207 'pa_weather_tabs_border_radius',
3208 array(
3209 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
3210 'type' => Controls_Manager::SLIDER,
3211 'size_units' => array( 'px', '%', 'em' ),
3212 'selectors' => array(
3213 '{{WRAPPER}} .premium-weather__tab-header' => 'border-radius: {{SIZE}}{{UNIT}};',
3214 ),
3215 )
3216 );
3217
3218 $this->end_controls_tab();
3219
3220 $this->start_controls_tab(
3221 'pa_weather_tabs_style_hover',
3222 array(
3223 'label' => __( 'Hover', 'premium-addons-for-elementor' ),
3224 )
3225 );
3226
3227 $this->add_control(
3228 'pa_weather_tabs_color_hov',
3229 array(
3230 'label' => __( 'Color', 'premium-addons-for-elementor' ),
3231 'type' => Controls_Manager::COLOR,
3232 'selectors' => array(
3233 '{{WRAPPER}} .premium-weather__tab-header:hover' => 'color: {{VALUE}};',
3234 ),
3235 )
3236 );
3237
3238 $this->add_group_control(
3239 Group_Control_Background::get_type(),
3240 array(
3241 'name' => 'pa_weather_tabs_bg_hov',
3242 'types' => array( 'classic', 'gradient' ),
3243 'selector' => '{{WRAPPER}} .premium-weather__tab-header:hover',
3244 )
3245 );
3246
3247 $this->add_group_control(
3248 Group_Control_Border::get_type(),
3249 array(
3250 'name' => 'pa_weather_tabs_border_hov',
3251 'selector' => '{{WRAPPER}} .premium-weather__tab-header:hover',
3252 )
3253 );
3254
3255 $this->add_control(
3256 'pa_weather_tabs_border_radius_hov',
3257 array(
3258 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
3259 'type' => Controls_Manager::SLIDER,
3260 'size_units' => array( 'px', '%', 'em' ),
3261 'selectors' => array(
3262 '{{WRAPPER}} .premium-weather__tab-header:hover' => 'border-radius: {{SIZE}}{{UNIT}};',
3263 ),
3264 )
3265 );
3266
3267 $this->end_controls_tab();
3268
3269 $this->start_controls_tab(
3270 'pa_weather_tabs_style_active',
3271 array(
3272 'label' => __( 'Active', 'premium-addons-for-elementor' ),
3273 )
3274 );
3275 $this->add_control(
3276 'pa_weather_tabs_color_active',
3277 array(
3278 'label' => __( 'Color', 'premium-addons-for-elementor' ),
3279 'type' => Controls_Manager::COLOR,
3280 'selectors' => array(
3281 '{{WRAPPER}} .premium-weather__tab-header.current' => 'color: {{VALUE}};',
3282 ),
3283 )
3284 );
3285
3286 $this->add_group_control(
3287 Group_Control_Background::get_type(),
3288 array(
3289 'name' => 'pa_weather_tabs_bg_active',
3290 'types' => array( 'classic', 'gradient' ),
3291 'selector' => '{{WRAPPER}} .premium-weather__tab-header.current',
3292 )
3293 );
3294
3295 $this->add_group_control(
3296 Group_Control_Border::get_type(),
3297 array(
3298 'name' => 'pa_weather_tabs_border_active',
3299 'selector' => '{{WRAPPER}} .premium-weather__tab-header.current',
3300 )
3301 );
3302
3303 $this->add_control(
3304 'pa_weather_tabs_border_radius_active',
3305 array(
3306 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
3307 'type' => Controls_Manager::SLIDER,
3308 'size_units' => array( 'px', '%', 'em' ),
3309 'selectors' => array(
3310 '{{WRAPPER}} .premium-weather__tab-header.current' => 'border-radius: {{SIZE}}{{UNIT}};',
3311 ),
3312 )
3313 );
3314
3315 $this->end_controls_tab();
3316
3317 $this->end_controls_tabs();
3318
3319 $this->add_responsive_control(
3320 'pa_weather_tabs_padding',
3321 array(
3322 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
3323 'type' => Controls_Manager::DIMENSIONS,
3324 'separator' => 'before',
3325 'size_units' => array( 'px', 'em', '%' ),
3326 'selectors' => array(
3327 '{{WRAPPER}} .premium-weather__tab-header' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3328 ),
3329 )
3330 );
3331
3332 $this->add_responsive_control(
3333 'pa_weather_tabs_margin',
3334 array(
3335 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
3336 'type' => Controls_Manager::DIMENSIONS,
3337 'size_units' => array( 'px', 'em', '%' ),
3338 'selectors' => array(
3339 '{{WRAPPER}} .premium-weather__tab-header' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3340 ),
3341 )
3342 );
3343
3344 $this->add_control(
3345 'pa_weather_tabs_icons',
3346 array(
3347 'label' => esc_html__( 'Icons Row', 'premium-addons-for-elementor' ),
3348 'separator' => 'before',
3349 'type' => Controls_Manager::HEADING,
3350 )
3351 );
3352
3353 $this->add_control(
3354 'pa_weather_tabs_icon_color',
3355 array(
3356 'label' => __( 'Color', 'premium-addons-for-elementor' ),
3357 'type' => Controls_Manager::COLOR,
3358 'selectors' => array(
3359 '{{WRAPPER}} .premium-weather__weather-indicator i' => 'color: {{VALUE}};',
3360 '{{WRAPPER}} .premium-weather__weather-indicator svg,
3361 {{WRAPPER}} .premium-weather__weather-indicator > svg *' => 'fill: {{VALUE}};',
3362 ),
3363 )
3364 );
3365
3366 $this->add_responsive_control(
3367 'pa_weather_tabs_icon_size',
3368 array(
3369 'label' => __( 'Icon Size', 'premium-addons-for-elementor' ),
3370 'type' => Controls_Manager::SLIDER,
3371 'selectors' => array(
3372 '{{WRAPPER}} .premium-weather__weather-indicator i' => 'font-size: {{SIZE}}{{UNIT}}',
3373 '{{WRAPPER}} .premium-weather__weather-indicator svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
3374 ),
3375 )
3376 );
3377
3378 $this->add_group_control(
3379 Group_Control_Background::get_type(),
3380 array(
3381 'name' => 'pa_weather_tabs_icon_bg',
3382 'types' => array( 'classic', 'gradient' ),
3383 'selector' => '{{WRAPPER}} .premium-weather__weather-indicators',
3384 )
3385 );
3386
3387 $this->add_group_control(
3388 Group_Control_Border::get_type(),
3389 array(
3390 'name' => 'pa_weather_tabs_icon_border',
3391 'selector' => '{{WRAPPER}} .premium-weather__weather-indicators',
3392 )
3393 );
3394
3395 $this->add_responsive_control(
3396 'pa_weather_tabs_icon_padding',
3397 array(
3398 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
3399 'type' => Controls_Manager::DIMENSIONS,
3400 'size_units' => array( 'px', 'em', '%' ),
3401 'selectors' => array(
3402 '{{WRAPPER}} .premium-weather__weather-indicators' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3403 ),
3404 )
3405 );
3406
3407 $this->add_responsive_control(
3408 'pa_weather_tabs_icon_margin',
3409 array(
3410 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
3411 'type' => Controls_Manager::DIMENSIONS,
3412 'size_units' => array( 'px', 'em', '%' ),
3413 'selectors' => array(
3414 '{{WRAPPER}} .premium-weather__weather-indicators' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3415 ),
3416 )
3417 );
3418
3419 $this->add_control(
3420 'pa_weather_tabs_date',
3421 array(
3422 'label' => esc_html__( 'Hours', 'premium-addons-for-elementor' ),
3423 'separator' => 'before',
3424 'type' => Controls_Manager::HEADING,
3425 )
3426 );
3427
3428 $this->add_group_control(
3429 Group_Control_Typography::get_type(),
3430 array(
3431 'name' => 'tabs_date',
3432 'selector' => '{{WRAPPER}} .premium-weather__hourly-item-date',
3433 )
3434 );
3435
3436 $this->add_control(
3437 'tabs_date_color',
3438 array(
3439 'label' => __( 'Color', 'premium-addons-for-elementor' ),
3440 'type' => Controls_Manager::COLOR,
3441 'selectors' => array(
3442 '{{WRAPPER}} .premium-weather__hourly-item-date' => 'color: {{VALUE}};',
3443 ),
3444 )
3445 );
3446
3447 $this->add_control(
3448 'pa_weather_tabs_details',
3449 array(
3450 'label' => esc_html__( 'Weather Details', 'premium-addons-for-elementor' ),
3451 'separator' => 'before',
3452 'type' => Controls_Manager::HEADING,
3453 )
3454 );
3455
3456 $this->add_group_control(
3457 Group_Control_Typography::get_type(),
3458 array(
3459 'name' => 'pa_weather_tabs_details_typo',
3460 'selector' => '{{WRAPPER}} .premium-weather__tab-content .premium-weather__hourly-item > *:not(.premium-weather__hourly-item-date):not(.premium-weather__icon-wrapper)',
3461 )
3462 );
3463
3464 $this->add_control(
3465 'pa_weather_tabs_details_color',
3466 array(
3467 'label' => __( 'Color', 'premium-addons-for-elementor' ),
3468 'type' => Controls_Manager::COLOR,
3469 'selectors' => array(
3470 '{{WRAPPER}} .premium-weather__tab-content .premium-weather__hourly-item > *:not(.premium-weather__hourly-item-date):not(.premium-weather__icon-wrapper)' => 'color: {{VALUE}};',
3471 ),
3472 )
3473 );
3474
3475 $this->add_group_control(
3476 Group_Control_Background::get_type(),
3477 array(
3478 'name' => 'pa_weather_tabs_details_bg',
3479 'types' => array( 'classic', 'gradient' ),
3480 'selector' => '{{WRAPPER}} .premium-weather__hourly-item',
3481 )
3482 );
3483
3484 $this->add_group_control(
3485 Group_Control_Border::get_type(),
3486 array(
3487 'name' => 'pa_weather_tabs_details_border',
3488 'selector' => '{{WRAPPER}} .premium-weather__hourly-item',
3489 )
3490 );
3491
3492 $this->add_control(
3493 'pa_weather_tabs_details_border_rad',
3494 array(
3495 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
3496 'type' => Controls_Manager::SLIDER,
3497 'size_units' => array( 'px', 'em', '%' ),
3498 'selectors' => array(
3499 '{{WRAPPER}} .premium-weather__hourly-item' => 'border-radius: {{SIZE}}{{UNIT}};',
3500 ),
3501 )
3502 );
3503
3504 $this->add_responsive_control(
3505 'pa_weather_tabs_details_padding',
3506 array(
3507 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
3508 'type' => Controls_Manager::DIMENSIONS,
3509 'size_units' => array( 'px', 'em', '%' ),
3510 'selectors' => array(
3511 '{{WRAPPER}} .premium-weather__hourly-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3512 ),
3513 )
3514 );
3515
3516 $this->add_responsive_control(
3517 'pa_weather_tabs_details_margin',
3518 array(
3519 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
3520 'type' => Controls_Manager::DIMENSIONS,
3521 'size_units' => array( 'px', 'em', '%' ),
3522 'selectors' => array(
3523 '{{WRAPPER}} .premium-weather__hourly-item' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3524 ),
3525 )
3526 );
3527
3528 $this->add_control(
3529 'tabs_forecast_icon',
3530 array(
3531 'label' => esc_html__( 'Weather Icon', 'premium-addons-for-elementor' ),
3532 'separator' => 'before',
3533 'type' => Controls_Manager::HEADING,
3534 )
3535 );
3536
3537 $this->add_control(
3538 'tabs_forecast_icon_color',
3539 array(
3540 'label' => __( 'Color', 'premium-addons-for-elementor' ),
3541 'type' => Controls_Manager::COLOR,
3542 'selectors' => array(
3543 '{{WRAPPER}} .premium-weather__tab-content .premium-weather__icon-wrapper svg,
3544 {{WRAPPER}} .premium-weather__tab-content .premium-weather__icon-wrapper svg *' => 'fill: {{VALUE}};',
3545 '{{WRAPPER}} .premium-weather__tab-content .premium-weather__icon-wrapper' => 'color: {{VALUE}};',
3546 ),
3547 )
3548 );
3549
3550 $papro_activated = apply_filters( 'papro_activated', false );
3551
3552 if ( $papro_activated ) {
3553 $this->add_control(
3554 'tabs_forecast_icon_stroke',
3555 array(
3556 'label' => __( 'Stroke Color', 'premium-addons-for-elementor' ),
3557 'type' => Controls_Manager::COLOR,
3558 'selectors' => array(
3559 '{{WRAPPER}} .premium-weather__tab-content .premium-weather__icon-wrapper svg *' => 'stroke: {{VALUE}} !important',
3560 ),
3561 'condition' => array(
3562 'enable_custom_icon' => 'yes',
3563 'icons_source' => 'default',
3564 'lottie_type' => 'outlined',
3565 ),
3566 )
3567 );
3568
3569 $this->add_responsive_control(
3570 'tabs_forecast_icon_stroke_width',
3571 array(
3572 'label' => __( 'Stroke Width', 'premium-addons-for-elementor' ),
3573 'type' => Controls_Manager::SLIDER,
3574 'range' => array(
3575 'px' => array(
3576 'min' => 0,
3577 'max' => 1000,
3578 ),
3579 ),
3580 'size_units' => array( 'px' ),
3581 'selectors' => array(
3582 '{{WRAPPER}} .premium-weather__tab-content .premium-weather__icon-wrapper svg *' => 'stroke-width: {{SIZE}}{{UNIT}} !important;',
3583 ),
3584 'condition' => array(
3585 'enable_custom_icon' => 'yes',
3586 'icons_source' => 'default',
3587 'lottie_type' => 'outlined',
3588 ),
3589 )
3590 );
3591 }
3592
3593 $this->add_responsive_control(
3594 'tabs_forecast_icon_size',
3595 array(
3596 'label' => __( 'Size', 'premium-addons-for-elementor' ),
3597 'type' => Controls_Manager::SLIDER,
3598 'size_units' => array( 'px' ),
3599 'range' => array(
3600 'px' => array(
3601 'min' => 0,
3602 'max' => 1000,
3603 ),
3604 ),
3605 'selectors' => array(
3606 '{{WRAPPER}} .premium-weather__tab-content .premium-weather__icon-wrapper > svg,
3607 {{WRAPPER}} .premium-weather__tab-content .premium-weather__icon-wrapper .premium-lottie-animation,
3608 {{WRAPPER}} .premium-weather__tab-content .premium-weather__icon-wrapper img' => 'width:{{SIZE}}{{UNIT}}; height:{{SIZE}}{{UNIT}};',
3609 '{{WRAPPER}} .premium-weather__tab-content .premium-weather__icon-wrapper i' => 'font-size:{{SIZE}}px',
3610 ),
3611 )
3612 );
3613
3614 $this->add_control(
3615 'pa_weather_tabs_notice',
3616 array(
3617 'label' => esc_html__( 'Notice', 'premium-addons-for-elementor' ),
3618 'separator' => 'before',
3619 'type' => Controls_Manager::HEADING,
3620 )
3621 );
3622
3623 $this->add_control(
3624 'notice_color',
3625 array(
3626 'label' => __( 'Color', 'premium-addons-for-elementor' ),
3627 'type' => Controls_Manager::COLOR,
3628 'selectors' => array(
3629 '{{WRAPPER}} .premium-weather__forecast-item-date' => 'color: {{VALUE}};',
3630 ),
3631 )
3632 );
3633
3634 $this->add_control(
3635 'pa_weather_tabs_cont',
3636 array(
3637 'label' => esc_html__( 'Container', 'premium-addons-for-elementor' ),
3638 'separator' => 'before',
3639 'type' => Controls_Manager::HEADING,
3640 )
3641 );
3642
3643 $this->add_group_control(
3644 Group_Control_Box_Shadow::get_type(),
3645 array(
3646 'name' => 'pa_weather_tabs_cont_shadow',
3647 'selector' => '{{WRAPPER}} .premium-weather__forecast-tabs-wrapper',
3648 )
3649 );
3650
3651 $this->add_group_control(
3652 Group_Control_Background::get_type(),
3653 array(
3654 'name' => 'pa_weather_tabs_cont_bg',
3655 'types' => array( 'classic', 'gradient' ),
3656 'selector' => '{{WRAPPER}} .premium-weather__forecast-tabs-wrapper',
3657 )
3658 );
3659
3660 $this->add_group_control(
3661 Group_Control_Border::get_type(),
3662 array(
3663 'name' => 'pa_weather_tabs_cont_border',
3664 'selector' => '{{WRAPPER}} .premium-weather__forecast-tabs-wrapper',
3665 )
3666 );
3667
3668 $this->add_control(
3669 'pa_weather_tabs_cont_border_rad',
3670 array(
3671 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
3672 'type' => Controls_Manager::SLIDER,
3673 'size_units' => array( 'px', 'em', '%' ),
3674 'selectors' => array(
3675 '{{WRAPPER}} .premium-weather__forecast-tabs-wrapper' => 'border-radius: {{SIZE}}{{UNIT}};',
3676 ),
3677 )
3678 );
3679
3680 $this->add_responsive_control(
3681 'pa_weather_tabs_cont_padding',
3682 array(
3683 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
3684 'type' => Controls_Manager::DIMENSIONS,
3685 'size_units' => array( 'px', 'em', '%' ),
3686 'selectors' => array(
3687 '{{WRAPPER}} .premium-weather__forecast-tabs-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3688 ),
3689 )
3690 );
3691
3692 $this->add_responsive_control(
3693 'pa_weather_tabs_cont_margin',
3694 array(
3695 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
3696 'type' => Controls_Manager::DIMENSIONS,
3697 'size_units' => array( 'px', 'em', '%' ),
3698 'selectors' => array(
3699 '{{WRAPPER}} .premium-weather__forecast-tabs-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3700 ),
3701 )
3702 );
3703
3704 $this->end_controls_section();
3705 }
3706
3707 /**
3708 * Render weather widget output on the frontend.
3709 * Written in PHP and used to generate the final HTML.
3710 *
3711 * @since 1.0.0
3712 * @access protected
3713 */
3714 protected function render() {
3715
3716 $settings = $this->get_settings_for_display();
3717
3718 $papro_activated = apply_filters( 'papro_activated', false );
3719
3720 if ( ! $papro_activated ) {
3721
3722 $settings['forecast_carousel_sw'] = false;
3723 $settings['forecast_days'] = false;
3724 $settings['forecast_tabs'] = false;
3725
3726 if ( 'yes' === $settings['enable_custom_icon'] || 'yes' === $settings['enable_forecast'] || 'layout-3' === $settings['layout'] || 'coords' === $settings['custom_location_type'] ) {
3727
3728 ?>
3729 <div class="premium-error-notice">
3730 <?php
3731 $message = __( 'This option is available in <b>Premium Addons Pro</b>.', 'premium-addons-for-elementor' );
3732 echo wp_kses_post( $message );
3733 ?>
3734 </div>
3735 <?php
3736 return false;
3737
3738 }
3739 }
3740
3741 $this->settings = $settings;
3742
3743 $id = $this->get_id();
3744
3745 $api_key = apply_filters( 'pa_weather_api', $settings['api_key'] );
3746
3747 if ( empty( $api_key ) ) {
3748 $notice = __( 'Please enter a valid API key.', 'premium-addons-for-elementor' );
3749
3750 ?>
3751 <div class="premium-error-notice">
3752 <?php echo wp_kses_post( $notice ); ?>
3753 </div>
3754 <?php
3755 return;
3756 }
3757
3758 $is_edit_mode = \Elementor\Plugin::$instance->editor->is_edit_mode();
3759
3760 $location_type = $settings['location_type'];
3761
3762 $forecast = 'yes' === $settings['enable_forecast'] ? true : false;
3763
3764 $hourly_forecast = 'yes' === $settings['enable_hourly'] ? true : false;
3765
3766 $api_settings = array(
3767 'api_key' => $api_key,
3768 'location_type' => $location_type,
3769 'unit' => $settings['unit'],
3770 'lang' => $settings['lang'],
3771 'forecast' => $forecast,
3772 'hourly' => $hourly_forecast,
3773 );
3774
3775 if ( $forecast ) {
3776 $api_settings['forecast_tabs'] = 'yes' === $settings['forecast_tabs'] && ! in_array( $settings['forecast_days'], array( '1', '6', '7', '8' ), true ) ? true : false;
3777 }
3778
3779 if ( 'custom' === $location_type ) {
3780
3781 $custom_loc_type = $settings['custom_location_type'];
3782
3783 $api_settings['custom_location_type'] = $custom_loc_type;
3784
3785 if ( 'name' === $custom_loc_type ) {
3786 $city_name = $settings['city_name'];
3787
3788 if ( empty( $city_name ) ) {
3789 $notice = __( 'Please Enter a Valid City Name.', 'premium-addons-for-elementor' );
3790
3791 ?>
3792 <div class="premium-error-notice">
3793 <?php echo wp_kses_post( $notice ); ?>
3794 </div>
3795 <?php
3796 return;
3797 }
3798
3799 $api_settings['city_name'] = $city_name;
3800
3801 } else {
3802
3803 $lat = $settings['lat_coord'];
3804 $long = $settings['long_coord'];
3805
3806 if ( empty( $lat ) || empty( $long ) ) {
3807 $notice = __( 'Please Enter Valid Latitude & Longitude Coordinates.', 'premium-addons-for-elementor' );
3808
3809 ?>
3810 <div class="premium-error-notice">
3811 <?php echo wp_kses_post( $notice ); ?>
3812 </div>
3813 <?php
3814 return;
3815 }
3816
3817 $api_settings['lat'] = $lat;
3818 $api_settings['long'] = $long;
3819 }
3820
3821 $transient_name = sprintf( 'pa_weather_%s_%s_%s', $api_key, $id, get_the_ID() );
3822
3823 if ( $is_edit_mode ) {
3824 $weather_data = false;
3825 } else {
3826 $weather_data = get_transient( $transient_name );
3827 }
3828
3829 if ( ! $weather_data ) {
3830
3831 $api_handler = new Pa_Weather_Handler( $api_settings );
3832
3833 $weather_data = $api_handler::get_weather_data();
3834
3835 // if ( isset( $weather_data['status'] ) && ! $weather_data['status'] ) {
3836 if ( isset( $weather_data['cod'] ) || ( isset( $weather_data['status'] ) && empty( $weather_data['status'] ) ) ) {
3837
3838 $notice = __( 'Something Went Wrong, Please make sure you\'ve entered valid data, CODE:', 'premium-addons-for-elementor' ) . $weather_data['cod'];
3839
3840 ?>
3841 <div class="premium-error-notice">
3842 <?php echo wp_kses_post( $notice ); ?>
3843 </div>
3844 <?php
3845 return;
3846 } else {
3847 $expire_time = HOUR_IN_SECONDS * $settings['reload'];
3848
3849 set_transient( $transient_name, $weather_data, $expire_time );
3850 }
3851 }
3852 } else {
3853
3854 $api_handler = new Pa_Weather_Handler( $api_settings );
3855
3856 $weather_data = $api_handler::get_weather_data();
3857
3858 // if ( isset( $weather_data['status'] ) && ! $weather_data['status'] ) {
3859 if ( isset( $weather_data['cod'] ) || ( isset( $weather_data['status'] ) && empty( $weather_data['status'] ) ) ) {
3860
3861 $notice = __( 'Something Went Wrong, Please make sure you\'ve entered valid data, CODE:', 'premium-addons-for-elementor' ) . $weather_data['cod'];
3862
3863 ?>
3864 <div class="premium-error-notice">
3865 <?php echo wp_kses_post( $notice ); ?>
3866 </div>
3867 <?php
3868 return;
3869 }
3870 }
3871
3872 $this->render_weather_layout( $weather_data, $settings );
3873 }
3874
3875 /**
3876 * Render Weather Layout.
3877 *
3878 * @access private
3879 * @since 2.8.23
3880 *
3881 * @param array $weather_data weather data.
3882 * @param array $settings widget settings.
3883 */
3884 private function render_weather_layout( $weather_data, $settings ) {
3885
3886 $layout = $settings['layout'];
3887 $show_temp_icon = 'yes' === $settings['show_temp_icon'] ? true : false;
3888 $show_current_weather = 'yes' === $settings['show_current_weather'] ? true : false;
3889 $current = $weather_data['current'];
3890 $forecast = 'yes' === $settings['enable_forecast'] ? true : false;
3891 $forecast_icon = $forecast && 'yes' === $settings['show_forecast_icon'] ? true : false;
3892 $hourly_forecast = 'yes' === $settings['enable_hourly'] ? $weather_data['hourly'] : false;
3893 $daily_carousel = 'yes' === $settings['forecast_carousel_sw'] ? true : false;
3894 $show_city = 'yes' === $settings['show_city'] ? true : false;
3895 $title = $show_city && ! empty( $settings['title'] ) ? $settings['title'] : false;
3896 $extra_weather = 'yes' === $settings['show_extra_info'] && is_array( $settings['pa_extra_weather'] ) ? $settings['pa_extra_weather'] : array();
3897 $slick_settings = array();
3898 $temp_unit = 'metric' === $settings['unit'] ? '&deg;C' : '&deg;F';
3899 $height = false !== $forecast && 'layout-2' === $settings['layout'] && ! empty( $settings['height']['size'] ) ? $settings['height']['size'] . 'px' : false;
3900 $tabs_mode = ! in_array( $settings['forecast_days'], array( '1', '6', '7', '8' ), true ) && 'yes' === $settings['forecast_tabs'] ? true : false;
3901 $show_curr_weather_desc = 'yes' === $settings['show_curr_weather_desc'] ? true : false;
3902 $timezone = $weather_data['timezone'];
3903
3904 if ( $hourly_forecast ) {
3905 $slick_settings = array(
3906 'layout' => $layout,
3907 'hourlyLayout' => $settings['hourly_layout'],
3908 'slidesToScroll' => $settings['slides_to_scroll'],
3909 'slidesToScrollTab' => isset( $settings['slides_to_scroll_tablet'] ) ? $settings['slides_to_scroll_tablet'] : 1,
3910 'slidesToScrollMobile' => isset( $settings['slides_to_scroll_mobile'] ) ? $settings['slides_to_scroll_mobile'] : 1,
3911 'slidesToShow' => empty( $settings['slides_to_show'] ) ? 4 : $settings['slides_to_show'],
3912 'slidesToShowTab' => isset( $settings['slides_to_show_tablet'] ) ? $settings['slides_to_show_tablet'] : 1,
3913 'slidesToShowMobile' => isset( $settings['slides_to_show_mobile'] ) ? $settings['slides_to_show_mobile'] : 1,
3914 );
3915 }
3916
3917 $is_edit_mode = \Elementor\Plugin::$instance->editor->is_edit_mode();
3918 $hidden_style = $is_edit_mode ? '' : 'visibility:hidden; opacity:0;';
3919
3920 $this->add_render_attribute(
3921 'outer_wrapper',
3922 array(
3923 'class' => 'premium-weather__outer-wrapper',
3924 'data-pa-weather-settings' => wp_json_encode( $slick_settings ),
3925 'data-pa-height' => $height,
3926 'style' => $hidden_style,
3927 )
3928 );
3929
3930 if ( $daily_carousel ) {
3931
3932 $daily_settings = array(
3933 'slidesToShow' => empty( $settings['daily_slides_to_show'] ) ? 4 : $settings['daily_slides_to_show'],
3934 'slidesToShowTab' => empty( $settings['daily_slides_to_show_tablet'] ) ? 1 : $settings['daily_slides_to_show_tablet'],
3935 'slidesToShowMobile' => empty( $settings['daily_slides_to_show_mobile'] ) ? 1 : $settings['daily_slides_to_show_mobile'],
3936 );
3937
3938 $this->add_render_attribute( 'outer_wrapper', 'data-pa-daily-settings', wp_json_encode( $daily_settings ) );
3939 }
3940
3941 if ( 'layout-2' !== $layout ) {
3942 $hourly_data = 'vertical' === $settings['hourly_layout'] ? is_array( $settings['hourly_weather_data'] ) : true;
3943 }
3944
3945 ?>
3946 <div <?php echo wp_kses_post( $this->get_render_attribute_string( 'outer_wrapper' ) ); ?>>
3947 <?php
3948
3949 // hourly_weather_data
3950 if ( 'layout-1' === $layout ) {
3951 ?>
3952 <?php if ( $show_current_weather ) : ?>
3953 <div class="premium-weather__current-weather">
3954 <div class="premium-weather__basic-weather">
3955 <?php if ( false !== $title ) { ?>
3956 <div class="premium-weather__city-wrapper">
3957 <span class="premium-weather__city-name"> <?php echo esc_html( str_replace( '{{city_name}}', $weather_data['city_name'], $title ) ); ?></span>
3958 </div>
3959 <?php } ?>
3960 <div class="premium-weather__icon-wrapper" title="<?php echo esc_attr( $current['weather'][0]['description'] ); ?>">
3961 <?php $this->render_weather_icon( $current['weather'][0]['icon'] ); ?>
3962 </div>
3963 <div class="premium-weather__temp-wrapper">
3964 <?php if ( $show_temp_icon ) : ?>
3965 <svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1,.premium-weather-cls-2{fill:#333;}.premium-weather-cls-2{fill-rule:evenodd;}</style></defs><g id="Temperature"><path class="premium-weather-cls-1" d="m13.5,17c0,.83-.68,1.5-1.5,1.5s-1.5-.67-1.5-1.5c0-.55.3-1.05.77-1.31.2-.11.3-.34.24-.56-.01-.04-.01-.08-.01-.13V5c0-.27.22-.5.5-.5s.5.23.5.5v10c0,.05-.01.09-.02.13-.06.22.04.45.24.56.48.26.78.76.78,1.31Z"/><path class="premium-weather-cls-1" d="m15.5,12.76v-7.76c0-1.93-1.57-3.5-3.5-3.5s-3.5,1.57-3.5,3.5v7.76c-1.26,1.04-2,2.58-2,4.24,0,3.04,2.46,5.5,5.5,5.5s5.5-2.46,5.5-5.5c0-1.66-.75-3.2-2-4.24Zm-3.5,6.74c-1.39,0-2.5-1.12-2.5-2.5,0-.8.38-1.53,1-2V5c0-.82.67-1.5,1.5-1.5s1.5.68,1.5,1.5v10c.62.47,1,1.2,1,2,0,1.38-1.12,2.5-2.5,2.5Z"/><path class="premium-weather-cls-2" d="m13.5,17c0,.83-.68,1.5-1.5,1.5s-1.5-.67-1.5-1.5c0-.55.3-1.05.77-1.31.2-.11.3-.34.24-.56-.01-.04-.01-.08-.01-.13V5c0-.27.22-.5.5-.5s.5.23.5.5v10c0,.05-.01.09-.02.13-.06.22.04.45.24.56.48.26.78.76.78,1.31Z"/></g></svg>
3966 <?php endif; ?>
3967 <span class="premium-weather__temp-val"><?php echo esc_html( round( $current['temp'], 0 ) ); ?></span>
3968 <span class="premium-weather__temp-unit"><?php echo $temp_unit; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span>
3969 </div>
3970 <?php if ( $show_curr_weather_desc ) : ?>
3971 <div class="premium-weather__desc-wrapper">
3972 <div class="premium-weather__desc"><?php echo esc_html( $current['weather'][0]['description'] ); ?></div>
3973 <div class="premium-weather__feels-like"> Feels Like: <?php echo esc_html( round( $current['feels_like'], 0 ) ) . $temp_unit; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div>
3974 </div>
3975 <?php endif; ?>
3976 </div>
3977
3978 <?php if ( count( $extra_weather ) ) { ?>
3979 <div class="premium-weather__extra-weather">
3980 <?php $this->render_extra_weather( $extra_weather, $current ); ?>
3981 </div>
3982 <?php } ?>
3983 </div>
3984 <?php endif; ?>
3985
3986 <?php if ( false !== $hourly_forecast && $hourly_data ) { ?>
3987 <div class="premium-weather__hourly-forecast-wrapper">
3988 <?php $this->render_hourly_forecast( $hourly_forecast, $timezone ); ?>
3989 </div>
3990 <?php } ?>
3991 <?php
3992 if ( false !== $forecast ) {
3993 if ( $tabs_mode ) {
3994 $this->render_forecast_tabs( $weather_data['tabs_data'] );
3995 } else {
3996 $this->render_forecast_days( $weather_data['daily'], $settings['forecast_days'], $forecast_icon, $show_temp_icon );
3997 }
3998 }
3999 ?>
4000 <?php
4001 } elseif ( 'layout-2' === $layout ) {
4002
4003 ?>
4004 <?php if ( false !== $title ) { ?>
4005 <div class="premium-weather__city-wrapper">
4006 <span class="premium-weather__city-name"> <?php echo esc_html( str_replace( '{{city_name}}', $weather_data['city_name'], $title ) ); ?></span>
4007 </div>
4008 <?php } ?>
4009
4010 <div class="premium-weather__current-weather">
4011 <?php if ( $show_current_weather ) : ?>
4012 <div class="premium-weather__basic-weather">
4013 <div class="premium-weather__temp-wrapper">
4014 <?php if ( $show_temp_icon ) : ?>
4015 <svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1,.premium-weather-cls-2{fill:#333;}.premium-weather-cls-2{fill-rule:evenodd;}</style></defs><g id="Temperature"><path class="premium-weather-cls-1" d="m13.5,17c0,.83-.68,1.5-1.5,1.5s-1.5-.67-1.5-1.5c0-.55.3-1.05.77-1.31.2-.11.3-.34.24-.56-.01-.04-.01-.08-.01-.13V5c0-.27.22-.5.5-.5s.5.23.5.5v10c0,.05-.01.09-.02.13-.06.22.04.45.24.56.48.26.78.76.78,1.31Z"/><path class="premium-weather-cls-1" d="m15.5,12.76v-7.76c0-1.93-1.57-3.5-3.5-3.5s-3.5,1.57-3.5,3.5v7.76c-1.26,1.04-2,2.58-2,4.24,0,3.04,2.46,5.5,5.5,5.5s5.5-2.46,5.5-5.5c0-1.66-.75-3.2-2-4.24Zm-3.5,6.74c-1.39,0-2.5-1.12-2.5-2.5,0-.8.38-1.53,1-2V5c0-.82.67-1.5,1.5-1.5s1.5.68,1.5,1.5v10c.62.47,1,1.2,1,2,0,1.38-1.12,2.5-2.5,2.5Z"/><path class="premium-weather-cls-2" d="m13.5,17c0,.83-.68,1.5-1.5,1.5s-1.5-.67-1.5-1.5c0-.55.3-1.05.77-1.31.2-.11.3-.34.24-.56-.01-.04-.01-.08-.01-.13V5c0-.27.22-.5.5-.5s.5.23.5.5v10c0,.05-.01.09-.02.13-.06.22.04.45.24.56.48.26.78.76.78,1.31Z"/></g></svg>
4016 <?php endif; ?>
4017 <span class="premium-weather__temp-val"><?php echo esc_html( round( $current['temp'], 0 ) ); ?></span>
4018 <span class="premium-weather__temp-unit"><?php echo $temp_unit; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span>
4019 </div>
4020 <div class="premium-weather__desc-wrapper">
4021 <div class="premium-weather__icon-wrapper" title="<?php echo esc_attr( $current['weather'][0]['description'] ); ?>">
4022 <?php $this->render_weather_icon( $current['weather'][0]['icon'] ); ?>
4023 </div>
4024 <?php if ( $show_curr_weather_desc ) : ?>
4025 <div class="premium-weather__desc"><?php echo esc_html( $current['weather'][0]['description'] ); ?></div>
4026 <div class="premium-weather__feels-like"> Feels Like: <?php echo esc_html( round( $current['feels_like'], 0 ) ) . $temp_unit; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div>
4027 <?php endif; ?>
4028 </div>
4029 </div>
4030 <?php endif; ?>
4031 <?php if ( ( $show_current_weather && count( $extra_weather ) ) || ( false !== $hourly_forecast ) ) : ?>
4032 <div class="premium-weather__extra-outer-wrapper" <?php // echo $hourly_forecast_css; ?>>
4033 <?php if ( $show_current_weather && count( $extra_weather ) ) { ?>
4034 <div class="premium-weather__extra-weather">
4035 <?php $this->render_extra_weather( $extra_weather, $current ); ?>
4036 </div>
4037 <?php
4038 }
4039
4040 if ( false !== $hourly_forecast ) {
4041 $this->render_hourly_forecast( $hourly_forecast, $timezone );
4042 }
4043 ?>
4044 </div>
4045 <?php endif; ?>
4046 </div>
4047 <?php
4048 if ( false !== $forecast ) {
4049 if ( $tabs_mode ) {
4050 $this->render_forecast_tabs( $weather_data['tabs_data'] );
4051 } else {
4052 $this->render_forecast_days( $weather_data['daily'], $settings['forecast_days'], $forecast_icon, $show_temp_icon );
4053 }
4054 }
4055 ?>
4056 <?php
4057 } elseif ( 'layout-3' === $layout ) {
4058 ?>
4059
4060 <?php if ( $show_current_weather ) : ?>
4061 <div class="premium-weather__current-weather">
4062 <div class="premium-weather__basic-weather">
4063 <div class="premium-weather__icon-wrapper" title="<?php echo esc_attr( $current['weather'][0]['description'] ); ?>">
4064 <?php $this->render_weather_icon( $current['weather'][0]['icon'] ); ?>
4065 </div>
4066
4067 <?php if ( false !== $title ) { ?>
4068 <div class="premium-weather__city-wrapper">
4069 <span class="premium-weather__city-name"> <?php echo esc_html( str_replace( '{{city_name}}', $weather_data['city_name'], $title ) ); ?></span>
4070 </div>
4071 <?php } ?>
4072 <?php if ( $show_curr_weather_desc ) : ?>
4073 <div class="premium-weather__desc"><?php echo esc_html( $current['weather'][0]['description'] ); ?></div>
4074 <div class="premium-weather__feels-like"> Feels Like: <?php echo esc_html( round( $current['feels_like'], 0 ) ) . $temp_unit; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div>
4075 <?php endif; ?>
4076 </div>
4077
4078 <div class="premium-weather__extra-outer-wrapper">
4079 <div class="premium-weather__temp-wrapper">
4080 <?php if ( $show_temp_icon ) : ?>
4081 <svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1,.premium-weather-cls-2{fill:#333;}.premium-weather-cls-2{fill-rule:evenodd;}</style></defs><g id="Temperature"><path class="premium-weather-cls-1" d="m13.5,17c0,.83-.68,1.5-1.5,1.5s-1.5-.67-1.5-1.5c0-.55.3-1.05.77-1.31.2-.11.3-.34.24-.56-.01-.04-.01-.08-.01-.13V5c0-.27.22-.5.5-.5s.5.23.5.5v10c0,.05-.01.09-.02.13-.06.22.04.45.24.56.48.26.78.76.78,1.31Z"/><path class="premium-weather-cls-1" d="m15.5,12.76v-7.76c0-1.93-1.57-3.5-3.5-3.5s-3.5,1.57-3.5,3.5v7.76c-1.26,1.04-2,2.58-2,4.24,0,3.04,2.46,5.5,5.5,5.5s5.5-2.46,5.5-5.5c0-1.66-.75-3.2-2-4.24Zm-3.5,6.74c-1.39,0-2.5-1.12-2.5-2.5,0-.8.38-1.53,1-2V5c0-.82.67-1.5,1.5-1.5s1.5.68,1.5,1.5v10c.62.47,1,1.2,1,2,0,1.38-1.12,2.5-2.5,2.5Z"/><path class="premium-weather-cls-2" d="m13.5,17c0,.83-.68,1.5-1.5,1.5s-1.5-.67-1.5-1.5c0-.55.3-1.05.77-1.31.2-.11.3-.34.24-.56-.01-.04-.01-.08-.01-.13V5c0-.27.22-.5.5-.5s.5.23.5.5v10c0,.05-.01.09-.02.13-.06.22.04.45.24.56.48.26.78.76.78,1.31Z"/></g></svg>
4082 <?php endif; ?>
4083 <span class="premium-weather__temp-val"><?php echo esc_html( round( $current['temp'], 0 ) ); ?></span>
4084 <span class="premium-weather__temp-unit"><?php echo $temp_unit; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span>
4085 </div>
4086 <?php if ( count( $extra_weather ) ) { ?>
4087 <div class="premium-weather__extra-weather">
4088 <?php $this->render_extra_weather( $extra_weather, $current ); ?>
4089 </div>
4090 <?php } ?>
4091 </div>
4092 </div>
4093 <?php endif; ?>
4094
4095 <?php if ( false !== $hourly_forecast && $hourly_data ) { ?>
4096 <div class="premium-weather__hourly-forecast-wrapper">
4097 <?php $this->render_hourly_forecast( $hourly_forecast, $timezone ); ?>
4098 </div>
4099
4100 <?php } ?>
4101 <?php
4102 if ( false !== $forecast ) {
4103 if ( $tabs_mode ) {
4104 $this->render_forecast_tabs( $weather_data['tabs_data'] );
4105 } else {
4106 $this->render_forecast_days( $weather_data['daily'], $settings['forecast_days'], $forecast_icon, $show_temp_icon );
4107 }
4108 }
4109 ?>
4110 <?php
4111 }
4112 ?>
4113 </div>
4114 <?php
4115 }
4116
4117 /**
4118 * Render Forecast Days.
4119 *
4120 * @access private
4121 * @since 2.8.23
4122 *
4123 * @param array $data forecast data.
4124 * @param int $days_num number of days to display.
4125 * @param string $layout wideget layout.
4126 */
4127 private function render_forecast_days( $data, $days_num, $forecast_icon, $show_temp_icon ) {
4128
4129 $layout = $this->settings['forecast_layouts'];
4130 ?>
4131 <div class="premium-weather__forecast">
4132 <?php
4133 for ( $i = 0; $i < $days_num; $i++ ) {
4134
4135 $item = $data[ $i ];
4136 $weather_desc = $item['weather'][0]['description'];
4137 $date = 'style-3' === $layout ? gmdate( 'l', $item['dt'] ) : gmdate( 'l, d', $item['dt'] );
4138
4139 if ( 0 === $i ) {
4140 $date = 'Today, ' . gmdate( 'd', $item['dt'] );
4141 }
4142
4143 if ( 1 === $i ) {
4144 $date = 'Tomorrow, ' . gmdate( 'd', $item['dt'] );
4145 }
4146 ?>
4147 <div class="premium-weather__forecast-item">
4148 <span class="premium-weather__forecast-item-date"><?php echo esc_html( $date ); ?></span>
4149 <?php if ( 'style-4' !== $layout ) { ?>
4150 <div class="premium-weather__forecast-item-data">
4151 <?php if ( $forecast_icon ) : ?>
4152 <div class="premium-weather__icon-wrapper" title="<?php echo esc_attr( $weather_desc ); ?>">
4153 <?php $this->render_weather_icon( $item['weather'][0]['icon'] ); ?>
4154 </div>
4155 <?php endif; ?>
4156 <div class="premium-weather__temp-wrapper">
4157 <span class="premium-weather__temp-max"><?php echo esc_html( round( $item['temp']['max'], 0 ) ) . '&#176;'; ?></span>
4158 <span class="premium-weather__temp-min"><?php echo esc_html( round( $item['temp']['min'], 0 ) ) . '&#176;'; ?></span>
4159 </div>
4160 </div>
4161 <?php } else { ?>
4162 <div class="premium-weather__forecast-item-data">
4163 <?php if ( $forecast_icon ) : ?>
4164 <div class="premium-weather__icon-wrapper" title="<?php echo esc_attr( $weather_desc ); ?>">
4165 <?php $this->render_weather_icon( $item['weather'][0]['icon'] ); ?>
4166 </div>
4167 <?php endif; ?>
4168 <span class="premium-weather__temp-max">
4169 <?php if ( $show_temp_icon ) : ?>
4170 <svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1,.premium-weather-cls-2{fill:#333;}.premium-weather-cls-2{fill-rule:evenodd;}</style></defs><g id="Temperature"><path class="premium-weather-cls-1" d="m13.5,17c0,.83-.68,1.5-1.5,1.5s-1.5-.67-1.5-1.5c0-.55.3-1.05.77-1.31.2-.11.3-.34.24-.56-.01-.04-.01-.08-.01-.13V5c0-.27.22-.5.5-.5s.5.23.5.5v10c0,.05-.01.09-.02.13-.06.22.04.45.24.56.48.26.78.76.78,1.31Z"/><path class="premium-weather-cls-1" d="m15.5,12.76v-7.76c0-1.93-1.57-3.5-3.5-3.5s-3.5,1.57-3.5,3.5v7.76c-1.26,1.04-2,2.58-2,4.24,0,3.04,2.46,5.5,5.5,5.5s5.5-2.46,5.5-5.5c0-1.66-.75-3.2-2-4.24Zm-3.5,6.74c-1.39,0-2.5-1.12-2.5-2.5,0-.8.38-1.53,1-2V5c0-.82.67-1.5,1.5-1.5s1.5.68,1.5,1.5v10c.62.47,1,1.2,1,2,0,1.38-1.12,2.5-2.5,2.5Z"/><path class="premium-weather-cls-2" d="m13.5,17c0,.83-.68,1.5-1.5,1.5s-1.5-.67-1.5-1.5c0-.55.3-1.05.77-1.31.2-.11.3-.34.24-.56-.01-.04-.01-.08-.01-.13V5c0-.27.22-.5.5-.5s.5.23.5.5v10c0,.05-.01.09-.02.13-.06.22.04.45.24.56.48.26.78.76.78,1.31Z"/></g></svg>
4171 <?php endif; ?>
4172 <?php echo esc_html( round( $item['temp']['max'], 0 ) ) . '&#176;'; ?>
4173 </span>
4174
4175 <span class="premium-weather__temp-min">
4176 <?php if ( $show_temp_icon ) : ?>
4177 <svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1,.premium-weather-cls-2{fill:#333;}.premium-weather-cls-2{fill-rule:evenodd;}</style></defs><g id="Temperature"><path class="premium-weather-cls-1" d="m13.5,17c0,.83-.68,1.5-1.5,1.5s-1.5-.67-1.5-1.5c0-.55.3-1.05.77-1.31.2-.11.3-.34.24-.56-.01-.04-.01-.08-.01-.13V5c0-.27.22-.5.5-.5s.5.23.5.5v10c0,.05-.01.09-.02.13-.06.22.04.45.24.56.48.26.78.76.78,1.31Z"/><path class="premium-weather-cls-1" d="m15.5,12.76v-7.76c0-1.93-1.57-3.5-3.5-3.5s-3.5,1.57-3.5,3.5v7.76c-1.26,1.04-2,2.58-2,4.24,0,3.04,2.46,5.5,5.5,5.5s5.5-2.46,5.5-5.5c0-1.66-.75-3.2-2-4.24Zm-3.5,6.74c-1.39,0-2.5-1.12-2.5-2.5,0-.8.38-1.53,1-2V5c0-.82.67-1.5,1.5-1.5s1.5.68,1.5,1.5v10c.62.47,1,1.2,1,2,0,1.38-1.12,2.5-2.5,2.5Z"/><path class="premium-weather-cls-2" d="m13.5,17c0,.83-.68,1.5-1.5,1.5s-1.5-.67-1.5-1.5c0-.55.3-1.05.77-1.31.2-.11.3-.34.24-.56-.01-.04-.01-.08-.01-.13V5c0-.27.22-.5.5-.5s.5.23.5.5v10c0,.05-.01.09-.02.13-.06.22.04.45.24.56.48.26.78.76.78,1.31Z"/></g></svg>
4178 <?php endif; ?>
4179 <?php echo esc_html( round( $item['temp']['min'], 0 ) ) . '&#176;'; ?>
4180 </span>
4181 </div>
4182 <?php } ?>
4183 </div>
4184 <?php } ?>
4185 </div>
4186 <?php
4187 }
4188
4189 /**
4190 * Render Extra Weather.
4191 * Renders extra weather info ( wind speed, humidity, pressure, rain, and snow).
4192 *
4193 * @access private
4194 * @since 2.8.23
4195 *
4196 * @param array $extra_weather weather info to display.
4197 * @param array $current current day's weather data.
4198 */
4199 private function render_extra_weather( $extra_weather, $current, $tabs = false ) {
4200
4201 if ( in_array( 'wind', $extra_weather, true ) && isset( $current['wind_speed'] ) ) {
4202 $unit = $this->settings['unit'];
4203 $wind_speed = 'metric' === $unit ? round( $current['wind_speed'] * 3.6, 0 ) . ' Kmph' : round( $current['wind_speed'], 0 ) . ' mph';
4204 ?>
4205 <div class="premium-weather__wind-wrapper">
4206 <?php if ( ! $tabs ) : ?>
4207 <i class="fas fa-wind"></i>
4208 <?php endif; ?>
4209 <span class="premium-weather__wind" title="Wind Speed"><?php echo esc_html( $wind_speed ); ?></span>
4210 </div>
4211 <?php } ?>
4212
4213 <?php
4214 if ( $tabs && in_array( 'wind_dir', $extra_weather, true ) && isset( $current['wind_speed'] ) ) {
4215 ?>
4216 <span class="premium-weather__wind-dir" title="Wind Direction"><?php echo esc_html( $current['wind_dir'] ) . 'deg'; ?></span>
4217 <?php } ?>
4218
4219 <?php if ( in_array( 'humidity', $extra_weather, true ) && isset( $current['humidity'] ) ) : ?>
4220 <div class="premium-weather__humidity-wrapper">
4221 <?php if ( ! $tabs ) : ?>
4222 <svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1{fill:#333;}</style></defs><path id="Humidity" class="premium-weather-cls-1" d="m19.5,15.28c0,3.99-3.37,7.22-7.5,7.22s-7.5-3.23-7.5-7.22c0-2.63,2.36-7.11,7.09-13.57.2-.27.61-.27.81,0,4.73,6.46,7.1,10.94,7.1,13.57Z"/></svg>
4223 <?php endif; ?>
4224 <span class="premium-weather__humidity" title="Humidity"><?php echo esc_html( $current['humidity'] ) . '%'; ?></span>
4225 </div>
4226 <?php endif; ?>
4227
4228 <?php if ( in_array( 'pressure', $extra_weather, true ) && isset( $current['pressure'] ) ) : ?>
4229 <div class="premium-weather__pressure-wrapper">
4230 <?php if ( ! $tabs ) : ?>
4231 <svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1{fill:#333;}</style></defs><path id="Weather_Pressure" class="premium-weather-cls-1" d="m12,1.5C6.2,1.5,1.5,6.2,1.5,12s4.7,10.5,10.5,10.5,10.5-4.7,10.5-10.5S17.8,1.5,12,1.5Zm0,1.75c.48,0,.87.39.87.88s-.39.87-.87.87-.88-.39-.88-.87.39-.88.88-.88Zm-4.05,1.06c.34-.04.68.12.86.43.24.42.1.95-.32,1.2s-.95.1-1.19-.32c-.24-.42-.1-.95.32-1.19.1-.06.22-.1.33-.11Zm8.09,0c.11.01.23.05.33.11.42.24.56.78.32,1.19-.24.42-.78.56-1.19.32s-.56-.78-.32-1.2c.18-.31.53-.47.86-.43Zm-10.76,2.88c.11.01.22.05.33.11.42.24.56.78.32,1.19s-.78.56-1.2.32c-.42-.24-.56-.78-.32-1.19.18-.31.53-.47.87-.43Zm13.43.03c.34-.04.68.12.86.43.24.42.1.95-.32,1.19l-5.51,3.16c0,.96-.78,1.74-1.75,1.74-.32,0-.61-.09-.87-.24l-1.91,1.1c-.14.08-.29.12-.44.12-.3,0-.6-.16-.76-.44-.24-.42-.09-.95.32-1.19l1.91-1.09c0-.96.79-1.74,1.75-1.74.32,0,.61.09.87.24l5.51-3.16c.1-.06.22-.1.33-.11Zm-14.59,3.91c.48,0,.87.39.87.88s-.39.87-.87.87-.88-.39-.88-.87.39-.88.88-.88Zm15.75,0c.48,0,.88.39.88.88s-.39.87-.88.87-.88-.39-.88-.87.39-.88.88-.88Zm-14.8,3.94c.34-.04.69.12.87.43.24.42.1.95-.32,1.19-.42.24-.95.1-1.19-.32s-.1-.95.32-1.19c.1-.06.22-.1.33-.11Zm13.86,0c.11.01.23.05.33.11.42.24.56.78.32,1.19-.24.42-.78.56-1.19.32-.42-.24-.56-.78-.32-1.19.18-.31.53-.47.87-.43Z"/></svg>
4232 <?php endif; ?>
4233 <span class="premium-weather__pressure" title="Pressure"><?php echo esc_html( $current['pressure'] ) . ' hpa'; ?></span>
4234 </div>
4235 <?php endif; ?>
4236
4237 <?php if ( in_array( 'rain', $extra_weather, true ) && isset( $current['rain'] ) ) : ?>
4238 <div class="premium-weather__rain-wrapper">
4239 <i class="fas fa-cloud-rain"></i>
4240 <span class="premium-weather__rain" title="Rain, Precipitation, mm/h"> <?php echo esc_html( $current['rain']['1h'] ) . 'mmph'; ?></span>
4241 </div>
4242 <?php endif; ?>
4243
4244 <?php if ( in_array( 'snow', $extra_weather, true ) && isset( $current['snow'] ) ) : ?>
4245 <div class="premium-weather__snow-wrapper">
4246 <i class="far fa-snowflake"></i>
4247 <span class="premium-weather__snow" title="Snow, Precipitation, mm/h"><?php echo esc_html( $current['snow']['1h'] ) . 'mmph'; ?></span>
4248 </div>
4249 <?php endif; ?>
4250 <?php
4251 }
4252
4253 /**
4254 * Render Hourly Forecast.
4255 *
4256 * @access private
4257 * @since 2.8.23
4258 *
4259 * @param array $data hourly forecast data.
4260 */
4261 private function render_hourly_forecast( $data, $timezone ) {
4262
4263 $settings = $this->settings;
4264 $limit = $settings['hourly_max'];
4265 $show_temp_icon = 'yes' === $settings['show_temp_icon'] ? true : false;
4266 $vertical_layout = 'layout-2' !== $settings['layout'] && 'vertical' === $settings['hourly_layout'] ? true : false;
4267
4268 if ( $vertical_layout ) {
4269 $weather_conditions = $settings['hourly_weather_data'];
4270
4271 $show_desc_icon = in_array( 'desc_icon', $weather_conditions, true ) ? true : false;
4272 $show_desc = in_array( 'desc', $weather_conditions, true ) ? true : false;
4273 $show_temp = in_array( 'temp', $weather_conditions, true ) ? true : false;
4274 }
4275
4276 for ( $i = 0; $i < $limit; $i++ ) {
4277 $current_time = time();
4278 $item = $data[ $i ];
4279 $weather_desc = $item['weather'][0]['description'];
4280
4281 ?>
4282 <div class="premium-weather__hourly-item">
4283 <span class="premium-weather__hourly-item-date"><?php echo esc_html( gmdate( 'g A', $item['dt'] + $timezone ) ); ?></span>
4284 <?php if ( ! $vertical_layout ) : ?>
4285 <div class="premium-weather__icon-wrapper" title="<?php echo esc_attr( $weather_desc ); ?>">
4286 <?php $this->render_weather_icon( $item['weather'][0]['icon'] ); ?>
4287 </div>
4288 <?php endif; ?>
4289
4290 <?php if ( ! $vertical_layout ) { ?>
4291 <div class="premium-weather__temp-wrapper">
4292 <?php if ( $show_temp_icon ) : ?>
4293 <svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1,.premium-weather-cls-2{fill:#333;}.premium-weather-cls-2{fill-rule:evenodd;}</style></defs><g id="Temperature"><path class="premium-weather-cls-1" d="m13.5,17c0,.83-.68,1.5-1.5,1.5s-1.5-.67-1.5-1.5c0-.55.3-1.05.77-1.31.2-.11.3-.34.24-.56-.01-.04-.01-.08-.01-.13V5c0-.27.22-.5.5-.5s.5.23.5.5v10c0,.05-.01.09-.02.13-.06.22.04.45.24.56.48.26.78.76.78,1.31Z"/><path class="premium-weather-cls-1" d="m15.5,12.76v-7.76c0-1.93-1.57-3.5-3.5-3.5s-3.5,1.57-3.5,3.5v7.76c-1.26,1.04-2,2.58-2,4.24,0,3.04,2.46,5.5,5.5,5.5s5.5-2.46,5.5-5.5c0-1.66-.75-3.2-2-4.24Zm-3.5,6.74c-1.39,0-2.5-1.12-2.5-2.5,0-.8.38-1.53,1-2V5c0-.82.67-1.5,1.5-1.5s1.5.68,1.5,1.5v10c.62.47,1,1.2,1,2,0,1.38-1.12,2.5-2.5,2.5Z"/><path class="premium-weather-cls-2" d="m13.5,17c0,.83-.68,1.5-1.5,1.5s-1.5-.67-1.5-1.5c0-.55.3-1.05.77-1.31.2-.11.3-.34.24-.56-.01-.04-.01-.08-.01-.13V5c0-.27.22-.5.5-.5s.5.23.5.5v10c0,.05-.01.09-.02.13-.06.22.04.45.24.56.48.26.78.76.78,1.31Z"/></g></svg>
4294 <?php endif; ?>
4295 <span class="premium-weather__temp">
4296 <?php
4297 echo esc_html( round( $item['temp'], 0 ) ) . '&#176;';
4298 ?>
4299 </span>
4300 </div>
4301 <?php } else { ?>
4302 <div class="premium-weather__hourly-data">
4303
4304 <?php if ( $show_desc_icon ) : ?>
4305 <div class="premium-weather__icon-wrapper" title="<?php echo esc_attr( $weather_desc ); ?>">
4306 <?php $this->render_weather_icon( $item['weather'][0]['icon'] ); ?>
4307 </div>
4308 <?php endif; ?>
4309
4310 <?php if ( $show_temp ) : ?>
4311 <div class="premium-weather__temp-wrapper">
4312 <?php if ( $show_temp_icon ) : ?>
4313 <svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1,.premium-weather-cls-2{fill:#333;}.premium-weather-cls-2{fill-rule:evenodd;}</style></defs><g id="Temperature"><path class="premium-weather-cls-1" d="m13.5,17c0,.83-.68,1.5-1.5,1.5s-1.5-.67-1.5-1.5c0-.55.3-1.05.77-1.31.2-.11.3-.34.24-.56-.01-.04-.01-.08-.01-.13V5c0-.27.22-.5.5-.5s.5.23.5.5v10c0,.05-.01.09-.02.13-.06.22.04.45.24.56.48.26.78.76.78,1.31Z"/><path class="premium-weather-cls-1" d="m15.5,12.76v-7.76c0-1.93-1.57-3.5-3.5-3.5s-3.5,1.57-3.5,3.5v7.76c-1.26,1.04-2,2.58-2,4.24,0,3.04,2.46,5.5,5.5,5.5s5.5-2.46,5.5-5.5c0-1.66-.75-3.2-2-4.24Zm-3.5,6.74c-1.39,0-2.5-1.12-2.5-2.5,0-.8.38-1.53,1-2V5c0-.82.67-1.5,1.5-1.5s1.5.68,1.5,1.5v10c.62.47,1,1.2,1,2,0,1.38-1.12,2.5-2.5,2.5Z"/><path class="premium-weather-cls-2" d="m13.5,17c0,.83-.68,1.5-1.5,1.5s-1.5-.67-1.5-1.5c0-.55.3-1.05.77-1.31.2-.11.3-.34.24-.56-.01-.04-.01-.08-.01-.13V5c0-.27.22-.5.5-.5s.5.23.5.5v10c0,.05-.01.09-.02.13-.06.22.04.45.24.56.48.26.78.76.78,1.31Z"/></g></svg>
4314 <?php endif; ?>
4315 <span class="premium-weather__temp">
4316 <?php
4317 echo esc_html( round( $item['temp'], 0 ) ) . '&#176;';
4318 ?>
4319 </span>
4320 </div>
4321 <?php endif; ?>
4322
4323 <?php $this->render_extra_weather( $weather_conditions, $item ); ?>
4324 <?php if ( $show_desc ) : ?>
4325 <span class="premium-weather__hourly-desc"> <?php echo esc_html( $item['weather'][0]['description'] ); ?></span>
4326 <?php endif; ?>
4327 </div>
4328 <?php } ?>
4329
4330 </div>
4331 <?php
4332 }
4333 }
4334
4335 /**
4336 * Get Weather Icon Code.
4337 *
4338 * @access private
4339 * @since 2.8.23
4340 *
4341 * @param string $code icon code.
4342 * @param bool $is_video_code true if the code for the video background.
4343 *
4344 * @return string
4345 */
4346 private function get_weather_icon_code( $code, $is_video_code = false ) {
4347
4348 $dual_icons = array( '01d', '01n', '02d', '02n', '10d', '10n' );
4349
4350 $code = in_array( $code, $dual_icons, true ) ? $code : substr( $code, 0, -1 );
4351
4352 if ( $is_video_code && in_array( $code, array( '09', '10d', '10n' ), true ) ) {
4353 $code = 'rain';
4354 }
4355
4356 return $code;
4357 }
4358
4359 /**
4360 * Render Weather Icon.
4361 *
4362 * @access private
4363 * @since 2.8.23
4364 *
4365 * @param string $code weather icon code.
4366 */
4367 private function render_weather_icon( $code ) {
4368
4369 $settings = $this->settings;
4370
4371 $code = $this->get_weather_icon_code( $code );
4372
4373 $enable_custom_icons = 'yes' === $settings['enable_custom_icon'] ? true : false;
4374
4375 $custom_icons = $enable_custom_icons ? $this->get_custom_icons() : array();
4376
4377 $default_icons = array(
4378 '01d' => '<svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1{fill:#333;}</style></defs><g id="Clear_Sky"><circle class="premium-weather-cls-1" cx="12" cy="12" r="5.5"/><path class="premium-weather-cls-1" d="m21.76,12.74h-1.95c-.98,0-.98-1.47,0-1.47h1.95c.98,0,.98,1.47,0,1.47Z"/><path class="premium-weather-cls-1" d="m19.39,5.62l-1.38,1.38c-.29.29-.75.29-1.04,0-.29-.29-.29-.75,0-1.04l1.38-1.38c.29-.28.75-.28,1.04,0,.28.29.28.75,0,1.04Z"/><path class="premium-weather-cls-1" d="m12.74,2.24v1.95c0,.4-.33.73-.73.73s-.74-.33-.74-.73v-1.95c0-.41.33-.74.74-.74s.73.33.73.74Z"/><path class="premium-weather-cls-1" d="m5.96,7.03l-1.38-1.38c-.32-.31-.29-.75,0-1.04s.72-.31,1.03,0l1.38,1.38c.69.69-.34,1.73-1.03,1.04Z"/><path class="premium-weather-cls-1" d="m4.19,12.74h-1.95c-.98,0-.98-1.47,0-1.47h1.95c.98,0,.98,1.47,0,1.47Z"/><path class="premium-weather-cls-1" d="m7.02,18.04l-1.38,1.38c-.31.31-.75.29-1.04,0s-.31-.72,0-1.03l1.38-1.38c.32-.31.75-.29,1.04,0,.29.28.31.72,0,1.03Z"/><path class="premium-weather-cls-1" d="m12.74,19.82v1.95c0,.98-1.47.98-1.47,0v-1.95c0-.98,1.47-.98,1.47,0Z"/><path class="premium-weather-cls-1" d="m19.43,19.4c-.29.28-.73.31-1.04,0l-1.38-1.39c-.31-.31-.29-.75,0-1.03.28-.29.72-.31,1.03,0l1.39,1.38c.31.31.28.75,0,1.04Z"/></g></svg>',
4379
4380 '01n' => '<svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1{fill:#333;}</style></defs><path id="Clear_Sky_Night" class="premium-weather-cls-1" d="m21.93,17.23c-1.89,3.24-5.4,5.27-9.26,5.27-5.89,0-10.67-4.7-10.67-10.51S6.37,1.87,11.95,1.5c.4-.02.67.41.46.76-.83,1.42-1.28,3.04-1.28,4.73,0,5.25,4.33,9.51,9.68,9.51.22,0,.44,0,.65-.02.4-.03.67.4.47.75Z"/></svg>',
4381
4382 '02d' => '<svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1,.premium-weather-cls-2{fill:#333;}.premium-weather-cls-2{fill-rule:evenodd;}</style></defs><g id="Few_Clouds"><path class="premium-weather-cls-1" d="m23,15.23c0,2.09-1.74,3.77-3.87,3.77h-10.59c-1.4,0-2.54-1.14-2.54-2.54s1.13-2.54,2.52-2.55c.05-2.72,2.33-4.91,5.13-4.91,1.27,0,2.45.45,3.35,1.22.46.38.84.84,1.14,1.36.32-.08.65-.12.99-.12,2.13,0,3.87,1.68,3.87,3.77Z"/><path class="premium-weather-cls-2" d="m11.85,7.56l-.83.83c-.19.19-.5.19-.69,0-.19-.19-.19-.5,0-.69l.83-.83c.19-.19.5-.19.69,0s.19.5,0,.69Z"/><path class="premium-weather-cls-2" d="m8,5.49v1.01c0,.28-.23.5-.5.5s-.5-.22-.5-.5v-1.01c0-.27.22-.49.5-.49s.5.22.5.49Z"/><path class="premium-weather-cls-2" d="m3.7,8.41l-.84-.83c-.46-.47.24-1.16.7-.7l.83.83c.46.46-.23,1.16-.69.7Z"/><path class="premium-weather-cls-2" d="m3,11.5c0,.28-.23.5-.5.5h-1.01c-.29,0-.46-.19-.49-.41v-.18c.03-.22.2-.41.49-.41h1.01c.27,0,.5.23.5.5Z"/><path class="premium-weather-cls-2" d="m4.41,15.02l-.84.83c-.46.46-1.15-.23-.69-.69l.83-.83c.46-.46,1.16.23.7.69Z"/><path class="premium-weather-cls-2" d="m10.01,9.18c-1.26.91-2.15,2.28-2.41,3.86-.77.21-1.44.68-1.91,1.31-1.05-.59-1.75-1.71-1.75-2.99,0-1.89,1.53-3.42,3.43-3.42,1.05,0,2.01.47,2.64,1.24Z"/></g></svg>',
4383
4384 '02n' => '<svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1{fill:#333;}</style></defs><g id="Few_Clouds_Night"><path class="premium-weather-cls-1" d="m18.27,19.5h-10.22c-1.41,0-2.55-1.14-2.55-2.55s1.13-2.54,2.53-2.55c.05-2.72,2.33-4.91,5.13-4.91,1.89,0,3.6,1.01,4.49,2.58.32-.08.65-.12.98-.12,2.13,0,3.87,1.69,3.87,3.77s-1.74,3.77-3.87,3.77c-.07,0-.13,0-.2,0-.05,0-.11,0-.16,0h0Z"/><path class="premium-weather-cls-1" d="m4.6,16.13c-1.27-.49-2.35-1.42-3.03-2.64-.19-.35.07-.77.47-.74.11,0,.22.01.33.01,2.68,0,4.86-2.24,4.86-5.01,0-.89-.23-1.75-.65-2.5-.19-.35.07-.77.47-.74,2.41.16,4.42,1.82,5.16,4.07-2.61.4-4.68,2.4-5.1,4.96-1.24.34-2.21,1.34-2.51,2.59h0Z"/></g></svg>',
4385
4386 '04' => '<svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1{fill:#333;}</style></defs><g id="Broken_Clouds"><path class="premium-weather-cls-1" d="m21,11.77c-.76-.49-1.68-.77-2.66-.77-.25,0-.49.02-.74.06-.99-1.28-2.5-2.06-4.13-2.06-2.49,0-4.59,1.79-5.14,4.21-1.36.5-2.32,1.79-2.32,3.29,0,.17.02.34.04.5h-.73c-1.83,0-3.32-1.45-3.32-3.25s1.49-3.25,3.32-3.25h.09c.23-3.07,2.63-5.5,5.57-5.5,2.16,0,4.08,1.33,5.01,3.35.21-.03.42-.05.64-.05,2.15,0,3.95,1.49,4.37,3.47Z"/><path class="premium-weather-cls-1" d="m22,15.5c0,1.95-1.68,3.5-3.74,3.5-.17,0-.34-.01-.51-.03-.13.02-.27.03-.41.03h-7.84c-1.39,0-2.5-1.12-2.5-2.5,0-1.27.94-2.32,2.17-2.48.23-2.25,2.04-4.02,4.25-4.02,1.52,0,2.9.85,3.66,2.18.38-.11.78-.18,1.18-.18,2.06,0,3.74,1.56,3.74,3.5Z"/></g></svg>',
4387
4388 '03' => '<svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1{fill:#333;}</style></defs><path id="Scattered_Clouds" class="premium-weather-cls-1" d="m17.78,18.5c-.11,0-.22,0-.33-.01-.1.01-.19.01-.29.01H4.72c-1.78,0-3.22-1.44-3.22-3.22s1.4-3.19,3.15-3.23v-.05c0-3.58,2.82-6.5,6.29-6.5,2.37,0,4.49,1.36,5.56,3.46.42-.12.85-.18,1.28-.18,2.61,0,4.72,2.18,4.72,4.86s-2.11,4.86-4.72,4.86Z"/></svg>',
4389
4390 '09' => '<svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1{fill:#333;}</style></defs><g id="Shower_Rain"><path class="premium-weather-cls-1" d="m22.5,10.14c0,.66-.13,1.29-.36,1.86-.71,1.76-2.39,3-4.36,3H4.55c-1.62,0-2.94-1.33-3.04-3-.01-.07-.01-.15-.01-.22,0-1.78,1.36-3.23,3.05-3.23h.1v-.05c0-3.58,2.82-6.5,6.29-6.5,2.37,0,4.48,1.36,5.56,3.46.42-.12.85-.18,1.28-.18,2.61,0,4.72,2.18,4.72,4.86Z"/><path class="premium-weather-cls-1" d="m18.44,17.73l-1.13,2.27-.87,1.73c-.12.24-.42.34-.67.22s-.35-.42-.22-.67l.64-1.28,1.36-2.72c.12-.25.42-.35.67-.22.25.12.35.42.22.67Z"/><path class="premium-weather-cls-1" d="m14.44,17.73l-1,2c-.09.17-.26.27-.45.27-.07,0-.15-.02-.22-.05-.25-.12-.35-.42-.22-.67l1-2c.12-.25.42-.35.67-.22.25.12.35.42.22.67Z"/><path class="premium-weather-cls-1" d="m10.44,17.73l-1.13,2.27-.87,1.73c-.12.24-.42.34-.67.22s-.35-.42-.22-.67l.64-1.28,1.36-2.72c.12-.25.42-.35.67-.22.25.12.35.42.22.67Z"/><path class="premium-weather-cls-1" d="m6.44,17.73l-1,2c-.09.17-.26.27-.45.27-.07,0-.15-.02-.22-.05-.25-.12-.35-.42-.22-.67l1-2c.12-.25.42-.35.67-.22.25.12.35.42.22.67Z"/></g></svg>',
4391
4392 '11' => '<svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1{fill:#333;}</style></defs><g id="Thunderstorm"><path class="premium-weather-cls-1" d="m22.5,10.64c0,2.06-1.24,3.82-3,4.52-.53.22-1.11.34-1.72.34-.12,0-.25,0-.29-.01-.11.01-.22.01-.33.01h-1.69c.15-.82-.3-1.68-1.13-2.06l-1.04-.46.4-3.82c.16-1.52-1.79-2.27-2.7-1.05l-4.13,5.6c-.42.56-.47,1.23-.24,1.79h-1.91c-.86,0-1.64-.34-2.22-.89-.62-.58-1-1.41-1-2.33s.38-1.75,1-2.34c.56-.53,1.31-.87,2.15-.89v-.05c0-2.31,1.18-4.35,2.95-5.5.97-.64,2.12-1,3.34-1s2.38.36,3.36,1c.92.6,1.69,1.44,2.2,2.46.42-.12.85-.18,1.28-.18.61,0,1.19.12,1.72.34,1.76.7,3,2.46,3,4.52Z"/><path class="premium-weather-cls-1" d="m14.32,15.7l-3.54,4.8-.59.8c-.3.41-.95.16-.9-.35l.05-.45.42-4.08-1.69-.76c-.54-.25-.76-.87-.4-1.35l4.14-5.6c.3-.41.95-.16.89.35l-.47,4.53,1.69.76c.55.25.76.87.4,1.35Z"/></g></svg>',
4393
4394 '13' => '<svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1{fill:#333;}</style></defs><path id="Snow" class="premium-weather-cls-1" d="m21.97,12.81c.12.4-.11.83-.51.96l-3.5,1.05,2.66,1.66c.87.54.05,1.85-.82,1.3l-2.31-1.44,1.18,3.63c.13.4-.09.84-.49.97-.4.13-.84-.09-.97-.49l-1.75-5.38-2.69-1.68v3.42l3.88,3.88c.3.3.3.79,0,1.09s-.79.3-1.09,0l-2.79-2.79v2.24c0,.43-.34.77-.76.77s-.77-.34-.77-.77v-2.24l-2.79,2.79c-.3.3-.79.3-1.09,0s-.3-.79,0-1.09l3.88-3.88v-3.42l-2.7,1.69-1.97,5.39c-.14.4-.58.61-.98.46-.4-.14-.61-.59-.46-.98l1.29-3.55-2.21,1.38c-.39.25-.84.12-1.06-.24-.23-.36-.15-.82.24-1.06l2.19-1.37-2.88-.29c-.42-.04-.73-.42-.69-.84.04-.42.42-.73.84-.69l4.86.49,2.84-1.78-2.76-1.72-4.79,1.43c-.41.13-.84-.1-.96-.51-.12-.41.11-.84.51-.96l3.5-1.05-2.66-1.66c-.87-.55-.05-1.85.82-1.31l2.31,1.45-1.18-3.63c-.13-.41.09-.84.49-.97.41-.13.84.09.97.49l1.75,5.38,2.69,1.68v-3.43l-3.88-3.87c-.3-.3-.3-.79,0-1.09s.79-.3,1.09,0l2.79,2.79v-2.25c0-.42.34-.77.77-.77s.76.35.76.77v2.25l2.79-2.79c.3-.3.79-.3,1.09,0s.3.79,0,1.09l-3.88,3.87v3.43l2.69-1.68,1.75-5.38c.13-.4.57-.62.97-.49.4.13.62.56.49.97l-1.18,3.63,2.31-1.45c.87-.54,1.69.76.82,1.31l-2.66,1.66,3.5,1.05c.4.12.63.55.51.96-.12.41-.55.64-.95.51l-4.8-1.43-2.76,1.72,2.76,1.73,4.8-1.44c.4-.12.83.11.95.52Z"/></svg>',
4395
4396 '50' => '<svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1{fill:#333;}</style></defs><g id="Mist"><path class="premium-weather-cls-1" d="m4.93,9.56c0,.41.33.73.73.73h12.67c1.21,0,2.19.99,2.19,2.2s-.98,2.2-2.19,2.2h-8.77c-.4,0-.73.33-.73.73s.33.73.73.73h6.82c1.21,0,2.19.99,2.19,2.2s-.98,2.2-2.19,2.2h-4.87c-.41,0-.73.33-.73.73v.49c0,.41-.33.73-.73.73s-.73-.32-.73-.73v-.49c0-1.21.98-2.2,2.19-2.2h4.87c.4,0,.73-.32.73-.73s-.33-.73-.73-.73h-6.82c-1.21,0-2.19-.98-2.19-2.2s.98-2.2,2.19-2.2h8.77c.4,0,.73-.32.73-.73s-.33-.73-.73-.73H5.66c-1.21,0-2.19-.98-2.19-2.2s.98-2.2,2.19-2.2h13.64c.41,0,.73-.32.73-.73s-.32-.73-.73-.73H4.69c-1.21,0-2.19-.99-2.19-2.2s.98-2.2,2.19-2.2h12.18c.4,0,.73.33.73.74s-.33.73-.73.73H4.69c-.41,0-.73.33-.73.73s.32.73.73.73h14.61c1.21,0,2.2.99,2.2,2.2s-.99,2.2-2.2,2.2H5.66c-.4,0-.73.33-.73.73Z"/></g></svg>',
4397
4398 '10d' => '<svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1,.premium-weather-cls-2{fill:#333;}.premium-weather-cls-2{fill-rule:evenodd;}</style></defs><g id="Rain"><path class="premium-weather-cls-2" d="m10.74,6.99c-1.89.79-3.3,2.49-3.64,4.55-.29.08-.57.2-.83.35-1.09-.58-1.83-1.72-1.83-3.03,0-1.89,1.53-3.42,3.43-3.42,1.19,0,2.25.61,2.87,1.55Z"/><path class="premium-weather-cls-2" d="m12.35,5.06l-.83.83c-.19.19-.5.19-.69,0-.19-.19-.19-.5,0-.69l.83-.83c.19-.19.5-.19.69,0s.19.5,0,.69Z"/><path class="premium-weather-cls-2" d="m8.5,2.99v1.01c0,.28-.23.5-.5.5s-.5-.22-.5-.5v-1.01c0-.27.22-.49.5-.49s.5.22.5.49Z"/><path class="premium-weather-cls-2" d="m4.2,5.91l-.84-.83c-.46-.47.24-1.16.7-.7l.83.83c.46.46-.23,1.16-.69.7Z"/><path class="premium-weather-cls-2" d="m3.5,9c0,.28-.23.5-.5.5h-1.01c-.66,0-.66-1,0-1h1.01c.27,0,.5.23.5.5Z"/><path class="premium-weather-cls-2" d="m4.91,12.52l-.84.83c-.11.11-.23.15-.34.15-.38,0-.7-.49-.35-.84l.83-.83c.46-.46,1.16.23.7.69Z"/><path class="premium-weather-cls-1" d="m22.5,13.73c0,2.09-1.74,3.77-3.87,3.77h-10.59c-1.4,0-2.54-1.14-2.54-2.54s1.13-2.54,2.52-2.55c.05-2.72,2.33-4.91,5.13-4.91,1.9,0,3.6,1.01,4.49,2.58.32-.08.65-.12.99-.12,2.13,0,3.87,1.68,3.87,3.77Z"/><path class="premium-weather-cls-1" d="m19.44,19.23l-1,2c-.12.24-.42.34-.67.22-.25-.12-.35-.42-.22-.67l1-2c.12-.25.42-.35.67-.22.25.12.35.42.22.67Z"/><path class="premium-weather-cls-1" d="m14.44,19.23l-1,2c-.12.24-.42.34-.67.22-.25-.12-.35-.42-.22-.67l1-2c.08-.18.26-.28.44-.28.08,0,.16.02.23.06.25.12.35.42.22.67Z"/><path class="premium-weather-cls-1" d="m9.44,19.23l-1,2c-.12.24-.42.34-.67.22-.25-.12-.35-.42-.22-.67l1-2c.08-.18.26-.28.44-.28.08,0,.16.02.23.06.25.12.35.42.22.67Z"/></g></svg>',
4399
4400 '10n' => '<svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1{fill:#333;}</style></defs><g id="Rain_Night"><path class="premium-weather-cls-1" d="m4.6,13.13c-1.27-.49-2.35-1.42-3.03-2.64-.19-.35.07-.77.47-.74.11,0,.22.01.33.01,2.68,0,4.86-2.24,4.86-5.01,0-.89-.23-1.75-.65-2.5-.19-.35.07-.77.47-.74,2.41.16,4.42,1.82,5.16,4.07-2.61.4-4.68,2.4-5.1,4.96-1.24.34-2.21,1.34-2.51,2.59h0Zm4.96,4.65c.12-.25.42-.35.67-.22s.35.42.22.67l-1,2c-.12.25-.42.35-.67.22s-.35-.42-.22-.67l1-2h0Zm3,0c.12-.25.42-.35.67-.22s.35.42.22.67l-2,4c-.12.25-.42.35-.67.22s-.35-.42-.22-.67l2-4h0Zm3,0c.12-.25.42-.35.67-.22s.35.42.22.67l-1,2c-.12.25-.42.35-.67.22s-.35-.42-.22-.67l1-2h0Zm3,0c.12-.25.42-.35.67-.22s.35.42.22.67l-2,4c-.12.25-.42.35-.67.22s-.35-.42-.22-.67l2-4h0Z"/><path class="premium-weather-cls-1" d="m18.63,8.95c2.13,0,3.87,1.69,3.87,3.77s-1.74,3.77-3.87,3.77h-10.59c-1.41,0-2.55-1.14-2.55-2.55s1.13-2.54,2.53-2.55c.05-2.72,2.33-4.91,5.13-4.91,1.89,0,3.6,1.01,4.49,2.58.32-.08.65-.12.98-.12h0Z"/></g></svg>',
4401 );
4402
4403 if ( isset( $custom_icons[ $code ] ) ) {
4404 $icon_source = $settings['icons_source'];
4405
4406 if ( 'default' === $icon_source ) {
4407 ?>
4408 <div class="premium-lottie-animation" data-lottie-url="<?php echo esc_url( $custom_icons[ $code ] ); ?>" data-lottie-loop="true" data-lottie-reverse="false"></div>
4409 <?php
4410 } else {
4411 $this->render_custom_icon( $custom_icons[ $code ], $code );
4412 }
4413 } else {
4414 echo $default_icons[ $code ]; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
4415 }
4416 }
4417
4418 /**
4419 * Render Custom Icon.
4420 *
4421 * @access private
4422 * @since 2.8.23
4423 *
4424 * @param array $icon_data icon data.
4425 */
4426 private function render_custom_icon( $icon, $code ) {
4427
4428 $settings = $this->settings;
4429 $draw_fill = $settings['svg_color'];
4430 $icon_type = $icon['type'];
4431 $icon = $icon['icon'];
4432
4433 if ( 'icon' === $icon_type ) {
4434 $is_svg = 'svg' === $icon['library'] ? true : false;
4435
4436 if ( $is_svg ) {
4437 Icons_Manager::render_icon(
4438 $icon,
4439 array(
4440 'aria-hidden' => 'true',
4441 )
4442 );
4443 } elseif ( 'yes' !== $settings['draw_svg'] ) {
4444 Icons_Manager::render_icon(
4445 $icon,
4446 array(
4447 'aria-hidden' => 'true',
4448 )
4449 );
4450 } else {
4451
4452 echo Helper_Functions::get_svg_by_icon(
4453 $icon,
4454 array(
4455 'class' => 'premium-drawable-icon premium-svg-drawer',
4456 'data-svg-loop' => 'false',
4457 'data-svg-fill' => $draw_fill,
4458 'data-svg-sync' => 'yes',
4459 'data-svg-frames' => '5',
4460 'data-svg-point' => '0',
4461 'aria-hidden' => 'hidden',
4462 )
4463 );
4464
4465 }
4466 } elseif ( 'image' === $icon_type ) {
4467
4468 if ( ! empty( $icon['img']['url'] ) ) {
4469 $img_src = wp_get_attachment_image_src( $icon['img']['id'], $icon['size'] );
4470 ?>
4471 <img src="<?php echo esc_url( $img_src[0] ); ?>" alt="<?php echo esc_attr( $icon['img']['alt'] ); ?>">
4472 <?php
4473 }
4474 } else {
4475 ?>
4476 <div class="premium-lottie-animation" data-lottie-url="<?php echo esc_url( $icon['url'] ); ?>" data-lottie-loop="<?php echo esc_attr( $icon['loop'] ); ?>" data-lottie-reverse="<?php echo esc_attr( $icon['reverse'] ); ?>"></div>
4477 <?php
4478 }
4479 }
4480
4481 /**
4482 * Get Custom Icons.
4483 *
4484 * @access private
4485 * @since 2.8.23
4486 *
4487 * @return array
4488 */
4489 private function get_custom_icons() {
4490
4491 $settings = $this->settings;
4492
4493 $icon_source = $settings['icons_source'];
4494
4495 if ( 'default' === $icon_source ) {
4496
4497 $lottie_type = $settings['lottie_type'];
4498
4499 $lottie_url = 'https://premiumtemplates.io/wp-content/uploads/premium-weather/' . $lottie_type;
4500
4501 $custom_icons = array(
4502 '01d' => $lottie_url . '/01d.json',
4503
4504 '01n' => $lottie_url . '/01n.json',
4505
4506 '02d' => $lottie_url . '/02d.json',
4507
4508 '02n' => $lottie_url . '/02n.json',
4509
4510 '04' => $lottie_url . '/04.json',
4511
4512 '03' => $lottie_url . '/03.json',
4513
4514 '09' => $lottie_url . '/09.json',
4515
4516 '11' => $lottie_url . '/11.json',
4517
4518 '13' => $lottie_url . '/13.json',
4519
4520 '50' => $lottie_url . '/50.json',
4521
4522 '10d' => $lottie_url . '/10d.json',
4523
4524 '10n' => $lottie_url . '/10n.json',
4525 );
4526 } else {
4527 $icons = $settings['custom_icons'];
4528
4529 $icon_source = $settings['icons_source'];
4530
4531 if ( ! count( $icons ) ) {
4532 return array();
4533 }
4534
4535 $dual_icons = array( '01', '02', '10' );
4536
4537 $condition_codes = array(
4538 'Clear Sky' => '01',
4539 'Few Clouds' => '02',
4540 'Scattered Clouds' => '03',
4541 'Broken Clouds' => '04',
4542 'Shower Rain' => '09',
4543 'Rain' => '10',
4544 'Thunderstorm' => '11',
4545 'Snow' => '13',
4546 'Mist' => '50',
4547 );
4548
4549 $custom_icons = array();
4550
4551 foreach ( $icons as $icon ) {
4552
4553 $icon_code = $condition_codes[ $icon['weather_desc'] ];
4554 $is_dual_icon = in_array( $icon_code, $dual_icons, true ) ? true : false;
4555
4556 $icon_type = $icon['pa_icon_type'];
4557
4558 if ( 'icon' === $icon_type ) {
4559 $custom_icon = $icon['pa_custom_icon'];
4560
4561 if ( $is_dual_icon ) {
4562 $night_custom_icon = empty( $icon['pa_custom_icon_night'] ) ? $custom_icon : $icon['pa_custom_icon_night'];
4563 }
4564 } elseif ( 'image' === $icon_type ) {
4565 $custom_icon = array(
4566 'img' => $icon['pa_weather_img'],
4567 'size' => $icon['image_size'],
4568 );
4569
4570 if ( $is_dual_icon ) {
4571 $night_custom_icon = array(
4572 'img' => $icon['pa_weather_img'],
4573 'size' => $icon['image_size'],
4574 );
4575
4576 if ( ! empty( $icon['pa_weather_img_night']['url'] ) ) {
4577 $night_custom_icon['img'] = $icon['pa_weather_img_night'];
4578 }
4579 }
4580 } else {
4581
4582 $source = $icon['lottie_source'];
4583
4584 $lottie_url = $icon['pa_lottie_url'];
4585 $custom_icon = array(
4586 'id' => $icon['_id'],
4587 'url' => $lottie_url,
4588 'loop' => $icon['pa_lottie_loop'],
4589 'reverse' => $icon['pa_lottie_reverse'],
4590 );
4591
4592 if ( $is_dual_icon ) {
4593 $night_custom_icon = array(
4594 'id' => $icon['_id'],
4595 'loop' => $icon['pa_lottie_loop'],
4596 'reverse' => $icon['pa_lottie_reverse'],
4597 );
4598
4599 $night_custom_icon['url'] = ! empty( $icon['pa_lottie_url_night'] ) ? $icon['pa_lottie_url_night'] : $lottie_url;
4600 }
4601 }
4602
4603 if ( $is_dual_icon ) {
4604
4605 $custom_icons[ $icon_code . 'n' ] = array(
4606 'type' => $icon_type,
4607 'icon' => $night_custom_icon,
4608 );
4609
4610 $icon_code .= 'd';
4611 }
4612
4613 $custom_icons[ $icon_code ] = array(
4614 'type' => $icon_type,
4615 'icon' => $custom_icon,
4616 );
4617 }
4618 }
4619
4620 return $custom_icons;
4621 }
4622
4623 /**
4624 * Render Forecast Tabs.
4625 *
4626 * @access private
4627 * @since 2.8.23
4628 *
4629 * @param array $forecast_data forcast data up to 5 days.
4630 */
4631 private function render_forecast_tabs( $forecast_data ) {
4632 ?>
4633 <div class="premium-weather__forecast-tabs-wrapper">
4634 <?php
4635 $this->render_forecast_tabs_headers( array_keys( $forecast_data ) );
4636 $this->render_forecast_tabs_content( $forecast_data );
4637 ?>
4638 </div>
4639 <?php
4640 }
4641
4642 private function render_forecast_tabs_headers( $headers ) {
4643
4644 $settings = $this->settings;
4645
4646 $limit = $settings['forecast_days'];
4647
4648 $date_format = $settings['date_format'];
4649
4650 $headers = empty( $settings['forecast_dates'] ) ? $headers : $this->extract_forecast_dates( $settings['forecast_dates'] );
4651 ?>
4652 <ul class="premium-weather__tabs-headers">
4653 <?php
4654 for ( $i = 0; $i < $limit; $i++ ) {
4655 if ( isset( $headers[ $i ] ) ) {
4656 $date = gmdate( $date_format, strtotime( $headers[ $i ] ) );
4657 ?>
4658 <li class='premium-weather__tab-header <?php echo $i === 0 ? ' current' : ''; ?>' data-content-id="#premium-tab-content-<?php echo esc_attr( $i ); ?>" aria-label='<?php echo esc_attr__( $date, 'premium-addons-for-elementor' ); ?>' title='<?php echo esc_attr__( $date, 'premium-addons-for-elementor' ); ?>'> <?php echo esc_html( $date ); ?></li>
4659 <?php
4660 }
4661 }
4662 ?>
4663 </ul>
4664 <?php
4665 }
4666
4667 private function render_forecast_tabs_content( $forecast_data ) {
4668
4669 $settings = $this->settings;
4670
4671 $limit = $settings['forecast_days'];
4672
4673 $headers = empty( $settings['forecast_dates'] ) ? array_keys( $forecast_data ) : $this->extract_forecast_dates( $settings['forecast_dates'] );
4674 $i = 0;
4675
4676 $weather_conditions = $settings['tabs_weather_data'];
4677
4678 $conditions_arr = array(
4679 'desc_icon' => in_array( 'desc_icon', $weather_conditions, true ) ? true : false,
4680 'temp' => in_array( 'temp', $weather_conditions, true ) ? true : false,
4681 'wind' => in_array( 'wind', $weather_conditions, true ) ? true : false,
4682 'wind_dir' => in_array( 'wind_dir', $weather_conditions, true ) ? true : false,
4683 'humidity' => in_array( 'humidity', $weather_conditions, true ) ? true : false,
4684 'pressure' => in_array( 'pressure', $weather_conditions, true ) ? true : false,
4685 'desc' => in_array( 'desc', $weather_conditions, true ) ? true : false,
4686 'feels_like' => in_array( 'feels_like', $weather_conditions, true ) ? true : false,
4687 );
4688
4689 ?>
4690 <div class="premium-weather__tabs-content-wrapper">
4691 <div class="premium-weather__weather-indicators">
4692 <span class='premium-weather__weather-indicator' title="Hours" aria-label="hours">
4693 <svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1{fill:#333;fill-rule:evenodd;}</style></defs><g id="Time"><path class="premium-weather-cls-1" d="m21.68,7.65c-.07-.88-.22-1.6-.56-2.26-.55-1.08-1.43-1.96-2.51-2.51-.66-.34-1.38-.49-2.26-.56-.87-.07-1.94-.07-3.32-.07h-2.06c-1.38,0-2.45,0-3.32.07-.88.07-1.6.22-2.26.56-1.08.55-1.96,1.43-2.51,2.51-.34.66-.49,1.38-.56,2.26-.07.87-.07,1.94-.07,3.32v2.06c0,1.38,0,2.45.07,3.32.07.88.22,1.6.56,2.26.55,1.08,1.43,1.96,2.51,2.51.66.34,1.38.49,2.26.56.87.07,1.94.07,3.32.07h2.06c1.38,0,2.45,0,3.32-.07.88-.07,1.6-.22,2.26-.56,1.08-.55,1.96-1.43,2.51-2.51.34-.66.49-1.38.56-2.26.07-.87.07-1.94.07-3.32v-2.06c0-1.38,0-2.45-.07-3.32Zm-4.47,9.56c-.2.19-.45.29-.71.29s-.51-.1-.71-.29l-4.5-4.5c-.18-.19-.29-.44-.29-.71v-5c0-.55.45-1,1-1s1,.45,1,1v4.59l4.21,4.2c.39.39.39,1.03,0,1.42Z"/></g></svg>
4694 </span>
4695 <?php if ( $conditions_arr['desc_icon'] ) : ?>
4696 <span class="premium-weather__weather-indicator empty"></span>
4697 <?php endif; ?>
4698
4699 <?php if ( $conditions_arr['temp'] ) : ?>
4700 <span class="premium-weather__weather-indicator" title="Temperature" aria-label="temperature">
4701 <svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1,.premium-weather-cls-2{fill:#333;}.premium-weather-cls-2{fill-rule:evenodd;}</style></defs><g id="Temperature"><path class="premium-weather-cls-1" d="m13.5,17c0,.83-.68,1.5-1.5,1.5s-1.5-.67-1.5-1.5c0-.55.3-1.05.77-1.31.2-.11.3-.34.24-.56-.01-.04-.01-.08-.01-.13V5c0-.27.22-.5.5-.5s.5.23.5.5v10c0,.05-.01.09-.02.13-.06.22.04.45.24.56.48.26.78.76.78,1.31Z"/><path class="premium-weather-cls-1" d="m15.5,12.76v-7.76c0-1.93-1.57-3.5-3.5-3.5s-3.5,1.57-3.5,3.5v7.76c-1.26,1.04-2,2.58-2,4.24,0,3.04,2.46,5.5,5.5,5.5s5.5-2.46,5.5-5.5c0-1.66-.75-3.2-2-4.24Zm-3.5,6.74c-1.39,0-2.5-1.12-2.5-2.5,0-.8.38-1.53,1-2V5c0-.82.67-1.5,1.5-1.5s1.5.68,1.5,1.5v10c.62.47,1,1.2,1,2,0,1.38-1.12,2.5-2.5,2.5Z"/><path class="premium-weather-cls-2" d="m13.5,17c0,.83-.68,1.5-1.5,1.5s-1.5-.67-1.5-1.5c0-.55.3-1.05.77-1.31.2-.11.3-.34.24-.56-.01-.04-.01-.08-.01-.13V5c0-.27.22-.5.5-.5s.5.23.5.5v10c0,.05-.01.09-.02.13-.06.22.04.45.24.56.48.26.78.76.78,1.31Z"/></g></svg>
4702 </span>
4703 <?php endif; ?>
4704
4705 <?php if ( $conditions_arr['feels_like'] ) : ?>
4706 <span class="premium-weather__weather-indicator" title="Feels Like" aria-label="feels like">
4707 <svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1,.premium-weather-cls-2{fill:#333;}.premium-weather-cls-2{fill-rule:evenodd;}</style></defs><g id="Feels_Like"><path class="premium-weather-cls-2" d="m19,7c0,2-2,4-4,4,2,0,4,2,4,4,0-2,2-4,4-4-2,0-4-2-4-4Zm-7,8c0,2-2,4-4,4,2,0,4,2,4,4,0-2,2-4,4-4-2,0-4-2-4-4Z"/><path class="premium-weather-cls-1" d="m1,8c3.5,0,7-3.5,7-7,0,3.5,3.5,7,7,7-3.5,0-7,3.5-7,7,0-3.5-3.5-7-7-7Z"/></g></svg>
4708 </span>
4709 <?php endif; ?>
4710
4711 <?php if ( $conditions_arr['wind'] ) : ?>
4712 <span class="premium-weather__weather-indicator" title="Wind Speed" aria-label="wind speed"><i class="fas fa-wind" aria-hidden='true'></i></span>
4713 <?php endif; ?>
4714
4715 <?php if ( $conditions_arr['wind_dir'] ) : ?>
4716 <span class="premium-weather__weather-indicator" title="Wind Direction" aria-label="wind direction">
4717 <svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1{fill:#333;fill-rule:evenodd;}</style></defs><g id="Wind_Direction"><path class="premium-weather-cls-1" d="m22,6.71l.71-.71-.71-.71-4-4c-.39-.39-1.02-.39-1.41,0-.39.39-.39,1.02,0,1.41l2.29,2.29h-2.97c-.87,0-1.52,0-2.12.19-.53.17-1.02.45-1.44.82-.47.42-.8.99-1.24,1.74l-.07.12-4.22,7.24c-.54.93-.71,1.19-.91,1.38-.21.19-.45.33-.72.41-.26.09-.58.1-1.65.1h-1.24c-.55,0-1,.45-1,1s.45,1,1,1h1.38s0,0,0,0c.87,0,1.52,0,2.12-.19.53-.17,1.02-.45,1.44-.83.47-.42.8-.99,1.24-1.74l.07-.12,4.22-7.24c.54-.93.71-1.19.91-1.38.21-.19.45-.33.72-.41.26-.09.58-.1,1.65-.1h2.83l-2.29,2.29c-.39.39-.39,1.02,0,1.41.39.39,1.02.39,1.41,0l4-4Z"/><path class="premium-weather-cls-1" d="m7.25,9.62l-.5-.86-.44-.75v-.02c-.37-.61-1.02-.98-1.73-.99h-.02s-2.26,0-2.26,0c-.55,0-1-.45-1-1s.45-1,1-1h2.29c1.41,0,2.71.75,3.43,1.97l.02.03.44.75.5.86-1.73,1.01Z"/><path class="premium-weather-cls-1" d="m22,17.29l.71.71-.71.71-4,4c-.39.39-1.02.39-1.41,0-.39-.39-.39-1.02,0-1.41l2.29-2.29h-3.88c-1.41,0-2.71-.75-3.43-1.97v-.03s-.45-.75-.45-.75l-.5-.86,1.73-1.01.5.86.44.75v.02c.37.61,1.02.98,1.73.99h3.87l-2.29-2.29c-.39-.39-.39-1.02,0-1.41.39-.39,1.02-.39,1.41,0l4,4"/></g></svg>
4718 </span>
4719 <?php endif; ?>
4720
4721 <?php if ( $conditions_arr['humidity'] ) : ?>
4722 <span class="premium-weather__weather-indicator" title="Humidity" aria-label="humidity">
4723 <svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1{fill:#333;}</style></defs><path id="Humidity" class="premium-weather-cls-1" d="m19.5,15.28c0,3.99-3.37,7.22-7.5,7.22s-7.5-3.23-7.5-7.22c0-2.63,2.36-7.11,7.09-13.57.2-.27.61-.27.81,0,4.73,6.46,7.1,10.94,7.1,13.57Z"/></svg>
4724 </span>
4725 <?php endif; ?>
4726
4727 <?php if ( $conditions_arr['pressure'] ) : ?>
4728 <span class="premium-weather__weather-indicator" title="Pressure" aria-label="pressure">
4729 <svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1{fill:#333;}</style></defs><path id="Weather_Pressure" class="premium-weather-cls-1" d="m12,1.5C6.2,1.5,1.5,6.2,1.5,12s4.7,10.5,10.5,10.5,10.5-4.7,10.5-10.5S17.8,1.5,12,1.5Zm0,1.75c.48,0,.87.39.87.88s-.39.87-.87.87-.88-.39-.88-.87.39-.88.88-.88Zm-4.05,1.06c.34-.04.68.12.86.43.24.42.1.95-.32,1.2s-.95.1-1.19-.32c-.24-.42-.1-.95.32-1.19.1-.06.22-.1.33-.11Zm8.09,0c.11.01.23.05.33.11.42.24.56.78.32,1.19-.24.42-.78.56-1.19.32s-.56-.78-.32-1.2c.18-.31.53-.47.86-.43Zm-10.76,2.88c.11.01.22.05.33.11.42.24.56.78.32,1.19s-.78.56-1.2.32c-.42-.24-.56-.78-.32-1.19.18-.31.53-.47.87-.43Zm13.43.03c.34-.04.68.12.86.43.24.42.1.95-.32,1.19l-5.51,3.16c0,.96-.78,1.74-1.75,1.74-.32,0-.61-.09-.87-.24l-1.91,1.1c-.14.08-.29.12-.44.12-.3,0-.6-.16-.76-.44-.24-.42-.09-.95.32-1.19l1.91-1.09c0-.96.79-1.74,1.75-1.74.32,0,.61.09.87.24l5.51-3.16c.1-.06.22-.1.33-.11Zm-14.59,3.91c.48,0,.87.39.87.88s-.39.87-.87.87-.88-.39-.88-.87.39-.88.88-.88Zm15.75,0c.48,0,.88.39.88.88s-.39.87-.88.87-.88-.39-.88-.87.39-.88.88-.88Zm-14.8,3.94c.34-.04.69.12.87.43.24.42.1.95-.32,1.19-.42.24-.95.1-1.19-.32s-.1-.95.32-1.19c.1-.06.22-.1.33-.11Zm13.86,0c.11.01.23.05.33.11.42.24.56.78.32,1.19-.24.42-.78.56-1.19.32-.42-.24-.56-.78-.32-1.19.18-.31.53-.47.87-.43Z"/></svg>
4730 </span>
4731 <?php endif; ?>
4732
4733 <?php if ( $conditions_arr['desc'] ) : ?>
4734 <span class="premium-weather__weather-indicator" title="Weather Description" aria-label="weather description">
4735 <svg id="Weather_Icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.premium-weather-cls-1,.premium-weather-cls-2{fill:#333;}.premium-weather-cls-2{fill-rule:evenodd;}</style></defs><g id="Description"><path class="premium-weather-cls-2" d="m22,9.79c0,2.2-1.13,3.58-2.22,4.37-.53.38-1.06.63-1.46.79-.2.07-.36.13-.49.16-.06.02-.11.03-.14.04-.02,0-.03,0-.04,0,0,0-.01,0-.01.01h-.03l-.1.03H6.49s-.03-.01-.03-.01c-.01-.01-.02-.01-.04-.01-.04-.01-.09-.01-.15-.02-.12-.02-.29-.06-.49-.11-.39-.1-.92-.28-1.47-.58-1.11-.62-2.31-1.81-2.31-3.87s1.19-3.28,2.29-3.93c.5-.3.99-.49,1.37-.6.4-2.6,2.73-4.28,5.14-4.74,2.58-.49,5.63.32,7.28,3.11.08.03.17.06.27.11.39.16.92.43,1.45.83,1.08.82,2.2,2.22,2.2,4.41Z"/><path class="premium-weather-cls-1" d="m15.6,22.8h-6c-.55,0-1-.45-1-1s.45-1,1-1h6c.55,0,1,.45,1,1s-.45,1-1,1Zm3.6-3.6h-3.6c-.55,0-1-.45-1-1s.45-1,1-1h3.6c.55,0,1,.45,1,1s-.45,1-1,1Zm-8.4,0h-6c-.55,0-1-.45-1-1s.45-1,1-1h6c.55,0,1,.45,1,1s-.45,1-1,1Z"/></g></svg>
4736 </span>
4737 <?php endif; ?>
4738 </div>
4739 <?php
4740 foreach ( $headers as $date ) {
4741 ?>
4742 <div id ='premium-tab-content-<?php echo esc_attr( $i ); ?>' class='premium-weather__tab-content <?php echo $i === 0 ? ' current' : ''; ?>'>
4743 <?php
4744 if ( isset( $forecast_data[ $date ] ) ) {
4745 $this->render_tabs_hourly_forecast( $forecast_data[ $date ], $conditions_arr );
4746 } else {
4747 ?>
4748 <span class="premium-weather__expire-notice"> <?php echo esc_html( $settings['date_notice'] ); ?></span>
4749 <?php
4750 }
4751 ?>
4752 </div>
4753 <?php
4754 ++$i;
4755 }
4756 ?>
4757 </div>
4758 <?php
4759 }
4760
4761 /**
4762 * Extracts Stock Symbols from a string separated by ",".
4763 *
4764 * @access public
4765 * @since 2.8.23
4766 *
4767 * @param string $symbol_str symbols strings.
4768 *
4769 * @return array
4770 */
4771 private function extract_forecast_dates( $dates_str ) {
4772
4773 $dates = explode( ',', $dates_str );
4774
4775 $dates = array_slice( $dates, 0, intval( $this->settings['forecast_days'] ) );
4776
4777 return $dates;
4778 }
4779
4780 private function render_tabs_hourly_forecast( $data, $conditions_arr ) {
4781
4782 $settings = $this->settings;
4783 $limit = $settings['tabs_hourly_max'];
4784 $weather_conditions = $settings['tabs_weather_data'];
4785
4786 for ( $i = 0; $i < $limit; $i++ ) {
4787 $item = isset( $data[ $i ] ) ? $data[ $i ] : false;
4788
4789 if ( $item ) {
4790 $weather_desc = $item['weather'][0]['description'];
4791
4792 ?>
4793 <div class="premium-weather__hourly-item">
4794 <span class="premium-weather__hourly-item-date"><?php echo esc_html( gmdate( 'd-h:i A', $item['dt'] ) ); ?></span>
4795
4796 <?php if ( $conditions_arr['desc_icon'] ) : ?>
4797 <div class="premium-weather__icon-wrapper" title="<?php echo esc_attr( $weather_desc ); ?>">
4798 <?php $this->render_weather_icon( $item['weather'][0]['icon'] ); ?>
4799 </div>
4800 <?php endif; ?>
4801
4802 <?php if ( $conditions_arr['temp'] ) : ?>
4803 <span class="premium-weather__temp">
4804 <?php
4805 echo esc_html( round( $item['main']['temp'], 0 ) ) . '&#176;';
4806 ?>
4807 </span>
4808 <?php endif; ?>
4809
4810 <?php if ( $conditions_arr['feels_like'] ) : ?>
4811 <span class="premium-weather__temp">
4812 <?php
4813 echo esc_html( round( $item['main']['feels_like'], 0 ) ) . '&#176;';
4814 ?>
4815 </span>
4816 <?php endif; ?>
4817
4818 <?php
4819 $item['main']['wind_speed'] = $item['wind']['speed'];
4820 $item['main']['wind_dir'] = $item['wind']['deg'];
4821 $this->render_extra_weather( $weather_conditions, $item['main'], true );
4822 ?>
4823
4824 <?php if ( $conditions_arr['desc'] ) : ?>
4825 <div class="premium-weather__hourly-desc"> <?php echo esc_html( $item['weather'][0]['description'] ); ?></div>
4826 <?php endif; ?>
4827 </div>
4828 <?php
4829 }
4830 }
4831 }
4832 }
4833