Plugin Directory

Changeset 3225072


Ignore:
Timestamp:
01/19/2025 01:40:52 PM (15 months ago)
Author:
medic52wp
Message:

Update to version 1.4.3 from GitHub

Location:
lift-trail-status
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • lift-trail-status/tags/1.4.3/README.txt

    r3214583 r3225072  
    55Requires at least: 4.7
    66Tested up to: 6.7.1
    7 Stable tag: 1.4.2
     7Stable tag: 1.4.3
    88Requires PHP: 8.0
    99License: GPLv2 or later
     
    7676== Changelog ==
    7777
     78= 1.4.3 =
     79Added time format option for 24hour or am/pm
     80Updated the ratings
     81
    7882= 1.4.2 =
    7983Updated for WordPress 6.7.1
  • lift-trail-status/tags/1.4.3/assets/css/mwpsstyle.css

    r3160188 r3225072  
    111111    font-style: normal;
    112112    font-size: 2.6rem;
    113     line-height: 1;
     113    line-height: 1 !important;
    114114    color: #063861;
    115115    letter-spacing: 0;
  • lift-trail-status/tags/1.4.3/includes/class-mwps-admin.php

    r3214583 r3225072  
    218218
    219219                                    $freestyleTerrain_order_by = isset( $options['freestyleTerrain_order_by'] ) ? $options['freestyleTerrain_order_by'] : '';
     220                                    $time_display              = isset( $options['time_display'] ) ? $options['time_display'] : '';
    220221                                    ?>
    221222                                    <table class="form-table">
     
    281282                                                    echo '<option value="">' . __( 'Default' ) . '</option>';
    282283                                                    echo '<option value="az" ' . selected( $freestyleTerrain_order_by, 'az', 0 ) . '>' . __( 'A-Z' ) . '</option>';
     284                                                    echo '</select>';
     285                                                    ?>
     286                                                </fieldset>
     287                                            </td>
     288                                        </tr>
     289                                        <tr>
     290                                            <th>Display of times</th>
     291                                            <td>
     292                                                <fieldset>
     293                                                    <?php
     294                                                    echo '<select name="' . esc_attr( $optionsName . '[time_display]' ) . '" id="lt_time_display">';
     295                                                    echo '<option value="">' . __( '24 hour' ) . '</option>';
     296                                                    echo '<option value="12hour" ' . selected( $time_display, '12hour', 0 ) . '>' . __( 'am/pm' ) . '</option>';
    283297                                                    echo '</select>';
    284298                                                    ?>
  • lift-trail-status/tags/1.4.3/includes/class-mwps-shortcodes-lift-trail.php

    r3214583 r3225072  
    6767
    6868        $freestyleTerrain_order_by = isset( $options['freestyleTerrain_order_by'] ) ? $options['freestyleTerrain_order_by'] : '';
     69        $time_display              = isset( $options['time_display'] ) ? $options['time_display'] : '';
    6970
    7071        $obj       = mwps_get_data( $url );
     
    7677        echo '<div class="medic52WPStatusWrap">';
    7778        if ( count( $areas ) > 0 ) {
     79            // Get all trails.
     80            $all_trails = [];
     81            foreach ( $areas as $area ) {
     82                $trails     = mlts_get_lifts_trails( $area, 'trails', $feed_type, $trails_order_by );
     83                $all_trails = array_merge( $all_trails, $trails );
     84            }
     85            // Get all difficulties.
     86            $trailDifficulties = [];
     87            foreach ( $all_trails as $trail ) {
     88                $trailDifficulties[] = isset( $trail['difficulty'] ) ? $trail['difficulty'] : '';
     89            }
     90            $trailDifficulties = array_filter( $trailDifficulties );
     91            $trailDifficulties = array_unique( $trailDifficulties );
    7892            //$facilities = $obj['facilities'];
    7993            //$areas = $facilities['areas'];
    8094
    81             /*echo '<pre>';print_r($areas);echo '</pre>';*/
     95            //echo '<pre>';print_r($trails);echo '</pre>';
    8296            ?>
    8397            <div class="mWPSWrap">
     
    159173                                //echo self::liftsList( $lifts, $listLiftsSeparately, $listDisplay );
    160174                                echo self::liftsList( [
    161                                     'list'       => $lifts,
    162                                     'separately' => $listLiftsSeparately,
    163                                     'display'    => $listDisplay,
     175                                    'list'         => $lifts,
     176                                    'separately'   => $listLiftsSeparately,
     177                                    'display'      => $listDisplay,
     178                                    'time_display' => $time_display,
    164179                                ] );
    165180                                ?>
     
    197212                                        //foreach ($ratingsCol as $ratingKey=>$ratingCol) {
    198213                                        foreach ( $ratingsOptions as $ratingKey => $ratingCol ) {
     214                                            if ( ! in_array( $ratingKey, $trailDifficulties ) ) {
     215                                                continue;
     216                                            }
    199217                                            $name = ( isset( $ratingsOptions[ $ratingKey ] ) && isset( $ratingsOptions[ $ratingKey ]['label'] ) ) ? $ratingsOptions[ $ratingKey ]['label'] : '';
    200218                                            if ( empty( $name ) ) {
     
    302320                                //echo self::liftsList( $lifts, $listLiftsSeparately, $listDisplay );
    303321                                echo self::liftsList( [
    304                                     'list'       => $lifts,
    305                                     'separately' => $listLiftsSeparately,
    306                                     'display'    => $listDisplay,
     322                                    'list'         => $lifts,
     323                                    'separately'   => $listLiftsSeparately,
     324                                    'display'      => $listDisplay,
     325                                    'time_display' => $time_display,
    307326                                ] );
    308327                            }
     
    402421                            // }
    403422                            echo self::liftsList( [
    404                                 'list'       => $fTerrains,
    405                                 'list_type'  => 'freestyleTerrain',
    406                                 'separately' => $listLiftsSeparately,
    407                                 'display'    => $listDisplay,
     423                                'list'         => $fTerrains,
     424                                'list_type'    => 'freestyleTerrain',
     425                                'separately'   => $listLiftsSeparately,
     426                                'display'      => $listDisplay,
     427                                'time_display' => $time_display,
    408428                            ] );
    409429                            ?>
     
    441461
    442462    public static function liftsList( $args ) {
    443         $default    = [
    444             'list'       => [],
    445             'list_type'  => 'lift',
    446             'separately' => 0,
    447             'display'    => 'none',
     463        $default      = [
     464            'list'         => [],
     465            'list_type'    => 'lift',
     466            'separately'   => 0,
     467            'display'      => 'none',
     468            'time_display' => '',
    448469        ];
    449         $args       = wp_parse_args( $args, $default );
    450         $list       = $args['list'];
    451         $list_type  = $args['list_type'];
    452         $separately = $args['separately'];
    453         $display    = $args['display'];
    454         $image_size = 'full';
    455         $html       = '';
     470        $args         = wp_parse_args( $args, $default );
     471        $list         = $args['list'];
     472        $list_type    = $args['list_type'];
     473        $separately   = $args['separately'];
     474        $display      = $args['display'];
     475        $time_display = $args['time_display'];
     476        $image_size   = 'full';
     477        $html         = '';
    456478        if ( $list_type === 'freestyleTerrain' ) {
    457479            $headerLabel = __( 'Freestyle Terrains', MWPS_TEXT_DOMAIN );
     
    521543                                $scheduleOpen  = isset( $col['scheduleOpen'] ) ? $col['scheduleOpen'] : '';
    522544                                $scheduleClose = isset( $col['scheduleClose'] ) ? $col['scheduleClose'] : '';
    523                                 $openTime      = '';
    524545                                if ( ! empty( $scheduleOpen ) ) {
    525                                     $openTime .= __( 'Operating Hours:' ) . ' ' . substr( $scheduleOpen, 0, 5 );
     546                                    if ( $time_display === '12hour' ) {
     547                                        $open_hour = date( 'h:i a', strtotime( $scheduleOpen ) );
     548                                    } else {
     549                                        $open_hour = substr( $scheduleOpen, 0, 5 );
     550                                    }
     551                                    $openTime = '';
     552                                    $openTime .= __( 'Operating Hours:' ) . ' ' . $open_hour;
    526553                                    if ( ! empty( $scheduleClose ) ) {
    527                                         $openTime .= '-' . substr( $scheduleClose, 0, 5 );
     554                                        if ( $time_display === '12hour' ) {
     555                                            $close_hour = date( 'h:i a', strtotime( $scheduleClose ) );
     556                                        } else {
     557                                            $close_hour = substr( $scheduleClose, 0, 5 );
     558                                        }
     559                                        $openTime .= '-' . $close_hour;
    528560                                    }
    529561                                }
  • lift-trail-status/tags/1.4.3/includes/mwps-core-functions.php

    r3214583 r3225072  
    2525        }
    2626        $response = wp_remote_get( $url );
    27         if ( ! is_wp_error( $response ) ) {
     27        if ( ! is_wp_error( $response ) && ( 200 === wp_remote_retrieve_response_code( $response ) ) ) {
    2828            $result = wp_remote_retrieve_body( $response );
    2929        } else {
     
    147147        usort( $lifts, 'm_sortByName' );
    148148    }
    149 //  if ( is_user_logged_in() ) {
    150 //      echo '<pre>';
    151 //      print_r( $lifts );
    152 //      echo '</pre>';
    153 //  }
     149    //  if ( is_user_logged_in() ) {
     150    //      echo '<pre>';
     151    //      print_r( $lifts );
     152    //      echo '</pre>';
     153    //  }
    154154
    155155    return $lifts;
  • lift-trail-status/tags/1.4.3/medic52-wpstatus.php

    r3214583 r3225072  
    44 * Plugin URI: https://www.medic52.com/
    55 * Description: A plugin that brings in the Trail & Lift status information for your leisure centre, ski resort or outdoor activity centre. Data automatically updates as your team update it on the dashboard.
    6  * Version: 1.4.2
     6 * Version: 1.4.3
    77 * Author: Medic52
    88 * Author URI: https://www.medic52.com/
     
    1313defined( 'ABSPATH' ) || exit;
    1414
    15 define( 'MEDIC52_WPSTATUS_VERSION', '1.4.2' );
     15define( 'MEDIC52_WPSTATUS_VERSION', '1.4.3' );
    1616
    1717// Define MWPS_PLUGIN_FILE.
  • lift-trail-status/trunk/README.txt

    r3214583 r3225072  
    55Requires at least: 4.7
    66Tested up to: 6.7.1
    7 Stable tag: 1.4.2
     7Stable tag: 1.4.3
    88Requires PHP: 8.0
    99License: GPLv2 or later
     
    7676== Changelog ==
    7777
     78= 1.4.3 =
     79Added time format option for 24hour or am/pm
     80Updated the ratings
     81
    7882= 1.4.2 =
    7983Updated for WordPress 6.7.1
  • lift-trail-status/trunk/assets/css/mwpsstyle.css

    r3160188 r3225072  
    111111    font-style: normal;
    112112    font-size: 2.6rem;
    113     line-height: 1;
     113    line-height: 1 !important;
    114114    color: #063861;
    115115    letter-spacing: 0;
  • lift-trail-status/trunk/includes/class-mwps-admin.php

    r3214583 r3225072  
    218218
    219219                                    $freestyleTerrain_order_by = isset( $options['freestyleTerrain_order_by'] ) ? $options['freestyleTerrain_order_by'] : '';
     220                                    $time_display              = isset( $options['time_display'] ) ? $options['time_display'] : '';
    220221                                    ?>
    221222                                    <table class="form-table">
     
    281282                                                    echo '<option value="">' . __( 'Default' ) . '</option>';
    282283                                                    echo '<option value="az" ' . selected( $freestyleTerrain_order_by, 'az', 0 ) . '>' . __( 'A-Z' ) . '</option>';
     284                                                    echo '</select>';
     285                                                    ?>
     286                                                </fieldset>
     287                                            </td>
     288                                        </tr>
     289                                        <tr>
     290                                            <th>Display of times</th>
     291                                            <td>
     292                                                <fieldset>
     293                                                    <?php
     294                                                    echo '<select name="' . esc_attr( $optionsName . '[time_display]' ) . '" id="lt_time_display">';
     295                                                    echo '<option value="">' . __( '24 hour' ) . '</option>';
     296                                                    echo '<option value="12hour" ' . selected( $time_display, '12hour', 0 ) . '>' . __( 'am/pm' ) . '</option>';
    283297                                                    echo '</select>';
    284298                                                    ?>
  • lift-trail-status/trunk/includes/class-mwps-shortcodes-lift-trail.php

    r3214583 r3225072  
    6767
    6868        $freestyleTerrain_order_by = isset( $options['freestyleTerrain_order_by'] ) ? $options['freestyleTerrain_order_by'] : '';
     69        $time_display              = isset( $options['time_display'] ) ? $options['time_display'] : '';
    6970
    7071        $obj       = mwps_get_data( $url );
     
    7677        echo '<div class="medic52WPStatusWrap">';
    7778        if ( count( $areas ) > 0 ) {
     79            // Get all trails.
     80            $all_trails = [];
     81            foreach ( $areas as $area ) {
     82                $trails     = mlts_get_lifts_trails( $area, 'trails', $feed_type, $trails_order_by );
     83                $all_trails = array_merge( $all_trails, $trails );
     84            }
     85            // Get all difficulties.
     86            $trailDifficulties = [];
     87            foreach ( $all_trails as $trail ) {
     88                $trailDifficulties[] = isset( $trail['difficulty'] ) ? $trail['difficulty'] : '';
     89            }
     90            $trailDifficulties = array_filter( $trailDifficulties );
     91            $trailDifficulties = array_unique( $trailDifficulties );
    7892            //$facilities = $obj['facilities'];
    7993            //$areas = $facilities['areas'];
    8094
    81             /*echo '<pre>';print_r($areas);echo '</pre>';*/
     95            //echo '<pre>';print_r($trails);echo '</pre>';
    8296            ?>
    8397            <div class="mWPSWrap">
     
    159173                                //echo self::liftsList( $lifts, $listLiftsSeparately, $listDisplay );
    160174                                echo self::liftsList( [
    161                                     'list'       => $lifts,
    162                                     'separately' => $listLiftsSeparately,
    163                                     'display'    => $listDisplay,
     175                                    'list'         => $lifts,
     176                                    'separately'   => $listLiftsSeparately,
     177                                    'display'      => $listDisplay,
     178                                    'time_display' => $time_display,
    164179                                ] );
    165180                                ?>
     
    197212                                        //foreach ($ratingsCol as $ratingKey=>$ratingCol) {
    198213                                        foreach ( $ratingsOptions as $ratingKey => $ratingCol ) {
     214                                            if ( ! in_array( $ratingKey, $trailDifficulties ) ) {
     215                                                continue;
     216                                            }
    199217                                            $name = ( isset( $ratingsOptions[ $ratingKey ] ) && isset( $ratingsOptions[ $ratingKey ]['label'] ) ) ? $ratingsOptions[ $ratingKey ]['label'] : '';
    200218                                            if ( empty( $name ) ) {
     
    302320                                //echo self::liftsList( $lifts, $listLiftsSeparately, $listDisplay );
    303321                                echo self::liftsList( [
    304                                     'list'       => $lifts,
    305                                     'separately' => $listLiftsSeparately,
    306                                     'display'    => $listDisplay,
     322                                    'list'         => $lifts,
     323                                    'separately'   => $listLiftsSeparately,
     324                                    'display'      => $listDisplay,
     325                                    'time_display' => $time_display,
    307326                                ] );
    308327                            }
     
    402421                            // }
    403422                            echo self::liftsList( [
    404                                 'list'       => $fTerrains,
    405                                 'list_type'  => 'freestyleTerrain',
    406                                 'separately' => $listLiftsSeparately,
    407                                 'display'    => $listDisplay,
     423                                'list'         => $fTerrains,
     424                                'list_type'    => 'freestyleTerrain',
     425                                'separately'   => $listLiftsSeparately,
     426                                'display'      => $listDisplay,
     427                                'time_display' => $time_display,
    408428                            ] );
    409429                            ?>
     
    441461
    442462    public static function liftsList( $args ) {
    443         $default    = [
    444             'list'       => [],
    445             'list_type'  => 'lift',
    446             'separately' => 0,
    447             'display'    => 'none',
     463        $default      = [
     464            'list'         => [],
     465            'list_type'    => 'lift',
     466            'separately'   => 0,
     467            'display'      => 'none',
     468            'time_display' => '',
    448469        ];
    449         $args       = wp_parse_args( $args, $default );
    450         $list       = $args['list'];
    451         $list_type  = $args['list_type'];
    452         $separately = $args['separately'];
    453         $display    = $args['display'];
    454         $image_size = 'full';
    455         $html       = '';
     470        $args         = wp_parse_args( $args, $default );
     471        $list         = $args['list'];
     472        $list_type    = $args['list_type'];
     473        $separately   = $args['separately'];
     474        $display      = $args['display'];
     475        $time_display = $args['time_display'];
     476        $image_size   = 'full';
     477        $html         = '';
    456478        if ( $list_type === 'freestyleTerrain' ) {
    457479            $headerLabel = __( 'Freestyle Terrains', MWPS_TEXT_DOMAIN );
     
    521543                                $scheduleOpen  = isset( $col['scheduleOpen'] ) ? $col['scheduleOpen'] : '';
    522544                                $scheduleClose = isset( $col['scheduleClose'] ) ? $col['scheduleClose'] : '';
    523                                 $openTime      = '';
    524545                                if ( ! empty( $scheduleOpen ) ) {
    525                                     $openTime .= __( 'Operating Hours:' ) . ' ' . substr( $scheduleOpen, 0, 5 );
     546                                    if ( $time_display === '12hour' ) {
     547                                        $open_hour = date( 'h:i a', strtotime( $scheduleOpen ) );
     548                                    } else {
     549                                        $open_hour = substr( $scheduleOpen, 0, 5 );
     550                                    }
     551                                    $openTime = '';
     552                                    $openTime .= __( 'Operating Hours:' ) . ' ' . $open_hour;
    526553                                    if ( ! empty( $scheduleClose ) ) {
    527                                         $openTime .= '-' . substr( $scheduleClose, 0, 5 );
     554                                        if ( $time_display === '12hour' ) {
     555                                            $close_hour = date( 'h:i a', strtotime( $scheduleClose ) );
     556                                        } else {
     557                                            $close_hour = substr( $scheduleClose, 0, 5 );
     558                                        }
     559                                        $openTime .= '-' . $close_hour;
    528560                                    }
    529561                                }
  • lift-trail-status/trunk/includes/mwps-core-functions.php

    r3214583 r3225072  
    2525        }
    2626        $response = wp_remote_get( $url );
    27         if ( ! is_wp_error( $response ) ) {
     27        if ( ! is_wp_error( $response ) && ( 200 === wp_remote_retrieve_response_code( $response ) ) ) {
    2828            $result = wp_remote_retrieve_body( $response );
    2929        } else {
     
    147147        usort( $lifts, 'm_sortByName' );
    148148    }
    149 //  if ( is_user_logged_in() ) {
    150 //      echo '<pre>';
    151 //      print_r( $lifts );
    152 //      echo '</pre>';
    153 //  }
     149    //  if ( is_user_logged_in() ) {
     150    //      echo '<pre>';
     151    //      print_r( $lifts );
     152    //      echo '</pre>';
     153    //  }
    154154
    155155    return $lifts;
  • lift-trail-status/trunk/medic52-wpstatus.php

    r3214583 r3225072  
    44 * Plugin URI: https://www.medic52.com/
    55 * Description: A plugin that brings in the Trail & Lift status information for your leisure centre, ski resort or outdoor activity centre. Data automatically updates as your team update it on the dashboard.
    6  * Version: 1.4.2
     6 * Version: 1.4.3
    77 * Author: Medic52
    88 * Author URI: https://www.medic52.com/
     
    1313defined( 'ABSPATH' ) || exit;
    1414
    15 define( 'MEDIC52_WPSTATUS_VERSION', '1.4.2' );
     15define( 'MEDIC52_WPSTATUS_VERSION', '1.4.3' );
    1616
    1717// Define MWPS_PLUGIN_FILE.
Note: See TracChangeset for help on using the changeset viewer.