Move old versions code to own class

[MAILPOET-1316]
This commit is contained in:
Pavel Dohnal
2018-05-01 12:18:22 +01:00
parent ea47524cc4
commit df58322f0e
6 changed files with 133 additions and 20 deletions

View File

@@ -138,6 +138,8 @@ class Initializer {
$this->setupPages();
$this->setupPHPVersionWarnings();
do_action('mailpoet_initialized', MAILPOET_VERSION);
} catch(\Exception $e) {
return $this->handleFailedInitialization($e);
@@ -270,6 +272,12 @@ class Initializer {
$exporters->init();
}
function setupPHPVersionWarnings() {
$php_version_warnings = new PHPVersionWarnings();
$warnings = $php_version_warnings->init(phpversion(), Menu::isOnMailPoetAdminPage());
if(is_string($warnings)) echo $warnings;
}
function handleFailedInitialization($exception) {
// check if we are able to add pages at this point
if(function_exists('wp_get_current_user')) {