';
echo esc_html__( 'WordPress 4.4 or higher is the required version. Please consider upgrading the WordPress before migrating the cookie categories.', 'cookie-law-info' );
echo '
';
if ( ! empty( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_REQUESTED_WITH'] ) ) ) == 'xmlhttprequest' ) {
exit();
}
} else {
$this->migrate_cookie_terms();
update_option( 'wt_cli_cookie_db_version', '2.0' );
do_action( 'wt_cli_after_cookie_category_migration' );
$redirect_url = admin_url( 'edit-tags.php?taxonomy=cookielawinfo-category&post_type=cookielawinfo' );
wp_safe_redirect( $redirect_url );
}
}
}
}
public function admin_non_necessary_cookie_page() {
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( esc_html__( 'You do not have sufficient permission to perform this operation', 'cookie-law-info' ) );
}
if ( isset( $_POST['update_thirdparty_settings_form'] ) || isset( $_POST['cli_non-necessary_ajax_update'] ) ) {
check_admin_referer( 'cookielawinfo-update-thirdparty' );
$this->update_non_necessary_cookie_settings( $_POST );
$this->finish_request();
}
$settings = $this->get_non_necessary_cookie_settings();
require_once plugin_dir_path( __FILE__ ) . 'views/non-necessary-settings.php';
}
public function admin_necessary_cookie_page() {
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( esc_html__( 'You do not have sufficient permission to perform this operation', 'cookie-law-info' ) );
}
if ( isset( $_POST['update_necessary_settings_form'] ) || isset( $_POST['cli_necessary_ajax_update'] ) ) {
check_admin_referer( 'cookielawinfo-update-necessary' );
$this->update_necessary_cookie_settings( $_POST );
$this->finish_request();
}
$settings = $this->get_necessary_cookie_settings();
require_once plugin_dir_path( __FILE__ ) . 'views/necessary-settings.php';
}
public function update_non_necessary_cookie_settings( $data ) {
$options = array();
$options['thirdparty_title'] = sanitize_text_field( isset( $data['wt_cli_non_necessary_title'] ) ? $data['wt_cli_non_necessary_title'] : '' );
$options['thirdparty_on_field'] = (bool) ( isset( $data['thirdparty_on_field'] ) ? Cookie_Law_Info::sanitise_settings( 'thirdparty_on_field', $data['thirdparty_on_field'] ) : false );
$options['third_party_default_state'] = (bool) ( isset( $data['third_party_default_state'] ) ? Cookie_Law_Info::sanitise_settings( 'third_party_default_state', $data['third_party_default_state'] ) : true );
$options['thirdparty_description'] = wp_kses_post( isset( $data['thirdparty_description'] ) && $data['thirdparty_description'] !== '' ? $data['thirdparty_description'] : '' );
$options['thirdparty_head_section'] = wp_unslash( isset( $data['thirdparty_head_section'] ) && $data['thirdparty_head_section'] !== '' ? $data['thirdparty_head_section'] : '' );
$options['thirdparty_body_section'] = wp_unslash( isset( $data['thirdparty_body_section'] ) && $data['thirdparty_body_section'] !== '' ? $data['thirdparty_body_section'] : '' );
update_option( 'cookielawinfo_thirdparty_settings', $options );
}
public function update_necessary_cookie_settings( $data ) {
$options = array();
$options['necessary_title'] = sanitize_text_field( isset( $data['wt_cli_necessary_title'] ) ? $data['wt_cli_necessary_title'] : '' );
$options['necessary_description'] = wp_kses_post( isset( $data['necessary_description'] ) && $data['necessary_description'] !== '' ? $data['necessary_description'] : '' );
update_option( 'cookielawinfo_necessary_settings', $options );
}
public function finish_request() {
echo '