PluginProbe
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions / trunk
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions vtrunk
260909 260829 260814 260805 110710 110731 110812 110815 110912 110913 110915 110926 110927 111002 111003 111011 111017 111029 111105 111206 111216 111220 120213 120219 120301 All 187 releases
s2member / src / includes / classes / constants.inc.php

constants.inc.php in s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions trunk, at src/includes/classes/constants.inc.php

2,457 lines 98.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // @codingStandardsIgnoreFile
3 /**
4 * s2Member's API Constants *(for site owners)*.
5 *
6 * Copyright: © 2009-2011
7 * {@link http://websharks-inc.com/ WebSharks, Inc.}
8 * (coded in the USA)
9 *
10 * Released under the terms of the GNU General Public License.
11 * You should have received a copy of the GNU General Public License,
12 * along with this software. In the main directory, see: /licensing/
13 * If not, see: {@link http://www.gnu.org/licenses/}.
14 *
15 * @package s2Member\API_Constants
16 * @since 3.5
17 */
18 if(!defined('WPINC')) // MUST have WordPress.
19 exit('Do not access this file directly.');
20
21 if(!class_exists('c_ws_plugin__s2member_constants'))
22 {
23 /**
24 * s2Member's API Constants *(for site owners)*.
25 *
26 * @package s2Member\API_Constants
27 * @since 3.5
28 */
29 class c_ws_plugin__s2member_constants
30 {
31 /**
32 * Defines several API Constants for s2Member.
33 *
34 * These are also duplicated into the JavaScript API for s2Member.
35 * Except for a few that would pose a security issue. Such as the PayPal API Credentials;
36 * those are NOT included in the JavaScript API.
37 *
38 * @package s2Member\API_Constants
39 * @since 3.5
40 *
41 * @attaches-to ``add_action('init');``
42 *
43 * @return null
44 */
45 public static function constants()
46 {
47 do_action('ws_plugin__s2member_before_constants', get_defined_vars());
48
49 $c = array(); // Initialize configuration values array.
50
51 $links = c_ws_plugin__s2member_cache::cached_page_links();
52
53 $user = (is_user_logged_in() && is_object($user = wp_get_current_user()) && $user->ID) ? $user : FALSE;
54
55 $level = c_ws_plugin__s2member_user_access::user_access_level($user);
56 $file_downloads = c_ws_plugin__s2member_files::user_downloads($user);
57 $login_redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url($user);
58
59 $custom = ($user) ? (string) get_user_option('s2member_custom', $user->ID) : '';
60 $subscr_id = ($user) ? (string) get_user_option('s2member_subscr_id', $user->ID) : '';
61 $subscr_gateway = ($user) ? (string) get_user_option('s2member_subscr_gateway', $user->ID) : '';
62 $registration_ip = ($user) ? (string) get_user_option('s2member_registration_ip', $user->ID) : '';
63 $custom_fields = ($user) ? (array) get_user_option('s2member_custom_fields', $user->ID) : array();
64 $paid_registration_times = ($user) ? (array) get_user_option('s2member_paid_registration_times', $user->ID) : array();
65 $login_counter = ($user) ? (int) get_user_option('s2member_login_counter') : -1;
66
67 foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
68 do_action('ws_plugin__s2member_during_constants', get_defined_vars());
69 unset($__refs, $__v);
70
71 /**
72 * Current version of s2Member.
73 *
74 * ———— Quick PHP Code Sample ————
75 * ```
76 * <!php echo S2MEMBER_VERSION; !>
77 * ```
78 * ———— Shortcode & JavaScript Equivalents ————
79 * ```
80 * [s2Get constant="S2MEMBER_VERSION" /]
81 *
82 * <script type="text/javascript">
83 * document.write(S2MEMBER_VERSION);
84 * </script>
85 * ```
86 *
87 * @package s2Member\API_Constants
88 * @since 3.5
89 *
90 * @var string
91 *
92 * @see s2Member\WS_PLUGIN__S2MEMBER_VERSION
93 */
94 if(!defined('S2MEMBER_VERSION'))
95 define ('S2MEMBER_VERSION', ($c[] = (string)WS_PLUGIN__S2MEMBER_VERSION));
96
97 /**
98 * The number of times the current User has logged into your site.
99 *
100 * Negative `-1` through number of times logged-in.
101 * Negative `-1` indicates they are NOT logged-in.
102 *
103 * ———— Quick PHP Code Sample ————
104 * ```
105 * <!php echo S2MEMBER_CURRENT_USER_LOGIN_COUNTER; !>
106 * ```
107 * ———— Shortcode & JavaScript Equivalents ————
108 * ```
109 * [s2Get constant="S2MEMBER_CURRENT_USER_LOGIN_COUNTER" /]
110 *
111 * <script type="text/javascript">
112 * document.write(S2MEMBER_CURRENT_USER_LOGIN_COUNTER);
113 * </script>
114 * ```
115 *
116 * @package s2Member\API_Constants
117 * @since 110720
118 *
119 * @var int
120 *
121 * @see s2Member\API_Functions\get_user_field()
122 * @see `get_user_field('s2member_login_counter')`
123 *
124 * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
125 */
126 if(!defined('S2MEMBER_CURRENT_USER_LOGIN_COUNTER'))
127 define ('S2MEMBER_CURRENT_USER_LOGIN_COUNTER', ($c[] = (int)$login_counter));
128
129 /**
130 * Is the current User logged-in at all.
131 *
132 * True if the current User IS logged-in, else false.
133 *
134 * ———— Quick PHP Code Sample ————
135 * ```
136 * <!php
137 * if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN)
138 * echo 'You ARE logged in.';
139 * !>
140 * ```
141 * ———— Shortcode & JavaScript Equivalents ————
142 * ```
143 * [s2If constant(S2MEMBER_CURRENT_USER_IS_LOGGED_IN)]
144 * You ARE logged-in.
145 * [/s2If]
146 *
147 * <script type="text/javascript">
148 * if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN)
149 * document.write('You ARE logged-in.');
150 * </script>
151 * ```
152 *
153 * @package s2Member\API_Constants
154 * @since 3.5
155 *
156 * @var bool
157 *
158 * @see s2Member\API_Functions\is_user_not_logged_in()
159 * @see http://codex.wordpress.org/Function_Reference/is_user_logged_in is_user_logged_in()
160 *
161 * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
162 */
163 if(!defined('S2MEMBER_CURRENT_USER_IS_LOGGED_IN'))
164 define ('S2MEMBER_CURRENT_USER_IS_LOGGED_IN', ($c[] = (($user) ? TRUE : FALSE)));
165
166 /**
167 * Is the current User logged-in as a Member.
168 *
169 * True if the current User IS logged-in with a Membership Level greater than `0`, else false.
170 *
171 * ———— Quick PHP Code Sample ————
172 * ```
173 * <!php
174 * if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER)
175 * echo 'You ARE logged in at Level #1 or higher.';
176 * !>
177 * ```
178 * ———— Shortcode & JavaScript Equivalents ————
179 * ```
180 * [s2If constant(S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER)]
181 * You ARE logged in at Level #1 or higher.
182 * [/s2If]
183 *
184 * <script type="text/javascript">
185 * if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER)
186 * document.write('You ARE logged in at Level #1 or higher.');
187 * </script>
188 * ```
189 *
190 * @package s2Member\API_Constants
191 * @since 3.5
192 *
193 * @var bool
194 *
195 * @see s2Member\API_Functions\is_user_not_logged_in()
196 * @see http://codex.wordpress.org/Function_Reference/is_user_logged_in is_user_logged_in()
197 *
198 * @see s2Member\API_Functions\user_is()
199 * @see s2Member\API_Functions\user_is_not()
200 *
201 * @see s2Member\API_Functions\current_user_is()
202 * @see s2Member\API_Functions\current_user_is_not()
203 * @see s2Member\API_Functions\current_user_is_for_blog()
204 * @see s2Member\API_Functions\current_user_is_not_for_blog()
205 *
206 * @see s2Member\API_Functions\current_user_cannot()
207 * @see s2Member\API_Functions\current_user_cannot_for_blog()
208 * @see http://codex.wordpress.org/Function_Reference/user_can user_can()
209 * @see http://codex.wordpress.org/Function_Reference/current_user_can current_user_can()
210 * @see http://codex.wordpress.org/Function_Reference/current_user_can_for_blog current_user_can_for_blog()
211 *
212 * @see s2Member\API_Functions\get_user_field()
213 * @see `get_user_field('s2member_access_role')`
214 * @see `get_user_field('s2member_access_level')`
215 * @see `get_user_field('s2member_access_label')`
216 *
217 * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
218 */
219 if(!defined('S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER'))
220 define ('S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER', ($c[] = (($user && $level >= 1) ? TRUE : FALSE)));
221
222 /**
223 * The current User's Membership Access Level.
224 *
225 * Negative `-1` through max Membership Level number.
226 * Negative `-1` indicates they are NOT logged-in.
227 *
228 * ———— Quick PHP Code Sample ————
229 * ```
230 * <!php echo S2MEMBER_CURRENT_USER_ACCESS_LEVEL; !>
231 * ```
232 * ———— Shortcode & JavaScript Equivalents ————
233 * ```
234 * [s2Get constant="S2MEMBER_CURRENT_USER_ACCESS_LEVEL" /]
235 *
236 * <script type="text/javascript">
237 * document.write(S2MEMBER_CURRENT_USER_ACCESS_LEVEL);
238 * </script>
239 * ```
240 *
241 * @package s2Member\API_Constants
242 * @since 3.5
243 *
244 * @var int
245 *
246 * @see s2Member\API_Functions\get_user_field()
247 * @see `get_user_field('s2member_access_role')`
248 * @see `get_user_field('s2member_access_level')`
249 * @see `get_user_field('s2member_access_label')`
250 *
251 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ACCESS_LABEL
252 *
253 * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
254 */
255 if(!defined('S2MEMBER_CURRENT_USER_ACCESS_LEVEL'))
256 define ('S2MEMBER_CURRENT_USER_ACCESS_LEVEL', ($c[] = (int)$level));
257
258 /**
259 * The current User's Membership Access Label.
260 *
261 * As configured by the site owner. Each Membership Level is associated with a Membership Label
262 * *(i.e., Bronze, Silver, Gold, Platinum)*, or whatever the site owner has configured.
263 *
264 * An empty string if NOT logged-in.
265 *
266 * ———— Quick PHP Code Sample ————
267 * ```
268 * <!php echo S2MEMBER_CURRENT_USER_ACCESS_LABEL; !>
269 * ```
270 * ———— Shortcode & JavaScript Equivalents ————
271 * ```
272 * [s2Get constant="S2MEMBER_CURRENT_USER_ACCESS_LABEL" /]
273 *
274 * <script type="text/javascript">
275 * document.write(S2MEMBER_CURRENT_USER_ACCESS_LABEL);
276 * </script>
277 * ```
278 *
279 * @package s2Member\API_Constants
280 * @since 3.5
281 *
282 * @var string
283 *
284 * @see s2Member\API_Functions\get_user_field()
285 * @see `get_user_field('s2member_access_role')`
286 * @see `get_user_field('s2member_access_level')`
287 * @see `get_user_field('s2member_access_label')`
288 *
289 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ACCESS_LEVEL
290 *
291 * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
292 */
293 if(!defined('S2MEMBER_CURRENT_USER_ACCESS_LABEL'))
294 define ('S2MEMBER_CURRENT_USER_ACCESS_LABEL', ($c[] = (($level >= 0 && isset($GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$level.'_label'])) ? (string)$GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$level.'_label'] : '')));
295
296 /**
297 * The current User's Paid Subscription ID (when applicable).
298 *
299 * An empty string if NOT logged-in.
300 *
301 * ———— Quick PHP Code Sample ————
302 * ```
303 * <!php echo S2MEMBER_CURRENT_USER_SUBSCR_ID; !>
304 * ```
305 * ———— Shortcode & JavaScript Equivalents ————
306 * ```
307 * [s2Get constant="S2MEMBER_CURRENT_USER_SUBSCR_ID" /]
308 *
309 * <script type="text/javascript">
310 * document.write(S2MEMBER_CURRENT_USER_SUBSCR_ID);
311 * </script>
312 * ```
313 *
314 * @package s2Member\API_Constants
315 * @since 3.5
316 *
317 * @var string
318 *
319 * @see s2Member\API_Functions\get_user_field()
320 * @see `get_user_field('s2member_subscr_id')`
321 *
322 * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
323 * @see `get_user_option('s2member_subscr_id')`
324 *
325 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_CUSTOM
326 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID
327 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY
328 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
329 *
330 * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
331 */
332 if(!defined('S2MEMBER_CURRENT_USER_SUBSCR_ID'))
333 define ('S2MEMBER_CURRENT_USER_SUBSCR_ID', ($c[] = (($user) ? (string)$subscr_id : '')));
334
335 /**
336 * The current User's Paid Subscription ID (when applicable);
337 * otherwise, this will contain their WordPress User ID.
338 *
339 * An empty string if NOT logged-in.
340 *
341 * ———— Quick PHP Code Sample ————
342 * ```
343 * <!php echo S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID; !>
344 * ```
345 * ———— Shortcode & JavaScript Equivalents ————
346 * ```
347 * [s2Get constant="S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID" /]
348 *
349 * <script type="text/javascript">
350 * document.write(S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID);
351 * </script>
352 * ```
353 *
354 * @package s2Member\API_Constants
355 * @since 3.5
356 *
357 * @var string
358 *
359 * @see s2Member\API_Functions\get_user_field()
360 * @see `get_user_field('s2member_subscr_or_wp_id')`
361 *
362 * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
363 * @see `get_user_option('s2member_subscr_id')`
364 *
365 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_CUSTOM
366 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_ID
367 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY
368 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
369 *
370 * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
371 */
372 if(!defined('S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID'))
373 define ('S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID', ($c[] = (($user) ? (($subscr_id) ? (string)$subscr_id : (string)$user->ID) : '')));
374
375 /**
376 * The current User's Paid Subscription Gateway Code (when applicable).
377 *
378 * Usually one of these values: `paypal`, `authnet`, `clickbank`, `google`, `ccbill`, `alipay`.
379 *
380 * An empty string if NOT logged-in, or if NOT a paying Member.
381 *
382 * ———— Quick PHP Code Sample ————
383 * ```
384 * <!php echo S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY; !>
385 * ```
386 * ———— Shortcode & JavaScript Equivalents ————
387 * ```
388 * [s2Get constant="S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY" /]
389 *
390 * <script type="text/javascript">
391 * document.write(S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY);
392 * </script>
393 * ```
394 *
395 * @package s2Member\API_Constants
396 * @since 3.5
397 *
398 * @var string
399 *
400 * @see s2Member\API_Functions\get_user_field()
401 * @see `get_user_field('s2member_subscr_gateway')`
402 *
403 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_CUSTOM
404 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_ID
405 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID
406 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
407 *
408 * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
409 * @see `get_user_option('s2member_subscr_gateway')`
410 */
411 if(!defined('S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY'))
412 define ('S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY', ($c[] = (($user) ? (string)$subscr_gateway : '')));
413
414 /**
415 * The current User's Custom String, associated with their Profile.
416 *
417 * For paying Members, this should always start with the installation domain name.
418 * This is taken from the `custom=""` Attribute in your Button/Form Shortcode.
419 *
420 * Other pipe delimited values may follow the installation domain name, if configured by the site owner.
421 * For instance, this might be equal to something like: `www.example.com|cv1|cv2|cv3`.
422 *
423 * An empty string if NOT logged-in, or if NOT a paying Member.
424 *
425 * ———— Quick PHP Code Sample ————
426 * ```
427 * <!php echo S2MEMBER_CURRENT_USER_CUSTOM; !>
428 * ```
429 * ———— Shortcode & JavaScript Equivalents ————
430 * ```
431 * [s2Get constant="S2MEMBER_CURRENT_USER_CUSTOM" /]
432 *
433 * <script type="text/javascript">
434 * document.write(S2MEMBER_CURRENT_USER_CUSTOM);
435 * </script>
436 * ```
437 *
438 * @package s2Member\API_Constants
439 * @since 3.5
440 *
441 * @var string
442 *
443 * @see s2Member\API_Functions\get_user_field()
444 * @see `get_user_field('s2member_custom')`
445 *
446 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_ID
447 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID
448 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY
449 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
450 *
451 * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
452 * @see `get_user_option('s2member_custom')`
453 */
454 if(!defined('S2MEMBER_CURRENT_USER_CUSTOM'))
455 define ('S2MEMBER_CURRENT_USER_CUSTOM', ($c[] = (($user) ? (string)$custom : '')));
456
457 /**
458 * The current User's Registration Time.
459 *
460 * The Registration Time, is the time at which the Username was created for the account, that's it.
461 * There's nothing special about this. This simply returns a {@link https://en.wikipedia.org/wiki/Unix_time Unix Timestamp}.
462 *
463 * This will be equal to `0` if NOT logged-in.
464 *
465 * ———— Quick PHP Code Sample ————
466 * ```
467 * <!php echo S2MEMBER_CURRENT_USER_REGISTRATION_TIME; !>
468 * ```
469 * ———— Shortcode & JavaScript Equivalents ————
470 * ```
471 * [s2Get constant="S2MEMBER_CURRENT_USER_REGISTRATION_TIME" /]
472 *
473 * <script type="text/javascript">
474 * document.write(S2MEMBER_CURRENT_USER_REGISTRATION_TIME);
475 * </script>
476 * ```
477 *
478 * @package s2Member\API_Constants
479 * @since 3.5
480 *
481 * @var int
482 *
483 * @see s2Member\API_Functions\s2member_registration_time()
484 *
485 * @see s2Member\API_Functions\s2member_paid_registration_time()
486 * @see `s2member_paid_registration_time('level1')`
487 *
488 * @see s2Member\API_Functions\get_user_field()
489 *
490 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_DAYS
491 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME
492 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS
493 *
494 * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
495 */
496 if(!defined('S2MEMBER_CURRENT_USER_REGISTRATION_TIME'))
497 define ('S2MEMBER_CURRENT_USER_REGISTRATION_TIME', ($c[] = (($user && $user->user_registered) ? (int)strtotime($user->user_registered) : 0)));
498
499 /**
500 * The current User's first Paid Registration Time; regardless of which paid Level they gained access to.
501 *
502 * **NOTE** A Paid Registration Time, is NOT necessarily related specifically to a Payment.
503 * s2Member records a Paid Registration Time, anytime a User acquires paid Membership Level Access.
504 *
505 * In other words, if you create a new User inside your Dashboard at a Membership Level greater than Level #0,
506 * s2Member will record a Paid Registration Time immediately, because Membership Levels > 0, are reserved for paying Members.
507 * s2Member monitors changes to all User accounts, and records the first Paid Registration Time for each Member, at each paid Membership Level.
508 * So, s2Member stores the first Time a Member reaches each Level of paid access; and s2Member does NOT care if they *actually* paid, or not.
509 *
510 * If the current User has never been at a paid Membership Level, this will be equal to `0`.
511 *
512 * This will be equal to `0` if NOT logged-in.
513 *
514 * ———— Quick PHP Code Sample ————
515 * ```
516 * <!php echo S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME; !>
517 * ```
518 * ———— Shortcode & JavaScript Equivalents ————
519 * ```
520 * [s2Get constant="S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME" /]
521 *
522 * <script type="text/javascript">
523 * document.write(S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME);
524 * </script>
525 * ```
526 *
527 * If you need to know the last time an actual payment was received, please use ``get_user_option ('s2member_last_payment_time')``.
528 *
529 * @package s2Member\API_Constants
530 * @since 3.5
531 *
532 * @var int
533 *
534 * @see s2Member\API_Functions\s2member_registration_time()
535 *
536 * @see s2Member\API_Functions\s2member_paid_registration_time()
537 * @see `s2member_paid_registration_time('level1')`
538 *
539 * @see s2Member\API_Functions\get_user_field()
540 *
541 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_TIME
542 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_DAYS
543 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS
544 *
545 * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
546 */
547 if(!defined('S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME'))
548 define ('S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME', ($c[] = (($user && isset($paid_registration_times['level']) && !empty((int)$paid_registration_times['level'])) ? (int)$paid_registration_times['level'] : 0)));
549
550 /**
551 * The number of days the current User has been a paid Member.
552 *
553 * **NOTE** This is calculated using the first Paid Registration Time.
554 * A Paid Registration Time, is NOT necessarily related specifically to a Payment.
555 * s2Member records a Paid Registration Time, anytime a User acquires paid Membership Level Access.
556 *
557 * In other words, if you create a new User inside your Dashboard at a Membership Level greater than Level #0,
558 * s2Member will record a Paid Registration Time immediately, because Membership Levels > 0, are reserved for paying Members.
559 * s2Member monitors changes to all User accounts, and records the first Paid Registration Time for each Member, at each paid Membership Level.
560 * So, s2Member stores the first Time a Member reaches each Level of paid access; and s2Member does NOT care if they *actually* paid, or not.
561 *
562 * If the current User has never been at a paid Membership Level, this will be equal to `0`.
563 *
564 * This will be equal to `0` if NOT logged-in.
565 *
566 * ———— Quick PHP Code Sample ————
567 * ```
568 * <!php echo S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS; !>
569 * ```
570 * ———— Shortcode & JavaScript Equivalents ————
571 * ```
572 * [s2Get constant="S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS" /]
573 *
574 * <script type="text/javascript">
575 * document.write(S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS);
576 * </script>
577 * ```
578 *
579 * If you need to know the last time an actual payment was received, please use ``get_user_option ('s2member_last_payment_time')``.
580 *
581 * @package s2Member\API_Constants
582 * @since 3.5
583 *
584 * @var int
585 *
586 * @see s2Member\API_Functions\s2member_registration_time()
587 *
588 * @see s2Member\API_Functions\s2member_paid_registration_time()
589 * @see `s2member_paid_registration_time('level1')`
590 *
591 * @see s2Member\API_Functions\get_user_field()
592 *
593 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_TIME
594 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_DAYS
595 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME
596 *
597 * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
598 */
599 if(!defined('S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS'))
600 define ('S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS', ($c[] = (($user && isset($paid_registration_times['level']) && !empty((int)$paid_registration_times['level'])) ? (int)floor((strtotime('now') - (int)$paid_registration_times['level']) / 86400) : 0)));
601
602 /**
603 * The number of days the current User has had an account, period.
604 *
605 * **NOTE** This is calculated with Registration Time.
606 * The Registration Time, is the time at which the Username was created for the account, that's it.
607 *
608 * This will be equal to `0` if NOT logged-in.
609 *
610 * ———— Quick PHP Code Sample ————
611 * ```
612 * <!php echo S2MEMBER_CURRENT_USER_REGISTRATION_DAYS; !>
613 * ```
614 * ———— Shortcode & JavaScript Equivalents ————
615 * ```
616 * [s2Get constant="S2MEMBER_CURRENT_USER_REGISTRATION_DAYS" /]
617 *
618 * <script type="text/javascript">
619 * document.write(S2MEMBER_CURRENT_USER_REGISTRATION_DAYS);
620 * </script>
621 * ```
622 *
623 * @package s2Member\API_Constants
624 * @since 3.5
625 *
626 * @var int
627 *
628 * @see s2Member\API_Functions\s2member_registration_time()
629 *
630 * @see s2Member\API_Functions\s2member_paid_registration_time()
631 * @see `s2member_paid_registration_time('level1')`
632 *
633 * @see s2Member\API_Functions\get_user_field()
634 *
635 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_TIME
636 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME
637 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS
638 *
639 * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
640 */
641 if(!defined('S2MEMBER_CURRENT_USER_REGISTRATION_DAYS'))
642 define ('S2MEMBER_CURRENT_USER_REGISTRATION_DAYS', ($c[] = (($user && $user->user_registered) ? (int)floor((strtotime('now') - strtotime($user->user_registered)) / 86400) : 0)));
643
644 /**
645 * The current User's Display Name.
646 *
647 * This is usually a name they prefer to be known by publicly.
648 * Some Users/Members prefer to use their First Name as the Display Name, and keep their Last Name private.
649 *
650 * An empty string if NOT logged-in.
651 *
652 * ———— Quick PHP Code Sample ————
653 * ```
654 * <!php echo S2MEMBER_CURRENT_USER_DISPLAY_NAME; !>
655 * ```
656 * ———— Shortcode & JavaScript Equivalents ————
657 * ```
658 * [s2Get constant="S2MEMBER_CURRENT_USER_DISPLAY_NAME" /]
659 *
660 * <script type="text/javascript">
661 * document.write(S2MEMBER_CURRENT_USER_DISPLAY_NAME);
662 * </script>
663 * ```
664 *
665 * @package s2Member\API_Constants
666 * @since 3.5
667 *
668 * @var string
669 *
670 * @see s2Member\API_Functions\get_user_field()
671 * @see `get_user_field('display_name')`
672 *
673 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID
674 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP
675 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
676 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN
677 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL
678 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME
679 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME
680 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
681 *
682 * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
683 */
684 if(!defined('S2MEMBER_CURRENT_USER_DISPLAY_NAME'))
685 define ('S2MEMBER_CURRENT_USER_DISPLAY_NAME', ($c[] = (($user) ? (string)$user->display_name : '')));
686
687 /**
688 * The current User's First Name.
689 *
690 * An empty string if NOT logged-in.
691 *
692 * ———— Quick PHP Code Sample ————
693 * ```
694 * <!php echo S2MEMBER_CURRENT_USER_FIRST_NAME; !>
695 * ```
696 * ———— Shortcode & JavaScript Equivalents ————
697 * ```
698 * [s2Get constant="S2MEMBER_CURRENT_USER_FIRST_NAME" /]
699 *
700 * <script type="text/javascript">
701 * document.write(S2MEMBER_CURRENT_USER_FIRST_NAME);
702 * </script>
703 * ```
704 *
705 * @package s2Member\API_Constants
706 * @since 3.5
707 *
708 * @var string
709 *
710 * @see s2Member\API_Functions\get_user_field()
711 * @see `get_user_field('first_name')`
712 *
713 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID
714 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP
715 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
716 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN
717 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL
718 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME
719 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME
720 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
721 *
722 * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
723 */
724 if(!defined('S2MEMBER_CURRENT_USER_FIRST_NAME'))
725 define ('S2MEMBER_CURRENT_USER_FIRST_NAME', ($c[] = (($user) ? (string)$user->first_name : '')));
726
727 /**
728 * The current User's Last Name.
729 *
730 * An empty string if NOT logged-in.
731 *
732 * ———— Quick PHP Code Sample ————
733 * ```
734 * <!php echo S2MEMBER_CURRENT_USER_LAST_NAME; !>
735 * ```
736 * ———— Shortcode & JavaScript Equivalents ————
737 * ```
738 * [s2Get constant="S2MEMBER_CURRENT_USER_LAST_NAME" /]
739 *
740 * <script type="text/javascript">
741 * document.write(S2MEMBER_CURRENT_USER_LAST_NAME);
742 * </script>
743 * ```
744 *
745 * @package s2Member\API_Constants
746 * @since 3.5
747 *
748 * @var string
749 *
750 * @see s2Member\API_Functions\get_user_field()
751 * @see `get_user_field('last_name')`
752 *
753 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID
754 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP
755 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
756 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN
757 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL
758 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME
759 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME
760 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
761 *
762 * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
763 */
764 if(!defined('S2MEMBER_CURRENT_USER_LAST_NAME'))
765 define ('S2MEMBER_CURRENT_USER_LAST_NAME', ($c[] = (($user) ? (string)$user->last_name : '')));
766
767 /**
768 * The current User's Username.
769 *
770 * An empty string if NOT logged-in.
771 *
772 * ———— Quick PHP Code Sample ————
773 * ```
774 * <!php echo S2MEMBER_CURRENT_USER_LOGIN; !>
775 * ```
776 * ———— Shortcode & JavaScript Equivalents ————
777 * ```
778 * [s2Get constant="S2MEMBER_CURRENT_USER_LOGIN" /]
779 *
780 * <script type="text/javascript">
781 * document.write(S2MEMBER_CURRENT_USER_LOGIN);
782 * </script>
783 * ```
784 *
785 * @package s2Member\API_Constants
786 * @since 3.5
787 *
788 * @var string
789 *
790 * @see s2Member\API_Functions\get_user_field()
791 * @see `get_user_field('user_login')`
792 *
793 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID
794 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP
795 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
796 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL
797 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME
798 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME
799 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME
800 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
801 *
802 * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
803 */
804 if(!defined('S2MEMBER_CURRENT_USER_LOGIN'))
805 define ('S2MEMBER_CURRENT_USER_LOGIN', ($c[] = (($user) ? (string)$user->user_login : '')));
806
807 /**
808 * The current User's Email Address.
809 *
810 * An empty string if NOT logged-in.
811 *
812 * ———— Quick PHP Code Sample ————
813 * ```
814 * <!php echo S2MEMBER_CURRENT_USER_EMAIL; !>
815 * ```
816 * ———— Shortcode & JavaScript Equivalents ————
817 * ```
818 * [s2Get constant="S2MEMBER_CURRENT_USER_EMAIL" /]
819 *
820 * <script type="text/javascript">
821 * document.write(S2MEMBER_CURRENT_USER_EMAIL);
822 * </script>
823 * ```
824 *
825 * @package s2Member\API_Constants
826 * @since 3.5
827 *
828 * @var string
829 *
830 * @see s2Member\API_Functions\get_user_field()
831 * @see `get_user_field('user_email')`
832 *
833 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID
834 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP
835 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
836 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN
837 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME
838 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME
839 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME
840 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
841 *
842 * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
843 */
844 if(!defined('S2MEMBER_CURRENT_USER_EMAIL'))
845 define ('S2MEMBER_CURRENT_USER_EMAIL', ($c[] = (($user) ? (string)$user->user_email : '')));
846
847 /**
848 * The current User's IP Address (even if/when NOT logged-in).
849 *
850 * This is the current IP Address, taken from ``$_SERVER['REMOTE_ADDR']``.
851 *
852 * ———— Quick PHP Code Sample ————
853 * ```
854 * <!php echo S2MEMBER_CURRENT_USER_IP; !>
855 * ```
856 * ———— Shortcode & JavaScript Equivalents ————
857 * ```
858 * [s2Get constant="S2MEMBER_CURRENT_USER_IP" /]
859 *
860 * <script type="text/javascript">
861 * document.write(S2MEMBER_CURRENT_USER_IP);
862 * </script>
863 * ```
864 *
865 * @package s2Member\API_Constants
866 * @since 3.5
867 *
868 * @var string
869 *
870 * @see s2Member\API_Functions\get_user_field()
871 * @see `get_user_field('s2member_registration_ip')`
872 * @see `get_user_field('ip')`
873 *
874 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
875 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID
876 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN
877 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL
878 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME
879 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME
880 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME
881 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
882 *
883 * @see http://www.php.net/manual/en/reserved.variables.server.php Superglobal $_SERVER
884 * @see `$_SERVER['REMOTE_ADDR']`
885 */
886 if(!defined('S2MEMBER_CURRENT_USER_IP'))
887 define ('S2MEMBER_CURRENT_USER_IP', ($c[] = c_ws_plugin__s2member_utils_ip::current()));
888
889 /**
890 * IP Address the current User had during registration.
891 *
892 * This is the IP Address the User had at the time they registered.
893 * It's useful when you need to know the original IP Address they used.
894 * For instance, this is needed by some affiliate tracking systems; such as iDevAffiliate.
895 *
896 * An empty string if NOT logged-in.
897 *
898 * ———— Quick PHP Code Sample ————
899 * ```
900 * <!php echo S2MEMBER_CURRENT_USER_REGISTRATION_IP; !>
901 * ```
902 * ———— Shortcode & JavaScript Equivalents ————
903 * ```
904 * [s2Get constant="S2MEMBER_CURRENT_USER_REGISTRATION_IP" /]
905 *
906 * <script type="text/javascript">
907 * document.write(S2MEMBER_CURRENT_USER_REGISTRATION_IP);
908 * </script>
909 * ```
910 *
911 * @package s2Member\API_Constants
912 * @since 3.5
913 *
914 * @var string
915 *
916 * @see s2Member\API_Functions\get_user_field()
917 * @see `get_user_field('s2member_registration_ip')`
918 * @see `get_user_field('ip')`
919 *
920 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP
921 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID
922 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN
923 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL
924 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME
925 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME
926 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME
927 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
928 *
929 * @see http://www.php.net/manual/en/reserved.variables.server.php Superglobal $_SERVER
930 * @see `$_SERVER['REMOTE_ADDR']`
931 */
932 if(!defined('S2MEMBER_CURRENT_USER_REGISTRATION_IP'))
933 define ('S2MEMBER_CURRENT_USER_REGISTRATION_IP', ($c[] = (($user) ? (string)$registration_ip : '')));
934
935 /**
936 * The current User's WordPress User ID.
937 *
938 * This will be equal to `0` if NOT logged-in.
939 *
940 * ———— Quick PHP Code Sample ————
941 * ```
942 * <!php echo S2MEMBER_CURRENT_USER_ID; !>
943 * ```
944 * ———— Shortcode & JavaScript Equivalents ————
945 * ```
946 * [s2Get constant="S2MEMBER_CURRENT_USER_ID" /]
947 *
948 * <script type="text/javascript">
949 * document.write(S2MEMBER_CURRENT_USER_ID);
950 * </script>
951 * ```
952 *
953 * @package s2Member\API_Constants
954 * @since 3.5
955 *
956 * @var int
957 *
958 * @see s2Member\API_Functions\get_user_field()
959 * @see `get_user_field('id')`
960 *
961 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP
962 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
963 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN
964 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL
965 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME
966 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME
967 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME
968 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
969 *
970 * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
971 */
972 if(!defined('S2MEMBER_CURRENT_USER_ID'))
973 define ('S2MEMBER_CURRENT_USER_ID', ($c[] = (($user) ? (int)$user->ID : 0)));
974
975 /**
976 * The current User's fields, provided by s2Member.
977 *
978 * This holds a JSON-encoded array, containing these array keys:
979 *
980 * o `id` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID}
981 * o `ip` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP}
982 * o `reg_ip` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP}
983 * o `email` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL}
984 * o `login` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN}
985 * o `first_name` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME}
986 * o `last_name` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME}
987 * o `display_name` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME}
988 * o `subscr_id` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_ID}
989 * o `subscr_or_wp_id` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID}
990 * o `subscr_gateway` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY}
991 * o `custom` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_CUSTOM}
992 * o and any Custom Registration/Profile Fields configured by the site owner.
993 *
994 * This will be an empty JSON-encoded array if NOT logged-in.
995 *
996 * ———— Code Sample ( Using ``json_decode(JSON, true)`` ) ————
997 * ```
998 * <!php
999 * $fields = json_decode(S2MEMBER_CURRENT_USER_FIELDS, true);
1000 * echo $fields['email']; # The current User's Email Address.
1001 * echo $fields['my_unique_field_id']; # A Custom Registration/Profile Field configured by the site owner.
1002 * !>
1003 * ```
1004 * ———— Shortcode & JavaScript Equivalents ————
1005 * ```
1006 * [s2Get user_field="id" /]
1007 * [s2Get user_field="ip" /]
1008 * [s2Get user_field="reg_ip" /]
1009 * [s2Get user_field="email" /]
1010 * [s2Get user_field="login" /]
1011 * [s2Get user_field="first_name" /]
1012 * [s2Get user_field="last_name" /]
1013 * [s2Get user_field="display_name" /]
1014 * [s2Get user_field="s2member_subscr_id" /]
1015 * [s2Get user_field="s2member_subscr_wp_id" /]
1016 * [s2Get user_field="s2member_subscr_gateway" /]
1017 * [s2Get user_field="s2member_custom" /]
1018 * [s2Get user_field="my_custom_field_id" /]
1019 *
1020 * <script type="text/javascript">
1021 * document.write(S2MEMBER_CURRENT_USER_FIELDS.id);
1022 * document.write(S2MEMBER_CURRENT_USER_FIELDS.display_name);
1023 * </script>
1024 * ```
1025 *
1026 * @package s2Member\API_Constants
1027 * @since 3.5
1028 *
1029 * @var string
1030 *
1031 * @see s2Member\API_Functions\get_user_field()
1032 *
1033 * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
1034 */
1035 if(!defined('S2MEMBER_CURRENT_USER_FIELDS'))
1036 define ('S2MEMBER_CURRENT_USER_FIELDS', ($c[] = (($user) ? json_encode(array_merge(array('id' => S2MEMBER_CURRENT_USER_ID, 'ip' => S2MEMBER_CURRENT_USER_IP, 'reg_ip' => S2MEMBER_CURRENT_USER_REGISTRATION_IP, 'email' => S2MEMBER_CURRENT_USER_EMAIL, 'login' => S2MEMBER_CURRENT_USER_LOGIN, 'first_name' => S2MEMBER_CURRENT_USER_FIRST_NAME, 'last_name' => S2MEMBER_CURRENT_USER_LAST_NAME, 'display_name' => S2MEMBER_CURRENT_USER_DISPLAY_NAME, 'subscr_id' => S2MEMBER_CURRENT_USER_SUBSCR_ID, 'subscr_or_wp_id' => S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID, 'subscr_gateway' => S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY, 'custom' => S2MEMBER_CURRENT_USER_CUSTOM), (array)$custom_fields)) : json_encode(array()))));
1037
1038 /**
1039 * Indicates the number of unique Files the current User is allowed to download every X days.
1040 *
1041 * `0` means no access to File Downloads has been made available to the User.
1042 *
1043 * This will be equal to `0` if NOT logged-in.
1044 *
1045 * ———— Quick PHP Code Sample ————
1046 * ```
1047 * <!php echo S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED; !>
1048 * ```
1049 * ———— Shortcode & JavaScript Equivalents ————
1050 * ```
1051 * [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED" /]
1052 *
1053 * <script type="text/javascript">
1054 * document.write(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED);
1055 * </script>
1056 * ```
1057 *
1058 * @package s2Member\API_Constants
1059 * @since 3.5
1060 *
1061 * @var int
1062 *
1063 * @see s2Member\API_Functions\s2member_user_downloads()
1064 * @see s2Member\API_Functions\s2member_total_downloads_of()
1065 * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
1066 *
1067 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1068 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
1069 *
1070 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
1071 *
1072 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
1073 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
1074 *
1075 * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
1076 * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
1077 *
1078 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
1079 *
1080 * @see `Dashboard → s2Member → Download Options`
1081 */
1082 if(!defined('S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED'))
1083 define ('S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED', ($c[] = (int)$file_downloads['allowed']));
1084
1085 /**
1086 * Does the current User have access to unlimited File Downloads.
1087 *
1088 * A value of true means the current User's allowed downloads are >= `999999999`, and false means it is not.
1089 * This is useful if you are allowing unlimited ( i.e., `999999999+` ) Downloads on some Membership Levels.
1090 * You can display `Unlimited` instead of a numerical value.
1091 *
1092 * This will be false if NOT logged-in.
1093 *
1094 * ———— Quick PHP Code Sample ————
1095 * ```
1096 * <!php
1097 * if(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED)
1098 * echo 'You have access to unlimited downloads.';
1099 * !>
1100 * ```
1101 * ———— Shortcode & JavaScript Equivalents ————
1102 * ```
1103 * [s2If constant(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED)]
1104 * You have access to unlimited downloads.
1105 * [/s2If]
1106 *
1107 * <script type="text/javascript">
1108 * if(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED)
1109 * document.write('You have access to unlimited downloads.');
1110 * </script>
1111 * ```
1112 *
1113 * @package s2Member\API_Constants
1114 * @since 3.5
1115 *
1116 * @var bool
1117 *
1118 * @see s2Member\API_Functions\s2member_user_downloads()
1119 * @see s2Member\API_Functions\s2member_total_downloads_of()
1120 * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
1121 *
1122 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1123 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
1124 *
1125 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
1126 *
1127 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
1128 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
1129 *
1130 * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
1131 * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
1132 *
1133 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
1134 *
1135 * @see `Dashboard → s2Member → Download Options`
1136 */
1137 if(!defined('S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED'))
1138 define ('S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED', ($c[] = (($file_downloads['allowed'] >= 999999999) ? TRUE : FALSE)));
1139
1140 /**
1141 * Indicates the number of unique Files the current User has downloaded in the last X days.
1142 *
1143 * This will be equal to `0` if NOT logged-in.
1144 *
1145 * ———— Quick PHP Code Sample ————
1146 * ```
1147 * <!php echo S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY; !>
1148 * ```
1149 * ———— Shortcode & JavaScript Equivalents ————
1150 * ```
1151 * [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY" /]
1152 *
1153 * <script type="text/javascript">
1154 * document.write(S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY);
1155 * </script>
1156 * ```
1157 *
1158 * @package s2Member\API_Constants
1159 * @since 3.5
1160 *
1161 * @var int
1162 *
1163 * @note This does NOT include File Downloads accessed with an Advanced File Download Key.
1164 *
1165 * @see s2Member\API_Functions\s2member_user_downloads()
1166 * @see s2Member\API_Functions\s2member_total_downloads_of()
1167 * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
1168 *
1169 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1170 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1171 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
1172 *
1173 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
1174 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
1175 *
1176 * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
1177 * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
1178 *
1179 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
1180 *
1181 * @see `Dashboard → s2Member → Download Options`
1182 */
1183 if(!defined('S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY'))
1184 define ('S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY', ($c[] = (int)$file_downloads['currently']));
1185
1186 /**
1187 * Indicates the X number of days, configured by the site owner; for the current User.
1188 *
1189 * This will be equal to `0` if NOT logged-in.
1190 *
1191 * ———— Quick PHP Code Sample ————
1192 * ```
1193 * You are allowed to download <!php echo S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED; !> files, every <!php echo S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS; !> days.
1194 * You've downloaded <!php echo S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY; !> files in the last <!php echo S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS; !> days.
1195 * ```
1196 * ———— Shortcode & JavaScript Equivalents ————
1197 * ```
1198 * You are allowed to download [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED" /] files, every [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS" /] days.
1199 * You've downloaded [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY" /] files in the last [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS" /] days.
1200 *
1201 * You are allowed to download <script type="text/javascript">document.write(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED);</script> files, every <script type="text/javascript">document.write(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS);</script> days.
1202 * You've downloaded <script type="text/javascript">document.write(S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY);</script> files in the last <script type="text/javascript">document.write(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS);</script> days.
1203 * ```
1204 *
1205 * @package s2Member\API_Constants
1206 * @since 3.5
1207 *
1208 * @var int
1209 *
1210 * @see s2Member\API_Functions\s2member_user_downloads()
1211 * @see s2Member\API_Functions\s2member_total_downloads_of()
1212 * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
1213 *
1214 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1215 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1216 *
1217 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
1218 *
1219 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
1220 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
1221 *
1222 * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
1223 * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
1224 *
1225 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
1226 *
1227 * @see `Dashboard → s2Member → Download Options`
1228 */
1229 if(!defined('S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS'))
1230 define ('S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS', ($c[] = (int)$file_downloads['allowed_days']));
1231
1232 /**
1233 * The configured Page ID, for the Download Limit Exceeded Page.
1234 *
1235 * This will be equal to `0` if NOT yet configured.
1236 *
1237 * ———— Quick PHP Code Sample ————
1238 * ```
1239 * <!php echo S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID; !>
1240 * ```
1241 * ———— Shortcode & JavaScript Equivalents ————
1242 * ```
1243 * [s2Get constant="S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID" /]
1244 *
1245 * <script type="text/javascript">
1246 * document.write(S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID);
1247 * </script>
1248 * ```
1249 *
1250 * @package s2Member\API_Constants
1251 * @since 3.5
1252 *
1253 * @var int
1254 *
1255 * @see s2Member\API_Functions\s2member_user_downloads()
1256 * @see s2Member\API_Functions\s2member_total_downloads_of()
1257 * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
1258 *
1259 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1260 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1261 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
1262 *
1263 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
1264 *
1265 * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
1266 * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
1267 *
1268 * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
1269 * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
1270 *
1271 * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
1272 * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
1273 *
1274 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
1275 *
1276 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
1277 *
1278 * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
1279 * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
1280 *
1281 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
1282 *
1283 * @see `Dashboard → s2Member → Download Options`
1284 */
1285 if(!defined('S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID'))
1286 define ('S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID', ($c[] = (int)$GLOBALS['WS_PLUGIN__']['s2member']['o']['file_download_limit_exceeded_page']));
1287
1288 /**
1289 * The configured Page ID, for the Membership Options Page.
1290 *
1291 * This will be equal to `0` if NOT yet configured.
1292 *
1293 * ———— Quick PHP Code Sample ————
1294 * ```
1295 * <!php echo S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID; !>
1296 * ```
1297 * ———— Shortcode & JavaScript Equivalents ————
1298 * ```
1299 * [s2Get constant="S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID" /]
1300 *
1301 * <script type="text/javascript">
1302 * document.write(S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID);
1303 * </script>
1304 * ```
1305 *
1306 * @package s2Member\API_Constants
1307 * @since 3.5
1308 *
1309 * @var int
1310 *
1311 * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
1312 * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
1313 *
1314 * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
1315 *
1316 * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
1317 * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
1318 *
1319 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
1320 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
1321 *
1322 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
1323 *
1324 * @see `Dashboard → s2Member → General Options → Membership Options Page`
1325 */
1326 if(!defined('S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID'))
1327 define ('S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID', ($c[] = (int)$GLOBALS['WS_PLUGIN__']['s2member']['o']['membership_options_page']));
1328
1329 /**
1330 * The configured Page ID, for the Login Welcome Page.
1331 *
1332 * This will be equal to `0` if NOT yet configured.
1333 *
1334 * ———— Quick PHP Code Sample ————
1335 * ```
1336 * <!php echo S2MEMBER_LOGIN_WELCOME_PAGE_ID; !>
1337 * ```
1338 * ———— Shortcode & JavaScript Equivalents ————
1339 * ```
1340 * [s2Get constant="S2MEMBER_LOGIN_WELCOME_PAGE_ID" /]
1341 *
1342 * <script type="text/javascript">
1343 * document.write(S2MEMBER_LOGIN_WELCOME_PAGE_ID);
1344 * </script>
1345 * ```
1346 *
1347 * @package s2Member\API_Constants
1348 * @since 3.5
1349 *
1350 * @var int
1351 *
1352 * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
1353 * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
1354 *
1355 * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
1356 * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
1357 *
1358 * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
1359 *
1360 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
1361 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
1362 *
1363 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
1364 *
1365 * @see `Dashboard → s2Member → General Options → Login Welcome Page`
1366 */
1367 if(!defined('S2MEMBER_LOGIN_WELCOME_PAGE_ID'))
1368 define ('S2MEMBER_LOGIN_WELCOME_PAGE_ID', ($c[] = (int)$GLOBALS['WS_PLUGIN__']['s2member']['o']['login_welcome_page']));
1369
1370 /**
1371 * A URL, which leads to the Stand-Alone Profile Modification Page.
1372 *
1373 * This is always a reference to `/?s2member_profile=1` *(i.e., the Stand-Alone version)*.
1374 *
1375 * ———— Quick PHP Code Sample ————
1376 * ```
1377 * <!php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; !>
1378 * ```
1379 * ———— Shortcode & JavaScript Equivalents ————
1380 * ```
1381 * [s2Get constant="S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL" /]
1382 *
1383 * <script type="text/javascript">
1384 * document.write(S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL);
1385 * </script>
1386 * ```
1387 *
1388 * @package s2Member\API_Constants
1389 * @since 3.5
1390 *
1391 * @var string
1392 *
1393 * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
1394 * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
1395 *
1396 * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
1397 * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
1398 *
1399 * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
1400 * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
1401 *
1402 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
1403 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
1404 *
1405 * @see `Dashboard → s2Member → General Options → Profile Modifications`
1406 */
1407 if(!defined('S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL'))
1408 define ('S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL', ($c[] = (string)home_url('/?s2member_profile=1')));
1409
1410 /**
1411 * A URL, which leads to the Download Limit Exceeded Page; as configured by the site owner.
1412 *
1413 * If the site owner has not yet configured a Download Limit Exceeded Page, this defaults to the Home Page.
1414 *
1415 * ———— Quick PHP Code Sample ————
1416 * ```
1417 * <!php echo S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL; !>
1418 * ```
1419 * ———— Shortcode & JavaScript Equivalents ————
1420 * ```
1421 * [s2Get constant="S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL" /]
1422 *
1423 * <script type="text/javascript">
1424 * document.write(S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL);
1425 * </script>
1426 * ```
1427 *
1428 * @package s2Member\API_Constants
1429 * @since 3.5
1430 *
1431 * @var string
1432 *
1433 * @see s2Member\API_Functions\s2member_user_downloads()
1434 * @see s2Member\API_Functions\s2member_total_downloads_of()
1435 * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
1436 *
1437 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1438 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1439 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
1440 *
1441 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
1442 *
1443 * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
1444 * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
1445 *
1446 * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
1447 * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
1448 *
1449 * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
1450 * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
1451 *
1452 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
1453 *
1454 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
1455 *
1456 * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
1457 * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
1458 *
1459 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
1460 *
1461 * @see `Dashboard → s2Member → Download Options`
1462 */
1463 if(!defined('S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL'))
1464 define ('S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL', ($c[] = (string)$links['file_download_limit_exceeded_page']));
1465
1466 /**
1467 * A URL, which leads to the Membership Options Page; as configured by the site owner.
1468 *
1469 * If the site owner has not yet configured a Membership Options Page, this defaults to the Home Page.
1470 *
1471 * ———— Quick PHP Code Sample ————
1472 * ```
1473 * <!php echo S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL; !>
1474 * ```
1475 * ———— Shortcode & JavaScript Equivalents ————
1476 * ```
1477 * [s2Get constant="S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL" /]
1478 *
1479 * <script type="text/javascript">
1480 * document.write(S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
1481 * </script>
1482 * ```
1483 *
1484 * @package s2Member\API_Constants
1485 * @since 3.5
1486 *
1487 * @var string
1488 *
1489 * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
1490 * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
1491 *
1492 * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
1493 *
1494 * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
1495 * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
1496 *
1497 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
1498 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
1499 *
1500 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
1501 *
1502 * @see `Dashboard → s2Member → General Options → Membership Options Page`
1503 */
1504 if(!defined('S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL'))
1505 define ('S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL', ($c[] = (string)$links['membership_options_page'])); // Signup page.
1506
1507 /**
1508 * The URL, which leads to the Login Welcome Page; as configured by the site owner.
1509 *
1510 * If the site owner has not yet configured a Login Welcome Page, this defaults to the Home Page.
1511 *
1512 * ———— Quick PHP Code Sample ————
1513 * ```
1514 * <!php echo S2MEMBER_LOGIN_WELCOME_PAGE_URL; !>
1515 * ```
1516 * ———— Shortcode & JavaScript Equivalents ————
1517 * ```
1518 * [s2Get constant="S2MEMBER_LOGIN_WELCOME_PAGE_URL" /]
1519 *
1520 * <script type="text/javascript">
1521 * document.write(S2MEMBER_LOGIN_WELCOME_PAGE_URL);
1522 * </script>
1523 * ```
1524 *
1525 * @package s2Member\API_Constants
1526 * @since 3.5
1527 *
1528 * @var string
1529 *
1530 * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
1531 * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
1532 *
1533 * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
1534 * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
1535 *
1536 * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
1537 *
1538 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
1539 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
1540 *
1541 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
1542 *
1543 * @see `Dashboard → s2Member → General Options → Login Welcome Page`
1544 */
1545 if(!defined('S2MEMBER_LOGIN_WELCOME_PAGE_URL'))
1546 define ('S2MEMBER_LOGIN_WELCOME_PAGE_URL', ($c[] = (($login_redirection_url) ? (string)$login_redirection_url : (string)$links['login_welcome_page'])));
1547
1548 /**
1549 * The URL, which logs the current User out of their account.
1550 *
1551 * This is the value provided by WordPress. It's the same as using ``wp_logout_url()``.
1552 *
1553 * ———— Quick PHP Code Sample ————
1554 * ```
1555 * <!php echo S2MEMBER_LOGOUT_PAGE_URL; !>
1556 * ```
1557 * ———— Shortcode & JavaScript Equivalents ————
1558 * ```
1559 * [s2Get constant="S2MEMBER_LOGOUT_PAGE_URL" /]
1560 *
1561 * <script type="text/javascript">
1562 * document.write(S2MEMBER_LOGOUT_PAGE_URL);
1563 * </script>
1564 * ```
1565 *
1566 * @package s2Member\API_Constants
1567 * @since 3.5
1568 *
1569 * @var string
1570 *
1571 * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
1572 *
1573 * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
1574 * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
1575 *
1576 * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
1577 * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
1578 *
1579 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
1580 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
1581 *
1582 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
1583 *
1584 * @see http://codex.wordpress.org/Function_Reference/wp_logout_url wp_logout_url()
1585 */
1586 if(!defined('S2MEMBER_LOGOUT_PAGE_URL'))
1587 define ('S2MEMBER_LOGOUT_PAGE_URL', ($c[] = (string)wp_logout_url())); // Triggers `wp_nonce_tick()`; watch out for dynamic changes.
1588
1589 /**
1590 * The URL, where a User can log into their account.
1591 *
1592 * This is the value provided by WordPress. It's the same as using ``wp_login_url()``.
1593 *
1594 * ———— Quick PHP Code Sample ————
1595 * ```
1596 * <!php echo S2MEMBER_LOGIN_PAGE_URL; !>
1597 * ```
1598 * ———— Shortcode & JavaScript Equivalents ————
1599 * ```
1600 * [s2Get constant="S2MEMBER_LOGIN_PAGE_URL" /]
1601 *
1602 * <script type="text/javascript">
1603 * document.write(S2MEMBER_LOGIN_PAGE_URL);
1604 * </script>
1605 * ```
1606 *
1607 * @package s2Member\API_Constants
1608 * @since 3.5
1609 *
1610 * @var string
1611 *
1612 * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
1613 *
1614 * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
1615 * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
1616 *
1617 * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
1618 * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
1619 *
1620 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
1621 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
1622 *
1623 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
1624 *
1625 * @see http://codex.wordpress.org/Function_Reference/wp_login_url wp_login_url()
1626 */
1627 if(!defined('S2MEMBER_LOGIN_PAGE_URL'))
1628 define ('S2MEMBER_LOGIN_PAGE_URL', ($c[] = (string)wp_login_url()));
1629
1630 /**
1631 * Each Membership Level (Label); as configured by the site owner.
1632 *
1633 * The defaults are as follows:
1634 * o Level #0 ``S2MEMBER_LEVEL0_LABEL`` = Free Subscriber
1635 * o Level #1 ``S2MEMBER_LEVEL1_LABEL`` = Bronze Member
1636 * o Level #2 ``S2MEMBER_LEVEL2_LABEL`` = Silver Member
1637 * o Level #3 ``S2MEMBER_LEVEL3_LABEL`` = Gold Member
1638 * o Level #4 ``S2MEMBER_LEVEL4_LABEL`` = Platinum Member
1639 *
1640 * ———— Quick PHP Code Sample ————
1641 * ```
1642 * <!php echo S2MEMBER_LEVEL0_LABEL; !>
1643 * ```
1644 * ———— Shortcode & JavaScript Equivalents ————
1645 * ```
1646 * [s2Get constant="S2MEMBER_LEVEL0_LABEL" /]
1647 *
1648 * <script type="text/javascript">
1649 * document.write(S2MEMBER_LEVEL0_LABEL);
1650 * </script>
1651 * ```
1652 *
1653 * @package s2Member\API_Constants
1654 * @since 3.5
1655 *
1656 * @var string
1657 *
1658 * @see s2Member\API_Functions\get_user_field()
1659 * @see `get_user_field('s2member_access_role')`
1660 * @see `get_user_field('s2member_access_level')`
1661 * @see `get_user_field('s2member_access_label')`
1662 *
1663 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ACCESS_LEVEL
1664 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ACCESS_LABEL
1665 *
1666 * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
1667 *
1668 * @see `Dashboard → s2Member → General Options → Membership Level (Labels)`
1669 */
1670 for($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++)
1671 {
1672 if(!defined(($S2MEMBER_LEVELn_LABEL = 'S2MEMBER_LEVEL'.$n.'_LABEL')))
1673 define($S2MEMBER_LEVELn_LABEL, ($c[] = (isset($GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$n.'_label']) ? (string)$GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$n.'_label'] : 'Level '.$n.' Member')));
1674 }
1675 /**
1676 * File Downloads allowed at each Membership Level; as configured by the site owner.
1677 *
1678 * The defaults are as follows:
1679 * o Level #0 ``S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED`` = `0`
1680 * o Level #1 ``S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED`` = `0`
1681 * o Level #2 ``S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED`` = `0`
1682 * o Level #3 ``S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED`` = `0`
1683 * o Level #4 ``S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED`` = `0`
1684 *
1685 * ———— Quick PHP Code Sample ————
1686 * ```
1687 * <!php echo S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED; !>
1688 * ```
1689 * ———— Shortcode & JavaScript Equivalents ————
1690 * ```
1691 * [s2Get constant="S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED" /]
1692 *
1693 * <script type="text/javascript">
1694 * document.write(S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED);
1695 * </script>
1696 * ```
1697 *
1698 * @package s2Member\API_Constants
1699 * @since 3.5
1700 *
1701 * @var int
1702 *
1703 * @see s2Member\API_Functions\s2member_user_downloads()
1704 * @see s2Member\API_Functions\s2member_total_downloads_of()
1705 * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
1706 *
1707 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1708 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1709 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
1710 *
1711 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
1712 *
1713 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
1714 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
1715 *
1716 * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
1717 *
1718 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
1719 *
1720 * @see `Dashboard → s2Member → Download Options`
1721 */
1722 for($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++)
1723 {
1724 if(!defined(($S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED = 'S2MEMBER_LEVEL'.$n.'_FILE_DOWNLOADS_ALLOWED')))
1725 define($S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED, ($c[] = (int)$GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$n.'_file_downloads_allowed']));
1726 }
1727 /**
1728 * File Download days, at each Membership Level; as configured by the site owner.
1729 *
1730 * The defaults are as follows:
1731 * o Level #0 ``S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS`` = `0`
1732 * o Level #1 ``S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS`` = `0`
1733 * o Level #2 ``S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS`` = `0`
1734 * o Level #3 ``S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS`` = `0`
1735 * o Level #4 ``S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS`` = `0`
1736 *
1737 * ———— Quick PHP Code Sample ————
1738 * ```
1739 * At Level #1, Members are allowed to download <!php echo S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED; !> files, every <!php echo S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS; !> days.
1740 * You are currently at Membership Level #<!php echo S2MEMBER_CURRENT_USER_ACCESS_LEVEL; !>. You've downloaded <!php echo S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY; !> files in the last <!php echo S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS; !> days.
1741 * ```
1742 * ———— Shortcode & JavaScript Equivalents ————
1743 * ```
1744 * At Level #1, Members are allowed to download [s2Get constant="S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED" /] files, every [s2Get constant="S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS" /] days.
1745 * You are currently at Membership Level #[s2Get constant="S2MEMBER_CURRENT_USER_ACCESS_LEVEL" /]. You've downloaded [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY" /] files in the last [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS" /] days.
1746 *
1747 * At Level #1, Members are allowed to download <script type="text/javascript">document.write(S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED);</script> files, every <script type="text/javascript">document.write(S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS);</script> days.
1748 * You are currently at Membership Level #<script type="text/javascript">document.write(S2MEMBER_CURRENT_USER_ACCESS_LEVEL);</script>. You've downloaded <script type="text/javascript">document.write(S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY);</script> files in the last <script type="text/javascript">document.write(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS);</script> days.
1749 * ```
1750 *
1751 * @package s2Member\API_Constants
1752 * @since 3.5
1753 *
1754 * @var int
1755 *
1756 * @see s2Member\API_Functions\s2member_user_downloads()
1757 * @see s2Member\API_Functions\s2member_total_downloads_of()
1758 * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
1759 *
1760 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1761 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1762 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
1763 *
1764 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
1765 *
1766 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
1767 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
1768 *
1769 * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
1770 *
1771 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
1772 *
1773 * @see `Dashboard → s2Member → Download Options`
1774 */
1775 for($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++)
1776 {
1777 if(!defined(($S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS = 'S2MEMBER_LEVEL'.$n.'_FILE_DOWNLOADS_ALLOWED_DAYS')))
1778 define($S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS, ($c[] = (int)$GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$n.'_file_downloads_allowed_days']));
1779 }
1780 /**
1781 * Inline File Download extensions; as configured by the site owner.
1782 *
1783 * ———— Quick PHP Code Sample ————
1784 * ```
1785 * <!php echo S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS; !>
1786 * ```
1787 * ———— Shortcode & JavaScript Equivalents ————
1788 * ```
1789 * [s2Get constant="S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS" /]
1790 *
1791 * <script type="text/javascript">
1792 * document.write(S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS);
1793 * </script>
1794 * ```
1795 *
1796 * @package s2Member\API_Constants
1797 * @since 3.5
1798 *
1799 * @var string
1800 *
1801 * @see s2Member\API_Functions\s2member_user_downloads()
1802 * @see s2Member\API_Functions\s2member_total_downloads_of()
1803 * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
1804 *
1805 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
1806 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
1807 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
1808 *
1809 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
1810 *
1811 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
1812 * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
1813 *
1814 * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
1815 * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
1816 *
1817 * @see `Dashboard → s2Member → Download Options`
1818 */
1819 if(!defined('S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS'))
1820 define ('S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS', ($c[] = (string)$GLOBALS['WS_PLUGIN__']['s2member']['o']['file_download_inline_extensions']));
1821
1822 /**
1823 * From: Name, for s2Member-specific emails; as configured by the site owner.
1824 *
1825 * ———— Quick PHP Code Sample ————
1826 * ```
1827 * <!php echo S2MEMBER_REG_EMAIL_FROM_NAME; !>
1828 * ```
1829 * ———— Shortcode & JavaScript Equivalents ————
1830 * ```
1831 * [s2Get constant="S2MEMBER_REG_EMAIL_FROM_NAME" /]
1832 *
1833 * <script type="text/javascript">
1834 * document.write(S2MEMBER_REG_EMAIL_FROM_NAME);
1835 * </script>
1836 * ```
1837 *
1838 * @package s2Member\API_Constants
1839 * @since 3.5
1840 *
1841 * @var string
1842 *
1843 * @see s2Member\API_Constants\S2MEMBER_REG_EMAIL_FROM_EMAIL
1844 *
1845 * @see `Dashboard → s2Member → General Options`
1846 */
1847 if(!defined('S2MEMBER_REG_EMAIL_FROM_NAME'))
1848 define ('S2MEMBER_REG_EMAIL_FROM_NAME', ($c[] = (string)$GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_name']));
1849
1850 /**
1851 * From: Email Address, for s2Member-specific emails; as configured by the site owner.
1852 *
1853 * ———— Quick PHP Code Sample ————
1854 * ```
1855 * <!php echo S2MEMBER_REG_EMAIL_FROM_EMAIL; !>
1856 * ```
1857 * ———— Shortcode & JavaScript Equivalents ————
1858 * ```
1859 * [s2Get constant="S2MEMBER_REG_EMAIL_FROM_EMAIL" /]
1860 *
1861 * <script type="text/javascript">
1862 * document.write(S2MEMBER_REG_EMAIL_FROM_EMAIL);
1863 * </script>
1864 * ```
1865 *
1866 * @package s2Member\API_Constants
1867 * @since 3.5
1868 *
1869 * @var string
1870 *
1871 * @see s2Member\API_Constants\S2MEMBER_REG_EMAIL_FROM_NAME
1872 *
1873 * @see `Dashboard → s2Member → General Options`
1874 */
1875 if(!defined('S2MEMBER_REG_EMAIL_FROM_EMAIL'))
1876 define ('S2MEMBER_REG_EMAIL_FROM_EMAIL', ($c[] = (string)$GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_email']));
1877
1878 /**
1879 * Full URL to PayPal IPN handler, provided by s2Member.
1880 *
1881 * ———— Quick PHP Code Sample ————
1882 * ```
1883 * <!php echo S2MEMBER_PAYPAL_NOTIFY_URL; !>
1884 * ```
1885 * ———— Shortcode & JavaScript Equivalents ————
1886 * ```
1887 * [s2Get constant="S2MEMBER_PAYPAL_NOTIFY_URL" /]
1888 *
1889 * <script type="text/javascript">
1890 * document.write(S2MEMBER_PAYPAL_NOTIFY_URL);
1891 * </script>
1892 * ```
1893 *
1894 * @package s2Member\API_Constants
1895 * @since 3.5
1896 *
1897 * @var string
1898 *
1899 * @see s2Member\API_Constants\S2MEMBER_PAYPAL_RETURN_URL
1900 * @see s2Member\API_Constants\S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN
1901 *
1902 * @see `Dashboard → s2Member → PayPal Options → IPN Integration`
1903 */
1904 if(!defined('S2MEMBER_PAYPAL_NOTIFY_URL'))
1905 define ('S2MEMBER_PAYPAL_NOTIFY_URL', ($c[] = (string)home_url('/?s2member_paypal_notify=1')));
1906
1907 /**
1908 * Full URL to PayPal Auto-Return/PDT handler, provided by s2Member.
1909 *
1910 * ———— Quick PHP Code Sample ————
1911 * ```
1912 * <!php echo S2MEMBER_PAYPAL_RETURN_URL; !>
1913 * ```
1914 * ———— Shortcode & JavaScript Equivalents ————
1915 * ```
1916 * [s2Get constant="S2MEMBER_PAYPAL_RETURN_URL" /]
1917 *
1918 * <script type="text/javascript">
1919 * document.write(S2MEMBER_PAYPAL_RETURN_URL);
1920 * </script>
1921 * ```
1922 *
1923 * @package s2Member\API_Constants
1924 * @since 3.5
1925 *
1926 * @var string
1927 *
1928 * @see s2Member\API_Constants\S2MEMBER_PAYPAL_NOTIFY_URL
1929 * @see s2Member\API_Constants\S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN
1930 *
1931 * @see `Dashboard → s2Member → PayPal Options → Auto-Return/PDT Integration`
1932 */
1933 if(!defined('S2MEMBER_PAYPAL_RETURN_URL'))
1934 define ('S2MEMBER_PAYPAL_RETURN_URL', ($c[] = (string)home_url('/?s2member_paypal_return=1')));
1935
1936 /**
1937 * PayPal Business Email Address; as configured by the site owner.
1938 *
1939 * ———— Quick PHP Code Sample ————
1940 * ```
1941 * <!php echo S2MEMBER_PAYPAL_BUSINESS; !>
1942 * ```
1943 * ———— Shortcode & JavaScript Equivalents ————
1944 * ```
1945 * [s2Get constant="S2MEMBER_PAYPAL_BUSINESS" /]
1946 *
1947 * <script type="text/javascript">
1948 * document.write(S2MEMBER_PAYPAL_BUSINESS);
1949 * </script>
1950 * ```
1951 *
1952 * @package s2Member\API_Constants
1953 * @since 3.5
1954 *
1955 * @var string
1956 *
1957 * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_USERNAME
1958 * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_PASSWORD
1959 * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_SIGNATURE
1960 *
1961 * @see `Dashboard → s2Member → PayPal Options → Account Details`
1962 */
1963 if(!defined('S2MEMBER_PAYPAL_BUSINESS'))
1964 define ('S2MEMBER_PAYPAL_BUSINESS', ($c[] = (string)$GLOBALS['WS_PLUGIN__']['s2member']['o']['paypal_business']));
1965
1966 /**
1967 * PayPal endpoint domain (changes when Sandbox Mode is enabled).
1968 *
1969 * o In Sandbox Mode, this is: `www.sandbox.paypal.com`.
1970 * o In Production Mode, this is: `www.paypal.com`.
1971 *
1972 * ———— Quick PHP Code Sample ————
1973 * ```
1974 * <!php echo S2MEMBER_PAYPAL_ENDPOINT; !>
1975 * ```
1976 * ———— Shortcode & JavaScript Equivalents ————
1977 * ```
1978 * [s2Get constant="S2MEMBER_PAYPAL_ENDPOINT" /]
1979 *
1980 * <script type="text/javascript">
1981 * document.write(S2MEMBER_PAYPAL_ENDPOINT);
1982 * </script>
1983 * ```
1984 *
1985 * @package s2Member\API_Constants
1986 * @since 3.5
1987 *
1988 * @var string
1989 *
1990 * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_ENDPOINT
1991 *
1992 * @see `Dashboard → s2Member → PayPal Options → Account Details`
1993 */
1994 if(!defined('S2MEMBER_PAYPAL_ENDPOINT'))
1995 define ('S2MEMBER_PAYPAL_ENDPOINT', ($c[] = (($GLOBALS['WS_PLUGIN__']['s2member']['o']['paypal_sandbox']) ? 'www.sandbox.paypal.com' : 'www.paypal.com')));
1996
1997 /**
1998 * PayPal API endpoint domain (changes when Sandbox Mode is enabled).
1999 *
2000 * o In Sandbox Mode, this is: `api-3t.sandbox.paypal.com`.
2001 * o In Production Mode, this is: `api-3t.paypal.com`.
2002 *
2003 * ———— Quick PHP Code Sample ————
2004 * ```
2005 * <!php echo S2MEMBER_PAYPAL_API_ENDPOINT; !>
2006 * ```
2007 * ———— Shortcode & JavaScript Equivalents ————
2008 * ```
2009 * [s2Get constant="S2MEMBER_PAYPAL_API_ENDPOINT" /]
2010 *
2011 * <script type="text/javascript">
2012 * document.write(S2MEMBER_PAYPAL_API_ENDPOINT);
2013 * </script>
2014 * ```
2015 *
2016 * @package s2Member\API_Constants
2017 * @since 3.5
2018 *
2019 * @var string
2020 *
2021 * @see s2Member\API_Constants\S2MEMBER_PAYPAL_ENDPOINT
2022 *
2023 * @see `Dashboard → s2Member → PayPal Options → Account Details`
2024 */
2025 if(!defined('S2MEMBER_PAYPAL_API_ENDPOINT'))
2026 define ('S2MEMBER_PAYPAL_API_ENDPOINT', ($c[] = (($GLOBALS['WS_PLUGIN__']['s2member']['o']['paypal_sandbox']) ? 'api-3t.sandbox.paypal.com' : 'api-3t.paypal.com')));
2027
2028 /**
2029 * PayPal API Username; as configured by the site owner.
2030 *
2031 * ———— Quick PHP Code Sample ————
2032 * ```
2033 * <!php echo S2MEMBER_PAYPAL_API_USERNAME; !>
2034 * ```
2035 * ———— Shortcode & JavaScript Equivalents ————
2036 * ```
2037 * [s2Get constant="S2MEMBER_PAYPAL_API_USERNAME" /]
2038 *
2039 * NOTE: For security purposes,
2040 * this API Constant is NOT available as a JavaScript Global.
2041 * ```
2042 *
2043 * @package s2Member\API_Constants
2044 * @since 3.5
2045 *
2046 * @var string
2047 *
2048 * @see s2Member\API_Constants\S2MEMBER_PAYPAL_BUSINESS
2049 * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_PASSWORD
2050 * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_SIGNATURE
2051 *
2052 * @see `Dashboard → s2Member → PayPal Options → Account Details`
2053 */
2054 if(!defined('S2MEMBER_PAYPAL_API_USERNAME'))
2055 define ('S2MEMBER_PAYPAL_API_USERNAME', ($c[] = (string)$GLOBALS['WS_PLUGIN__']['s2member']['o']['paypal_api_username']));
2056
2057 /**
2058 * PayPal API Password; as configured by the site owner.
2059 *
2060 * ———— Quick PHP Code Sample ————
2061 * ```
2062 * <!php echo S2MEMBER_PAYPAL_API_PASSWORD; !>
2063 * ```
2064 * ———— Shortcode & JavaScript Equivalents ————
2065 * ```
2066 * [s2Get constant="S2MEMBER_PAYPAL_API_PASSWORD" /]
2067 *
2068 * NOTE: For security purposes,
2069 * this API Constant is NOT available as a JavaScript Global.
2070 * ```
2071 *
2072 * @package s2Member\API_Constants
2073 * @since 3.5
2074 *
2075 * @var string
2076 *
2077 * @see s2Member\API_Constants\S2MEMBER_PAYPAL_BUSINESS
2078 * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_USERNAME
2079 * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_SIGNATURE
2080 *
2081 * @see `Dashboard → s2Member → PayPal Options → Account Details`
2082 */
2083 if(!defined('S2MEMBER_PAYPAL_API_PASSWORD'))
2084 define ('S2MEMBER_PAYPAL_API_PASSWORD', ($c[] = (string)$GLOBALS['WS_PLUGIN__']['s2member']['o']['paypal_api_password']));
2085
2086 /**
2087 * PayPal API Signature; as configured by the site owner.
2088 *
2089 * ———— Quick PHP Code Sample ————
2090 * ```
2091 * <!php echo S2MEMBER_PAYPAL_API_SIGNATURE; !>
2092 * ```
2093 * ———— Shortcode & JavaScript Equivalents ————
2094 * ```
2095 * [s2Get constant="S2MEMBER_PAYPAL_API_SIGNATURE" /]
2096 *
2097 * NOTE: For security purposes,
2098 * this API Constant is NOT available as a JavaScript Global.
2099 * ```
2100 *
2101 * @package s2Member\API_Constants
2102 * @since 3.5
2103 *
2104 * @var string
2105 *
2106 * @see s2Member\API_Constants\S2MEMBER_PAYPAL_BUSINESS
2107 * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_USERNAME
2108 * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_PASSWORD
2109 *
2110 * @see `Dashboard → s2Member → PayPal Options → Account Details`
2111 */
2112 if(!defined('S2MEMBER_PAYPAL_API_SIGNATURE'))
2113 define ('S2MEMBER_PAYPAL_API_SIGNATURE', ($c[] = (string)$GLOBALS['WS_PLUGIN__']['s2member']['o']['paypal_api_signature']));
2114
2115 /**
2116 * PayPal PDT Identity Token; as configured by the site owner.
2117 *
2118 * ———— Quick PHP Code Sample ————
2119 * ```
2120 * <!php echo S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN; !>
2121 * ```
2122 * ———— Shortcode & JavaScript Equivalents ————
2123 * ```
2124 * [s2Get constant="S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN" /]
2125 *
2126 * NOTE: For security purposes,
2127 * this API Constant is NOT available as a JavaScript Global.
2128 * ```
2129 *
2130 * @package s2Member\API_Constants
2131 * @since 3.5
2132 *
2133 * @var string
2134 *
2135 * @see s2Member\API_Constants\S2MEMBER_PAYPAL_RETURN_URL
2136 * @see s2Member\API_Constants\S2MEMBER_PAYPAL_NOTIFY_URL
2137 *
2138 * @see `Dashboard → s2Member → PayPal Options → Auto-Return/PDT Integration`
2139 */
2140 if(!defined('S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN'))
2141 define ('S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN', ($c[] = (string)$GLOBALS['WS_PLUGIN__']['s2member']['o']['paypal_identity_token']));
2142
2143 /**
2144 * PayPal value for Payment Buttons with input name: `invoice`.
2145 *
2146 * This can be used to auto-fill the `invoice` value in PayPal Button Codes, with a unique Code~IP combination.
2147 * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2148 *
2149 * Note. This API Constant is excluded from the ``$c[]`` hash calculation used in the generation of {@link s2Member\API_Constants\WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5}.
2150 * It MUST be excluded, because the value of this particular API Constant will change too often *(i.e., it changes, depending on microtime)*.
2151 * So, when including this API Constant in the JavaScript API as a Global, care must be taken to build an Invoice, using JavaScript
2152 * to calculate the unique time-based code, with something like: `Math.round (new Date ().getTime ())`.
2153 *
2154 * These five API Constants are special.
2155 * o {@link s2Member\API_Constants\S2MEMBER_VALUE_FOR_PP_INV}
2156 * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
2157 * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
2158 * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
2159 * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
2160 *
2161 * They are used by the PayPal Button Generator for s2Member.
2162 *
2163 * The `INV` value can be used to auto-fill the `invoice` for PayPal Button Codes, with a unique Code~IP combination.
2164 * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2165 *
2166 * The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
2167 * when they click a PayPal Modification Button that was generated for you by s2Member's Button Generator.
2168 *
2169 * Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
2170 * s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
2171 * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal Buttons,
2172 * you won't even see these, because they're added internally by the Shortcode processor.
2173 *
2174 * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal.
2175 *
2176 * Anyway, these five API Constants are just documented here for clarity;
2177 * you probably won't use any of these directly; the Button Generator pops them in.
2178 *
2179 * ———— Quick PHP Code Sample ————
2180 * ```
2181 * <!php echo S2MEMBER_VALUE_FOR_PP_INV; !>
2182 * ```
2183 * ———— Shortcode & JavaScript Equivalents ————
2184 * ```
2185 * [s2Get constant="S2MEMBER_VALUE_FOR_PP_INV" /]
2186 *
2187 * <script type="text/javascript">
2188 * document.write(S2MEMBER_VALUE_FOR_PP_INV);
2189 * </script>
2190 * ```
2191 *
2192 * @package s2Member\API_Constants
2193 * @since 110720
2194 *
2195 * @var string
2196 *
2197 * @see s2Member\API_Functions\s2member_value_for_pp_inv()
2198 *
2199 * @see `Dashboard → s2Member → PayPal Buttons`
2200 */
2201 if(!defined('S2MEMBER_VALUE_FOR_PP_INV'))
2202 define ('S2MEMBER_VALUE_FOR_PP_INV', uniqid().'~'.S2MEMBER_CURRENT_USER_IP);
2203
2204 /**
2205 * PayPal value for Payment Buttons with input name: `on0`.
2206 *
2207 * Used in PayPal Modification Buttons *(i.e., upgrades/downgrades)*.
2208 *
2209 * This auto-fills the `on0` value in PayPal Button Codes. If a Button Code is presented to a logged-in Member,
2210 * this will auto-fill the value for the `on0` input variable, with the string: "Referencing Customer ID".
2211 * Otherwise, it will be set to a default value of: "Originating Domain".
2212 *
2213 * These five API Constants are special.
2214 * o {@link s2Member\API_Constants\S2MEMBER_VALUE_FOR_PP_INV}
2215 * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
2216 * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
2217 * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
2218 * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
2219 *
2220 * They are used by the PayPal Button Generator for s2Member.
2221 *
2222 * The `INV` value can be used to auto-fill the `invoice` for PayPal Button Codes, with a unique Code~IP combination.
2223 * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2224 *
2225 * The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
2226 * when they click a PayPal Modification Button that was generated for you by s2Member's Button Generator.
2227 *
2228 * Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
2229 * s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
2230 * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal Buttons,
2231 * you won't even see these, because they're added internally by the Shortcode processor.
2232 *
2233 * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal.
2234 *
2235 * Anyway, these five API Constants are just documented here for clarity;
2236 * you probably won't use any of these directly; the Button Generator pops them in.
2237 *
2238 * ———— Quick PHP Code Sample ————
2239 * ```
2240 * <!php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0; !>
2241 * ```
2242 * ———— Shortcode & JavaScript Equivalents ————
2243 * ```
2244 * [s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0" /]
2245 *
2246 * <script type="text/javascript">
2247 * document.write(S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0);
2248 * </script>
2249 * ```
2250 *
2251 * @package s2Member\API_Constants
2252 * @since 3.5
2253 *
2254 * @var string
2255 *
2256 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0
2257 *
2258 * @see `Dashboard → s2Member → PayPal Buttons`
2259 */
2260 if(!defined('S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0'))
2261 define ('S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0', ($c[] = ((S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID) ? 'Referencing Customer ID' : 'Originating Domain')));
2262
2263 /**
2264 * PayPal value for Payment Buttons with input name: `os0`.
2265 *
2266 * Used in PayPal Modification Buttons *(i.e., upgrades/downgrades)*.
2267 *
2268 * This auto-fills the `os0` value in PayPal Button Codes. If a Button Code is presented to a logged-in Member,
2269 * this will auto-fill the value for the `os0` input variable, with the value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID}.
2270 * Otherwise, it will be set to a default value of ``$_SERVER['HTTP_HOST']`` *(the originating domain name)*.
2271 *
2272 * These five API Constants are special.
2273 * o {@link s2Member\API_Constants\S2MEMBER_VALUE_FOR_PP_INV}
2274 * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
2275 * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
2276 * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
2277 * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
2278 *
2279 * They are used by the PayPal Button Generator for s2Member.
2280 *
2281 * The `INV` value can be used to auto-fill the `invoice` for PayPal Button Codes, with a unique Code~IP combination.
2282 * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2283 *
2284 * The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
2285 * when they click a PayPal Modification Button that was generated for you by s2Member's Button Generator.
2286 *
2287 * Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
2288 * s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
2289 * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal Buttons,
2290 * you won't even see these, because they're added internally by the Shortcode processor.
2291 *
2292 * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal.
2293 *
2294 * Anyway, these five API Constants are just documented here for clarity;
2295 * you probably won't use any of these directly; the Button Generator pops them in.
2296 *
2297 * ———— Quick PHP Code Sample ————
2298 * ```
2299 * <!php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0; !>
2300 * ```
2301 * ———— Shortcode & JavaScript Equivalents ————
2302 * ```
2303 * [s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0" /]
2304 *
2305 * <script type="text/javascript">
2306 * document.write(S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0);
2307 * </script>
2308 * ```
2309 *
2310 * @package s2Member\API_Constants
2311 * @since 3.5
2312 *
2313 * @var string
2314 *
2315 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0
2316 *
2317 * @see `Dashboard → s2Member → PayPal Buttons`
2318 */
2319 if(!defined('S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0'))
2320 define ('S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0', ($c[] = ((S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID) ? S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID : (string)@$_SERVER['HTTP_HOST'])));
2321
2322 /**
2323 * PayPal value for Payment Buttons with input name: `on1`.
2324 *
2325 * This auto-fills the `on1` value in PayPal Button Codes.
2326 * This always contains the string: "Customer IP Address".
2327 *
2328 * These five API Constants are special.
2329 * o {@link s2Member\API_Constants\S2MEMBER_VALUE_FOR_PP_INV}
2330 * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
2331 * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
2332 * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
2333 * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
2334 *
2335 * They are used by the PayPal Button Generator for s2Member.
2336 *
2337 * The `INV` value can be used to auto-fill the `invoice` for PayPal Button Codes, with a unique Code~IP combination.
2338 * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2339 *
2340 * The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
2341 * when they click a PayPal Modification Button that was generated for you by s2Member's Button Generator.
2342 *
2343 * Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
2344 * s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
2345 * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal Buttons,
2346 * you won't even see these, because they're added internally by the Shortcode processor.
2347 *
2348 * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal.
2349 *
2350 * Anyway, these five API Constants are just documented here for clarity;
2351 * you probably won't use any of these directly; the Button Generator pops them in.
2352 *
2353 * ———— Quick PHP Code Sample ————
2354 * ```
2355 * <!php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1; !>
2356 * ```
2357 * ———— Shortcode & JavaScript Equivalents ————
2358 * ```
2359 * [s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1" /]
2360 *
2361 * <script type="text/javascript">
2362 * document.write(S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1);
2363 * </script>
2364 * ```
2365 *
2366 * @package s2Member\API_Constants
2367 * @since 3.5
2368 *
2369 * @var string
2370 *
2371 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1
2372 *
2373 * @see `Dashboard → s2Member → PayPal Buttons`
2374 */
2375 if(!defined('S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1'))
2376 define ('S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1', ($c[] = 'Customer IP Address'));
2377
2378 /**
2379 * PayPal value for Payment Buttons with input name: `os1`.
2380 *
2381 * This auto-fills the `os1` value in PayPal Button Codes,
2382 * with the Customer's IP Address, via ``$_SERVER['REMOTE_ADDR']``.
2383 *
2384 * These five API Constants are special.
2385 * o {@link s2Member\API_Constants\S2MEMBER_VALUE_FOR_PP_INV}
2386 * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
2387 * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
2388 * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
2389 * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
2390 *
2391 * They are used by the PayPal Button Generator for s2Member.
2392 *
2393 * The `INV` value can be used to auto-fill the `invoice` for PayPal Button Codes, with a unique Code~IP combination.
2394 * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
2395 *
2396 * The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
2397 * when they click a PayPal Modification Button that was generated for you by s2Member's Button Generator.
2398 *
2399 * Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
2400 * s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
2401 * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal Buttons,
2402 * you won't even see these, because they're added internally by the Shortcode processor.
2403 *
2404 * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal.
2405 *
2406 * Anyway, these five API Constants are just documented here for clarity;
2407 * you probably won't use any of these directly; the Button Generator pops them in.
2408 *
2409 * ———— Quick PHP Code Sample ————
2410 * ```
2411 * <!php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1; !>
2412 * ```
2413 * ———— Shortcode & JavaScript Equivalents ————
2414 * ```
2415 * [s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1" /]
2416 *
2417 * <script type="text/javascript">
2418 * document.write(S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1);
2419 * </script>
2420 * ```
2421 *
2422 * @package s2Member\API_Constants
2423 * @since 3.5
2424 *
2425 * @var string
2426 *
2427 * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1
2428 *
2429 * @see `Dashboard → s2Member → PayPal Buttons`
2430 */
2431 if(!defined('S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1'))
2432 define ('S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1', ($c[] = c_ws_plugin__s2member_utils_ip::current()));
2433
2434 /*
2435 Allows other Constants to be calculated with their checksums included too.
2436 */
2437 $c = apply_filters('ws_plugin__s2member_during_constants_c', $c, get_defined_vars());
2438
2439 /**
2440 * Used internally by s2Member to compare the value of all API Constants at once.
2441 *
2442 * @package s2Member\API_Constants
2443 * @since 3.5
2444 *
2445 * @var string
2446 */
2447 if(!defined('WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5'))
2448 define ('WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5', md5(serialize($c).c_ws_plugin__s2member_utilities::ver_checksum()));
2449
2450 /*
2451 Calls the after Hook. Do NOT set Constants here.
2452 */
2453 do_action('ws_plugin__s2member_after_constants', get_defined_vars());
2454 }
2455 }
2456 }
2457