Automattic\WooCommerce\StoreApi\Utilities

RateLimits::get_options()public staticWC 1.0

Return options for Rate Limits, to be returned by the "woocommerce_store_api_rate_limit_options" filter.

Метод класса: RateLimits{}

Хуки из метода

Возвращает

Объект. Default options.

Использование

$result = RateLimits::get_options();

Код RateLimits::get_options() WC 7.3.0

public static function get_options() {
	$default_options = [
		/**
		 * Filters the Store API rate limit check, which is disabled by default.
		 *
		 * This can be used also to disable the rate limit check when testing API endpoints via a REST API client.
		 */
		'enabled'       => self::ENABLED,

		/**
		 * Filters whether proxy support is enabled for the Store API rate limit check. This is disabled by default.
		 *
		 * If the store is behind a proxy, load balancer, CDN etc. the user can enable this to properly obtain
		 * the client's IP address through standard transport headers.
		 */
		'proxy_support' => self::PROXY_SUPPORT,

		'limit'         => self::LIMIT,
		'seconds'       => self::SECONDS,
	];

	return (object) array_merge( // By using array_merge we ensure we get a properly populated options object.
		$default_options,
		/**
		 * Filters options for Rate Limits.
		 *
		 * @param array $rate_limit_options Array of option values.
		 * @return array
		 */
		apply_filters(
			'woocommerce_store_api_rate_limit_options',
			$default_options
		)
	);
}