/** * @since 1.0.0 */ public function form_handler() { if (!empty($_POST['stylify_button'])) { $status = $this->stylify->refresh(); $message = is_wp_error($status) ? $status->get_error_message() : __('Colors updated.', 'Postmatic'); $class = is_wp_error($status) ? 'error' : 'updated'; Prompt_Core::$options->set('site_styles', $this->stylify->get_styles()); $this->add_notice($message, $class); return; } if (!empty($_POST['reset_site_styles_button'])) { Prompt_Core::$options->set('site_styles', array()); $this->stylify = new Prompt_Stylify(array()); $this->add_notice(__('Colors set to defaults.', 'Postmatic')); return; } if (!empty($_POST['send_test_email_button'])) { $to_address = sanitize_email($_POST['test_email_address']); if (!is_email($to_address)) { $this->add_notice(__('Test email was <strong>not sent</strong> to an invalid address.', 'Postmatic'), 'error'); return; } $html_template = new Prompt_Template('test-email.php'); $footnote = __('This is a test email sent by Postmatic. It is solely for demonstrating the Postmatic template and is not replyable. Also, that is not latin. <a href="https://en.wikipedia.org/wiki/Lorem_ipsum">It is Lorem ipsum</a>.', 'Postmatic'); $batch = new Prompt_Email_Batch(array('subject' => __('This is a test email. By Postmatic.', 'Postmatic'), 'html_content' => $html_template->render(), 'message_type' => Prompt_Enum_Message_Types::ADMIN, 'footnote_html' => $footnote, 'footnote_text' => $footnote)); $batch->add_individual_message_values(array('to_address' => $to_address)); if (!is_wp_error(Prompt_Factory::make_mailer($batch)->send())) { $this->add_notice(__('Test email <strong>sent</strong>.', 'Postmatic')); return; } } parent::form_handler(); }
/** * Create tabs and process any tab-submitted data. * * @since 1.4.0 * * @return bool whether submitted tab data was processed */ protected function process_tabs() { if (is_null($this->tabs)) { $this->add_tabs(); } $did_updates = false; $submitted_tab_slug = isset($_POST['tab']) ? $_POST['tab'] : null; if ($submitted_tab_slug) { $this->submitted_tab = $this->tabs[$submitted_tab_slug]; $this->submitted_tab->form_handler(); $this->reset_key(); // in case a new key was saved $did_updates = true; } return $did_updates; }
/** * * @since 2.0.0 * * @param bool|string $options * @param array|null $overridden_options */ public function __construct($options, $overridden_options = null) { parent::__construct($options, $overridden_options); }