Changeset 3284372
- Timestamp:
- 04/29/2025 08:01:46 PM (11 months ago)
- Location:
- beerxml-shortcode/trunk
- Files:
-
- 3 edited
-
beerxml-shortcode.php (modified) (4 diffs)
-
includes/classes.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
beerxml-shortcode/trunk/beerxml-shortcode.php
r1667900 r3284372 6 6 Author: Derek Springer 7 7 Author URI: http://www.fivebladesbrewing.com/beerxml-plugin-wordpress/ 8 Version: 0. 7.18 Version: 0.8 9 9 License: GPL2 or later 10 10 Text Domain: beerxml-shortcode … … 144 144 } 145 145 146 $recipe = esc_url_raw( $recipe ); 147 $recipe_filename = pathinfo( $recipe, PATHINFO_FILENAME ); 146 $recipe_loc = filter_var( esc_attr( $recipe ), FILTER_VALIDATE_URL ); 147 if ( ! $recipe_loc ) { 148 return '<!-- Error parsing BeerXML document -->'; 149 } 150 151 $recipe_filename = pathinfo( $recipe_loc, PATHINFO_FILENAME ); 148 152 $recipe_id = "beerxml_shortcode_recipe-{$post->ID}_{$recipe_filename}"; 149 153 … … 164 168 165 169 if ( ! $cache || false === ( $beer_xml = get_transient( $recipe_id ) ) ) { 166 $beer_xml = new BeerXML( $recipe );170 $beer_xml = new BeerXML( $recipe_loc ); 167 171 } else { 168 172 // result was in cache, just use that … … 725 729 static function build_yeast( $yeast, $metric = false ) { 726 730 if ( $metric ) { 727 $yeast->min_temperature = round( $yeast->min_temperature, 2 );728 $yeast->max_temperature = round( $yeast->max_temperature, 2 );731 $yeast->min_temperature = round( floatval( $yeast->min_temperature ), 2 ); 732 $yeast->max_temperature = round( floatval( $yeast->max_temperature ), 2 ); 729 733 $t_temp = __( 'C', 'beerxml-shortcode' ); 730 734 } else { 731 $yeast->min_temperature = round( ( $yeast->min_temperature* (9/5) ) + 32, 1 );732 $yeast->max_temperature = round( ( $yeast->max_temperature* (9/5) ) + 32, 1 );735 $yeast->min_temperature = round( ( floatval( $yeast->min_temperature ) * (9/5) ) + 32, 1 ); 736 $yeast->max_temperature = round( ( floatval( $yeast->max_temperature ) * (9/5) ) + 32, 1 ); 733 737 $t_temp = __( 'F', 'beerxml-shortcode' ); 734 738 } -
beerxml-shortcode/trunk/includes/classes.php
r895496 r3284372 6 6 7 7 function __construct( $xml_loc ) { 8 $response = wp_ remote_get( $xml_loc );8 $response = wp_safe_remote_get( $xml_loc ); 9 9 if ( is_wp_error( $response ) ) { 10 10 $error_message = $response->get_error_message(); … … 22 22 $xml = wp_remote_retrieve_body( $response ); 23 23 $xrecipes = simplexml_load_string( $xml ); 24 if ( ! $xrecipes ) 24 if ( ! $xrecipes ) { 25 25 return; 26 } 26 27 27 28 foreach ( $xrecipes->RECIPE as $recipe ) { -
beerxml-shortcode/trunk/readme.txt
r1763269 r3284372 4 4 Tags: shortcode, beer, beerxml, homebrew, recipe 5 5 Requires at least: 3.4 6 Tested up to: 4.97 Stable tag: 0. 7.16 Tested up to: 6.8 7 Stable tag: 0.8 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 60 60 61 61 == Changelog == 62 63 = 0.8 = 64 65 * Some potential SSRF fixes. 66 * Better error handling for yeasts that don't parse cleanly. 62 67 63 68 = 0.7.1 =
Note: See TracChangeset
for help on using the changeset viewer.