Server IP : 172.67.158.161 / Your IP : 3.144.102.138 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/v1/ |
Upload File : |
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing namespace MailPoet\API\JSON\v1; if (!defined('ABSPATH')) exit; use MailPoet\API\JSON\Endpoint as APIEndpoint; use MailPoet\API\JSON\Error as APIError; use MailPoet\Config\AccessControl; use MailPoet\Features\FeatureFlagsController; use MailPoet\Features\FeaturesController; class FeatureFlags extends APIEndpoint { public $permissions = [ 'global' => AccessControl::PERMISSION_MANAGE_FEATURES, ]; /** @var FeaturesController */ private $featuresController; /** @var FeatureFlagsController */ private $featureFlagsController; public function __construct( FeaturesController $featuresController, FeatureFlagsController $featureFlags ) { $this->featuresController = $featuresController; $this->featureFlagsController = $featureFlags; } public function getAll() { $featureFlags = $this->featureFlagsController->getAll(); return $this->successResponse($featureFlags); } public function set(array $flags) { foreach ($flags as $name => $value) { if (!$this->featuresController->exists($name)) { return $this->badRequest([ APIError::BAD_REQUEST => "Feature '$name' does not exist'", ]); } } foreach ($flags as $name => $value) { $this->featureFlagsController->set($name, (bool)$value); } return $this->successResponse([]); } }