/
home
/
techb158
/
l2hypotheques.com
/
wp-content
/
plugins
/
woocommerce
/
includes
/
/home/techb158/l2hypotheques.com/wp-content/plugins/woocommerce/includes
mkdir
upload
Name
Size
Mode
Actions
abstracts/
-
0755
rm
admin/
-
0755
rm
blocks/
-
0755
rm
cli/
-
0755
rm
customizer/
-
0755
rm
data-stores/
-
0755
rm
emails/
-
0755
rm
export/
-
0755
rm
gateways/
-
0755
rm
import/
-
0755
rm
integrations/
-
0755
rm
interfaces/
-
0755
rm
legacy/
-
0755
rm
libraries/
-
0755
rm
log-handlers/
-
0755
rm
payment-tokens/
-
0755
rm
product-usage/
-
0755
rm
queue/
-
0755
rm
react-admin/
-
0755
rm
rest-api/
-
0755
rm
shipping/
-
0755
rm
shortcodes/
-
0755
rm
theme-support/
-
0755
rm
tracks/
-
0755
rm
traits/
-
0755
rm
walkers/
-
0755
rm
wccom-site/
-
0755
rm
widgets/
-
0755
rm
class-wc-ajax.php
126393
0644
edit
dl
rm
class-wc-auth.php
12995
0644
edit
dl
rm
class-wc-autoloader.php
5394
0644
edit
dl
rm
class-wc-background-emailer.php
4685
0644
edit
dl
rm
class-wc-background-updater.php
3535
0644
edit
dl
rm
class-wc-brands-brand-settings-manager.php
1826
0644
edit
dl
rm
class-wc-brands-coupons.php
7059
0644
edit
dl
rm
class-wc-brands.php
35635
0644
edit
dl
rm
class-wc-breadcrumb.php
10660
0644
edit
dl
rm
class-wc-cache-helper.php
12998
0644
edit
dl
rm
class-wc-cart-fees.php
3448
0644
edit
dl
rm
class-wc-cart-session.php
25993
0644
edit
dl
rm
class-wc-cart-totals.php
29163
0644
edit
dl
rm
class-wc-cart.php
75991
0644
edit
dl
rm
class-wc-checkout.php
51349
0644
edit
dl
rm
class-wc-cli.php
3419
0644
edit
dl
rm
class-wc-comments.php
23631
0644
edit
dl
rm
class-wc-countries.php
51881
0644
edit
dl
rm
class-wc-coupon.php
44920
0644
edit
dl
rm
class-wc-customer-download-log.php
3452
0644
edit
dl
rm
class-wc-customer-download.php
10587
0644
edit
dl
rm
class-wc-customer.php
34000
0644
edit
dl
rm
class-wc-data-exception.php
1321
0644
edit
dl
rm
class-wc-data-store.php
6752
0644
edit
dl
rm
class-wc-datetime.php
2310
0644
edit
dl
rm
class-wc-deprecated-action-hooks.php
6746
0644
edit
dl
rm
class-wc-deprecated-filter-hooks.php
7518
0644
edit
dl
rm
class-wc-discounts.php
37523
0644
edit
dl
rm
class-wc-download-handler.php
29053
0644
edit
dl
rm
class-wc-emails.php
40026
0644
edit
dl
rm
class-wc-embed.php
4342
0644
edit
dl
rm
class-wc-form-handler.php
49327
0644
edit
dl
rm
class-wc-frontend-scripts.php
35185
0644
edit
dl
rm
class-wc-geo-ip.php
31159
0644
edit
dl
rm
class-wc-geolite-integration.php
2036
0644
edit
dl
rm
class-wc-geolocation.php
11615
0644
edit
dl
rm
class-wc-https.php
4439
0644
edit
dl
rm
class-wc-install.php
118843
0644
edit
dl
rm
class-wc-integrations.php
1308
0644
edit
dl
rm
class-wc-log-levels.php
3992
0644
edit
dl
rm
class-wc-logger.php
9639
0644
edit
dl
rm
class-wc-meta-data.php
2260
0644
edit
dl
rm
class-wc-order-factory.php
8868
0644
edit
dl
rm
class-wc-order-item-coupon.php
4175
0644
edit
dl
rm
class-wc-order-item-fee.php
10228
0644
edit
dl
rm
class-wc-order-item-meta.php
5942
0644
edit
dl
rm
class-wc-order-item-product.php
17962
0644
edit
dl
rm
class-wc-order-item-shipping.php
9815
0644
edit
dl
rm
class-wc-order-item-tax.php
6644
0644
edit
dl
rm
class-wc-order-item.php
21907
0644
edit
dl
rm
class-wc-order-query.php
2613
0644
edit
dl
rm
class-wc-order-refund.php
6135
0644
edit
dl
rm
class-wc-order.php
79390
0644
edit
dl
rm
class-wc-payment-gateways.php
16953
0644
edit
dl
rm
class-wc-payment-tokens.php
6390
0644
edit
dl
rm
class-wc-post-data.php
37759
0644
edit
dl
rm
class-wc-post-types.php
33680
0644
edit
dl
rm
class-wc-privacy-background-process.php
1833
0644
edit
dl
rm
class-wc-privacy-erasers.php
13941
0644
edit
dl
rm
class-wc-privacy-exporters.php
15044
0644
edit
dl
rm
class-wc-privacy.php
17629
0644
edit
dl
rm
class-wc-product-attribute.php
8057
0644
edit
dl
rm
class-wc-product-download.php
13494
0644
edit
dl
rm
class-wc-product-external.php
5104
0644
edit
dl
rm
class-wc-product-factory.php
4654
0644
edit
dl
rm
class-wc-product-grouped.php
6907
0644
edit
dl
rm
class-wc-product-query.php
2328
0644
edit
dl
rm
class-wc-product-simple.php
2765
0644
edit
dl
rm
class-wc-product-variable.php
24264
0644
edit
dl
rm
class-wc-product-variation.php
20661
0644
edit
dl
rm
class-wc-query.php
34299
0644
edit
dl
rm
class-wc-rate-limiter.php
4100
0644
edit
dl
rm
class-wc-regenerate-images-request.php
7923
0644
edit
dl
rm
class-wc-regenerate-images.php
15806
0644
edit
dl
rm
class-wc-register-wp-admin-settings.php
5171
0644
edit
dl
rm
class-wc-rest-authentication.php
22068
0644
edit
dl
rm
class-wc-rest-exception.php
276
0644
edit
dl
rm
class-wc-session-handler.php
24728
0644
edit
dl
rm
class-wc-shipping-rate.php
9566
0644
edit
dl
rm
class-wc-shipping-zone.php
13392
0644
edit
dl
rm
class-wc-shipping-zones.php
5115
0644
edit
dl
rm
class-wc-shipping.php
13160
0644
edit
dl
rm
class-wc-shortcodes.php
19274
0644
edit
dl
rm
class-wc-structured-data.php
25011
0644
edit
dl
rm
class-wc-tax.php
40694
0644
edit
dl
rm
class-wc-template-loader.php
20911
0644
edit
dl
rm
class-wc-tracker.php
52731
0644
edit
dl
rm
class-wc-validation.php
5929
0644
edit
dl
rm
class-wc-webhook.php
30807
0644
edit
dl
rm
class-woocommerce.php
63658
0644
edit
dl
rm
wc-account-functions.php
14485
0644
edit
dl
rm
wc-attribute-functions.php
22377
0644
edit
dl
rm
wc-brands-functions.php
4270
0644
edit
dl
rm
wc-cart-functions.php
21308
0644
edit
dl
rm
wc-conditional-functions.php
15902
0644
edit
dl
rm
wc-core-functions.php
80603
0644
edit
dl
rm
wc-coupon-functions.php
5698
0644
edit
dl
rm
wc-deprecated-functions.php
40731
0644
edit
dl
rm
wc-formatting-functions.php
51093
0644
edit
dl
rm
wc-interactivity-api-functions.php
2219
0644
edit
dl
rm
wc-notice-functions.php
8696
0644
edit
dl
rm
wc-order-functions.php
44448
0644
edit
dl
rm
wc-order-item-functions.php
5153
0644
edit
dl
rm
wc-order-step-logger-functions.php
6114
0644
edit
dl
rm
wc-page-functions.php
9657
0644
edit
dl
rm
wc-product-functions.php
68992
0644
edit
dl
rm
wc-rest-functions.php
14268
0644
edit
dl
rm
wc-stock-functions.php
17851
0644
edit
dl
rm
wc-template-functions.php
145297
0644
edit
dl
rm
wc-template-hooks.php
13151
0644
edit
dl
rm
wc-term-functions.php
25158
0644
edit
dl
rm
wc-update-functions.php
104334
0644
edit
dl
rm
wc-user-functions.php
34991
0644
edit
dl
rm
wc-webhook-functions.php
5905
0644
edit
dl
rm
wc-widget-functions.php
2063
0644
edit
dl
rm
Edit:
/home/techb158/l2hypotheques.com/wp-content/plugins/woocommerce/includes/class-wc-rate-limiter.php
(4100B)
<?php /** * Provide basic rate limiting functionality via WP Options API. * * Currently only provides a simple limit by delaying action by X seconds. * * Example usage: * * When an action runs, call set_rate_limit, e.g.: * * WC_Rate_Limiter::set_rate_limit( "{$my_action_name}_{$user_id}", $delay ); * * This sets a timestamp for future timestamp after which action can run again. * * * Then before running the action again, check if the action is allowed to run, e.g.: * * if ( WC_Rate_Limiter::retried_too_soon( "{$my_action_name}_{$user_id}" ) ) { * add_notice( 'Sorry, too soon!' ); * } * * @package WooCommerce\Classes * @version 3.9.0 * @since 3.9.0 */ defined( 'ABSPATH' ) || exit; /** * Rate limit class. */ class WC_Rate_Limiter { /** * Cache group. */ const CACHE_GROUP = 'wc_rate_limit'; /** * Hook in methods. */ public static function init() { add_action( 'woocommerce_cleanup_rate_limits', array( __CLASS__, 'cleanup' ) ); } /** * Constructs key name from action identifier. * Left in for backwards compatibility. * * @param string $action_id Identifier of the action. * @return string */ public static function storage_id( $action_id ) { return $action_id; } /** * Gets a cache prefix. * * @param string $action_id Identifier of the action. * @return string */ protected static function get_cache_key( $action_id ) { return WC_Cache_Helper::get_cache_prefix( 'rate_limit' . $action_id ); } /** * Retrieve a cached rate limit. * * @param string $action_id Identifier of the action. * @return bool|int */ protected static function get_cached( $action_id ) { return wp_cache_get( self::get_cache_key( $action_id ), self::CACHE_GROUP ); } /** * Cache a rate limit. * * @param string $action_id Identifier of the action. * @param int $expiry Timestamp when the limit expires. * @return bool */ protected static function set_cache( $action_id, $expiry ) { return wp_cache_set( self::get_cache_key( $action_id ), $expiry, self::CACHE_GROUP ); } /** * Returns true if the action is not allowed to be run by the rate limiter yet, false otherwise. * * @param string $action_id Identifier of the action. * @return bool */ public static function retried_too_soon( $action_id ) { global $wpdb; $next_try_allowed_at = self::get_cached( $action_id ); if ( false === $next_try_allowed_at ) { $next_try_allowed_at = $wpdb->get_var( $wpdb->prepare( " SELECT rate_limit_expiry FROM {$wpdb->prefix}wc_rate_limits WHERE rate_limit_key = %s ", $action_id ) ); self::set_cache( $action_id, $next_try_allowed_at ); } // No record of action running, so action is allowed to run. if ( null === $next_try_allowed_at ) { return false; } // Before the next run is allowed, retry forbidden. if ( time() <= $next_try_allowed_at ) { return true; } // After the next run is allowed, retry allowed. return false; } /** * Sets the rate limit delay in seconds for action with identifier $id. * * @param string $action_id Identifier of the action. * @param int $delay Delay in seconds. * @return bool True if the option setting was successful, false otherwise. */ public static function set_rate_limit( $action_id, $delay ) { global $wpdb; $next_try_allowed_at = time() + $delay; $result = $wpdb->replace( $wpdb->prefix . 'wc_rate_limits', array( 'rate_limit_key' => $action_id, 'rate_limit_expiry' => $next_try_allowed_at, ), array( '%s', '%d' ) ); self::set_cache( $action_id, $next_try_allowed_at ); return false !== $result; } /** * Cleanup expired rate limits from the database and clear caches. */ public static function cleanup() { global $wpdb; $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}wc_rate_limits WHERE rate_limit_expiry < %d", time() ) ); if ( class_exists( 'WC_Cache_Helper' ) ) { WC_Cache_Helper::invalidate_cache_group( self::CACHE_GROUP ); } } } WC_Rate_Limiter::init();
Save
cmd:
run