function form() { global $user_ID; $token = fep_create_nonce('add_announcement'); $message_title = isset($_REQUEST['message_title']) ? esc_html($_REQUEST['message_title']) : ''; $message_content = isset($_REQUEST['message_content']) ? esc_textarea($_REQUEST['message_content']) : ''; $form = "<form action='" . fep_action_url('addannouncement') . "' method='post' enctype='multipart/form-data'>\r\n " . __("Subject", 'fep') . ":<br/>\r\n <input type='text' name='message_title' value='{$message_title}' /><br/>"; ob_start(); do_action('fep_announcement_form_before_content'); echo __("Message", 'fep') . ":<br/>"; if ('wp_editor' == fep_get_option('editor_type') || current_user_can('manage_options')) { wp_editor($message_content, 'message_content', array('teeny' => false, 'media_buttons' => false, 'textarea_rows' => 8)); } elseif ('teeny' == fep_get_option('editor_type', 'teeny')) { wp_editor($message_content, 'message_content', array('teeny' => true, 'media_buttons' => false, 'textarea_rows' => 8)); } else { echo "<textarea name='message_content' placeholder='Message Content'>{$message_content}</textarea>"; } do_action('fep_announcement_form_after_content'); $form .= ob_get_contents(); ob_end_clean(); $form .= "<input type='hidden' name='message_from' value='{$user_ID}' />\r\n\t <input type='hidden' name='token' value='{$token}' /><br/>\r\n <input type='submit' name='add-announcement' value='" . __("Submit", 'fep') . "' />\r\n </form>"; return $form; }
function fep_createPage() { $token = fep_create_nonce('fep-create-page'); $form = "<p>\r\n <form action='" . admin_url('admin.php?page=fep-instruction') . "' method='post'>\r\n " . __("Title of \"Front End PM\" Page", 'fep') . ":<br/>\r\n <input type='text' name='fep-create-page-title' value='' /><br/>\r\n\t <strong>" . __("Slug", 'fep') . "</strong>: <em>" . __("If blank, slug will be automatically created based on Title", 'fep') . "</em><br/>\r\n <input type='text' name='fep-create-page-slug' value='' /><br/>\r\n\t <input type='hidden' name='token' value='{$token}' /><br/>\r\n <input class='button-primary' type='submit' name='fep-create-page' value='" . __("Create Page", 'fep') . "' />\r\n </form></p>"; return $form; }
function fep_reply_form($args = '') { global $user_ID; $defaults = array('message_from' => $user_ID, 'message_to' => '', 'message_top' => '', 'message_title' => '', 'parent_id' => 0, 'token' => fep_create_nonce('new_message')); $args = wp_parse_args($args, $defaults); $reply_form = "\r\n <p><strong>" . __("Add Reply", 'fep') . ":</strong></p>\r\n <form action='" . fep_action_url('checkmessage') . "' method='post' enctype='multipart/form-data'><br/>"; ob_start(); do_action('fep_reply_form_before_content'); if ('wp_editor' == fep_get_option('editor_type') || current_user_can('manage_options')) { wp_editor('', 'message_content', array('teeny' => false, 'media_buttons' => false)); } elseif ('teeny' == fep_get_option('editor_type', 'teeny')) { wp_editor('', 'message_content', array('teeny' => true, 'media_buttons' => false)); } else { echo "<textarea name='message_content' placeholder='" . __('Message Content', 'fep') . "'></textarea>"; } do_action('fep_reply_form_after_content'); $reply_form .= ob_get_contents(); ob_end_clean(); $reply_form .= "\r\n <input type='hidden' name='message_to' value='" . $args['message_to'] . "' />\r\n\t <input type='hidden' name='message_top' value='" . $args['message_top'] . "' />\r\n <input type='hidden' name='message_title' value='" . $args['message_title'] . "' />\r\n <input type='hidden' name='message_from' value='" . $args['message_from'] . "' />\r\n <input type='hidden' name='parent_id' value='" . $args['parent_id'] . "' />\r\n\t <input type='hidden' name='token' value='" . $args['token'] . "' /><br/>\r\n <input type='submit' name='new_message' value='" . __("Send Message", 'fep') . "' />\r\n </form>"; return apply_filters('fep_reply_form', $reply_form); }
function display_attachment($message_id) { $attachment = fep_get_message_meta($message_id, 'attachment'); $token = fep_create_nonce('download'); if ($attachment) { echo "<hr /><strong>" . __("Attachment", 'fep') . ":</strong><br />"; foreach ($attachment as $meta) { $unserialized_file = maybe_unserialize($meta->field_value); if ($unserialized_file['type'] && $unserialized_file['url'] && $unserialized_file['file']) { $attachment_id = $meta->meta_id; echo "<a href='" . fep_action_url("download&id={$attachment_id}&token={$token}") . "' title='Download " . basename($unserialized_file['url']) . "'>" . basename($unserialized_file['url']) . "</a><br />"; } } } }
function delete_url($del_url, $id) { if (current_user_can('manage_options')) { $token = fep_create_nonce('delete_message_admin'); $del_url = fep_action_url("deletemessageadmin&id={$id}&token={$token}"); } return $del_url; }
function new_message() { global $user_ID; $token = fep_create_nonce('new_message'); $to = isset($_GET['to']) ? $_GET['to'] : ''; $message_to = isset($_POST['message_to']) ? esc_html($_POST['message_to']) : fep_get_userdata($to, 'user_login'); $message_top = isset($_POST['message_top']) ? esc_html($_POST['message_top']) : fep_get_userdata($to, 'display_name'); $message_title = isset($_REQUEST['message_title']) ? esc_html($_REQUEST['message_title']) : ''; $message_content = isset($_REQUEST['message_content']) ? esc_textarea($_REQUEST['message_content']) : ''; $parent_id = isset($_POST['parent_id']) ? absint($_POST['parent_id']) : 0; $newMsg = "<p><strong>" . __("Create New Message", 'fep') . ":</strong></p>"; $newMsg .= "<form action='" . fep_action_url('checkmessage') . "' method='post' enctype='multipart/form-data'>"; $MgsTo = __("To", 'fep') . ": "; if (fep_get_option('hide_autosuggest') != '1' || current_user_can('manage_options')) { wp_enqueue_script('fep-script'); $MgsTo .= "<noscript>" . __('Username of recipient', 'fep') . "</noscript><br/>"; $MgsTo .= "<input type='hidden' id='fep-message-to' name='message_to' autocomplete='off' value='{$message_to}' />\r\n\t\t<input type='text' id='fep-message-top' name='message_top' placeholder='" . __('Name of recipient', 'fep') . "' autocomplete='off' value='{$message_top}' /><img src='" . FEP_PLUGIN_URL . "images/loading.gif' class='fep-ajax-img' style='display:none;'/><br/>\r\n <div id='fep-result'></div>"; } else { $MgsTo .= "<br/><input type='text' name='message_to' placeholder='" . __('Username of recipient', 'fep') . "' autocomplete='off' value='{$message_to}' /><br/>"; } $newMsg .= apply_filters('fep_message_form_to_filter', $MgsTo); $newMsg .= __("Subject", 'fep') . ":<br/>\r\n <input type='text' name='message_title' placeholder='" . __('Subject', 'fep') . "' maxlength='65' value='{$message_title}' /><br/>"; ob_start(); do_action('fep_message_form_before_content'); echo __("Message", 'fep') . ":<br/>"; if ('wp_editor' == fep_get_option('editor_type') || current_user_can('manage_options')) { wp_editor($message_content, 'message_content', array('teeny' => false, 'media_buttons' => false)); } elseif ('teeny' == fep_get_option('editor_type', 'teeny')) { wp_editor($message_content, 'message_content', array('teeny' => true, 'media_buttons' => false)); } else { echo "<textarea name='message_content' placeholder='" . __('Message Content', 'fep') . "'>{$message_content}</textarea>"; } do_action('fep_message_form_after_content'); $newMsg .= ob_get_contents(); ob_end_clean(); $newMsg .= "<input type='hidden' name='message_from' value='{$user_ID}' />\r\n <input type='hidden' name='parent_id' value='{$parent_id}' />\r\n\t\t<input type='hidden' name='token' value='{$token}' /><br/>\r\n <input type='submit' name='new_message' value='" . __("Send Message", 'fep') . "' />\r\n </form>"; return apply_filters('fep_filter_new_message_form', $newMsg); }
function fep_delete_message_link($pID, $wholeThread) { $token = fep_create_nonce('delete_message'); $del_url = fep_action_url("deletemessage&id={$pID}&token={$token}"); echo "<p><a href='" . apply_filters('fep_delete_message_url', $del_url, $pID) . "' onclick='return confirm(\"" . __('Are you sure?', 'fep') . "\");'>" . __("Delete", 'fep') . "</a></p>"; }