← All changes
|
includes/admin/tasks/open_task/wppm_edit_task_thread.php
+90
-66
1.0.2
→
6.0.6
View file →
| @@ -1,66 +1,90 @@ | ||
| 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); | |
| 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']) ? absint(sanitize_text_field(wp_unslash($_POST['comment_id']))) : '' ; | |
| 8 | +$task_id = isset($_POST['task_id']) ? absint(sanitize_text_field(wp_unslash($_POST['task_id']))) : '' ; | |
| 9 | +$proj_id = isset($_POST['proj_id']) ? absint(sanitize_text_field(wp_unslash($_POST['proj_id']))) : '' ; | |
| 10 | +$task_data = $wppmfunction->get_task($task_id); | |
| 11 | +$task_comment = $wppmfunction->get_task_comment($comment_id); | |
| 12 | +$settings = get_option("wppm-ap-modal"); | |
| 13 | +$wppm_rich_text_editor = get_option('wppm_rich_text_editor'); | |
| 14 | +$wppm_toolbar_actions = get_option('wppm_toolbar_actions'); | |
| 15 | +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;} | |
| 16 | +ob_start(); | |
| 17 | +?> | |
| 18 | +<form id="frm_edit_task_thread" method="post"> | |
| 19 | + <div> | |
| 20 | + <textarea id="wppm_edit_task_thread_editor"> | |
| 21 | + <?php echo !empty($task_comment['body']) ? wp_kses_post(wpautop($task_comment['body'])) : ''; ?> | |
| 22 | + </textarea> | |
| 23 | + </div> | |
| 24 | + <input type="hidden" name="action" value="wppm_set_edit_task_thread" /> | |
| 25 | + <input type="hidden" name="_ajax_nonce" value="<?php echo esc_attr( wp_create_nonce( 'wppm_set_edit_task_thread' ) ); ?>"> | |
| 26 | + <input type="hidden" id="wppm_task_id" name="task_id" value="<?php echo (esc_attr($task_id)) ?>" /> | |
| 27 | + <input type="hidden" id="wppm_comment_id" name="comment_id" value="<?php echo (esc_attr($comment_id)) ?>" /> | |
| 28 | +</form> | |
| 29 | +<script> | |
| 30 | +jQuery( document ).ready( function( jQuery ) { <?php | |
| 31 | + if((!empty($wppm_rich_text_editor)) && ($wppm_rich_text_editor == 1)){ | |
| 32 | + $bold = (isset($wppm_toolbar_actions['bold']) && $wppm_toolbar_actions['bold']==1)? 'bold' :""; | |
| 33 | + $italic = (isset($wppm_toolbar_actions['italic']) && $wppm_toolbar_actions['italic']==1)? 'italic' :""; | |
| 34 | + $underline = (isset($wppm_toolbar_actions['underline']) && $wppm_toolbar_actions['underline']==1)?'underline' :""; | |
| 35 | + $blockquote = (isset($wppm_toolbar_actions['blockquote']) && $wppm_toolbar_actions['blockquote']==1)? 'blockquote' :""; | |
| 36 | + $align = (isset($wppm_toolbar_actions['align']) && $wppm_toolbar_actions['align']==1)? ' alignleft aligncenter alignright ' :""; | |
| 37 | + $bullist = (isset($wppm_toolbar_actions['bullist']) && $wppm_toolbar_actions['bullist']==1)? $bullist = 'bullist' :""; | |
| 38 | + $numlist = (isset($wppm_toolbar_actions['numlist']) && $wppm_toolbar_actions['numlist']==1)? $numlist = 'numlist' :""; | |
| 39 | + $rtl = (isset($wppm_toolbar_actions['rtl']) && $wppm_toolbar_actions['rtl']==1)? $rtl = 'rtl' :""; | |
| 40 | + $link = (isset($wppm_toolbar_actions['link']) && $wppm_toolbar_actions['link']==1)? $link = 'link' :""; | |
| 41 | + $image = (isset($wppm_toolbar_actions['wppm_insert_editor_img']) && $wppm_toolbar_actions['wppm_insert_editor_img']==1)? $image = 'image' :""; | |
| 42 | + $forecolor = (isset($wppm_toolbar_actions['forecolor']) && $wppm_toolbar_actions['forecolor']==1)? $forecolor = 'forecolor' :""; | |
| 43 | + $backcolor = (isset($wppm_toolbar_actions['backcolor']) && $wppm_toolbar_actions['backcolor']==1)? $backcolor = 'backcolor' :""; | |
| 44 | + $strikethrough = (isset($wppm_toolbar_actions['strikethrough']) && $wppm_toolbar_actions['strikethrough']==1)? $strikethrough = 'strikethrough' :""; | |
| 45 | + $toolbar = trim("$bold $italic $underline $blockquote | $align | $bullist $numlist | $rtl | $link $image | $forecolor $backcolor $strikethrough");?> | |
| 46 | + tinymce.remove(); | |
| 47 | + tinymce.init({ | |
| 48 | + selector:'#wppm_edit_task_thread_editor', | |
| 49 | + body_id: 'wppm_edit_task_thread_editor', | |
| 50 | + directionality : '<?php //echo 'rtl'; ?>', | |
| 51 | + menubar: false, | |
| 52 | + statusbar: false, | |
| 53 | + height : '200', | |
| 54 | + width : '100%', | |
| 55 | + plugins: [ | |
| 56 | + 'lists link image directionality' | |
| 57 | + ], | |
| 58 | + image_advtab: true, | |
| 59 | + toolbar: '<?php echo esc_js( $toolbar ); ?>', | |
| 60 | + branding: false, | |
| 61 | + autoresize_bottom_margin: 20, | |
| 62 | + browser_spellcheck : true, | |
| 63 | + relative_urls : false, | |
| 64 | + remove_script_host : false, | |
| 65 | + convert_urls : true, | |
| 66 | + content_style: | |
| 67 | + `body { | |
| 68 | + color:<?php echo esc_attr( $settings['body-text-color'])?>!important; | |
| 69 | + }`, | |
| 70 | + setup: function (editor) { | |
| 71 | + } | |
| 72 | + }); | |
| 73 | + <?php } ?> | |
| 74 | + }); | |
| 75 | +<?php | |
| 76 | +$body = ob_get_clean(); | |
| 77 | + | |
| 78 | +ob_start(); | |
| 79 | +?> | |
| 80 | +<button type="button" class="btn <?php echo ($proj_id!=0)?'wppm_modal_close':'wppm_task_modal_close'?>" onclick="<?php echo ($proj_id!=0)?'wppm_modal_close();':'wppm_task_modal_close();'?>"><?php echo esc_html_e('Close','taskbuilder');?></button> | |
| 81 | +<button type="button" class="btn <?php echo ($proj_id!=0)?'wppm_popup_action':'wppm_task_popup_action'?>" onclick="wppm_set_edit_task_thread(<?php echo (esc_js($task_id))?>,<?php echo esc_js($proj_id) ?>);"><?php echo esc_html_e('Save','taskbuilder');?></button> | |
| 82 | +<?php | |
| 83 | +$footer = ob_get_clean(); | |
| 84 | + | |
| 85 | +$output = array( | |
| 86 | + 'body' => $body, | |
| 87 | + 'footer' => $footer | |
| 88 | +); | |
| 89 | + | |
| 90 | +echo wp_json_encode($output); | |