Plugin Directory

Changeset 3438808


Ignore:
Timestamp:
01/13/2026 04:39:30 PM (6 weeks ago)
Author:
spelhubben
Message:

Update to version 1.9.4 from GitHub

Location:
spelhubben-weather
Files:
2 added
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • spelhubben-weather/tags/1.9.4/includes/class-assets.php

    r3435228 r3438808  
    3131        }
    3232        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);
    3335
    3436        // Load core style only when plugin output is present on the page
    3537        if ( $this->should_load_assets() ) {
    3638            wp_enqueue_style('sv-vader-style');
     39            wp_enqueue_script('sv-vader-wind');
    3740        }
    3841
  • spelhubben-weather/tags/1.9.4/includes/class-renderer.php

    r3437920 r3438808  
    357357                            <div>
    358358                                💨 <?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                                } ?>
    360363                            </div>
    361364                        <?php endif; ?>
  • spelhubben-weather/tags/1.9.4/includes/format.php

    r3437920 r3438808  
    6464    function sv_vader_wind_dir(?float $deg): string {
    6565        if ($deg === null) return '';
     66        // Normalize degrees to [0,360)
     67        $deg = fmod(floatval($deg) + 360.0, 360.0);
    6668        $cardinals = [
    6769            __('N', 'spelhubben-weather'),
     
    7375            __('W', 'spelhubben-weather'),
    7476            __('NW', 'spelhubben-weather'),
    75             __('N', 'spelhubben-weather'),
    7677        ];
    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];
    7883    }
    7984}
     
    8287    function sv_vader_wind_dir_icon(?float $deg): string {
    8388        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);
    8491        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),
    8794            esc_attr(sv_vader_wind_dir($deg))
    8895        );
  • spelhubben-weather/tags/1.9.4/includes/integrations/vc.php

    r3437920 r3438808  
    7373                    'heading' => __( 'Show map', 'spelhubben-weather' ),
    7474                    'param_name' => 'map',
    75                     'value' => array( __( 'Show map' ) => '1' ),
     75                    'value' => array( __( 'Show map', 'spelhubben-weather' ) => '1' ),
    7676                ),
    7777                array(
  • spelhubben-weather/tags/1.9.4/readme.txt

    r3437920 r3438808  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 1.9.3
     7Stable tag: 1.9.4
    88Donate link: https://www.paypal.com/donate/?hosted_button_id=CV74CEXY5XEAU
     9
     10License: GPLv3 or later
     11License URI: https://www.gnu.org/licenses/gpl-3.0.html
    912
    1013Weather widget, Gutenberg block and shortcode with optional map and multi-provider forecasts.
     
    197200
    198201== 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
    199205- = 1.9.3 =
    200 - **New:** Support for wind in knots (`knt`, alias `kn`) across Shortcodes, Block, Widget and WPBakery/VC.
    201206- **New:** `wind_unit` override in Block inspector, Widget settings and Shortcodes Quick Builder.
    202207- **Improved:** `metric_knt` preset for metric display with knots.
  • spelhubben-weather/tags/1.9.4/spelhubben-weather.php

    r3437920 r3438808  
    33 * Plugin Name: Spelhubben Weather
    44 * 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.3
     5 * Version: 1.9.4
    66 * Author: Spelhubben
    77 * Text Domain: spelhubben-weather
     
    2323
    2424// ── 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    }
    2828if ( ! defined( 'SV_VADER_DIR' ) ) {
    2929    define( 'SV_VADER_DIR', plugin_dir_path( __FILE__ ) );
  • spelhubben-weather/trunk/includes/class-assets.php

    r3435228 r3438808  
    3131        }
    3232        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);
    3335
    3436        // Load core style only when plugin output is present on the page
    3537        if ( $this->should_load_assets() ) {
    3638            wp_enqueue_style('sv-vader-style');
     39            wp_enqueue_script('sv-vader-wind');
    3740        }
    3841
  • spelhubben-weather/trunk/includes/class-renderer.php

    r3437920 r3438808  
    357357                            <div>
    358358                                💨 <?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                                } ?>
    360363                            </div>
    361364                        <?php endif; ?>
  • spelhubben-weather/trunk/includes/format.php

    r3437920 r3438808  
    6464    function sv_vader_wind_dir(?float $deg): string {
    6565        if ($deg === null) return '';
     66        // Normalize degrees to [0,360)
     67        $deg = fmod(floatval($deg) + 360.0, 360.0);
    6668        $cardinals = [
    6769            __('N', 'spelhubben-weather'),
     
    7375            __('W', 'spelhubben-weather'),
    7476            __('NW', 'spelhubben-weather'),
    75             __('N', 'spelhubben-weather'),
    7677        ];
    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];
    7883    }
    7984}
     
    8287    function sv_vader_wind_dir_icon(?float $deg): string {
    8388        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);
    8491        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),
    8794            esc_attr(sv_vader_wind_dir($deg))
    8895        );
  • spelhubben-weather/trunk/includes/integrations/vc.php

    r3437920 r3438808  
    7373                    'heading' => __( 'Show map', 'spelhubben-weather' ),
    7474                    'param_name' => 'map',
    75                     'value' => array( __( 'Show map' ) => '1' ),
     75                    'value' => array( __( 'Show map', 'spelhubben-weather' ) => '1' ),
    7676                ),
    7777                array(
  • spelhubben-weather/trunk/readme.txt

    r3437920 r3438808  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 1.9.3
     7Stable tag: 1.9.4
    88Donate link: https://www.paypal.com/donate/?hosted_button_id=CV74CEXY5XEAU
     9
     10License: GPLv3 or later
     11License URI: https://www.gnu.org/licenses/gpl-3.0.html
    912
    1013Weather widget, Gutenberg block and shortcode with optional map and multi-provider forecasts.
     
    197200
    198201== 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
    199205- = 1.9.3 =
    200 - **New:** Support for wind in knots (`knt`, alias `kn`) across Shortcodes, Block, Widget and WPBakery/VC.
    201206- **New:** `wind_unit` override in Block inspector, Widget settings and Shortcodes Quick Builder.
    202207- **Improved:** `metric_knt` preset for metric display with knots.
  • spelhubben-weather/trunk/spelhubben-weather.php

    r3437920 r3438808  
    33 * Plugin Name: Spelhubben Weather
    44 * 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.3
     5 * Version: 1.9.4
    66 * Author: Spelhubben
    77 * Text Domain: spelhubben-weather
     
    2323
    2424// ── 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    }
    2828if ( ! defined( 'SV_VADER_DIR' ) ) {
    2929    define( 'SV_VADER_DIR', plugin_dir_path( __FILE__ ) );
Note: See TracChangeset for help on using the changeset viewer.