added welcome page

This commit is contained in:
Jonathan Labreuille
2015-11-13 12:59:49 +01:00
parent 10a20935c3
commit f6ab0050b2
2 changed files with 47 additions and 20 deletions

View File

@ -100,6 +100,7 @@ class Menu {
function registered_pages() {
global $_registered_pages;
$pages = array(
'mailpoet-welcome' => array($this, 'welcome'),
'mailpoet-form-editor' => array($this, 'formEditor'),
'mailpoet-newsletter-editor' => array($this, 'newletterEditor')
);
@ -117,26 +118,16 @@ class Menu {
echo $this->renderer->render('index.html', $data);
}
function welcome() {
$data = array(
'settings' => Setting::getAll(),
'current_user' => wp_get_current_user()
);
echo $this->renderer->render('welcome.html', $data);
}
function settings() {
// flags (available features on WP install)
$flags = array();
if(is_multisite()) {
// get multisite registration option
$registration = apply_filters(
'wpmu_registration_enabled',
get_site_option('registration', 'all')
);
// check if users can register
$flags['registration_enabled'] =
!(in_array($registration, array('none', 'blog')));
} else {
// check if users can register
$flags['registration_enabled'] =
(bool)get_option('users_can_register', false);
}
$settings = Setting::getAll();
// dkim: check if public/private keys have been generated
@ -158,7 +149,7 @@ class Menu {
'settings' => $settings,
'segments' => Segment::getPublished()->findArray(),
'pages' => Pages::getAll(),
'flags' => $flags,
'flags' => $this->_getFlags(),
'charsets' => Charsets::getAll(),
'current_user' => wp_get_current_user(),
'permissions' => Permissions::getAll(),
@ -171,6 +162,29 @@ class Menu {
echo $this->renderer->render('settings.html', $data);
}
private function _getFlags() {
// flags (available features on WP install)
$flags = array();
if(is_multisite()) {
// get multisite registration option
$registration = apply_filters(
'wpmu_registration_enabled',
get_site_option('registration', 'all')
);
// check if users can register
$flags['registration_enabled'] =
!(in_array($registration, array('none', 'blog')));
} else {
// check if users can register
$flags['registration_enabled'] =
(bool)get_option('users_can_register', false);
}
return $flags;
}
function subscribers() {
$data = array();

13
views/welcome.html Normal file
View File

@ -0,0 +1,13 @@
<% extends 'layout.html' %>
<% block content %>
<div id="mailpoet_welcome">
<h2><%= __('Welcome welcome welcome!') %></h2>
<h3>Settings:</h3>
<%= dump(settings) %>
<h3>Current user:</h3>
<%= dump(current_user) %>
</div>
<% endblock %>