Automattic\WooCommerce\Internal\StockNotifications\Frontend
SignupRateLimiter::get_rate_limits
Get the rate limits that apply to the current sign-up attempt, keyed by rate limit ID.
Buckets with a zero delay are left out, so switching one off writes nothing.
Метод класса: SignupRateLimiter{}
Хуков нет.
Возвращает
array<string, int>.
Использование
$result = SignupRateLimiter::get_rate_limits( $user_email ): array;
- $user_email(строка) (обязательный)
- The e-mail address used to sign up.
Код SignupRateLimiter::get_rate_limits() SignupRateLimiter::get rate limits WC 11.2.2
private static function get_rate_limits( string $user_email ): array {
$options = self::get_options();
$rate_limits = array();
if ( ! $options['enabled'] ) {
return $rate_limits;
}
if ( $options['client_delay'] > 0 ) {
if ( is_user_logged_in() ) {
$rate_limits[ self::RATE_LIMIT_USER_PREFIX . get_current_user_id() ] = $options['client_delay'];
} else {
$ip_address = self::get_ip_address( $options['proxy_support'] );
if ( '' !== $ip_address ) {
$rate_limits[ self::RATE_LIMIT_IP_PREFIX . hash( 'sha256', $ip_address ) ] = $options['client_delay'];
}
}
}
$user_email = strtolower( trim( $user_email ) );
if ( '' !== $user_email && $options['email_delay'] > 0 ) {
$rate_limits[ self::RATE_LIMIT_EMAIL_PREFIX . hash( 'sha256', $user_email ) ] = $options['email_delay'];
}
return $rate_limits;
}