Changeset 3438808
- Timestamp:
- 01/13/2026 04:39:30 PM (6 weeks ago)
- Location:
- spelhubben-weather
- Files:
-
- 2 added
- 12 edited
- 1 copied
-
tags/1.9.4 (copied) (copied from spelhubben-weather/trunk)
-
tags/1.9.4/assets/wind.js (added)
-
tags/1.9.4/includes/class-assets.php (modified) (1 diff)
-
tags/1.9.4/includes/class-renderer.php (modified) (1 diff)
-
tags/1.9.4/includes/format.php (modified) (3 diffs)
-
tags/1.9.4/includes/integrations/vc.php (modified) (1 diff)
-
tags/1.9.4/readme.txt (modified) (2 diffs)
-
tags/1.9.4/spelhubben-weather.php (modified) (2 diffs)
-
trunk/assets/wind.js (added)
-
trunk/includes/class-assets.php (modified) (1 diff)
-
trunk/includes/class-renderer.php (modified) (1 diff)
-
trunk/includes/format.php (modified) (3 diffs)
-
trunk/includes/integrations/vc.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/spelhubben-weather.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
spelhubben-weather/tags/1.9.4/includes/class-assets.php
r3435228 r3438808 31 31 } 32 32 wp_register_script('sv-vader-map', SV_VADER_URL . $map_file, ['leaflet-js'], SV_VADER_VER, true); 33 // Small helper to rotate wind direction arrows when inline styles are stripped 34 wp_register_script('sv-vader-wind', SV_VADER_URL . 'assets/wind.js', [], SV_VADER_VER, true); 33 35 34 36 // Load core style only when plugin output is present on the page 35 37 if ( $this->should_load_assets() ) { 36 38 wp_enqueue_style('sv-vader-style'); 39 wp_enqueue_script('sv-vader-wind'); 37 40 } 38 41 -
spelhubben-weather/tags/1.9.4/includes/class-renderer.php
r3437920 r3438808 357 357 <div> 358 358 💨 <?php esc_html_e('Wind:', 'spelhubben-weather'); ?> <?php echo esc_html(sv_vader_num($w_val)); ?> <?php echo esc_html($w_u); ?> 359 <?php if (in_array('wind_dir', $show, true)) echo wp_kses_post( sv_vader_wind_dir_icon($w_dir) ); ?> 359 <?php if ($w_dir !== null) { 360 echo wp_kses_post( sv_vader_wind_dir_icon($w_dir) ); 361 // (debug removed) 362 } ?> 360 363 </div> 361 364 <?php endif; ?> -
spelhubben-weather/tags/1.9.4/includes/format.php
r3437920 r3438808 64 64 function sv_vader_wind_dir(?float $deg): string { 65 65 if ($deg === null) return ''; 66 // Normalize degrees to [0,360) 67 $deg = fmod(floatval($deg) + 360.0, 360.0); 66 68 $cardinals = [ 67 69 __('N', 'spelhubben-weather'), … … 73 75 __('W', 'spelhubben-weather'), 74 76 __('NW', 'spelhubben-weather'), 75 __('N', 'spelhubben-weather'),76 77 ]; 77 return $cardinals[round($deg / 45)]; 78 79 // Use standard sector calculation: each cardinal spans 45°, centered on multiples of 45°. 80 // Adding 22.5° before flooring ensures correct rounding at boundaries. 81 $index = (int) floor(($deg + 22.5) / 45.0) % 8; 82 return $cardinals[$index]; 78 83 } 79 84 } … … 82 87 function sv_vader_wind_dir_icon(?float $deg): string { 83 88 if ($deg === null) return ''; 89 // Output a data attribute instead of inline styles (wp_kses_post may strip style attrs). 90 $deg_val = floatval($deg); 84 91 return sprintf( 85 '<span class="svv-wind-dir" style="display:inline-block;transform:rotate(%ddeg);line-height:1;font-style:normal;vertical-align:middle;" title="%s">➤</span>',86 intval($deg) - 90,92 '<span class="svv-wind-dir" data-deg="%s" title="%s">➤</span>', 93 esc_attr((string)$deg_val), 87 94 esc_attr(sv_vader_wind_dir($deg)) 88 95 ); -
spelhubben-weather/tags/1.9.4/includes/integrations/vc.php
r3437920 r3438808 73 73 'heading' => __( 'Show map', 'spelhubben-weather' ), 74 74 'param_name' => 'map', 75 'value' => array( __( 'Show map' ) => '1' ),75 'value' => array( __( 'Show map', 'spelhubben-weather' ) => '1' ), 76 76 ), 77 77 array( -
spelhubben-weather/tags/1.9.4/readme.txt
r3437920 r3438808 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 1.9. 37 Stable tag: 1.9.4 8 8 Donate link: https://www.paypal.com/donate/?hosted_button_id=CV74CEXY5XEAU 9 10 License: GPLv3 or later 11 License URI: https://www.gnu.org/licenses/gpl-3.0.html 9 12 10 13 Weather widget, Gutenberg block and shortcode with optional map and multi-provider forecasts. … … 197 200 198 201 == Changelog == 202 - = 1.9.4 = 203 - **Fixed:** Wind direction cardinal calculation and arrow rotation; ensured text-domain i18n call fixed for VC integration; asset sanitization workaround for wind arrow rotation (data-deg + frontend JS). 204 199 205 - = 1.9.3 = 200 - **New:** Support for wind in knots (`knt`, alias `kn`) across Shortcodes, Block, Widget and WPBakery/VC.201 206 - **New:** `wind_unit` override in Block inspector, Widget settings and Shortcodes Quick Builder. 202 207 - **Improved:** `metric_knt` preset for metric display with knots. -
spelhubben-weather/tags/1.9.4/spelhubben-weather.php
r3437920 r3438808 3 3 * Plugin Name: Spelhubben Weather 4 4 * Description: Displays current weather and an optional forecast with a simple consensus across providers (Open-Meteo, SMHI, Yr/MET Norway). Supports shortcode + Gutenberg block + classic widget. Optional Leaflet map, subtle animations, daily forecast, and multiple layouts. 5 * Version: 1.9. 35 * Version: 1.9.4 6 6 * Author: Spelhubben 7 7 * Text Domain: spelhubben-weather … … 23 23 24 24 // ── Constants (kept for backward compatibility). 25 if ( ! defined( 'SV_VADER_VER' ) ) {26 define( 'SV_VADER_VER', '1.9.3' );27 }25 if ( ! defined( 'SV_VADER_VER' ) ) { 26 define( 'SV_VADER_VER', '1.9.4' ); 27 } 28 28 if ( ! defined( 'SV_VADER_DIR' ) ) { 29 29 define( 'SV_VADER_DIR', plugin_dir_path( __FILE__ ) ); -
spelhubben-weather/trunk/includes/class-assets.php
r3435228 r3438808 31 31 } 32 32 wp_register_script('sv-vader-map', SV_VADER_URL . $map_file, ['leaflet-js'], SV_VADER_VER, true); 33 // Small helper to rotate wind direction arrows when inline styles are stripped 34 wp_register_script('sv-vader-wind', SV_VADER_URL . 'assets/wind.js', [], SV_VADER_VER, true); 33 35 34 36 // Load core style only when plugin output is present on the page 35 37 if ( $this->should_load_assets() ) { 36 38 wp_enqueue_style('sv-vader-style'); 39 wp_enqueue_script('sv-vader-wind'); 37 40 } 38 41 -
spelhubben-weather/trunk/includes/class-renderer.php
r3437920 r3438808 357 357 <div> 358 358 💨 <?php esc_html_e('Wind:', 'spelhubben-weather'); ?> <?php echo esc_html(sv_vader_num($w_val)); ?> <?php echo esc_html($w_u); ?> 359 <?php if (in_array('wind_dir', $show, true)) echo wp_kses_post( sv_vader_wind_dir_icon($w_dir) ); ?> 359 <?php if ($w_dir !== null) { 360 echo wp_kses_post( sv_vader_wind_dir_icon($w_dir) ); 361 // (debug removed) 362 } ?> 360 363 </div> 361 364 <?php endif; ?> -
spelhubben-weather/trunk/includes/format.php
r3437920 r3438808 64 64 function sv_vader_wind_dir(?float $deg): string { 65 65 if ($deg === null) return ''; 66 // Normalize degrees to [0,360) 67 $deg = fmod(floatval($deg) + 360.0, 360.0); 66 68 $cardinals = [ 67 69 __('N', 'spelhubben-weather'), … … 73 75 __('W', 'spelhubben-weather'), 74 76 __('NW', 'spelhubben-weather'), 75 __('N', 'spelhubben-weather'),76 77 ]; 77 return $cardinals[round($deg / 45)]; 78 79 // Use standard sector calculation: each cardinal spans 45°, centered on multiples of 45°. 80 // Adding 22.5° before flooring ensures correct rounding at boundaries. 81 $index = (int) floor(($deg + 22.5) / 45.0) % 8; 82 return $cardinals[$index]; 78 83 } 79 84 } … … 82 87 function sv_vader_wind_dir_icon(?float $deg): string { 83 88 if ($deg === null) return ''; 89 // Output a data attribute instead of inline styles (wp_kses_post may strip style attrs). 90 $deg_val = floatval($deg); 84 91 return sprintf( 85 '<span class="svv-wind-dir" style="display:inline-block;transform:rotate(%ddeg);line-height:1;font-style:normal;vertical-align:middle;" title="%s">➤</span>',86 intval($deg) - 90,92 '<span class="svv-wind-dir" data-deg="%s" title="%s">➤</span>', 93 esc_attr((string)$deg_val), 87 94 esc_attr(sv_vader_wind_dir($deg)) 88 95 ); -
spelhubben-weather/trunk/includes/integrations/vc.php
r3437920 r3438808 73 73 'heading' => __( 'Show map', 'spelhubben-weather' ), 74 74 'param_name' => 'map', 75 'value' => array( __( 'Show map' ) => '1' ),75 'value' => array( __( 'Show map', 'spelhubben-weather' ) => '1' ), 76 76 ), 77 77 array( -
spelhubben-weather/trunk/readme.txt
r3437920 r3438808 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 1.9. 37 Stable tag: 1.9.4 8 8 Donate link: https://www.paypal.com/donate/?hosted_button_id=CV74CEXY5XEAU 9 10 License: GPLv3 or later 11 License URI: https://www.gnu.org/licenses/gpl-3.0.html 9 12 10 13 Weather widget, Gutenberg block and shortcode with optional map and multi-provider forecasts. … … 197 200 198 201 == Changelog == 202 - = 1.9.4 = 203 - **Fixed:** Wind direction cardinal calculation and arrow rotation; ensured text-domain i18n call fixed for VC integration; asset sanitization workaround for wind arrow rotation (data-deg + frontend JS). 204 199 205 - = 1.9.3 = 200 - **New:** Support for wind in knots (`knt`, alias `kn`) across Shortcodes, Block, Widget and WPBakery/VC.201 206 - **New:** `wind_unit` override in Block inspector, Widget settings and Shortcodes Quick Builder. 202 207 - **Improved:** `metric_knt` preset for metric display with knots. -
spelhubben-weather/trunk/spelhubben-weather.php
r3437920 r3438808 3 3 * Plugin Name: Spelhubben Weather 4 4 * Description: Displays current weather and an optional forecast with a simple consensus across providers (Open-Meteo, SMHI, Yr/MET Norway). Supports shortcode + Gutenberg block + classic widget. Optional Leaflet map, subtle animations, daily forecast, and multiple layouts. 5 * Version: 1.9. 35 * Version: 1.9.4 6 6 * Author: Spelhubben 7 7 * Text Domain: spelhubben-weather … … 23 23 24 24 // ── Constants (kept for backward compatibility). 25 if ( ! defined( 'SV_VADER_VER' ) ) {26 define( 'SV_VADER_VER', '1.9.3' );27 }25 if ( ! defined( 'SV_VADER_VER' ) ) { 26 define( 'SV_VADER_VER', '1.9.4' ); 27 } 28 28 if ( ! defined( 'SV_VADER_DIR' ) ) { 29 29 define( 'SV_VADER_DIR', plugin_dir_path( __FILE__ ) );
Note: See TracChangeset
for help on using the changeset viewer.