|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Patchstack\Extensions; |
| 4 | + |
| 5 | +/** |
| 6 | + * Any extension must implement the methods of the interface. |
| 7 | + * Some CMS systems might implement some of the logic completely different than others. |
| 8 | + */ |
| 9 | +interface ExtensionInterface |
| 10 | +{ |
| 11 | + /** |
| 12 | + * Log the request, this can be of type BLOCK, LOG or REDIRECT. |
| 13 | + * |
| 14 | + * @param int $ruleId |
| 15 | + * @param string $bodyData |
| 16 | + * @param string $blockType |
| 17 | + * @return void |
| 18 | + */ |
| 19 | + public function logRequest($ruleId, $bodyData, $blockType); |
| 20 | + |
| 21 | + /** |
| 22 | + * Determine if the current visitor can bypass the firewall. |
| 23 | + * |
| 24 | + * @return bool |
| 25 | + */ |
| 26 | + public function canBypass(); |
| 27 | + |
| 28 | + /** |
| 29 | + * Determine if the visitor is blocked from the website. |
| 30 | + * |
| 31 | + * @param int $minutes |
| 32 | + * @param int $blockTime |
| 33 | + * @param int $attempts |
| 34 | + * @return bool |
| 35 | + */ |
| 36 | + public function isBlocked($minutes, $blockTime, $attempts); |
| 37 | + |
| 38 | + /** |
| 39 | + * Force exit the page when a request has been blocked. |
| 40 | + * |
| 41 | + * @param int $ruleId |
| 42 | + * @return void |
| 43 | + */ |
| 44 | + public function forceExit($ruleId); |
| 45 | + |
| 46 | + /** |
| 47 | + * Get the IP address of the request. |
| 48 | + * |
| 49 | + * @return string |
| 50 | + */ |
| 51 | + public function getIpAddress(); |
| 52 | + |
| 53 | + /** |
| 54 | + * Determine if the request should be passed without going through the firewall. |
| 55 | + * |
| 56 | + * @param array $whitelistRules |
| 57 | + * @param array $request |
| 58 | + */ |
| 59 | + public function isWhitelisted($whitelistRules, $request); |
| 60 | + |
| 61 | + /** |
| 62 | + * Determine if the current request is a file upload request. |
| 63 | + * |
| 64 | + * @return boolean |
| 65 | + */ |
| 66 | + public function isFileUploadRequest(); |
| 67 | +} |
0 commit comments