options['track']; $email['token'] = $this->get_token(); $email['type'] = 'message'; $email['send_on'] = time(); $email['editor'] = NewsletterEmails::EDITOR_HTML; $email['message'] = "\n\n\nYour email title\n\n\n\n"; $email = Newsletter::instance()->save_email($email); $controls->js_redirect($this->get_editor_url($email->id, $email->editor)); return; } $theme = $this->themes->get_theme($theme_id); // Should never happen if (!$theme) { die('Invalid theme'); } if (!file_exists($theme['dir'] . '/theme-options.php') && check_admin_referer('newsletter-new')) { $email = array(); $email['status'] = 'new'; $email['subject'] = __('Here the email subject', 'newsletter'); $email['track'] = Newsletter::instance()->options['track']; $email['token'] = $this->get_token(); $email['type'] = 'message'; $email['send_on'] = time(); $email['editor'] = NewsletterEmails::EDITOR_TINYMCE; $theme_options = $this->themes->get_options($controls->data['theme']); $theme_url = $theme['url']; $theme_subject = ''; ob_start(); include $theme['dir'] . '/theme.php'; $email['message'] = ob_get_clean(); if (!empty($theme_subject)) { $email['subject'] = $theme_subject; } if (file_exists($theme['dir'] . '/theme-text.php')) { ob_start(); include $theme['dir'] . '/theme-text.php'; $email['message_text'] = ob_get_clean(); } else { $email['message_text'] = 'You need a modern email client to read this email. Read it online: {email_url}.'; } $email = Newsletter::instance()->save_email($email); $controls->js_redirect($this->get_editor_url($email->id, $email->editor)); return; } if ($controls->is_action('refresh')) { $this->themes->save_options($theme_id, $controls->data); } if ($controls->is_action('create')) { $this->themes->save_options($theme_id, $controls->data); $email = array(); $email['status'] = 'new'; $email['subject'] = __('Here the email subject', 'newsletter'); $email['track'] = Newsletter::instance()->options['track']; $email['message_text'] = ''; $email['type'] = 'message'; $email['send_on'] = time(); $email['editor'] = NewsletterEmails::EDITOR_TINYMCE; $theme_options = $this->themes->get_options($theme_id); $theme_url = $theme['url']; $theme_subject = ''; ob_start(); include $theme['dir'] . '/theme.php'; $email['message'] = ob_get_clean(); if (!empty($theme_subject)) { $email['subject'] = $theme_subject; } if (is_file($theme['dir'] . '/theme-text.php')) { ob_start(); include $theme['dir'] . '/theme-text.php'; $email['message_text'] = ob_get_clean(); } $email = $this->save_email($email); $controls->js_redirect($this->get_editor_url($email->id, $email->editor)); return; } else { $controls->data = $this->themes->get_options($theme_id); $controls->data['id'] = $theme_id; } ?>


Theme options are saved for next time you'll use this theme.

init(); ?> hidden('id'); ?>
button_primary('refresh', __('Refresh the preview', 'newsletter')); ?>
button_primary('create', 'Proceed to edit »', 'this.form.action=\'' . home_url('/', is_ssl() ? 'https' : 'http') . '?na=emails-create\';this.form.submit()'); ?>