-
Notifications
You must be signed in to change notification settings - Fork 59
/
membership2.php
230 lines (203 loc) · 6.07 KB
/
membership2.php
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<?php
/**
* Plugin Name: Membership 2 Pro
* Plugin URI: https://premium.wpmudev.org/project/membership/
* Version: 1.1.6
* Build Stamp: BUILDTIME
* Description: The most powerful, easy to use and flexible membership plugin for WordPress sites available.
* Author: WPMU DEV
* Author URI: http://premium.wpmudev.org/
* WDP ID: 1003656
* License: GPL2
* License URI: http://opensource.org/licenses/GPL-2.0
* Text Domain: membership2
*
* @package Membership2
*/
/**
* Copyright notice
*
* @copyright Incsub (http://incsub.com/)
*
* Authors: Philipp Stracker, Fabio Jun Onishi, Victor Ivanov, Jack Kitterhing, Rheinard Korf, Ashok Kumar Nath, Paul Kevin
* Contributors: Joji Mori, Patrick Cohen, Panos Lyrakis
*
* @license http://opensource.org/licenses/GPL-2.0 GNU General Public License, version 2 (GPL-2.0)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2, as
* published by the Free Software Foundation.
*
* This program 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
/**
* Initializes constants and create the main plugin object MS_Plugin.
* This function is called *instantly* when this file was loaded.
*
* @since 1.0.0
*/
function membership2_pro_init_app() {
if ( defined( 'MS_PLUGIN' ) ) {
$plugin_name = 'Membership 2 Pro';
if ( is_admin() ) {
// Can happen in Multisite installs where a sub-site has activated the
// plugin and then the plugin is also activated in network-admin.
printf(
'<div class="notice error"><p><strong>%s</strong>: %s</p></div>',
sprintf(
esc_html__( 'Could not load the plugin %s, because another version of the plugin is already loaded', 'membership2' ),
$plugin_name
),
esc_html( MS_PLUGIN . ' (v' . MS_PLUGIN_VERSION . ')' )
);
}
return;
}
/**
* Plugin version
*
* @since 1.0.0
*/
define( 'MS_PLUGIN_VERSION', '1.1.6' );
/**
* Free or pro plugin?
* This only affects some display settings, it does not really lock/unlock
* any premium features...
*
* @since 1.0.3.2
*/
define( 'MS_IS_PRO', true );
/**
* Plugin main-file.
*
* @since 1.0.3.0
*/
define( 'MS_PLUGIN_FILE', __FILE__ );
/**
* Plugin identifier constant.
*
* @since 1.0.0
*/
define( 'MS_PLUGIN', plugin_basename( __FILE__ ) );
/**
* Plugin name dir constant.
*
* @since 1.0.0
*/
define( 'MS_PLUGIN_NAME', dirname( MS_PLUGIN ) );
/**
* Plugin name dir constant.
*
* @since 1.0.3
*/
define( 'MS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
/**
* Plugin base dir
*/
define( 'MS_PLUGIN_BASE_DIR', dirname( __FILE__ ) );
$externals = array(
dirname( __FILE__ ) . '/lib/wpmu-lib/core.php',
dirname( __FILE__ ) . '/lib/wdev-frash/module.php',
dirname( __FILE__ ) . '/lib/wpmudev-dashboard/wpmudev-dash-notification.php'
);
$cta_label = false;
$drip_param = false;
// WPMUDEV Dashboard.
global $wpmudev_notices;
$wpmudev_notices[] = array(
'id' => 1003656,
'name' => 'Membership 2 Pro',
'screens' => array(
'toplevel_page_membership-2',
'membership-2_page_membership2-members',
'membership-2_page_membership2-setup',
'membership-2_page_membership2-billing',
'membership-2_page_membership2-coupons',
'membership-2_page_membership2-addon',
'membership-2_page_membership2-settings',
),
);
foreach ( $externals as $path ) {
if ( file_exists( $path ) ) { require_once $path; }
}
// Register the current plugin, for pro and free plugins!
do_action(
'wdev-register-plugin',
/* Plugin ID */ plugin_basename( __FILE__ ),
/* Plugin Title */ 'Membership 2',
/* https://wordpress.org */ '/plugins/membership/',
/* Email Button CTA */ $cta_label,
/* getdrip Plugin param */ $drip_param
);
/**
* Prepare rating message.
*
* @return string Message to display.
*/
function _membership2_rating_message() {
return __( "Hey %s, you've been using %s for a while now, and we hope you're happy with it.", 'membership2' ) .
'<br />' .
__( "We're constantly working to improve our plugins, and it helps a lot when members just like you share feedback!", 'membership2' );
}
add_filter(
'wdev-rating-message-' . plugin_basename( __FILE__ ),
'_membership2_rating_message'
);
/**
* Translation.
*
* Tip:
* The translation files must have the filename [TEXT-DOMAIN]-[locale].mo
* Example: membership2-en_EN.mo / membership2-de_DE.mo
*/
function _membership2_translate_plugin() {
load_plugin_textdomain(
'membership2',
false,
dirname( plugin_basename( __FILE__ ) ) . '/languages'
);
}
add_action( 'plugins_loaded', '_membership2_translate_plugin' );
if ( (defined( 'WP_DEBUG' ) && WP_DEBUG) || (defined( 'WDEV_DEBUG' ) && WDEV_DEBUG) ) {
// Load development/testing code before the plugin is initialized.
$testfile = dirname( __FILE__ ) . '/tests/wp/init.php';
if ( file_exists( $testfile ) ) { include $testfile; }
}
include MS_PLUGIN_BASE_DIR . '/app/ms-loader.php';
if ( is_dir( MS_PLUGIN_BASE_DIR . '/premium' ) ) {
include MS_PLUGIN_BASE_DIR . '/premium/ms-premium-loader.php';
MS_Premium_Loader::instance();
}
// Initialize the M2 class loader.
$loader = new MS_Loader();
/**
* Create an instance of the plugin object.
*
* This is the primary entry point for the Membership plugin.
*
* @since 1.0.0
*/
MS_Plugin::instance();
/**
* Ajax Logins
*
* @since 1.0.4
*/
MS_Auth::check_ms_ajax();
}
if ( ! function_exists( 'is_plugin_active' ) ) {
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
}
//Deactivate free
if ( is_plugin_active( 'membership/membership.php' ) ) {
deactivate_plugins( array( 'membership/membership.php' ) );
}
membership2_pro_init_app();