Changeset 3225072
- Timestamp:
- 01/19/2025 01:40:52 PM (15 months ago)
- Location:
- lift-trail-status
- Files:
-
- 12 edited
- 1 copied
-
tags/1.4.3 (copied) (copied from lift-trail-status/trunk)
-
tags/1.4.3/README.txt (modified) (2 diffs)
-
tags/1.4.3/assets/css/mwpsstyle.css (modified) (1 diff)
-
tags/1.4.3/includes/class-mwps-admin.php (modified) (2 diffs)
-
tags/1.4.3/includes/class-mwps-shortcodes-lift-trail.php (modified) (8 diffs)
-
tags/1.4.3/includes/mwps-core-functions.php (modified) (2 diffs)
-
tags/1.4.3/medic52-wpstatus.php (modified) (2 diffs)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/assets/css/mwpsstyle.css (modified) (1 diff)
-
trunk/includes/class-mwps-admin.php (modified) (2 diffs)
-
trunk/includes/class-mwps-shortcodes-lift-trail.php (modified) (8 diffs)
-
trunk/includes/mwps-core-functions.php (modified) (2 diffs)
-
trunk/medic52-wpstatus.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lift-trail-status/tags/1.4.3/README.txt
r3214583 r3225072 5 5 Requires at least: 4.7 6 6 Tested up to: 6.7.1 7 Stable tag: 1.4. 27 Stable tag: 1.4.3 8 8 Requires PHP: 8.0 9 9 License: GPLv2 or later … … 76 76 == Changelog == 77 77 78 = 1.4.3 = 79 Added time format option for 24hour or am/pm 80 Updated the ratings 81 78 82 = 1.4.2 = 79 83 Updated for WordPress 6.7.1 -
lift-trail-status/tags/1.4.3/assets/css/mwpsstyle.css
r3160188 r3225072 111 111 font-style: normal; 112 112 font-size: 2.6rem; 113 line-height: 1 ;113 line-height: 1 !important; 114 114 color: #063861; 115 115 letter-spacing: 0; -
lift-trail-status/tags/1.4.3/includes/class-mwps-admin.php
r3214583 r3225072 218 218 219 219 $freestyleTerrain_order_by = isset( $options['freestyleTerrain_order_by'] ) ? $options['freestyleTerrain_order_by'] : ''; 220 $time_display = isset( $options['time_display'] ) ? $options['time_display'] : ''; 220 221 ?> 221 222 <table class="form-table"> … … 281 282 echo '<option value="">' . __( 'Default' ) . '</option>'; 282 283 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>'; 283 297 echo '</select>'; 284 298 ?> -
lift-trail-status/tags/1.4.3/includes/class-mwps-shortcodes-lift-trail.php
r3214583 r3225072 67 67 68 68 $freestyleTerrain_order_by = isset( $options['freestyleTerrain_order_by'] ) ? $options['freestyleTerrain_order_by'] : ''; 69 $time_display = isset( $options['time_display'] ) ? $options['time_display'] : ''; 69 70 70 71 $obj = mwps_get_data( $url ); … … 76 77 echo '<div class="medic52WPStatusWrap">'; 77 78 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 ); 78 92 //$facilities = $obj['facilities']; 79 93 //$areas = $facilities['areas']; 80 94 81 / *echo '<pre>';print_r($areas);echo '</pre>';*/95 //echo '<pre>';print_r($trails);echo '</pre>'; 82 96 ?> 83 97 <div class="mWPSWrap"> … … 159 173 //echo self::liftsList( $lifts, $listLiftsSeparately, $listDisplay ); 160 174 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, 164 179 ] ); 165 180 ?> … … 197 212 //foreach ($ratingsCol as $ratingKey=>$ratingCol) { 198 213 foreach ( $ratingsOptions as $ratingKey => $ratingCol ) { 214 if ( ! in_array( $ratingKey, $trailDifficulties ) ) { 215 continue; 216 } 199 217 $name = ( isset( $ratingsOptions[ $ratingKey ] ) && isset( $ratingsOptions[ $ratingKey ]['label'] ) ) ? $ratingsOptions[ $ratingKey ]['label'] : ''; 200 218 if ( empty( $name ) ) { … … 302 320 //echo self::liftsList( $lifts, $listLiftsSeparately, $listDisplay ); 303 321 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, 307 326 ] ); 308 327 } … … 402 421 // } 403 422 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, 408 428 ] ); 409 429 ?> … … 441 461 442 462 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' => '', 448 469 ]; 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 = ''; 456 478 if ( $list_type === 'freestyleTerrain' ) { 457 479 $headerLabel = __( 'Freestyle Terrains', MWPS_TEXT_DOMAIN ); … … 521 543 $scheduleOpen = isset( $col['scheduleOpen'] ) ? $col['scheduleOpen'] : ''; 522 544 $scheduleClose = isset( $col['scheduleClose'] ) ? $col['scheduleClose'] : ''; 523 $openTime = '';524 545 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; 526 553 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; 528 560 } 529 561 } -
lift-trail-status/tags/1.4.3/includes/mwps-core-functions.php
r3214583 r3225072 25 25 } 26 26 $response = wp_remote_get( $url ); 27 if ( ! is_wp_error( $response ) ) {27 if ( ! is_wp_error( $response ) && ( 200 === wp_remote_retrieve_response_code( $response ) ) ) { 28 28 $result = wp_remote_retrieve_body( $response ); 29 29 } else { … … 147 147 usort( $lifts, 'm_sortByName' ); 148 148 } 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 // } 154 154 155 155 return $lifts; -
lift-trail-status/tags/1.4.3/medic52-wpstatus.php
r3214583 r3225072 4 4 * Plugin URI: https://www.medic52.com/ 5 5 * 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. 26 * Version: 1.4.3 7 7 * Author: Medic52 8 8 * Author URI: https://www.medic52.com/ … … 13 13 defined( 'ABSPATH' ) || exit; 14 14 15 define( 'MEDIC52_WPSTATUS_VERSION', '1.4. 2' );15 define( 'MEDIC52_WPSTATUS_VERSION', '1.4.3' ); 16 16 17 17 // Define MWPS_PLUGIN_FILE. -
lift-trail-status/trunk/README.txt
r3214583 r3225072 5 5 Requires at least: 4.7 6 6 Tested up to: 6.7.1 7 Stable tag: 1.4. 27 Stable tag: 1.4.3 8 8 Requires PHP: 8.0 9 9 License: GPLv2 or later … … 76 76 == Changelog == 77 77 78 = 1.4.3 = 79 Added time format option for 24hour or am/pm 80 Updated the ratings 81 78 82 = 1.4.2 = 79 83 Updated for WordPress 6.7.1 -
lift-trail-status/trunk/assets/css/mwpsstyle.css
r3160188 r3225072 111 111 font-style: normal; 112 112 font-size: 2.6rem; 113 line-height: 1 ;113 line-height: 1 !important; 114 114 color: #063861; 115 115 letter-spacing: 0; -
lift-trail-status/trunk/includes/class-mwps-admin.php
r3214583 r3225072 218 218 219 219 $freestyleTerrain_order_by = isset( $options['freestyleTerrain_order_by'] ) ? $options['freestyleTerrain_order_by'] : ''; 220 $time_display = isset( $options['time_display'] ) ? $options['time_display'] : ''; 220 221 ?> 221 222 <table class="form-table"> … … 281 282 echo '<option value="">' . __( 'Default' ) . '</option>'; 282 283 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>'; 283 297 echo '</select>'; 284 298 ?> -
lift-trail-status/trunk/includes/class-mwps-shortcodes-lift-trail.php
r3214583 r3225072 67 67 68 68 $freestyleTerrain_order_by = isset( $options['freestyleTerrain_order_by'] ) ? $options['freestyleTerrain_order_by'] : ''; 69 $time_display = isset( $options['time_display'] ) ? $options['time_display'] : ''; 69 70 70 71 $obj = mwps_get_data( $url ); … … 76 77 echo '<div class="medic52WPStatusWrap">'; 77 78 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 ); 78 92 //$facilities = $obj['facilities']; 79 93 //$areas = $facilities['areas']; 80 94 81 / *echo '<pre>';print_r($areas);echo '</pre>';*/95 //echo '<pre>';print_r($trails);echo '</pre>'; 82 96 ?> 83 97 <div class="mWPSWrap"> … … 159 173 //echo self::liftsList( $lifts, $listLiftsSeparately, $listDisplay ); 160 174 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, 164 179 ] ); 165 180 ?> … … 197 212 //foreach ($ratingsCol as $ratingKey=>$ratingCol) { 198 213 foreach ( $ratingsOptions as $ratingKey => $ratingCol ) { 214 if ( ! in_array( $ratingKey, $trailDifficulties ) ) { 215 continue; 216 } 199 217 $name = ( isset( $ratingsOptions[ $ratingKey ] ) && isset( $ratingsOptions[ $ratingKey ]['label'] ) ) ? $ratingsOptions[ $ratingKey ]['label'] : ''; 200 218 if ( empty( $name ) ) { … … 302 320 //echo self::liftsList( $lifts, $listLiftsSeparately, $listDisplay ); 303 321 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, 307 326 ] ); 308 327 } … … 402 421 // } 403 422 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, 408 428 ] ); 409 429 ?> … … 441 461 442 462 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' => '', 448 469 ]; 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 = ''; 456 478 if ( $list_type === 'freestyleTerrain' ) { 457 479 $headerLabel = __( 'Freestyle Terrains', MWPS_TEXT_DOMAIN ); … … 521 543 $scheduleOpen = isset( $col['scheduleOpen'] ) ? $col['scheduleOpen'] : ''; 522 544 $scheduleClose = isset( $col['scheduleClose'] ) ? $col['scheduleClose'] : ''; 523 $openTime = '';524 545 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; 526 553 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; 528 560 } 529 561 } -
lift-trail-status/trunk/includes/mwps-core-functions.php
r3214583 r3225072 25 25 } 26 26 $response = wp_remote_get( $url ); 27 if ( ! is_wp_error( $response ) ) {27 if ( ! is_wp_error( $response ) && ( 200 === wp_remote_retrieve_response_code( $response ) ) ) { 28 28 $result = wp_remote_retrieve_body( $response ); 29 29 } else { … … 147 147 usort( $lifts, 'm_sortByName' ); 148 148 } 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 // } 154 154 155 155 return $lifts; -
lift-trail-status/trunk/medic52-wpstatus.php
r3214583 r3225072 4 4 * Plugin URI: https://www.medic52.com/ 5 5 * 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. 26 * Version: 1.4.3 7 7 * Author: Medic52 8 8 * Author URI: https://www.medic52.com/ … … 13 13 defined( 'ABSPATH' ) || exit; 14 14 15 define( 'MEDIC52_WPSTATUS_VERSION', '1.4. 2' );15 define( 'MEDIC52_WPSTATUS_VERSION', '1.4.3' ); 16 16 17 17 // Define MWPS_PLUGIN_FILE.
Note: See TracChangeset
for help on using the changeset viewer.