Move WPHooks methods to WPFunctions

This commit is contained in:
Amine Ben hammou
2019-01-28 19:00:19 +01:00
parent d452cfcae7
commit 8b602bd947
49 changed files with 354 additions and 258 deletions

View File

@@ -3,25 +3,31 @@
namespace MailPoet\API\JSON\v1;
use MailPoet\API\JSON\Endpoint as APIEndpoint;
use MailPoet\WP\Functions as WPFunctions;
use MailPoet\Config\AccessControl;
use MailPoet\Config\Activator;
use MailPoet\WP\Hooks;
if(!defined('ABSPATH')) exit;
class Setup extends APIEndpoint {
private $wp;
public $permissions = array(
'global' => AccessControl::PERMISSION_MANAGE_SETTINGS
);
function __construct(WPFunctions $wp) {
$this->wp = $wp;
}
function reset() {
try {
$activator = new Activator();
$activator->deactivate();
$activator->activate();
Hooks::doAction('mailpoet_setup_reset');
$this->wp->doAction('mailpoet_setup_reset');
return $this->successResponse();
} catch(\Exception $e) {
dd($e->getMessage());
return $this->errorResponse(array(
$e->getCode() => $e->getMessage()
));