← All changes
|
includes/admin/settings/wppm_get_edit_priority.php
+50
-50
5.0.0
→
6.0.6
View file →
| @@ -1,50 +1,50 @@ | ||
| 1 | -<?php | |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | - exit; // Exit if accessed directly | |
| 4 | -} | |
| 5 | - | |
| 6 | -global $current_user,$wpdb; | |
| 7 | -if (!($current_user->ID && $current_user->has_cap('manage_options') || ($current_user->ID && $current_user->has_cap('wppm_admin')))) { | |
| 8 | - exit; | |
| 9 | -} | |
| 10 | -$priority_id = isset($_POST) && isset($_POST['priority_id']) ? intval(sanitize_text_field($_POST['priority_id'])) : 0; | |
| 11 | -if (!$priority_id) {exit;} | |
| 12 | -$priority = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}wppm_task_priorities WHERE id = '".esc_sql($priority_id)."' "); | |
| 13 | -ob_start(); | |
| 14 | -?> | |
| 15 | -<div class="form-group"> | |
| 16 | - <label for="wppm_edit_priority_name"><?php echo esc_html_e('Priority Name','taskbuilder');?></label> | |
| 17 | - <p class="help-block"><?php echo esc_html_e('Insert priority name. Please make sure priority name you are entering should not already exist.','taskbuilder');?></p> | |
| 18 | - <input id="wppm_edit_priority_name" class="form-control" name="wppm_edit_priority_name" value="<?php echo esc_attr($priority->name)?>" /> | |
| 19 | -</div> | |
| 20 | -<div class="form-group"> | |
| 21 | - <label for="wppm_edit_priority_color"><?php echo esc_html_e('Color','taskbuilder');?></label> | |
| 22 | - <p class="help-block"><?php echo esc_html_e('Text color of priority.','taskbuilder');?></p> | |
| 23 | - <input id="wppm_edit_priority_color" class="wppm_edit_color_picker" name="wppm_edit_priority_color" value="<?php echo esc_attr($priority->color)?>" /> | |
| 24 | -</div> | |
| 25 | -<div class="form-group"> | |
| 26 | - <label for="wppm_edit_priority_bg_color"><?php echo esc_html_e('Background Color','taskbuilder');?></label> | |
| 27 | - <p class="help-block"><?php echo esc_html_e('Background color of priority.','taskbuilder');?></p> | |
| 28 | - <input id="wppm_edit_priority_bg_color" class="wppm_edit_color_picker" name="wppm_edit_priority_bg_color" value="<?php echo esc_attr($priority->bg_color)?>" /> | |
| 29 | -</div> | |
| 30 | -<script> | |
| 31 | - jQuery(document).ready(function(){ | |
| 32 | - jQuery('.wppm_edit_color_picker').wpColorPicker(); | |
| 33 | - }); | |
| 34 | -</script> | |
| 35 | -<?php | |
| 36 | -$body = ob_get_clean(); | |
| 37 | -ob_start(); | |
| 38 | -?> | |
| 39 | -<button type="button" class="btn wppm_popup_close" onclick="wppm_modal_close();"><?php echo esc_html_e('Close','taskbuilder');?></button> | |
| 40 | -<button type="button" class="btn wppm_popup_action" onclick="wppm_set_edit_priority(<?php echo htmlentities(esc_attr($priority_id))?>);"><?php echo esc_html_e('Submit','taskbuilder');?></button> | |
| 41 | -<input type="hidden" name="_ajax_nonce" value="<?php echo esc_attr( wp_create_nonce( 'wppm_set_edit_priority' ) ); ?>"> | |
| 42 | -<?php | |
| 43 | -$footer = ob_get_clean(); | |
| 44 | - | |
| 45 | -$output = array( | |
| 46 | - 'body' => $body, | |
| 47 | - 'footer' => $footer | |
| 48 | -); | |
| 49 | - | |
| 50 | -echo json_encode($output); | |
| 1 | +<?php | |
| 2 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | + exit; // Exit if accessed directly | |
| 4 | +} | |
| 5 | + | |
| 6 | +global $current_user,$wpdb; | |
| 7 | +if (!($current_user->ID && $current_user->has_cap('manage_options') || ($current_user->ID && $current_user->has_cap('wppm_admin')))) { | |
| 8 | + exit; | |
| 9 | +} | |
| 10 | +$priority_id = isset($_POST) && isset($_POST['priority_id']) ? absint(sanitize_text_field(wp_unslash($_POST['priority_id']))) : 0; | |
| 11 | +if (!$priority_id) {exit;} | |
| 12 | +$priority = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}wppm_task_priorities WHERE id = %d", $priority_id)); | |
| 13 | +ob_start(); | |
| 14 | +?> | |
| 15 | +<div class="form-group"> | |
| 16 | + <label for="wppm_edit_priority_name"><?php echo esc_html_e('Priority Name','taskbuilder');?></label> | |
| 17 | + <p class="help-block"><?php echo esc_html_e('Insert priority name. Please make sure priority name you are entering should not already exist.','taskbuilder');?></p> | |
| 18 | + <input id="wppm_edit_priority_name" class="form-control" name="wppm_edit_priority_name" value="<?php echo esc_attr($priority->name)?>" /> | |
| 19 | +</div> | |
| 20 | +<div class="form-group"> | |
| 21 | + <label for="wppm_edit_priority_color"><?php echo esc_html_e('Color','taskbuilder');?></label> | |
| 22 | + <p class="help-block"><?php echo esc_html_e('Text color of priority.','taskbuilder');?></p> | |
| 23 | + <input id="wppm_edit_priority_color" class="wppm_edit_color_picker" name="wppm_edit_priority_color" value="<?php echo esc_attr($priority->color)?>" /> | |
| 24 | +</div> | |
| 25 | +<div class="form-group"> | |
| 26 | + <label for="wppm_edit_priority_bg_color"><?php echo esc_html_e('Background Color','taskbuilder');?></label> | |
| 27 | + <p class="help-block"><?php echo esc_html_e('Background color of priority.','taskbuilder');?></p> | |
| 28 | + <input id="wppm_edit_priority_bg_color" class="wppm_edit_color_picker" name="wppm_edit_priority_bg_color" value="<?php echo esc_attr($priority->bg_color)?>" /> | |
| 29 | +</div> | |
| 30 | +<script> | |
| 31 | + jQuery(document).ready(function(){ | |
| 32 | + jQuery('.wppm_edit_color_picker').wpColorPicker(); | |
| 33 | + }); | |
| 34 | +</script> | |
| 35 | +<?php | |
| 36 | +$body = ob_get_clean(); | |
| 37 | +ob_start(); | |
| 38 | +?> | |
| 39 | +<button type="button" class="btn wppm_popup_close" onclick="wppm_modal_close();"><?php echo esc_html_e('Close','taskbuilder');?></button> | |
| 40 | +<button type="button" class="btn wppm_popup_action" onclick="wppm_set_edit_priority(<?php echo (esc_attr($priority_id))?>);"><?php echo esc_html_e('Submit','taskbuilder');?></button> | |
| 41 | +<input type="hidden" name="_ajax_nonce" value="<?php echo esc_attr( wp_create_nonce( 'wppm_set_edit_priority' ) ); ?>"> | |
| 42 | +<?php | |
| 43 | +$footer = ob_get_clean(); | |
| 44 | + | |
| 45 | +$output = array( | |
| 46 | + 'body' => $body, | |
| 47 | + 'footer' => $footer | |
| 48 | +); | |
| 49 | + | |
| 50 | +echo wp_json_encode($output); | |