Files
piratepoet/lib/API/Settings.php
Jonathan Labreuille 9410d4f10a Reorganized new API + added legacy API support + new API
- Updated Settings Router to new standards
- Updated settings.html to reflect API change with better error handling
- Updated Settings API unit tests
2016-08-01 17:00:32 +02:00

27 lines
517 B
PHP

<?php
namespace MailPoet\API;
use \MailPoet\Models\Setting;
if(!defined('ABSPATH')) exit;
class Settings extends API {
function __construct() {
}
function get() {
$settings = Setting::getAll();
return $this->successResponse($settings);
}
function set($settings = array()) {
if(empty($settings)) {
return $this->badRequest();
} else {
foreach($settings as $name => $value) {
Setting::setValue($name, $value);
}
return $this->successResponse();
}
}
}