Runs hooks setup only when plugin is initilized
This commit is contained in:
@@ -17,6 +17,8 @@ class Initializer {
|
|||||||
private $access_control;
|
private $access_control;
|
||||||
private $renderer;
|
private $renderer;
|
||||||
|
|
||||||
|
const INITILIAZED = 'MAILPOET_INITIALIZED';
|
||||||
|
|
||||||
function __construct($params = array(
|
function __construct($params = array(
|
||||||
'file' => '',
|
'file' => '',
|
||||||
'version' => '1.0.0'
|
'version' => '1.0.0'
|
||||||
@@ -113,12 +115,10 @@ class Initializer {
|
|||||||
|
|
||||||
do_action('mailpoet_initialized', MAILPOET_VERSION);
|
do_action('mailpoet_initialized', MAILPOET_VERSION);
|
||||||
} catch(\Exception $e) {
|
} catch(\Exception $e) {
|
||||||
define('MAILPOET_INITIALIZED', false);
|
|
||||||
|
|
||||||
return $this->handleFailedInitialization($e);
|
return $this->handleFailedInitialization($e);
|
||||||
}
|
}
|
||||||
|
|
||||||
define('MAILPOET_INITIALIZED', true);
|
define(self::INITILIAZED, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function maybeDbUpdate() {
|
function maybeDbUpdate() {
|
||||||
@@ -222,6 +222,7 @@ class Initializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setupHooks() {
|
function setupHooks() {
|
||||||
|
if(!defined(self::INITILIAZED)) return;
|
||||||
try {
|
try {
|
||||||
$hooks = new Hooks();
|
$hooks = new Hooks();
|
||||||
$hooks->init();
|
$hooks->init();
|
||||||
|
Reference in New Issue
Block a user