/** * Sends plain-text email, inserting the System Info * * @since 1.0 * * @return void */ static function send_email() { global $current_user; if (isset($_POST['send-system-info-email-address']) && isset($_POST['send-system-info-email-subject']) && isset($_POST['send-system-info-email-message'])) { if (!empty($_POST['send-system-info-email-address'])) { $address = $_POST['send-system-info-email-address']; } else { return 'error'; } if (!empty($_POST['send-system-info-email-subject'])) { $subject = $_POST['send-system-info-email-subject']; } else { return 'error'; } if (!empty($_POST['send-system-info-email-message'])) { $message = $_POST['send-system-info-email-message']; } else { $message = '- System Info Message -'; } get_currentuserinfo(); $headers = array('From: ' . $current_user->display_name . ' <' . $current_user->user_email . '>', 'Reply-To: ' . $current_user->user_email); // Insert System Info into email $message .= "\r\n\r\n---------------\r\n\r\n" . Send_System_Info_Plugin::display(); $sent = wp_mail($address, $subject, $message, $headers); if ($sent) { return 'sent'; } else { return 'error'; } } return false; }
/** * Renders Remote View using $_GET value * * @since 1.0 * @action template_redirect * * @return void */ static function remote_view() { if (!isset($_GET['system_info']) || empty($_GET['system_info'])) { return; } $query_value = $_GET['system_info']; $value = get_option('system_info_remote_url'); echo '<pre>'; if ($query_value == $value) { echo esc_html(Send_System_Info_Plugin::display()); exit; } else { exit('Invalid System Info URL.'); } echo '</pre>'; }