← All changes
|
includes/admin/settings/wppm_set_page_settings.php
+28
-24
5.0.0
→
6.0.6
View file →
| @@ -1,24 +1,28 @@ | ||
| 1 | -<?php | |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | - exit; // Exit if accessed directly | |
| 4 | -} | |
| 5 | - | |
| 6 | -global $current_user,$wppmfunction; | |
| 7 | -if (!($current_user->ID && $current_user->has_cap('manage_options') || ($current_user->ID && $current_user->has_cap('wppm_admin')))) { | |
| 8 | - exit; | |
| 9 | -} | |
| 10 | -if ( check_ajax_referer( 'wppm_set_page_settings', '_ajax_nonce', false ) != 1 ) { | |
| 11 | - wp_send_json_error( 'Unauthorised request!', 401 ); | |
| 12 | -} | |
| 13 | - | |
| 14 | -$page_settings = apply_filters( | |
| 15 | - 'wppm_set_page_settings', | |
| 16 | - array( | |
| 17 | - 'task-url-page' => isset( $_POST['task-url-page'] ) ? intval( $_POST['task-url-page'] ) : 0, | |
| 18 | - 'project-url-page' => isset( $_POST['project-url-page'] ) ? intval( $_POST['project-url-page'] ) : 0 | |
| 19 | - ) | |
| 20 | -); | |
| 21 | -update_option( 'wppm-page-settings', $page_settings ); | |
| 22 | -do_action('wppm_set_page_settings'); | |
| 23 | - | |
| 24 | -echo '{ "sucess_status":"1","messege":"'.__('Settings saved.','taskbuilder').'" }'; | |
| 1 | +<?php | |
| 2 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | + exit; // Exit if accessed directly | |
| 4 | +} | |
| 5 | + | |
| 6 | +global $current_user,$wppmfunction; | |
| 7 | +if (!($current_user->ID && $current_user->has_cap('manage_options') || ($current_user->ID && $current_user->has_cap('wppm_admin')))) { | |
| 8 | + exit; | |
| 9 | +} | |
| 10 | +if ( check_ajax_referer( 'wppm_set_page_settings', '_ajax_nonce', false ) != 1 ) { | |
| 11 | + wp_send_json_error( 'Unauthorised request!', 401 ); | |
| 12 | +} | |
| 13 | + | |
| 14 | +$page_settings = apply_filters( | |
| 15 | + 'wppm_set_page_settings', | |
| 16 | + array( | |
| 17 | + 'task-url-page' => isset( $_POST['task-url-page'] ) ? intval( $_POST['task-url-page'] ) : 0, | |
| 18 | + 'project-url-page' => isset( $_POST['project-url-page'] ) ? intval( $_POST['project-url-page'] ) : 0 | |
| 19 | + ) | |
| 20 | +); | |
| 21 | +update_option( 'wppm-page-settings', $page_settings ); | |
| 22 | +do_action('wppm_set_page_settings'); | |
| 23 | + | |
| 24 | +echo wp_json_encode( array( | |
| 25 | + 'sucess_status' => 1, | |
| 26 | + 'messege' => esc_html__( 'Settings saved.', 'taskbuilder' ), | |
| 27 | +) ); | |
| 28 | +wp_die(); | |