class-affiliates-settings-network.php
3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
/**
* class-affiliates-settings-network.php
*
* Copyright (c) 2010 - 2015 "kento" Karim Rahimpur www.itthinx.com
*
* This code is released under the GNU General Public License.
* See COPYRIGHT.txt and LICENSE.txt.
*
* This code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This header and all notices must be kept intact.
*
* @author Karim Rahimpur
* @package affiliates
* @since affiliates 2.8.0
*/
if ( !defined( 'ABSPATH' ) ) {
exit;
}
define( 'AFFILIATES_MS_ADMIN_SETTINGS_NONCE', 'aff_ms_settings_nonce' );
/**
* Settings admin section.
*/
class Affiliates_Settings_Network {
/**
* Settings initialization.
*/
public static function init() {
}
/**
* Network options.
*/
public static function network_admin_settings() {
global $wp, $wpdb, $affiliates_options, $wp_roles;
if ( !current_user_can( AFFILIATES_ADMINISTER_OPTIONS ) ) {
wp_die( __( 'Access denied.', AFFILIATES_PLUGIN_DOMAIN ) );
}
echo '<h1>' . __( 'Affiliates', AFFILIATES_PLUGIN_DOMAIN ) . '</h1>';
if ( affiliates_is_sitewide_plugin() ) {
if ( isset( $_POST['submit'] ) ) {
if ( wp_verify_nonce( $_POST[AFFILIATES_MS_ADMIN_SETTINGS_NONCE], 'admin' ) ) {
if ( !empty( $_POST['delete-network-data'] ) ) {
update_option( 'aff_delete_network_data', true );
} else {
update_option( 'aff_delete_network_data', false );
}
}
}
$delete_network_data = get_option( 'aff_delete_network_data', false );
echo
'<form action="" name="options" method="post">' .
'<div>' .
'<h3>' . __( 'Affiliates network data', AFFILIATES_PLUGIN_DOMAIN ) . '</h3>' .
'<p>' .
'<input name="delete-network-data" type="checkbox" ' . ( $delete_network_data ? 'checked="checked"' : '' ) . '/>' .
'<label for="delete-network-data">' . __( 'Delete all affiliate data on network deactivation', AFFILIATES_PLUGIN_DOMAIN ) . '</label>' .
'</p>' .
'<p class="description warning">' .
__( 'READ AND UNDERSTAND the following before activating this option:', AFFILIATES_PLUGIN_DOMAIN ) .
'</p>' .
'<ol class="description warning">' .
'<li>' . __( 'CAUTION: If this option is active while the plugin is network deactivated, <strong>ALL affiliate and referral data will be DELETED on all sites of the network</strong>.', AFFILIATES_PLUGIN_DOMAIN ) . '</li>' .
'<li>' . __( 'This option should only be used to clean up after testing.', AFFILIATES_PLUGIN_DOMAIN ) . '</li>' .
'<li>' . __( 'Make sure to back up your data or do not enable this option.', AFFILIATES_PLUGIN_DOMAIN ) . '</li>' .
'<li>' . __( 'By enabling this option you agree to be solely responsible for any loss of data or any other consequences thereof.', AFFILIATES_PLUGIN_DOMAIN ) . '</li>' .
'</ol>' .
'<p>' .
wp_nonce_field( 'admin', AFFILIATES_MS_ADMIN_SETTINGS_NONCE, true, false ) .
'<input class="button button-primary" type="submit" name="submit" value="' . __( 'Save', AFFILIATES_PLUGIN_DOMAIN ) . '"/>' .
'</p>' .
'</div>' .
'</form>';
}
}
}
Affiliates_Settings_Network::init();