Plugin Directory

Changeset 3468455

Timestamp:
02/24/2026 09:39:44 AM (9 days ago)
Author:
matteoenna
Message:

[wine-cellar-manager: 3.3.0

Location:
wine-cellar-manager
Files:
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wine-cellar-manager/tags/3.3.0/class/idealconsumptionalert/wineCellarManager_consumption-notifier_Class.php

    r3332502 r3468455  
    1111        add_action( 'wcm_send_consumption_alert_event', [ $this, 'maybe_send_alert_email' ] );
    1212        add_action( 'init', [ $this, 'init_hooks' ] );
    13         register_deactivation_hook( __FILE__, [ __CLASS__, 'clear_cron' ] );
     13        register_deactivation_hook( , [ __CLASS__, 'clear_cron' ] );
    1414    }
    1515
  • wine-cellar-manager/tags/3.3.0/class/wineCellarManager_data_Class.php

    r3323208 r3468455  
    11<?php
     2
     3
     4
     5
    26
    37    class wineCellarManagerDataClass {
  • wine-cellar-manager/tags/3.3.0/class/wineCellarManager_stats_Class.php

    r3309431 r3468455  
    99    public function __construct() {
    1010        add_action( 'admin_menu', [ $this, 'add_stats_page' ] );
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
    1170    }
    1271
     
    3695        $wine_type = $this->get_wine_type_stats( $post_type );
    3796
     97
     98
     99
    38100        include plugin_dir_path( __FILE__ ) . '../templates/admin/admin-wine-stats.php';
    39101    }
     
    70132        global $wpdb;
    71133
    72         return $wpdb->get_results(
    73             $wpdb->prepare(
    74                 "SELECT p.ID, p.post_title,
    75                         (SELECT meta_value FROM {$wpdb->postmeta} WHERE post_id = p.ID AND meta_key = 'vintage') AS vintage,
     134        $mov_subquery = "SELECT CAST(pm_mov.meta_value AS UNSIGNED) AS wine_id, COUNT(*) AS mov_count
     135                         FROM {$wpdb->posts} p_mov
     136                         INNER JOIN {$wpdb->postmeta} pm_mov ON pm_mov.post_id = p_mov.ID AND pm_mov.meta_key = 'wine_id'
     137                         WHERE p_mov.post_type = 'wine_movement' AND p_mov.post_status = 'publish'
     138                         GROUP BY CAST(pm_mov.meta_value AS UNSIGNED)";
     139
     140        return $wpdb->get_results(
     141            $wpdb->prepare(
     142                "SELECT p.ID, p.post_title,
     143                        (SELECT meta_value FROM {$wpdb->postmeta} WHERE post_id = p.ID AND meta_key = 'vintage' LIMIT 1) AS vintage,
    76144                        GROUP_CONCAT(t.name SEPARATOR ', ') AS winery
    77145                 FROM {$wpdb->postmeta} pm
    78146                 INNER JOIN {$wpdb->posts} p ON pm.post_id = p.ID
    79147                 LEFT JOIN {$wpdb->term_relationships} tr ON tr.object_id = p.ID
    80                  LEFT JOIN {$wpdb->term_taxonomy} tt ON tt.term_taxonomy_id = tr.term_taxonomy_id
     148                 LEFT JOIN {$wpdb->term_taxonomy} tt ON tt.term_taxonomy_id = tr.term_taxonomy_id
    81149                 LEFT JOIN {$wpdb->terms} t ON t.term_id = tt.term_id
    82                  WHERE pm.meta_key = %s AND pm.meta_value = '0' AND p.post_type = %s AND p.post_status = 'publish' AND tt.taxonomy = 'winery'
    83                  GROUP BY p.ID",
    84                  'quantity',
    85                  $post_type
    86             )
     150                 LEFT JOIN ({$mov_subquery}) AS mov ON mov.wine_id = p.ID
     151                 WHERE pm.meta_key = %s AND pm.meta_value = '0' AND p.post_type = %s AND p.post_status = 'publish'
     152                 GROUP BY p.ID
     153                 ORDER BY mov.mov_count DESC, p.post_title ASC",
     154                'quantity',
     155                $post_type
     156            )
    87157        );
    88158    }
     
    160230        return $hierarchy;
    161231    }
     232
     233
     234
     235
     236
     237
     238
     239
     240
     241
     242
     243
     244
     245
     246
     247
     248
     249
     250
     251
     252
     253
     254
     255
     256
     257
     258
     259
     260
     261
     262
     263
     264
     265
     266
     267
     268
     269
     270
     271
     272
     273
     274
     275
     276
     277
     278
     279
     280
     281
     282
     283
     284
     285
     286
     287
     288
     289
     290
     291
     292
     293
     294
     295
     296
     297
     298
    162299}
    163300
  • wine-cellar-manager/tags/3.3.0/readme.txt

    r3408905 r3468455  
    55Requires PHP: 7.2.5
    66Tested up to: 6.9
    7 Stable tag: 3.2.1
     7Stable tag: 3.
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • wine-cellar-manager/tags/3.3.0/templates/admin/admin-sidebar.php

    r3332502 r3468455  
    77    <div style="width: 300px; background: #f9f9f9; border: 1px solid #ddd; padding: 15px; border-radius: 4px; margin-bottom: 20px;">
    88        <h2><?php esc_html_e( 'Useful links', 'wine-cellar-manager' ); ?></h2>
    9         <p><a href="https://mywinerepository.it" target="_blank"><?php esc_html_e( 'Visit the project site', 'wine-cellar-manager' ); ?></a></p>
    10         <p><a href="https://winecellarmanager.net/" target="_blank"><?php esc_html_e( 'Get support', 'wine-cellar-manager' ); ?></a></p>
     9        <p><a href="https://mywinerepository.it" target="_blank"><?php esc_html_e( 'Visit the project site', 'wine-cellar-manager' ); ?></a></p>
     10        <p><a href="https://"><?php esc_html_e( 'Get support', 'wine-cellar-manager' ); ?></a></p>
    1111    </div>
    1212
    1313    <div style="width: 300px; background: #f9f9f9; border: 1px solid #ddd; padding: 15px; border-radius: 4px;">
    1414        <h2><?php esc_html_e( 'Plugin Info', 'wine-cellar-manager' ); ?></h2>
    15         <p><?php esc_html_e( 'Version 3.1.3', 'wine-cellar-manager' ); ?> — <a href="https://profiles.wordpress.org/matteoenna/" target="_blank"><?php esc_html_e( 'by Matteo Enna', 'wine-cellar-manager' ); ?></a></p>
     15        <p><?php e"><?php esc_html_e( 'by Matteo Enna', 'wine-cellar-manager' ); ?></a></p>
    1616    </div>
    1717</div>
  • wine-cellar-manager/tags/3.3.0/templates/admin/admin-wine-config-gpt.php

    r3309431 r3468455  
    4646        </div>
    4747
    48         <?php include plugin_dir_path( __FILE__ ) . '/../../templates/admin//admin-sidebar.php'; ?>
     48        <?php include plugin_dir_path( __FILE__ ) . '/../../templates/admin/admin-sidebar.php'; ?>
    4949
    5050    </div>
  • wine-cellar-manager/tags/3.3.0/templates/admin/admin-wine-stats.php

    r3309431 r3468455  
    3737
    3838                <div class="wine-stats-box full-width">
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
    3959                    <h2><?php esc_html_e( 'List of Wines with Quantity 0', 'wine-cellar-manager' ); ?></h2>
    4060                    <?php if ( ! empty( $wines_at_zero ) ) : ?>
    41                         <ul>
    42                             <?php foreach ( $wines_at_zero as $wine ) : ?>
    43                                 <li>
    44                                     <a href="<?php echo esc_url( get_edit_post_link( $wine->ID ) ); ?>">
    45                                         <?php echo esc_html( $wine->post_title." (".$wine->vintage.") - ".$wine->winery ); ?>
    46                                     </a>
    47                                 </li>
    48                             <?php endforeach; ?>
    49                         </ul>
     61                        <?php
     62                        $list_items = $wines_at_zero;
     63                        $show_view_more = count( $list_items ) > 5;
     64                        ?>
     65                        <div class="wcm-stats-list<?php echo $show_view_more ? ' wcm-stats-list--collapsed' : ''; ?>" data-wcm-list>
     66                            <ul>
     67                                <?php foreach ( $list_items as $idx => $wine ) : ?>
     68                                    <li class="wcm-stats-list__item<?php echo $idx >= 5 ? ' wcm-stats-list__item--overflow' : ''; ?>">
     69                                        <a href="<?php echo esc_url( get_edit_post_link( $wine->ID ) ); ?>">
     70                                            <?php echo esc_html( $wine->post_title . ' (' . $wine->vintage . ') - ' . $wine->winery ); ?>
     71                                        </a>
     72                                    </li>
     73                                <?php endforeach; ?>
     74                            </ul>
     75                            <?php if ( $show_view_more ) : ?>
     76                                <p class="wcm-stats-list__toggle">
     77                                    <button type="button" class="button button-link wcm-view-more" data-wcm-view-more aria-expanded="false">
     78                                        <?php echo esc_html( sprintf( __( 'View more (%d)', 'wine-cellar-manager' ), count( $list_items ) - 5 ) ); ?>
     79                                    </button>
     80                                </p>
     81                            <?php endif; ?>
     82                        </div>
    5083                    <?php else : ?>
    5184                        <p><?php esc_html_e( 'No wines found.', 'wine-cellar-manager' ); ?></p>
     
    5588                <div class="wine-stats-box third-width">
    5689                    <h2><?php esc_html_e( 'Winery', 'wine-cellar-manager' ); ?></h2>
    57                     <ul>
    58                         <?php foreach ( $winery as $parent_term ) : ?>
    59                             <li><strong><?php echo esc_html( $parent_term['name'] ); ?></strong>: <?php echo esc_html( $parent_term['count'] ); ?></li>
    60                             <?php if ( ! empty( $parent_term['children'] ) ) : ?>
    61                                 <ul>
    62                                     <?php foreach ( $parent_term['children'] as $child_term ) : ?>
    63                                         <li style="margin-left: 20px;">&mdash; <?php echo esc_html( $child_term['name'] ); ?>: <?php echo esc_html( $child_term['count'] ); ?></li>
    64                                     <?php endforeach; ?>
    65                                 </ul>
    66                             <?php endif; ?>
    67                         <?php endforeach; ?>
    68                     </ul>
     90                    <?php
     91                    $tax_list = $winery;
     92                    $tax_count = is_array( $tax_list ) ? count( $tax_list ) : 0;
     93                    $tax_show_more = $tax_count > 5;
     94                    ?>
     95                    <div class="wcm-stats-list<?php echo $tax_show_more ? ' wcm-stats-list--collapsed' : ''; ?>" data-wcm-list>
     96                        <ul>
     97                            <?php
     98                            if ( ! empty( $tax_list ) ) {
     99                                $idx = 0;
     100                                foreach ( $tax_list as $parent_term ) {
     101                                    $is_overflow = $idx >= 5;
     102                                    echo '<li class="wcm-stats-list__item' . ( $is_overflow ? ' wcm-stats-list__item--overflow' : '' ) . '">';
     103                                    echo '<strong>' . esc_html( $parent_term['name'] ) . '</strong>: ' . esc_html( $parent_term['count'] );
     104                                    if ( ! empty( $parent_term['children'] ) ) {
     105                                        echo '<ul>';
     106                                        foreach ( $parent_term['children'] as $child_term ) {
     107                                            echo '<li style="margin-left: 20px;">&mdash; ' . esc_html( $child_term['name'] ) . ': ' . esc_html( $child_term['count'] ) . '</li>';
     108                                        }
     109                                        echo '</ul>';
     110                                    }
     111                                    echo '</li>';
     112                                    $idx++;
     113                                }
     114                            }
     115                            ?>
     116                        </ul>
     117                        <?php if ( $tax_show_more ) : ?>
     118                            <p class="wcm-stats-list__toggle">
     119                                <button type="button" class="button button-link wcm-view-more" data-wcm-view-more aria-expanded="false">
     120                                    <?php echo esc_html( sprintf( __( 'View more (%d)', 'wine-cellar-manager' ), $tax_count - 5 ) ); ?>
     121                                </button>
     122                            </p>
     123                        <?php endif; ?>
     124                    </div>
    69125                </div>
    70126
    71127                <div class="wine-stats-box third-width">
    72128                    <h2><?php esc_html_e( 'Region', 'wine-cellar-manager' ); ?></h2>
    73                     <ul>
    74                         <?php foreach ( $region as $parent_term ) : ?>
    75                             <li><strong><?php echo esc_html( $parent_term['name'] ); ?></strong>: <?php echo esc_html( $parent_term['count'] ); ?></li>
    76                             <?php if ( ! empty( $parent_term['children'] ) ) : ?>
    77                                 <ul>
    78                                     <?php foreach ( $parent_term['children'] as $child_term ) : ?>
    79                                         <li style="margin-left: 20px;">&mdash; <?php echo esc_html( $child_term['name'] ); ?>: <?php echo esc_html( $child_term['count'] ); ?></li>
    80                                     <?php endforeach; ?>
    81                                 </ul>
    82                             <?php endif; ?>
    83                         <?php endforeach; ?>
    84                     </ul>
     129                    <?php
     130                    $tax_list = $region;
     131                    $tax_count = is_array( $tax_list ) ? count( $tax_list ) : 0;
     132                    $tax_show_more = $tax_count > 5;
     133                    ?>
     134                    <div class="wcm-stats-list<?php echo $tax_show_more ? ' wcm-stats-list--collapsed' : ''; ?>" data-wcm-list>
     135                        <ul>
     136                            <?php
     137                            if ( ! empty( $tax_list ) ) {
     138                                $idx = 0;
     139                                foreach ( $tax_list as $parent_term ) {
     140                                    $is_overflow = $idx >= 5;
     141                                    echo '<li class="wcm-stats-list__item' . ( $is_overflow ? ' wcm-stats-list__item--overflow' : '' ) . '">';
     142                                    echo '<strong>' . esc_html( $parent_term['name'] ) . '</strong>: ' . esc_html( $parent_term['count'] );
     143                                    if ( ! empty( $parent_term['children'] ) ) {
     144                                        echo '<ul>';
     145                                        foreach ( $parent_term['children'] as $child_term ) {
     146                                            echo '<li style="margin-left: 20px;">&mdash; ' . esc_html( $child_term['name'] ) . ': ' . esc_html( $child_term['count'] ) . '</li>';
     147                                        }
     148                                        echo '</ul>';
     149                                    }
     150                                    echo '</li>';
     151                                    $idx++;
     152                                }
     153                            }
     154                            ?>
     155                        </ul>
     156                        <?php if ( $tax_show_more ) : ?>
     157                            <p class="wcm-stats-list__toggle">
     158                                <button type="button" class="button button-link wcm-view-more" data-wcm-view-more aria-expanded="false">
     159                                    <?php echo esc_html( sprintf( __( 'View more (%d)', 'wine-cellar-manager' ), $tax_count - 5 ) ); ?>
     160                                </button>
     161                            </p>
     162                        <?php endif; ?>
     163                    </div>
    85164                </div>
    86165
    87166                <div class="wine-stats-box third-width">
    88167                    <h2><?php esc_html_e( 'Grape', 'wine-cellar-manager' ); ?></h2>
    89                     <ul>
    90                         <?php foreach ( $grape as $parent_term ) : ?>
    91                             <li><strong><?php echo esc_html( $parent_term['name'] ); ?></strong>: <?php echo esc_html( $parent_term['count'] ); ?></li>
    92                             <?php if ( ! empty( $parent_term['children'] ) ) : ?>
    93                                 <ul>
    94                                     <?php foreach ( $parent_term['children'] as $child_term ) : ?>
    95                                         <li style="margin-left: 20px;">&mdash; <?php echo esc_html( $child_term['name'] ); ?>: <?php echo esc_html( $child_term['count'] ); ?></li>
    96                                     <?php endforeach; ?>
    97                                 </ul>
    98                             <?php endif; ?>
    99                         <?php endforeach; ?>
    100                     </ul>
     168                    <?php
     169                    $tax_list = $grape;
     170                    $tax_count = is_array( $tax_list ) ? count( $tax_list ) : 0;
     171                    $tax_show_more = $tax_count > 5;
     172                    ?>
     173                    <div class="wcm-stats-list<?php echo $tax_show_more ? ' wcm-stats-list--collapsed' : ''; ?>" data-wcm-list>
     174                        <ul>
     175                            <?php
     176                            if ( ! empty( $tax_list ) ) {
     177                                $idx = 0;
     178                                foreach ( $tax_list as $parent_term ) {
     179                                    $is_overflow = $idx >= 5;
     180                                    echo '<li class="wcm-stats-list__item' . ( $is_overflow ? ' wcm-stats-list__item--overflow' : '' ) . '">';
     181                                    echo '<strong>' . esc_html( $parent_term['name'] ) . '</strong>: ' . esc_html( $parent_term['count'] );
     182                                    if ( ! empty( $parent_term['children'] ) ) {
     183                                        echo '<ul>';
     184                                        foreach ( $parent_term['children'] as $child_term ) {
     185                                            echo '<li style="margin-left: 20px;">&mdash; ' . esc_html( $child_term['name'] ) . ': ' . esc_html( $child_term['count'] ) . '</li>';
     186                                        }
     187                                        echo '</ul>';
     188                                    }
     189                                    echo '</li>';
     190                                    $idx++;
     191                                }
     192                            }
     193                            ?>
     194                        </ul>
     195                        <?php if ( $tax_show_more ) : ?>
     196                            <p class="wcm-stats-list__toggle">
     197                                <button type="button" class="button button-link wcm-view-more" data-wcm-view-more aria-expanded="false">
     198                                    <?php echo esc_html( sprintf( __( 'View more (%d)', 'wine-cellar-manager' ), $tax_count - 5 ) ); ?>
     199                                </button>
     200                            </p>
     201                        <?php endif; ?>
     202                    </div>
    101203                </div>
    102204
     
    128230    }
    129231
     232
     233
     234
     235
    130236    .wine-stats-box.full-width {
    131237        grid-column: span 12;
     
    140246    }
    141247}
     248
     249
     250
     251
     252
     253
     254
     255
     256
     257
     258
     259
    142260</style>
     261
     262
     263
     264
     265
     266
     267
     268
     269
     270
     271
     272
     273
     274
     275
     276
  • wine-cellar-manager/tags/3.3.0/wine-cellar-manager.php

    r3408905 r3468455  
    33   Plugin Name: Wine Cellar Manager
    44   Description: A plugin to manage your wine inventory.
    5    Version: 3.2.1
     5   Version: 3.
    66   Author: Matteo Enna
    77   Author URI: https://matteoenna.it/it/wordpress-work/
     
    1414    }
    1515
    16     require_once (dirname(__FILE__).'/class/wineCellarManagerClass.php');
     16    define( 'WINE_CELLAR_MANAGER_VERSION', '3.3.0' );
     17    define( 'WINE_CELLAR_MANAGER_PLUGIN_FILE', __FILE__ );
    1718
    18     $wcm = new wineCellarManagerClass();
     19    require_once __DIR__ . '/class/wineCellarManagerClass.php';
     20
     21    new wineCellarManagerClass();
  • wine-cellar-manager/trunk/class/idealconsumptionalert/wineCellarManager_consumption-notifier_Class.php

    r3332502 r3468455  
    1111        add_action( 'wcm_send_consumption_alert_event', [ $this, 'maybe_send_alert_email' ] );
    1212        add_action( 'init', [ $this, 'init_hooks' ] );
    13         register_deactivation_hook( __FILE__, [ __CLASS__, 'clear_cron' ] );
     13        register_deactivation_hook( , [ __CLASS__, 'clear_cron' ] );
    1414    }
    1515
  • wine-cellar-manager/trunk/class/wineCellarManager_data_Class.php

    r3323208 r3468455  
    11<?php
     2
     3
     4
     5
    26
    37    class wineCellarManagerDataClass {
  • wine-cellar-manager/trunk/class/wineCellarManager_stats_Class.php

    r3309431 r3468455  
    99    public function __construct() {
    1010        add_action( 'admin_menu', [ $this, 'add_stats_page' ] );
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
    1170    }
    1271
     
    3695        $wine_type = $this->get_wine_type_stats( $post_type );
    3796
     97
     98
     99
    38100        include plugin_dir_path( __FILE__ ) . '../templates/admin/admin-wine-stats.php';
    39101    }
     
    70132        global $wpdb;
    71133
    72         return $wpdb->get_results(
    73             $wpdb->prepare(
    74                 "SELECT p.ID, p.post_title,
    75                         (SELECT meta_value FROM {$wpdb->postmeta} WHERE post_id = p.ID AND meta_key = 'vintage') AS vintage,
     134        $mov_subquery = "SELECT CAST(pm_mov.meta_value AS UNSIGNED) AS wine_id, COUNT(*) AS mov_count
     135                         FROM {$wpdb->posts} p_mov
     136                         INNER JOIN {$wpdb->postmeta} pm_mov ON pm_mov.post_id = p_mov.ID AND pm_mov.meta_key = 'wine_id'
     137                         WHERE p_mov.post_type = 'wine_movement' AND p_mov.post_status = 'publish'
     138                         GROUP BY CAST(pm_mov.meta_value AS UNSIGNED)";
     139
     140        return $wpdb->get_results(
     141            $wpdb->prepare(
     142                "SELECT p.ID, p.post_title,
     143                        (SELECT meta_value FROM {$wpdb->postmeta} WHERE post_id = p.ID AND meta_key = 'vintage' LIMIT 1) AS vintage,
    76144                        GROUP_CONCAT(t.name SEPARATOR ', ') AS winery
    77145                 FROM {$wpdb->postmeta} pm
    78146                 INNER JOIN {$wpdb->posts} p ON pm.post_id = p.ID
    79147                 LEFT JOIN {$wpdb->term_relationships} tr ON tr.object_id = p.ID
    80                  LEFT JOIN {$wpdb->term_taxonomy} tt ON tt.term_taxonomy_id = tr.term_taxonomy_id
     148                 LEFT JOIN {$wpdb->term_taxonomy} tt ON tt.term_taxonomy_id = tr.term_taxonomy_id
    81149                 LEFT JOIN {$wpdb->terms} t ON t.term_id = tt.term_id
    82                  WHERE pm.meta_key = %s AND pm.meta_value = '0' AND p.post_type = %s AND p.post_status = 'publish' AND tt.taxonomy = 'winery'
    83                  GROUP BY p.ID",
    84                  'quantity',
    85                  $post_type
    86             )
     150                 LEFT JOIN ({$mov_subquery}) AS mov ON mov.wine_id = p.ID
     151                 WHERE pm.meta_key = %s AND pm.meta_value = '0' AND p.post_type = %s AND p.post_status = 'publish'
     152                 GROUP BY p.ID
     153                 ORDER BY mov.mov_count DESC, p.post_title ASC",
     154                'quantity',
     155                $post_type
     156            )
    87157        );
    88158    }
     
    160230        return $hierarchy;
    161231    }
     232
     233
     234
     235
     236
     237
     238
     239
     240
     241
     242
     243
     244
     245
     246
     247
     248
     249
     250
     251
     252
     253
     254
     255
     256
     257
     258
     259
     260
     261
     262
     263
     264
     265
     266
     267
     268
     269
     270
     271
     272
     273
     274
     275
     276
     277
     278
     279
     280
     281
     282
     283
     284
     285
     286
     287
     288
     289
     290
     291
     292
     293
     294
     295
     296
     297
     298
    162299}
    163300
  • wine-cellar-manager/trunk/readme.txt

    r3408905 r3468455  
    55Requires PHP: 7.2.5
    66Tested up to: 6.9
    7 Stable tag: 3.2.1
     7Stable tag: 3.
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • wine-cellar-manager/trunk/templates/admin/admin-sidebar.php

    r3332502 r3468455  
    77    <div style="width: 300px; background: #f9f9f9; border: 1px solid #ddd; padding: 15px; border-radius: 4px; margin-bottom: 20px;">
    88        <h2><?php esc_html_e( 'Useful links', 'wine-cellar-manager' ); ?></h2>
    9         <p><a href="https://mywinerepository.it" target="_blank"><?php esc_html_e( 'Visit the project site', 'wine-cellar-manager' ); ?></a></p>
    10         <p><a href="https://winecellarmanager.net/" target="_blank"><?php esc_html_e( 'Get support', 'wine-cellar-manager' ); ?></a></p>
     9        <p><a href="https://mywinerepository.it" target="_blank"><?php esc_html_e( 'Visit the project site', 'wine-cellar-manager' ); ?></a></p>
     10        <p><a href="https://"><?php esc_html_e( 'Get support', 'wine-cellar-manager' ); ?></a></p>
    1111    </div>
    1212
    1313    <div style="width: 300px; background: #f9f9f9; border: 1px solid #ddd; padding: 15px; border-radius: 4px;">
    1414        <h2><?php esc_html_e( 'Plugin Info', 'wine-cellar-manager' ); ?></h2>
    15         <p><?php esc_html_e( 'Version 3.1.3', 'wine-cellar-manager' ); ?> — <a href="https://profiles.wordpress.org/matteoenna/" target="_blank"><?php esc_html_e( 'by Matteo Enna', 'wine-cellar-manager' ); ?></a></p>
     15        <p><?php e"><?php esc_html_e( 'by Matteo Enna', 'wine-cellar-manager' ); ?></a></p>
    1616    </div>
    1717</div>
  • wine-cellar-manager/trunk/templates/admin/admin-wine-config-gpt.php

    r3309431 r3468455  
    4646        </div>
    4747
    48         <?php include plugin_dir_path( __FILE__ ) . '/../../templates/admin//admin-sidebar.php'; ?>
     48        <?php include plugin_dir_path( __FILE__ ) . '/../../templates/admin/admin-sidebar.php'; ?>
    4949
    5050    </div>
  • wine-cellar-manager/trunk/templates/admin/admin-wine-stats.php

    r3309431 r3468455  
    3737
    3838                <div class="wine-stats-box full-width">
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
    3959                    <h2><?php esc_html_e( 'List of Wines with Quantity 0', 'wine-cellar-manager' ); ?></h2>
    4060                    <?php if ( ! empty( $wines_at_zero ) ) : ?>
    41                         <ul>
    42                             <?php foreach ( $wines_at_zero as $wine ) : ?>
    43                                 <li>
    44                                     <a href="<?php echo esc_url( get_edit_post_link( $wine->ID ) ); ?>">
    45                                         <?php echo esc_html( $wine->post_title." (".$wine->vintage.") - ".$wine->winery ); ?>
    46                                     </a>
    47                                 </li>
    48                             <?php endforeach; ?>
    49                         </ul>
     61                        <?php
     62                        $list_items = $wines_at_zero;
     63                        $show_view_more = count( $list_items ) > 5;
     64                        ?>
     65                        <div class="wcm-stats-list<?php echo $show_view_more ? ' wcm-stats-list--collapsed' : ''; ?>" data-wcm-list>
     66                            <ul>
     67                                <?php foreach ( $list_items as $idx => $wine ) : ?>
     68                                    <li class="wcm-stats-list__item<?php echo $idx >= 5 ? ' wcm-stats-list__item--overflow' : ''; ?>">
     69                                        <a href="<?php echo esc_url( get_edit_post_link( $wine->ID ) ); ?>">
     70                                            <?php echo esc_html( $wine->post_title . ' (' . $wine->vintage . ') - ' . $wine->winery ); ?>
     71                                        </a>
     72                                    </li>
     73                                <?php endforeach; ?>
     74                            </ul>
     75                            <?php if ( $show_view_more ) : ?>
     76                                <p class="wcm-stats-list__toggle">
     77                                    <button type="button" class="button button-link wcm-view-more" data-wcm-view-more aria-expanded="false">
     78                                        <?php echo esc_html( sprintf( __( 'View more (%d)', 'wine-cellar-manager' ), count( $list_items ) - 5 ) ); ?>
     79                                    </button>
     80                                </p>
     81                            <?php endif; ?>
     82                        </div>
    5083                    <?php else : ?>
    5184                        <p><?php esc_html_e( 'No wines found.', 'wine-cellar-manager' ); ?></p>
     
    5588                <div class="wine-stats-box third-width">
    5689                    <h2><?php esc_html_e( 'Winery', 'wine-cellar-manager' ); ?></h2>
    57                     <ul>
    58                         <?php foreach ( $winery as $parent_term ) : ?>
    59                             <li><strong><?php echo esc_html( $parent_term['name'] ); ?></strong>: <?php echo esc_html( $parent_term['count'] ); ?></li>
    60                             <?php if ( ! empty( $parent_term['children'] ) ) : ?>
    61                                 <ul>
    62                                     <?php foreach ( $parent_term['children'] as $child_term ) : ?>
    63                                         <li style="margin-left: 20px;">&mdash; <?php echo esc_html( $child_term['name'] ); ?>: <?php echo esc_html( $child_term['count'] ); ?></li>
    64                                     <?php endforeach; ?>
    65                                 </ul>
    66                             <?php endif; ?>
    67                         <?php endforeach; ?>
    68                     </ul>
     90                    <?php
     91                    $tax_list = $winery;
     92                    $tax_count = is_array( $tax_list ) ? count( $tax_list ) : 0;
     93                    $tax_show_more = $tax_count > 5;
     94                    ?>
     95                    <div class="wcm-stats-list<?php echo $tax_show_more ? ' wcm-stats-list--collapsed' : ''; ?>" data-wcm-list>
     96                        <ul>
     97                            <?php
     98                            if ( ! empty( $tax_list ) ) {
     99                                $idx = 0;
     100                                foreach ( $tax_list as $parent_term ) {
     101                                    $is_overflow = $idx >= 5;
     102                                    echo '<li class="wcm-stats-list__item' . ( $is_overflow ? ' wcm-stats-list__item--overflow' : '' ) . '">';
     103                                    echo '<strong>' . esc_html( $parent_term['name'] ) . '</strong>: ' . esc_html( $parent_term['count'] );
     104                                    if ( ! empty( $parent_term['children'] ) ) {
     105                                        echo '<ul>';
     106                                        foreach ( $parent_term['children'] as $child_term ) {
     107                                            echo '<li style="margin-left: 20px;">&mdash; ' . esc_html( $child_term['name'] ) . ': ' . esc_html( $child_term['count'] ) . '</li>';
     108                                        }
     109                                        echo '</ul>';
     110                                    }
     111                                    echo '</li>';
     112                                    $idx++;
     113                                }
     114                            }
     115                            ?>
     116                        </ul>
     117                        <?php if ( $tax_show_more ) : ?>
     118                            <p class="wcm-stats-list__toggle">
     119                                <button type="button" class="button button-link wcm-view-more" data-wcm-view-more aria-expanded="false">
     120                                    <?php echo esc_html( sprintf( __( 'View more (%d)', 'wine-cellar-manager' ), $tax_count - 5 ) ); ?>
     121                                </button>
     122                            </p>
     123                        <?php endif; ?>
     124                    </div>
    69125                </div>
    70126
    71127                <div class="wine-stats-box third-width">
    72128                    <h2><?php esc_html_e( 'Region', 'wine-cellar-manager' ); ?></h2>
    73                     <ul>
    74                         <?php foreach ( $region as $parent_term ) : ?>
    75                             <li><strong><?php echo esc_html( $parent_term['name'] ); ?></strong>: <?php echo esc_html( $parent_term['count'] ); ?></li>
    76                             <?php if ( ! empty( $parent_term['children'] ) ) : ?>
    77                                 <ul>
    78                                     <?php foreach ( $parent_term['children'] as $child_term ) : ?>
    79                                         <li style="margin-left: 20px;">&mdash; <?php echo esc_html( $child_term['name'] ); ?>: <?php echo esc_html( $child_term['count'] ); ?></li>
    80                                     <?php endforeach; ?>
    81                                 </ul>
    82                             <?php endif; ?>
    83                         <?php endforeach; ?>
    84                     </ul>
     129                    <?php
     130                    $tax_list = $region;
     131                    $tax_count = is_array( $tax_list ) ? count( $tax_list ) : 0;
     132                    $tax_show_more = $tax_count > 5;
     133                    ?>
     134                    <div class="wcm-stats-list<?php echo $tax_show_more ? ' wcm-stats-list--collapsed' : ''; ?>" data-wcm-list>
     135                        <ul>
     136                            <?php
     137                            if ( ! empty( $tax_list ) ) {
     138                                $idx = 0;
     139                                foreach ( $tax_list as $parent_term ) {
     140                                    $is_overflow = $idx >= 5;
     141                                    echo '<li class="wcm-stats-list__item' . ( $is_overflow ? ' wcm-stats-list__item--overflow' : '' ) . '">';
     142                                    echo '<strong>' . esc_html( $parent_term['name'] ) . '</strong>: ' . esc_html( $parent_term['count'] );
     143                                    if ( ! empty( $parent_term['children'] ) ) {
     144                                        echo '<ul>';
     145                                        foreach ( $parent_term['children'] as $child_term ) {
     146                                            echo '<li style="margin-left: 20px;">&mdash; ' . esc_html( $child_term['name'] ) . ': ' . esc_html( $child_term['count'] ) . '</li>';
     147                                        }
     148                                        echo '</ul>';
     149                                    }
     150                                    echo '</li>';
     151                                    $idx++;
     152                                }
     153                            }
     154                            ?>
     155                        </ul>
     156                        <?php if ( $tax_show_more ) : ?>
     157                            <p class="wcm-stats-list__toggle">
     158                                <button type="button" class="button button-link wcm-view-more" data-wcm-view-more aria-expanded="false">
     159                                    <?php echo esc_html( sprintf( __( 'View more (%d)', 'wine-cellar-manager' ), $tax_count - 5 ) ); ?>
     160                                </button>
     161                            </p>
     162                        <?php endif; ?>
     163                    </div>
    85164                </div>
    86165
    87166                <div class="wine-stats-box third-width">
    88167                    <h2><?php esc_html_e( 'Grape', 'wine-cellar-manager' ); ?></h2>
    89                     <ul>
    90                         <?php foreach ( $grape as $parent_term ) : ?>
    91                             <li><strong><?php echo esc_html( $parent_term['name'] ); ?></strong>: <?php echo esc_html( $parent_term['count'] ); ?></li>
    92                             <?php if ( ! empty( $parent_term['children'] ) ) : ?>
    93                                 <ul>
    94                                     <?php foreach ( $parent_term['children'] as $child_term ) : ?>
    95                                         <li style="margin-left: 20px;">&mdash; <?php echo esc_html( $child_term['name'] ); ?>: <?php echo esc_html( $child_term['count'] ); ?></li>
    96                                     <?php endforeach; ?>
    97                                 </ul>
    98                             <?php endif; ?>
    99                         <?php endforeach; ?>
    100                     </ul>
     168                    <?php
     169                    $tax_list = $grape;
     170                    $tax_count = is_array( $tax_list ) ? count( $tax_list ) : 0;
     171                    $tax_show_more = $tax_count > 5;
     172                    ?>
     173                    <div class="wcm-stats-list<?php echo $tax_show_more ? ' wcm-stats-list--collapsed' : ''; ?>" data-wcm-list>
     174                        <ul>
     175                            <?php
     176                            if ( ! empty( $tax_list ) ) {
     177                                $idx = 0;
     178                                foreach ( $tax_list as $parent_term ) {
     179                                    $is_overflow = $idx >= 5;
     180                                    echo '<li class="wcm-stats-list__item' . ( $is_overflow ? ' wcm-stats-list__item--overflow' : '' ) . '">';
     181                                    echo '<strong>' . esc_html( $parent_term['name'] ) . '</strong>: ' . esc_html( $parent_term['count'] );
     182                                    if ( ! empty( $parent_term['children'] ) ) {
     183                                        echo '<ul>';
     184                                        foreach ( $parent_term['children'] as $child_term ) {
     185                                            echo '<li style="margin-left: 20px;">&mdash; ' . esc_html( $child_term['name'] ) . ': ' . esc_html( $child_term['count'] ) . '</li>';
     186                                        }
     187                                        echo '</ul>';
     188                                    }
     189                                    echo '</li>';
     190                                    $idx++;
     191                                }
     192                            }
     193                            ?>
     194                        </ul>
     195                        <?php if ( $tax_show_more ) : ?>
     196                            <p class="wcm-stats-list__toggle">
     197                                <button type="button" class="button button-link wcm-view-more" data-wcm-view-more aria-expanded="false">
     198                                    <?php echo esc_html( sprintf( __( 'View more (%d)', 'wine-cellar-manager' ), $tax_count - 5 ) ); ?>
     199                                </button>
     200                            </p>
     201                        <?php endif; ?>
     202                    </div>
    101203                </div>
    102204
     
    128230    }
    129231
     232
     233
     234
     235
    130236    .wine-stats-box.full-width {
    131237        grid-column: span 12;
     
    140246    }
    141247}
     248
     249
     250
     251
     252
     253
     254
     255
     256
     257
     258
     259
    142260</style>
     261
     262
     263
     264
     265
     266
     267
     268
     269
     270
     271
     272
     273
     274
     275
     276
  • wine-cellar-manager/trunk/wine-cellar-manager.php

    r3408905 r3468455  
    33   Plugin Name: Wine Cellar Manager
    44   Description: A plugin to manage your wine inventory.
    5    Version: 3.2.1
     5   Version: 3.
    66   Author: Matteo Enna
    77   Author URI: https://matteoenna.it/it/wordpress-work/
     
    1414    }
    1515
    16     require_once (dirname(__FILE__).'/class/wineCellarManagerClass.php');
     16    define( 'WINE_CELLAR_MANAGER_VERSION', '3.3.0' );
     17    define( 'WINE_CELLAR_MANAGER_PLUGIN_FILE', __FILE__ );
    1718
    18     $wcm = new wineCellarManagerClass();
     19    require_once __DIR__ . '/class/wineCellarManagerClass.php';
     20
     21    new wineCellarManagerClass();
Note: See TracChangeset for help on using the changeset viewer.