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