| 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 |
$proj_id = isset($_POST['proj_id']) ? intval(sanitize_text_field($_POST['proj_id'])) : '' ; |
| 9 |
$project_data = $wppmfunction->get_project($proj_id); |
| 10 |
$project_comment = $wppmfunction->get_proj_comment($comment_id); |
| 11 |
$settings = get_option("wppm-ap-modal"); |
| 12 |
if (!(($current_user->ID && $current_user->has_cap('manage_options')) || $wppmfunction->has_proj_comment_permission('edit_proj_comment',$proj_id,$comment_id))) {exit;} |
| 13 |
ob_start(); |
| 14 |
?> |
| 15 |
<form id="frm_edit_proj_thread" method="post"> |
| 16 |
<div> |
| 17 |
<textarea id="wppm_edit_proj_thread_editor"> |
| 18 |
<?php echo stripslashes(htmlspecialchars_decode(esc_textarea($project_comment['body']),ENT_QUOTES))?> |
| 19 |
</textarea> |
| 20 |
</div> |
| 21 |
<input type="hidden" name="action" value="wppm_set_edit_proj_thread" /> |
| 22 |
<input type="hidden" name="_ajax_nonce" value="<?php echo esc_attr( wp_create_nonce( 'wppm_set_edit_proj_thread' ) ); ?>"> |
| 23 |
<input type="hidden" id="wppm_proj_id" name="proj_id" value="<?php echo htmlentities(esc_attr($proj_id)) ?>" /> |
| 24 |
<input type="hidden" id="wppm_proj_comment_id" name="proj_comment_id" value="<?php echo htmlentities(esc_attr($comment_id)) ?>" /> |
| 25 |
</form> |
| 26 |
<script> |
| 27 |
jQuery( document ).ready( function( jQuery ) { |
| 28 |
tinymce.remove(); |
| 29 |
tinymce.init({ |
| 30 |
selector:'#wppm_edit_proj_thread_editor', |
| 31 |
body_id: 'wppm_edit_proj_thread_editor', |
| 32 |
directionality : '<?php //echo 'rtl'; ?>', |
| 33 |
menubar: false, |
| 34 |
statusbar: false, |
| 35 |
height : '200', |
| 36 |
width : '100%', |
| 37 |
plugins: [ |
| 38 |
'lists link image directionality' |
| 39 |
], |
| 40 |
image_advtab: true, |
| 41 |
toolbar: 'bold italic underline blockquote | alignleft aligncenter alignright | bullist numlist | rtl | link image', |
| 42 |
branding: false, |
| 43 |
autoresize_bottom_margin: 20, |
| 44 |
browser_spellcheck : true, |
| 45 |
relative_urls : false, |
| 46 |
remove_script_host : false, |
| 47 |
convert_urls : true, |
| 48 |
content_style: |
| 49 |
`body { |
| 50 |
color:<?php echo esc_attr( $settings['body-text-color'])?>!important; |
| 51 |
}`, |
| 52 |
setup: function (editor) { |
| 53 |
} |
| 54 |
}); |
| 55 |
}); |
| 56 |
<?php |
| 57 |
$body = ob_get_clean(); |
| 58 |
|
| 59 |
ob_start(); |
| 60 |
?> |
| 61 |
<button type="button" class="btn wppm_popup_close" onclick="wppm_modal_close();"><?php echo esc_html_e('Close','taskbuilder');?></button> |
| 62 |
<button type="button" class="btn wppm_popup_action" onclick="wppm_set_edit_proj_thread(<?php echo esc_attr($proj_id) ?>);"><?php echo esc_html_e('Save','taskbuilder');?></button> |
| 63 |
<?php |
| 64 |
$footer = ob_get_clean(); |
| 65 |
|
| 66 |
$output = array( |
| 67 |
'body' => $body, |
| 68 |
'footer' => $footer |
| 69 |
); |
| 70 |
|
| 71 |
echo json_encode($output); |