-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwpcampus-network.php
More file actions
193 lines (168 loc) · 4.47 KB
/
wpcampus-network.php
File metadata and controls
193 lines (168 loc) · 4.47 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<?php
/**
* Plugin Name: WPCampus: Network
* Plugin URI: https://wpcampus.org
* Description: Manages network-wide functionality for the WPCampus network of sites.
* Version: 1.0.0
* Author: WPCampus
* Author URI: https://wpcampus.org
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: wpcampus-network
* Domain Path: /languages
*/
defined( 'ABSPATH' ) or die();
/**
* Load plugin files.
*
* @since 1.0.0
*/
$plugin_dir = plugin_dir_path( __FILE__ );
require_once $plugin_dir . 'inc/class-wpcampus-network.php';
require_once $plugin_dir . 'inc/class-wpcampus-network-global.php';
require_once $plugin_dir . 'inc/class-wpcampus-network-analytics.php';
require_once $plugin_dir . 'inc/wpcampus-forms.php';
if ( is_admin() ) {
require_once $plugin_dir . 'inc/class-wpcampus-network-admin.php';
}
/**
* Only certain people can see the site
* while we set things up.
*
* Using a lower priority 'parse_request'
* because that's where 'REST_REQUEST' is defined.
*
* @TODO:
* - Remove before launch.
add_action( 'parse_request', function() {
// Ignore on the login page.
if ( 'wp-login.php' == $GLOBALS['pagenow'] ) {
return;
}
// Ignore on the REST API. We need for Printful.
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
return;
}
// For login.
if ( ! is_user_logged_in() ) {
auth_redirect();
}
// Only certain users can view.
if ( ! current_user_can( 'manage_wpcampus_shop' ) ) {
wp_safe_redirect( 'https://wpcampus.org' );
exit;
}
}, 100 );*/
/**
* Returns the instance of our main WPCampus_Network class.
*
* Will come in handy when we need to access the
* class to retrieve data throughout the plugin.
*
* @return WPCampus_Network
*/
function wpcampus_network() {
return WPCampus_Network::instance();
}
/**
* Helper functions.
*/
function wpcampus_get_network_site_url() {
return wpcampus_network()->get_network_site_url();
}
/**
* Interact with network components.
*/
function wpcampus_network_enable( $comp ) {
wpcampus_network()->enable( $comp );
}
function wpcampus_network_disable( $comp ) {
wpcampus_network()->disable( $comp );
}
/**
* Interact with the banner.
*/
function wpcampus_get_network_banner() {
return wpcampus_network()->get_network_banner();
}
function wpcampus_print_network_banner( $args = array() ) {
wpcampus_network()->print_network_banner( $args );
}
/**
* Interact with the notifications.
*/
function wpcampus_get_network_notifications() {
return wpcampus_network()->get_network_notifications();
}
function wpcampus_print_network_notifications() {
wpcampus_network()->print_network_notifications();
}
/**
* Interact with the callout.
*/
function wpcampus_get_network_callout() {
return wpcampus_network()->get_callout();
}
function wpcampus_print_network_callout() {
wpcampus_network()->print_callout();
}
/**
* Interact with the Code of Conduct.
*/
function wpcampus_get_network_coc() {
return wpcampus_network()->get_code_of_conduct_container();
}
function wpcampus_print_network_coc() {
wpcampus_network()->print_code_of_conduct_container();
}
/**
* Interact with the footer.
*/
function wpcampus_get_network_footer() {
return wpcampus_network()->get_network_footer();
}
function wpcampus_print_network_footer() {
wpcampus_network()->print_network_footer();
}
/**
* Interact with the MailChimp signup.
*/
function wpcampus_print_mailchimp_signup() {
wpcampus_network()->print_mailchimp_signup();
}
/**
* Print our sessions.
*/
function wpcampus_print_sessions() {
wpcampus_network()->print_sessions();
}
/**
* Get markup for the watch videos page.
*/
function wpcampus_print_watch_filters( $videos_id, $args = array() ) {
wpcampus_network()->print_watch_filters( $videos_id, $args );
}
function wpcampus_print_watch_videos( $html_id, $args = array() ) {
wpcampus_network()->print_watch_videos( $html_id, $args );
}
/**
* Interact with social media.
*/
function wpcampus_print_social_media_icons( $args = [] ) {
wpcampus_network()->print_social_media_icons( $args );
}
/**
* Help users log in and out.
*/
function wpcampus_get_login_form( $args = array() ) {
return wpcampus_network()->get_login_form( $args );
}
function wpcampus_print_login_form( $args = array() ) {
wpcampus_network()->print_login_form( $args );
}
function wpcampus_get_current_rest_route() {
return wpcampus_network()->get_current_rest_route();
}
function wpcampus_add_header_nocache() {
return wpcampus_network()->add_header_nocache();
}