Server IP : 104.21.14.103 / Your IP : 18.224.67.105 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/thread-self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/lib/API/JSON/ |
Upload File : |
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing namespace MailPoet\API\JSON; if (!defined('ABSPATH')) exit; use MailPoet\Config\AccessControl; abstract class Endpoint { const TYPE_POST = 'POST'; const TYPE_GET = 'GET'; public $permissions = [ 'global' => AccessControl::PERMISSION_MANAGE_SETTINGS, 'methods' => [], ]; protected static $getMethods = []; public function successResponse( $data = [], $meta = [], $status = Response::STATUS_OK ) { return new SuccessResponse($data, $meta, $status); } public function errorResponse( $errors = [], $meta = [], $status = Response::STATUS_NOT_FOUND ) { if (empty($errors)) { $errors = [ Error::UNKNOWN => __('An unknown error occurred.', 'mailpoet'), ]; } return new ErrorResponse($errors, $meta, $status); } public function badRequest($errors = [], $meta = []) { if (empty($errors)) { $errors = [ Error::BAD_REQUEST => __('Invalid request parameters', 'mailpoet'), ]; } return new ErrorResponse($errors, $meta, Response::STATUS_BAD_REQUEST); } public function isMethodAllowed($name, $type) { // Block GET requests on POST endpoints, but allow POST requests on GET endpoints (some plugins // change REQUEST_METHOD to POST on GET requests, which caused them to be blocked) if ($type === self::TYPE_GET && !in_array($name, static::$getMethods)) { return false; } return true; } }