Plugin Directory

Changeset 2981217


Ignore:
Timestamp:
10/19/2023 01:54:11 PM (2 years ago)
Author:
datafeedr.com
Message:

Update to version 0.9.67 from GitHub

Location:
datafeedr-comparison-sets
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • datafeedr-comparison-sets/tags/0.9.67/datafeedr-comparison-sets.php

    r2901871 r2981217  
    1010Requires PHP: 7.4
    1111Requires at least: 3.8
    12 Tested up to: 6.2.1-alpha
    13 Version: 0.9.66
     12Tested up to: 6.3.3-alpha
     13Version: 0.9.67
    1414
    1515WC requires at least: 3.0
    16 WC tested up to: 7.0
     16WC tested up to: 7.9
    1717
    1818Datafeedr Comparison Sets Plugin
     
    4343 * Define constants.
    4444 */
    45 define( 'DFRCS_VERSION', '0.9.66' );
     45define( 'DFRCS_VERSION', '0.9.67' );
    4646define( 'DFRCS_DB_VERSION', '0.9.0' );
    4747define( 'DFRCS_URL', plugin_dir_url( __FILE__ ) );
  • datafeedr-comparison-sets/tags/0.9.67/includes/actions.php

    r2755156 r2981217  
    12361236
    12371237    $request = $_REQUEST;
    1238     $source  = $request['source'];
    1239     $source  = base64_decode( $source );
    1240     $source  = unserialize( $source );
    1241 
     1238
     1239    $request_source  = $request['source'];
     1240    $request_source  = base64_decode( $request_source );
     1241    $request_source = unserialize( $request_source, [ 'allowed_classes' => false, 'max_depth' => 1 ] );
     1242
     1243    // Ensure that $request_source is an array. Die if not an array.
     1244    if ( ! is_array( $request_source ) ) {
     1245        die();
     1246    }
     1247
     1248    $source = [];
     1249
     1250    // Sanitize data returned
     1251    foreach ( $request_source as $k => $v ) {
     1252        $source[ sanitize_text_field( $k ) ] = sanitize_text_field( $v );
     1253    }
     1254
     1255    /**
     1256     * $source will look something like this:
     1257     *
     1258     *  Array (
     1259     *      [id] => 2173400008798575
     1260     *      [post_id] => 338
     1261     *      [context] => wc_single_product_page
     1262     *  )
     1263     */
    12421264    $source['display_method'] = 'ajax';
    12431265
     
    12631285    $source = $request['source'];
    12641286    $source = base64_decode( $source );
    1265     $source = unserialize( $source );
     1287    $source = unserialize( $source, [ 'allowed_classes' => false, 'max_depth' => 1 ] );
     1288
     1289    // Ensure that $source is an array. Die if not an array.
     1290    if ( ! is_array( $source ) ) {
     1291        die();
     1292    }
    12661293
    12671294    $source['display_method'] = 'ajax';
  • datafeedr-comparison-sets/tags/0.9.67/includes/functions.php

    r2755156 r2981217  
    234234    }
    235235
    236     return apply_filters( 'dfrcs_title', str_replace( $s, $r, $compset->args['title'] ), $compset ) . $msg;
     236    $title = apply_filters( 'dfrcs_title', str_replace( $s, $r, $compset->args['title'] ), $compset );
     237
     238    return esc_html( $title ) . $msg;
    237239}
    238240
     
    760762    }
    761763
     764    if ( ! dfrcs_is_valid_md5( $hash ) ) {
     765        return;
     766    }
     767
    762768    global $wpdb;
    763769
     
    780786
    781787    $hash = trim( $hash );
    782     if ( empty( $hash ) ) {
     788
     789    if ( ! dfrcs_is_valid_md5( $hash ) ) {
    783790        return false;
    784791    }
     
    799806
    800807    $hash = trim( $hash );
    801     if ( empty( $hash ) ) {
    802         return false;
     808
     809    if ( ! dfrcs_is_valid_md5( $hash ) ) {
     810        return;
    803811    }
    804812
     
    825833    if ( empty( $hash ) ) {
    826834        _e( 'Missing comparison set hash.', DFRCS_DOMAIN );
     835
     836        return;
     837    }
     838
     839    if ( ! dfrcs_is_valid_md5( $hash ) ) {
     840        _e( 'Invalid hash.', DFRCS_DOMAIN );
    827841
    828842        return;
     
    13871401    return (bool) dfrcs_get_option( 'use_amazon_data_in_search' );
    13881402}
     1403
     1404/**
     1405 * Validates the validity of an MD5 hash.
     1406 *
     1407 * @see https://stackoverflow.com/a/14300703
     1408 *
     1409 * @param string $md5
     1410 *
     1411 * @return bool
     1412 */
     1413function dfrcs_is_valid_md5( string $md5 = '' ): bool {
     1414    return boolval( preg_match( '/^[a-f0-9]{32}$/', $md5 ) );
     1415}
  • datafeedr-comparison-sets/tags/0.9.67/readme.txt

    r2901871 r2981217  
    88Requires PHP: 7.4
    99Requires at least: 3.8
    10 Tested up to: 6.2.1-alpha
    11 Stable tag: 0.9.66
     10Tested up to: 6.3.3-alpha
     11Stable tag: 0.9.67
    1212
    1313Automatically create price comparison sets for your WooCommerce products or by using a shortcode.
     
    205205
    206206== Changelog ==
     207
     208= 0.9.67 - 2023/10/19 =
     209* Verifying hashes
     210* Better handling of source data string
    207211
    208212= 0.9.66 - 2023/04/20 =
  • datafeedr-comparison-sets/trunk/datafeedr-comparison-sets.php

    r2901871 r2981217  
    1010Requires PHP: 7.4
    1111Requires at least: 3.8
    12 Tested up to: 6.2.1-alpha
    13 Version: 0.9.66
     12Tested up to: 6.3.3-alpha
     13Version: 0.9.67
    1414
    1515WC requires at least: 3.0
    16 WC tested up to: 7.0
     16WC tested up to: 7.9
    1717
    1818Datafeedr Comparison Sets Plugin
     
    4343 * Define constants.
    4444 */
    45 define( 'DFRCS_VERSION', '0.9.66' );
     45define( 'DFRCS_VERSION', '0.9.67' );
    4646define( 'DFRCS_DB_VERSION', '0.9.0' );
    4747define( 'DFRCS_URL', plugin_dir_url( __FILE__ ) );
  • datafeedr-comparison-sets/trunk/includes/actions.php

    r2755156 r2981217  
    12361236
    12371237    $request = $_REQUEST;
    1238     $source  = $request['source'];
    1239     $source  = base64_decode( $source );
    1240     $source  = unserialize( $source );
    1241 
     1238
     1239    $request_source  = $request['source'];
     1240    $request_source  = base64_decode( $request_source );
     1241    $request_source = unserialize( $request_source, [ 'allowed_classes' => false, 'max_depth' => 1 ] );
     1242
     1243    // Ensure that $request_source is an array. Die if not an array.
     1244    if ( ! is_array( $request_source ) ) {
     1245        die();
     1246    }
     1247
     1248    $source = [];
     1249
     1250    // Sanitize data returned
     1251    foreach ( $request_source as $k => $v ) {
     1252        $source[ sanitize_text_field( $k ) ] = sanitize_text_field( $v );
     1253    }
     1254
     1255    /**
     1256     * $source will look something like this:
     1257     *
     1258     *  Array (
     1259     *      [id] => 2173400008798575
     1260     *      [post_id] => 338
     1261     *      [context] => wc_single_product_page
     1262     *  )
     1263     */
    12421264    $source['display_method'] = 'ajax';
    12431265
     
    12631285    $source = $request['source'];
    12641286    $source = base64_decode( $source );
    1265     $source = unserialize( $source );
     1287    $source = unserialize( $source, [ 'allowed_classes' => false, 'max_depth' => 1 ] );
     1288
     1289    // Ensure that $source is an array. Die if not an array.
     1290    if ( ! is_array( $source ) ) {
     1291        die();
     1292    }
    12661293
    12671294    $source['display_method'] = 'ajax';
  • datafeedr-comparison-sets/trunk/includes/functions.php

    r2755156 r2981217  
    234234    }
    235235
    236     return apply_filters( 'dfrcs_title', str_replace( $s, $r, $compset->args['title'] ), $compset ) . $msg;
     236    $title = apply_filters( 'dfrcs_title', str_replace( $s, $r, $compset->args['title'] ), $compset );
     237
     238    return esc_html( $title ) . $msg;
    237239}
    238240
     
    760762    }
    761763
     764    if ( ! dfrcs_is_valid_md5( $hash ) ) {
     765        return;
     766    }
     767
    762768    global $wpdb;
    763769
     
    780786
    781787    $hash = trim( $hash );
    782     if ( empty( $hash ) ) {
     788
     789    if ( ! dfrcs_is_valid_md5( $hash ) ) {
    783790        return false;
    784791    }
     
    799806
    800807    $hash = trim( $hash );
    801     if ( empty( $hash ) ) {
    802         return false;
     808
     809    if ( ! dfrcs_is_valid_md5( $hash ) ) {
     810        return;
    803811    }
    804812
     
    825833    if ( empty( $hash ) ) {
    826834        _e( 'Missing comparison set hash.', DFRCS_DOMAIN );
     835
     836        return;
     837    }
     838
     839    if ( ! dfrcs_is_valid_md5( $hash ) ) {
     840        _e( 'Invalid hash.', DFRCS_DOMAIN );
    827841
    828842        return;
     
    13871401    return (bool) dfrcs_get_option( 'use_amazon_data_in_search' );
    13881402}
     1403
     1404/**
     1405 * Validates the validity of an MD5 hash.
     1406 *
     1407 * @see https://stackoverflow.com/a/14300703
     1408 *
     1409 * @param string $md5
     1410 *
     1411 * @return bool
     1412 */
     1413function dfrcs_is_valid_md5( string $md5 = '' ): bool {
     1414    return boolval( preg_match( '/^[a-f0-9]{32}$/', $md5 ) );
     1415}
  • datafeedr-comparison-sets/trunk/readme.txt

    r2901871 r2981217  
    88Requires PHP: 7.4
    99Requires at least: 3.8
    10 Tested up to: 6.2.1-alpha
    11 Stable tag: 0.9.66
     10Tested up to: 6.3.3-alpha
     11Stable tag: 0.9.67
    1212
    1313Automatically create price comparison sets for your WooCommerce products or by using a shortcode.
     
    205205
    206206== Changelog ==
     207
     208= 0.9.67 - 2023/10/19 =
     209* Verifying hashes
     210* Better handling of source data string
    207211
    208212= 0.9.66 - 2023/04/20 =
Note: See TracChangeset for help on using the changeset viewer.