Plugin Directory

Changeset 3435748


Ignore:
Timestamp:
01/09/2026 09:10:33 AM (6 weeks ago)
Author:
spelhubben
Message:

Update to version 1.9.1 from GitHub

Location:
spelhubben-weather
Files:
4 deleted
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • spelhubben-weather/tags/1.9.1/admin/admin.js

    r3435228 r3435748  
    312312      var show = Array.from(document.querySelectorAll('.svv-b-show:checked')).map(function(i){ return i.value; }).join(',');
    313313      var layout = document.querySelector('.svv-b-layout').value;
     314      var theme = (document.querySelector('.svv-b-theme') && document.querySelector('.svv-b-theme').value) || 'auto';
    314315      var map = document.querySelector('.svv-b-map').checked ? '1' : '0';
    315316      var animate = document.querySelector('.svv-b-animate').checked ? '1' : '0';
     
    319320      if (show && show !== 'temp,wind,wind_dir,icon') sc += ' show="' + show + '"';
    320321      if (layout !== 'card') sc += ' layout="' + layout + '"';
     322      if (theme && theme !== 'auto') sc += ' theme="' + theme + '"';
    321323      if (map === '1') sc += ' map="1"';
    322324      if (animate === '0') sc += ' animate="0"';
  • spelhubben-weather/tags/1.9.1/admin/page-shortcodes.php

    r3435228 r3435748  
    2222        $nx10 = '[spelhubben_weather providers="smhi,yr"]';
    2323        $nx11 = '[spelhubben_weather place="Stockholm" show="temp,wind,wind_dir,icon"]';
     24        $nx12 = '[spelhubben_weather place="Stockholm" theme="dark" show="temp,icon" map="0"]';
    2425
    2526        $new_examples = array(
     
    3031            array( 'label' => __( 'Only temperature + wind, imperial', 'spelhubben-weather' ), 'code' => $nx5 ),
    3132            array( 'label' => __( 'Show temperature, wind speed & direction', 'spelhubben-weather' ), 'code' => $nx11 ),
     33            array( 'label' => __( 'Force dark theme (example)', 'spelhubben-weather' ), 'code' => $nx12 ),
    3234            array( 'label' => __( 'Provider comparison mode', 'spelhubben-weather' ), 'code' => $nx6 ),
    3335            array( 'label' => __( 'With weather alerts enabled', 'spelhubben-weather' ), 'code' => $nx7 ),
     
    136138                                </div>
    137139                                <div>
     140                                    <strong><?php esc_html_e( 'Theme:', 'spelhubben-weather' ); ?></strong><br>
     141                                    <select class="svv-b-theme">
     142                                        <option value="auto">Auto</option>
     143                                        <option value="light">Light</option>
     144                                        <option value="dark">Dark</option>
     145                                    </select>
     146                                </div>
     147                                <div>
    138148                                    <strong><?php esc_html_e( 'Extras:', 'spelhubben-weather' ); ?></strong><br>
    139149                                    <label><input type="checkbox" class="svv-b-map" value="1"> <?php esc_html_e( 'Map', 'spelhubben-weather' ); ?></label>
     
    205215                                    <tr data-group="uf"><td><code>precip_unit</code></td><td><?php esc_html_e( 'Override precipitation unit', 'spelhubben-weather' ); ?></td><td><code>precip_unit="in"</code></td></tr>
    206216                                    <tr data-group="uf"><td><code>date_format</code></td><td><?php esc_html_e( 'Forecast date label (PHP date)', 'spelhubben-weather' ); ?></td><td><code>date_format="D j/n"</code></td></tr>
     217                                    <tr data-group="disp"><td><code>theme</code></td><td><?php esc_html_e( 'auto | light | dark — force display theme (auto uses site/browser preference)', 'spelhubben-weather' ); ?></td><td><code>theme="dark"</code></td></tr>
    207218                                </tbody>
    208219                            </table>
  • spelhubben-weather/tags/1.9.1/assets/style.css

    r3435228 r3435748  
    5858}
    5959
     60/* Forced theme classes/attributes from shortcode/block/widget */
     61.svv-theme-dark,
     62[data-svv-theme="dark"] {
     63  --svv-bg: #1e1e1e;
     64  --svv-text: #f0f0f0;
     65  --svv-border: #333333;
     66  --svv-shadow: rgba(0,0,0,.2);
     67  --svv-badge-border: #444444;
     68  --svv-muted: #aaaaaa;
     69}
     70
     71.svv-theme-light,
     72[data-svv-theme="light"] {
     73  --svv-bg: #ffffff;
     74  --svv-text: #1a1a1a;
     75  --svv-border: #e6e6e6;
     76  --svv-shadow: rgba(0,0,0,.04);
     77  --svv-badge-border: #eeeeee;
     78  --svv-muted: #666666;
     79}
     80
     81/* Make Leaflet map tiles subtly darker in forced dark theme for better contrast */
     82.svv-theme-dark .svv-map,
     83[data-svv-theme="dark"] .svv-map {
     84  filter: brightness(0.78) contrast(1.06) saturate(0.95);
     85}
     86
     87/* Alerts styling in forced dark theme to match darker UI */
     88.svv-theme-dark .svv-alert-mini.is-danger,
     89[data-svv-theme="dark"] .svv-alert-mini.is-danger {
     90  background: #2b0a0a; /* darker red background */
     91  color: #ffb4b4; /* slightly desaturated light text for readability */
     92  border-color: #5a0f0f;
     93}
     94.svv-theme-dark .svv-alert-mini.is-warning,
     95[data-svv-theme="dark"] .svv-alert-mini.is-warning {
     96  background: #2f1602; /* darker amber */
     97  color: #ffdca8; /* warm light text */
     98  border-color: #5b2d09;
     99}
     100.svv-theme-dark .svv-alert-mini.is-info,
     101[data-svv-theme="dark"] .svv-alert-mini.is-info {
     102  background: #0b1630; /* deeper blue */
     103  color: #dbeeff; /* pale blue text */
     104  border-color: #14283f;
     105}
     106
    60107.svv-ort{font-weight:600;margin-bottom:calc(6px * var(--svv-scale));}
    61108
  • spelhubben-weather/tags/1.9.1/includes/Widget/class-widget.php

    r3435228 r3435748  
    3636            'days'      => 5,
    3737            'show_alerts' => 1,
     38            'theme'     => 'auto',
    3839            'class'     => 'is-widget',
    3940        ];
     
    6364        $days        = max(1, min(14, (int) $instance['days']));
    6465        $show_alerts = !empty($instance['show_alerts']) ? 1 : 0;
     66        $theme       = in_array(strtolower($instance['theme'] ?? 'auto'), ['auto','light','dark'], true) ? strtolower($instance['theme']) : 'auto';
    6567        $extra_cls   = isset($instance['class']) ? sanitize_html_class($instance['class'], '') : '';
    6668
     
    8890                'days'        => (string) $days,
    8991                'show_alerts' => $show_alerts ? '1' : '0',
     92                    'theme'       => $theme,
    9093            ]);
    9194
     
    113116            'forecast'  => 'none',
    114117            'days'      => 5,
     118            'theme'     => 'auto',
    115119            'class'     => '',
    116120        ];
     
    197201        </p>
    198202        <p>
     203            <label for="<?php echo esc_attr($this->get_field_id('theme')); ?>"><?php esc_html_e('Theme:', 'spelhubben-weather'); ?></label>
     204            <select id="<?php echo esc_attr($this->get_field_id('theme')); ?>"
     205                    name="<?php echo esc_attr($this->get_field_name('theme')); ?>"
     206                    class="widefat">
     207                <?php
     208                $themes = ['auto','light','dark'];
     209                foreach ($themes as $th) {
     210                    printf(
     211                        '<option value="%1$s"%2$s>%1$s</option>',
     212                        esc_attr($th),
     213                        selected($instance['theme'], $th, false)
     214                    );
     215                }
     216                ?>
     217            </select>
     218        </p>
     219        <p>
    199220            <input id="<?php echo esc_attr($this->get_field_id('map')); ?>"
    200221                   name="<?php echo esc_attr($this->get_field_name('map')); ?>"
     
    271292        $instance['days']        = max(1, min(14, (int) ($new_instance['days'] ?? 5)));
    272293        $instance['show_alerts'] = !empty($new_instance['show_alerts']) ? 1 : 0;
     294        $instance['theme']       = in_array(strtolower($new_instance['theme'] ?? 'auto'), ['auto','light','dark'], true) ? sanitize_text_field(strtolower($new_instance['theme'])) : 'auto';
    273295        $instance['class']       = sanitize_html_class($new_instance['class'] ?? '', '');
    274296
  • spelhubben-weather/tags/1.9.1/includes/class-block.php

    r3435228 r3435748  
    3030                        'animate'    => ! empty( $attrs['animate'] ) ? '1' : '0',
    3131                        'forecast'   => isset( $attrs['forecast'] ) ? $attrs['forecast'] : 'none',
     32                        'theme'      => $attrs['theme'] ?? 'auto',
    3233                        'days'       => isset( $attrs['days'] ) ? (string) intval( $attrs['days'] ) : '5',
    3334
     
    6162                        'animate'     => ! empty( $attrs['animate'] ) ? '1' : '0',
    6263                        'forecast'    => isset( $attrs['forecast'] ) ? $attrs['forecast'] : 'none',
     64                        'theme'       => $attrs['theme'] ?? 'auto',
    6365                        'days'        => isset( $attrs['days'] ) ? (string) intval( $attrs['days'] ) : '5',
    6466                        'show_alerts' => isset( $attrs['showAlerts'] ) ? ( $attrs['showAlerts'] ? '1' : '0' ) : (string) $opts['show_alerts'],
  • spelhubben-weather/tags/1.9.1/includes/class-plugin.php

    r3435228 r3435748  
    7474
    7575        // Pass-through of same-name attributes
    76         foreach (['lat','lon','show','layout','class','providers','forecast','days','map_height'] as $k) {
     76        foreach (['lat','lon','show','layout','class','providers','forecast','days','map_height','theme'] as $k) {
    7777            if (isset($norm[$k])) {
    7878                $legacy[$k] = $norm[$k];
  • spelhubben-weather/tags/1.9.1/includes/class-renderer.php

    r3435228 r3435748  
    4040            'precip_unit'  => $opts['precip_unit'],
    4141            'date_format'  => $opts['date_format'],
     42            'theme'        => 'auto',
    4243        ], $atts, 'sv_vader');
    4344
     
    9798        $classes = 'sv-vader spelhubben-weather ' . $a['class'] . ' ' . ($is_anim ? 'svv-anim' : '') . ' svv-layout-' . $layout;
    9899
     100        // Theme handling: auto|light|dark (fallback to auto)
     101        $theme = strtolower(trim((string) ($a['theme'] ?? 'auto')));
     102        if (!in_array($theme, ['auto','light','dark'], true)) {
     103            $theme = 'auto';
     104        }
     105
     106        if ($theme !== 'auto') {
     107            $classes .= ' svv-theme-' . $theme;
     108        }
     109
    99110        ob_start(); ?>
    100         <div class="<?php echo esc_attr($classes); ?>" data-svv-ro="1">
     111        <div class="<?php echo esc_attr($classes); ?>" data-svv-ro="1" data-svv-theme="<?php echo esc_attr($theme); ?>">
    101112            <?php if (!empty($name) && $layout !== 'inline'): ?>
    102113                <div class="svv-ort"><?php echo esc_html($name); ?></div>
  • spelhubben-weather/tags/1.9.1/spelhubben-weather.php

    r3435228 r3435748  
    99 * Requires at least: 6.8
    1010 * Requires PHP: 7.4
    11  * License: GPLv3 or later
    12  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
     11 * License: GPLv2 or later
     12 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1313 */
    1414/*
    1515 * Copyright (C) 2026 Spelhubben
    16  * Licensed under the GNU General Public License v3 (or later)
    17  * https://www.gnu.org/licenses/gpl-3.0.html
     16 * Licensed under the GNU General Public License v2 (or later)
     17 * https://www.gnu.org/licenses/gpl-2.0.html
    1818 */
    1919
  • spelhubben-weather/trunk/admin/admin.js

    r3435228 r3435748  
    312312      var show = Array.from(document.querySelectorAll('.svv-b-show:checked')).map(function(i){ return i.value; }).join(',');
    313313      var layout = document.querySelector('.svv-b-layout').value;
     314      var theme = (document.querySelector('.svv-b-theme') && document.querySelector('.svv-b-theme').value) || 'auto';
    314315      var map = document.querySelector('.svv-b-map').checked ? '1' : '0';
    315316      var animate = document.querySelector('.svv-b-animate').checked ? '1' : '0';
     
    319320      if (show && show !== 'temp,wind,wind_dir,icon') sc += ' show="' + show + '"';
    320321      if (layout !== 'card') sc += ' layout="' + layout + '"';
     322      if (theme && theme !== 'auto') sc += ' theme="' + theme + '"';
    321323      if (map === '1') sc += ' map="1"';
    322324      if (animate === '0') sc += ' animate="0"';
  • spelhubben-weather/trunk/admin/page-shortcodes.php

    r3435228 r3435748  
    2222        $nx10 = '[spelhubben_weather providers="smhi,yr"]';
    2323        $nx11 = '[spelhubben_weather place="Stockholm" show="temp,wind,wind_dir,icon"]';
     24        $nx12 = '[spelhubben_weather place="Stockholm" theme="dark" show="temp,icon" map="0"]';
    2425
    2526        $new_examples = array(
     
    3031            array( 'label' => __( 'Only temperature + wind, imperial', 'spelhubben-weather' ), 'code' => $nx5 ),
    3132            array( 'label' => __( 'Show temperature, wind speed & direction', 'spelhubben-weather' ), 'code' => $nx11 ),
     33            array( 'label' => __( 'Force dark theme (example)', 'spelhubben-weather' ), 'code' => $nx12 ),
    3234            array( 'label' => __( 'Provider comparison mode', 'spelhubben-weather' ), 'code' => $nx6 ),
    3335            array( 'label' => __( 'With weather alerts enabled', 'spelhubben-weather' ), 'code' => $nx7 ),
     
    136138                                </div>
    137139                                <div>
     140                                    <strong><?php esc_html_e( 'Theme:', 'spelhubben-weather' ); ?></strong><br>
     141                                    <select class="svv-b-theme">
     142                                        <option value="auto">Auto</option>
     143                                        <option value="light">Light</option>
     144                                        <option value="dark">Dark</option>
     145                                    </select>
     146                                </div>
     147                                <div>
    138148                                    <strong><?php esc_html_e( 'Extras:', 'spelhubben-weather' ); ?></strong><br>
    139149                                    <label><input type="checkbox" class="svv-b-map" value="1"> <?php esc_html_e( 'Map', 'spelhubben-weather' ); ?></label>
     
    205215                                    <tr data-group="uf"><td><code>precip_unit</code></td><td><?php esc_html_e( 'Override precipitation unit', 'spelhubben-weather' ); ?></td><td><code>precip_unit="in"</code></td></tr>
    206216                                    <tr data-group="uf"><td><code>date_format</code></td><td><?php esc_html_e( 'Forecast date label (PHP date)', 'spelhubben-weather' ); ?></td><td><code>date_format="D j/n"</code></td></tr>
     217                                    <tr data-group="disp"><td><code>theme</code></td><td><?php esc_html_e( 'auto | light | dark — force display theme (auto uses site/browser preference)', 'spelhubben-weather' ); ?></td><td><code>theme="dark"</code></td></tr>
    207218                                </tbody>
    208219                            </table>
  • spelhubben-weather/trunk/assets/style.css

    r3435228 r3435748  
    5858}
    5959
     60/* Forced theme classes/attributes from shortcode/block/widget */
     61.svv-theme-dark,
     62[data-svv-theme="dark"] {
     63  --svv-bg: #1e1e1e;
     64  --svv-text: #f0f0f0;
     65  --svv-border: #333333;
     66  --svv-shadow: rgba(0,0,0,.2);
     67  --svv-badge-border: #444444;
     68  --svv-muted: #aaaaaa;
     69}
     70
     71.svv-theme-light,
     72[data-svv-theme="light"] {
     73  --svv-bg: #ffffff;
     74  --svv-text: #1a1a1a;
     75  --svv-border: #e6e6e6;
     76  --svv-shadow: rgba(0,0,0,.04);
     77  --svv-badge-border: #eeeeee;
     78  --svv-muted: #666666;
     79}
     80
     81/* Make Leaflet map tiles subtly darker in forced dark theme for better contrast */
     82.svv-theme-dark .svv-map,
     83[data-svv-theme="dark"] .svv-map {
     84  filter: brightness(0.78) contrast(1.06) saturate(0.95);
     85}
     86
     87/* Alerts styling in forced dark theme to match darker UI */
     88.svv-theme-dark .svv-alert-mini.is-danger,
     89[data-svv-theme="dark"] .svv-alert-mini.is-danger {
     90  background: #2b0a0a; /* darker red background */
     91  color: #ffb4b4; /* slightly desaturated light text for readability */
     92  border-color: #5a0f0f;
     93}
     94.svv-theme-dark .svv-alert-mini.is-warning,
     95[data-svv-theme="dark"] .svv-alert-mini.is-warning {
     96  background: #2f1602; /* darker amber */
     97  color: #ffdca8; /* warm light text */
     98  border-color: #5b2d09;
     99}
     100.svv-theme-dark .svv-alert-mini.is-info,
     101[data-svv-theme="dark"] .svv-alert-mini.is-info {
     102  background: #0b1630; /* deeper blue */
     103  color: #dbeeff; /* pale blue text */
     104  border-color: #14283f;
     105}
     106
    60107.svv-ort{font-weight:600;margin-bottom:calc(6px * var(--svv-scale));}
    61108
  • spelhubben-weather/trunk/includes/Widget/class-widget.php

    r3435228 r3435748  
    3636            'days'      => 5,
    3737            'show_alerts' => 1,
     38            'theme'     => 'auto',
    3839            'class'     => 'is-widget',
    3940        ];
     
    6364        $days        = max(1, min(14, (int) $instance['days']));
    6465        $show_alerts = !empty($instance['show_alerts']) ? 1 : 0;
     66        $theme       = in_array(strtolower($instance['theme'] ?? 'auto'), ['auto','light','dark'], true) ? strtolower($instance['theme']) : 'auto';
    6567        $extra_cls   = isset($instance['class']) ? sanitize_html_class($instance['class'], '') : '';
    6668
     
    8890                'days'        => (string) $days,
    8991                'show_alerts' => $show_alerts ? '1' : '0',
     92                    'theme'       => $theme,
    9093            ]);
    9194
     
    113116            'forecast'  => 'none',
    114117            'days'      => 5,
     118            'theme'     => 'auto',
    115119            'class'     => '',
    116120        ];
     
    197201        </p>
    198202        <p>
     203            <label for="<?php echo esc_attr($this->get_field_id('theme')); ?>"><?php esc_html_e('Theme:', 'spelhubben-weather'); ?></label>
     204            <select id="<?php echo esc_attr($this->get_field_id('theme')); ?>"
     205                    name="<?php echo esc_attr($this->get_field_name('theme')); ?>"
     206                    class="widefat">
     207                <?php
     208                $themes = ['auto','light','dark'];
     209                foreach ($themes as $th) {
     210                    printf(
     211                        '<option value="%1$s"%2$s>%1$s</option>',
     212                        esc_attr($th),
     213                        selected($instance['theme'], $th, false)
     214                    );
     215                }
     216                ?>
     217            </select>
     218        </p>
     219        <p>
    199220            <input id="<?php echo esc_attr($this->get_field_id('map')); ?>"
    200221                   name="<?php echo esc_attr($this->get_field_name('map')); ?>"
     
    271292        $instance['days']        = max(1, min(14, (int) ($new_instance['days'] ?? 5)));
    272293        $instance['show_alerts'] = !empty($new_instance['show_alerts']) ? 1 : 0;
     294        $instance['theme']       = in_array(strtolower($new_instance['theme'] ?? 'auto'), ['auto','light','dark'], true) ? sanitize_text_field(strtolower($new_instance['theme'])) : 'auto';
    273295        $instance['class']       = sanitize_html_class($new_instance['class'] ?? '', '');
    274296
  • spelhubben-weather/trunk/includes/class-block.php

    r3435228 r3435748  
    3030                        'animate'    => ! empty( $attrs['animate'] ) ? '1' : '0',
    3131                        'forecast'   => isset( $attrs['forecast'] ) ? $attrs['forecast'] : 'none',
     32                        'theme'      => $attrs['theme'] ?? 'auto',
    3233                        'days'       => isset( $attrs['days'] ) ? (string) intval( $attrs['days'] ) : '5',
    3334
     
    6162                        'animate'     => ! empty( $attrs['animate'] ) ? '1' : '0',
    6263                        'forecast'    => isset( $attrs['forecast'] ) ? $attrs['forecast'] : 'none',
     64                        'theme'       => $attrs['theme'] ?? 'auto',
    6365                        'days'        => isset( $attrs['days'] ) ? (string) intval( $attrs['days'] ) : '5',
    6466                        'show_alerts' => isset( $attrs['showAlerts'] ) ? ( $attrs['showAlerts'] ? '1' : '0' ) : (string) $opts['show_alerts'],
  • spelhubben-weather/trunk/includes/class-plugin.php

    r3435228 r3435748  
    7474
    7575        // Pass-through of same-name attributes
    76         foreach (['lat','lon','show','layout','class','providers','forecast','days','map_height'] as $k) {
     76        foreach (['lat','lon','show','layout','class','providers','forecast','days','map_height','theme'] as $k) {
    7777            if (isset($norm[$k])) {
    7878                $legacy[$k] = $norm[$k];
  • spelhubben-weather/trunk/includes/class-renderer.php

    r3435228 r3435748  
    4040            'precip_unit'  => $opts['precip_unit'],
    4141            'date_format'  => $opts['date_format'],
     42            'theme'        => 'auto',
    4243        ], $atts, 'sv_vader');
    4344
     
    9798        $classes = 'sv-vader spelhubben-weather ' . $a['class'] . ' ' . ($is_anim ? 'svv-anim' : '') . ' svv-layout-' . $layout;
    9899
     100        // Theme handling: auto|light|dark (fallback to auto)
     101        $theme = strtolower(trim((string) ($a['theme'] ?? 'auto')));
     102        if (!in_array($theme, ['auto','light','dark'], true)) {
     103            $theme = 'auto';
     104        }
     105
     106        if ($theme !== 'auto') {
     107            $classes .= ' svv-theme-' . $theme;
     108        }
     109
    99110        ob_start(); ?>
    100         <div class="<?php echo esc_attr($classes); ?>" data-svv-ro="1">
     111        <div class="<?php echo esc_attr($classes); ?>" data-svv-ro="1" data-svv-theme="<?php echo esc_attr($theme); ?>">
    101112            <?php if (!empty($name) && $layout !== 'inline'): ?>
    102113                <div class="svv-ort"><?php echo esc_html($name); ?></div>
  • spelhubben-weather/trunk/spelhubben-weather.php

    r3435228 r3435748  
    99 * Requires at least: 6.8
    1010 * Requires PHP: 7.4
    11  * License: GPLv3 or later
    12  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
     11 * License: GPLv2 or later
     12 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1313 */
    1414/*
    1515 * Copyright (C) 2026 Spelhubben
    16  * Licensed under the GNU General Public License v3 (or later)
    17  * https://www.gnu.org/licenses/gpl-3.0.html
     16 * Licensed under the GNU General Public License v2 (or later)
     17 * https://www.gnu.org/licenses/gpl-2.0.html
    1818 */
    1919
Note: See TracChangeset for help on using the changeset viewer.