[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.133.150.142: ~ $
<?php

namespace MailPoet\API\JSON;

if (!defined('ABSPATH')) exit;


use MailPoet\WP\Functions as WPFunctions;

class ErrorResponse extends Response {
  public $errors;

  public function __construct(
    $errors = [],
    $meta = [],
    $status = self::STATUS_NOT_FOUND
  ) {
    parent::__construct($status, $meta);
    $this->errors = $this->formatErrors($errors);
  }

  public function getData() {
    return (empty($this->errors)) ? null : ['errors' => $this->errors];
  }

  public function formatErrors($errors = []) {
    return array_map(function($error, $message) {
      // sanitize SQL error
      if (preg_match('/^SQLSTATE/i', $message)) {
        $message = WPFunctions::get()->__('An unknown error occurred.', 'mailpoet');
      }
      return [
        'error' => $error,
        'message' => $message,
      ];
    }, array_keys($errors), array_values($errors));
  }
}

Filemanager

Name Type Size Permission Actions
ResponseBuilders Folder 0700
v1 Folder 0700
API.php File 8.66 KB 0644
Endpoint.php File 1.48 KB 0644
Error.php File 304 B 0644
ErrorHandler.php File 860 B 0644
ErrorResponse.php File 890 B 0644
Response.php File 1020 B 0644
SuccessResponse.php File 425 B 0644
index.php File 0 B 0644