| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly |
| 4 |
} |
| 5 |
|
| 6 |
global $wpdb,$wppmfunction,$current_user; |
| 7 |
$comment_id = isset($_POST['comment_id']) ? intval(sanitize_text_field($_POST['comment_id'])) : '' ; |
| 8 |
$task_id = isset($_POST['task_id']) ? intval(sanitize_text_field($_POST['task_id'])) : '' ; |
| 9 |
$proj_id = isset($_POST['proj_id']) ? intval(sanitize_text_field($_POST['proj_id'])) : '' ; |
| 10 |
$task_data = $wppmfunction->get_task($task_id); |
| 11 |
$task_comment = $wppmfunction->get_task_comment($comment_id); |
| 12 |
if (!(($current_user->ID && $current_user->has_cap('manage_options')) || ($wppmfunction->has_permission('change_task_details',$task_id)) || ($current_user->ID == $task_comment['created_by']))) {exit;} |
| 13 |
ob_start(); |
| 14 |
?> |
| 15 |
<form id="frm_edit_task_thread" method="post"> |
| 16 |
<div> |
| 17 |
<textarea id="wppm_edit_task_thread_editor"> |
| 18 |
<?php echo stripslashes(htmlspecialchars_decode(esc_textarea($task_comment['body']),ENT_QUOTES))?> |
| 19 |
</textarea> |
| 20 |
</div> |
| 21 |
<input type="hidden" name="action" value="wppm_set_edit_task_thread" /> |
| 22 |
<input type="hidden" id="wppm_task_id" name="task_id" value="<?php echo htmlentities(esc_attr($task_id)) ?>" /> |
| 23 |
<input type="hidden" id="wppm_comment_id" name="comment_id" value="<?php echo htmlentities(esc_attr($comment_id)) ?>" /> |
| 24 |
</form> |
| 25 |
<script> |
| 26 |
jQuery( document ).ready( function( jQuery ) { |
| 27 |
tinymce.remove(); |
| 28 |
tinymce.init({ |
| 29 |
selector:'#wppm_edit_task_thread_editor', |
| 30 |
body_id: 'wppm_edit_task_thread_editor', |
| 31 |
directionality : '<?php //echo 'rtl'; ?>', |
| 32 |
menubar: false, |
| 33 |
statusbar: false, |
| 34 |
height : '200', |
| 35 |
width : '100%', |
| 36 |
plugins: [ |
| 37 |
'lists link image directionality' |
| 38 |
], |
| 39 |
image_advtab: true, |
| 40 |
toolbar: 'bold italic underline blockquote | alignleft aligncenter alignright | bullist numlist | rtl | link image', |
| 41 |
branding: false, |
| 42 |
autoresize_bottom_margin: 20, |
| 43 |
browser_spellcheck : true, |
| 44 |
relative_urls : false, |
| 45 |
remove_script_host : false, |
| 46 |
convert_urls : true, |
| 47 |
setup: function (editor) { |
| 48 |
} |
| 49 |
}); |
| 50 |
}); |
| 51 |
<?php |
| 52 |
$body = ob_get_clean(); |
| 53 |
|
| 54 |
ob_start(); |
| 55 |
?> |
| 56 |
<button type="button" class="btn wppm_popup_close" onclick="wppm_modal_close();"><?php echo esc_html_e('Close','taskbuilder');?></button> |
| 57 |
<button type="button" class="btn wppm_popup_action" onclick="wppm_set_edit_task_thread(<?php echo htmlentities(esc_attr($task_id))?>,<?php echo esc_attr($proj_id) ?>);"><?php echo esc_html_e('Save','taskbuilder');?></button> |
| 58 |
<?php |
| 59 |
$footer = ob_get_clean(); |
| 60 |
|
| 61 |
$output = array( |
| 62 |
'body' => $body, |
| 63 |
'footer' => $footer |
| 64 |
); |
| 65 |
|
| 66 |
echo json_encode($output); |