/**
  * Handles the Shortcode for: `[s2File /]`.
  *
  * @package s2Member\s2File
  * @since 110926
  *
  * @attaches-to ``add_shortcode("s2File");``
  *
  * @param array $attr An array of Attributes.
  * @param str $content Content inside the Shortcode.
  * @param str $shortcode The actual Shortcode name itself.
  * @return str Value of requested File Download URL, streamer array element; or null on failure.
  */
 public static function sc_get_file($attr = FALSE, $content = FALSE, $shortcode = FALSE)
 {
     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
     do_action("ws_plugin__s2member_before_sc_get_file", get_defined_vars());
     unset($__refs, $__v);
     /* Unset defined __refs, __v. */
     /**/
     $attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
     /* Force array; trim quote entities. */
     /**/
     $attr = shortcode_atts(array("download" => "", "download_key" => "", "stream" => "", "inline" => "", "storage" => "", "remote" => "", "ssl" => "", "rewrite" => "", "rewrite_base" => "", "skip_confirmation" => "", "url_to_storage_source" => "", "count_against_user" => "", "check_user" => "", "get_streamer_json" => "", "get_streamer_array" => ""), $attr);
     /**/
     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
     do_action("ws_plugin__s2member_before_sc_get_file_after_shortcode_atts", get_defined_vars());
     unset($__refs, $__v);
     /* Unset defined __refs, __v. */
     /**/
     $get_streamer_json = filter_var($attr["get_streamer_json"], FILTER_VALIDATE_BOOLEAN);
     /* Getting streamer? */
     $get_streamer_array = filter_var($attr["get_streamer_array"], FILTER_VALIDATE_BOOLEAN);
     /* Streamer? */
     $get_streamer_json = $get_streamer_array = $get_streamer_array || $get_streamer_json ? true : false;
     /**/
     foreach ($attr as $key => $value) {
         /* Now we need to go through and a `file_` prefix  to certain Attribute keys, for compatibility. */
         if (strlen($value) && in_array($key, array("download", "download_key", "stream", "inline", "storage", "remote", "ssl", "rewrite", "rewrite_base"))) {
             $config["file_" . $key] = $value;
         } else {
             if (strlen($value) && !in_array($key, array("get_streamer_json", "get_streamer_array"))) {
                 /* Else, exclude? */
                 $config[$key] = $value;
             }
         }
     }
     /**/
     unset($key, $value);
     /* Ditch these now. We don't want these bleeding into Hooks/Filters anyway. */
     /**/
     if (!empty($config) && isset($config["file_download"])) {
         $_get = c_ws_plugin__s2member_files::create_file_download_url($config, $get_streamer_array);
         /**/
         if ($get_streamer_array && $get_streamer_json && is_array($_get)) {
             $get = json_encode($_get);
         } else {
             if ($get_streamer_array && $get_streamer_json) {
                 $get = "null";
             } else {
                 if (!empty($_get)) {
                     /* Else ``$get``. */
                     $get = $_get;
                 }
             }
         }
         /* Default return. */
     }
     /**/
     return apply_filters("ws_plugin__s2member_sc_get_file", isset($get) ? $get : null, get_defined_vars());
 }
 /**
  * Handles the Shortcode for: `[s2Key /]`.
  *
  * @package s2Member\s2Key
  * @since 110912
  *
  * @attaches-to ``add_shortcode("s2Key");``
  *
  * @param array $attr An array of Attributes.
  * @param string $content Content inside the Shortcode.
  * @param string $shortcode The actual Shortcode name itself.
  * @return string Value of the requested key, or null on failure.
  */
 public static function sc_get_key($attr = FALSE, $content = FALSE, $shortcode = FALSE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_sc_get_key", get_defined_vars());
     unset($__refs, $__v);
     $attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
     $attr = shortcode_atts(array("file_download" => "", "directive" => ""), $attr);
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_sc_get_key_after_shortcode_atts", get_defined_vars());
     unset($__refs, $__v);
     if ($attr["file_download"]) {
         // Requesting a File Download Key?
         $get = c_ws_plugin__s2member_files::file_download_key($attr["file_download"], $attr["directive"]);
     }
     return apply_filters("ws_plugin__s2member_sc_get_key", isset($get) ? $get : null, get_defined_vars());
 }
Example #3
0
 /**
  * Handles the Shortcode for: `[s2Key /]`.
  *
  * @package s2Member\s2Key
  * @since 110912
  *
  * @attaches-to ``add_shortcode('s2Key');``
  *
  * @param array  $attr An array of Attributes.
  * @param string $content Content inside the Shortcode.
  * @param string $shortcode The actual Shortcode name itself.
  *
  * @return string Value of the requested key, or null on failure.
  */
 public static function sc_get_key($attr = array(), $content = '', $shortcode = '')
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_sc_get_key', get_defined_vars());
     unset($__refs, $__v);
     // Allow variables to be modified by reference.
     $attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
     $attr = shortcode_atts(array('file_download' => '', 'directive' => ''), $attr);
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_sc_get_key_after_shortcode_atts', get_defined_vars());
     unset($__refs, $__v);
     // Allow variables to be modified by reference.
     if ($attr['file_download']) {
         // Requesting a File Download Key?
         $get = c_ws_plugin__s2member_files::file_download_key($attr['file_download'], $attr['directive']);
     }
     return apply_filters('ws_plugin__s2member_sc_get_key', isset($get) ? $get : '', get_defined_vars());
 }
Example #4
0
 /**
  * Builds and handles the Download Options page.
  *
  * @package s2Member\Menu_Pages
  * @since 3.5
  */
 public static function down_ops_page()
 {
     do_action('ws_plugin__s2member_before_down_ops_page', get_defined_vars());
     c_ws_plugin__s2member_menu_pages::update_all_options();
     if (!empty($_REQUEST['ws_plugin__s2member_cf_options_reset']) && wp_verify_nonce($_REQUEST['ws_plugin__s2member_cf_options_reset'], 'ws-plugin--s2member-cf-options-reset')) {
         c_ws_plugin__s2member_files_in::reset_aws_cf_config_values();
         // A full CloudFront reset.
         c_ws_plugin__s2member_admin_notices::display_admin_notice('Amazon CloudFront configuration reset successfully.');
     }
     $files_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['files_dir'];
     $htaccess = $GLOBALS['WS_PLUGIN__']['s2member']['c']['files_dir'] . '/.htaccess';
     $htaccess_contents = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS['WS_PLUGIN__']['s2member']['c']['files_dir_htaccess'])));
     $no_gzip_htaccess = ABSPATH . '.htaccess';
     // Always located in the absolute root path for WordPress.
     $no_gzip_htaccess_contents = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS['WS_PLUGIN__']['s2member']['c']['files_no_gzip_htaccess'])));
     if (!c_ws_plugin__s2member_files::no_gzip_rules_in_root_htaccess()) {
         // If s2Member's GZIP exclusions do NOT yet exist in the root `.htaccess` file.
         c_ws_plugin__s2member_files::write_no_gzip_into_root_htaccess() . clearstatcache();
     }
     // Handle the root `.htaccess` file now.
     if (!is_dir($files_dir) && is_writable(dirname(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($files_dir)))) {
         mkdir($files_dir, 0777, TRUE) . clearstatcache();
     }
     // Create this directory structure now.
     if (is_dir($files_dir) && is_writable($files_dir) && !file_exists($htaccess)) {
         // This file does NOT exist yet?
         file_put_contents($htaccess, $htaccess_contents) . clearstatcache();
     }
     // Create the `.htaccess` file now.
     if (!c_ws_plugin__s2member_files::no_gzip_rules_in_root_htaccess()) {
         // If s2Member's GZIP exclusions do NOT yet exist in the root `.htaccess` file.
         c_ws_plugin__s2member_admin_notices::display_admin_notice('Possible GZIP conflict on server. Unable to write GZIP exclusions into root .htaccess file (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($no_gzip_htaccess)) . '</code>). Please read the panel below: <strong>Preventing GZIP Conflicts</strong>, and add this section yourself:<br /><pre>' . esc_html($no_gzip_htaccess_contents) . '</pre>', TRUE);
     }
     if (!is_dir($files_dir)) {
         // If the security-enabled files directory does not exist yet.
         c_ws_plugin__s2member_admin_notices::display_admin_notice('The security-enabled files directory (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($files_dir)) . '</code>) does not exist. Please create this directory manually.', TRUE);
     }
     if (!file_exists($htaccess)) {
         // If the `.htaccess` file has not been created yet.
         c_ws_plugin__s2member_admin_notices::display_admin_notice('The .htaccess protection file (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($htaccess)) . '</code>) does not exist. Please create this file manually. Inside your .htaccess file, add this:<br /><pre>' . esc_html($htaccess_contents) . '</pre>', TRUE);
     } else {
         if (!preg_match('/deny from all/i', file_get_contents($htaccess))) {
             // Else if the `.htaccess` file does not offer the required protection.
             c_ws_plugin__s2member_admin_notices::display_admin_notice('Unprotected. The .htaccess protection file (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($htaccess)) . '</code>) does not contain <code>deny from all</code>. Inside your .htaccess file, add this:<br /><pre>' . esc_html($htaccess_contents) . '</pre>', TRUE);
         }
     }
     if (!empty($_POST['ws_plugin__s2member_amazon_cf_files_auto_configure_distros']) && ($nonce = $_POST['ws_plugin__s2member_amazon_cf_files_auto_configure_distros']) && wp_verify_nonce($nonce, 'ws-plugin--s2member-amazon-cf-files-auto-configure-distros')) {
         if (($amazon_cf_auto_configure_distros = c_ws_plugin__s2member_files_in::amazon_cf_auto_configure_distros()) && $amazon_cf_auto_configure_distros['success']) {
             c_ws_plugin__s2member_admin_notices::display_admin_notice('Amazon CloudFront Distributions auto-configured successfully. Please allow 30 minutes for initial propagation. <strong>Tip:</strong> If you try to stream over the RTMP protocol using something like the <code>[s2Stream /]</code> shortcode, and you keep getting an "ID Not Found" error while using JW Player; please note that it can <em>sometimes</em> take a full 24 hours for RTMP (i.e., streaming distributions) to begin working properly. This is because there are a few initialization routines that must complete on the AWS side when you first integrate with CloudFront. Please be patient.' . ($GLOBALS['WS_PLUGIN__']['s2member']['o']['amazon_cf_files_distro_downloads_cname'] ? '<br /><em>Downloads Distribution CNAME: <code>' . esc_html($GLOBALS['WS_PLUGIN__']['s2member']['o']['amazon_cf_files_distro_downloads_cname']) . ' &mdash;&raquo; ' . esc_html($GLOBALS['WS_PLUGIN__']['s2member']['o']['amazon_cf_files_distro_downloads_dname']) . '</code></em>' : '') . ($GLOBALS['WS_PLUGIN__']['s2member']['o']['amazon_cf_files_distro_streaming_cname'] ? '<br /><em>Streaming Distribution CNAME: <code>' . esc_html($GLOBALS['WS_PLUGIN__']['s2member']['o']['amazon_cf_files_distro_streaming_cname']) . ' &mdash;&raquo; ' . esc_html($GLOBALS['WS_PLUGIN__']['s2member']['o']['amazon_cf_files_distro_streaming_dname']) . '</code></em>' : ''));
         } else {
             // Else there was an error. We need to report this back to the site owner so they can understand what's going on.
             (c_ws_plugin__s2member_menu_pages::$pre_display_errors['cf_files_auto_configure_distros'] = TRUE) . c_ws_plugin__s2member_admin_notices::display_admin_notice('Unable to auto-configure Amazon CloudFront Distributions.<br />Error code: <code>' . esc_html($amazon_cf_auto_configure_distros['code']) . '</code>. Error Message: <code>' . esc_html($amazon_cf_auto_configure_distros['message']) . '</code>', TRUE);
         }
     }
     if (!empty($_POST['ws_plugin__s2member_amazon_s3_files_auto_configure_acls']) && ($nonce = $_POST['ws_plugin__s2member_amazon_s3_files_auto_configure_acls']) && wp_verify_nonce($nonce, 'ws-plugin--s2member-amazon-s3-files-auto-configure-acls')) {
         if (($amazon_s3_auto_configure_acls = c_ws_plugin__s2member_files_in::amazon_s3_auto_configure_acls()) && $amazon_s3_auto_configure_acls['success']) {
             c_ws_plugin__s2member_admin_notices::display_admin_notice('Amazon S3 ACLs auto-configured successfully.');
         } else {
             // Else there was an error. We need to report this back to the site owner so they can understand what's going on.
             (c_ws_plugin__s2member_menu_pages::$pre_display_errors['s3_files_auto_configure_acls'] = TRUE) . c_ws_plugin__s2member_admin_notices::display_admin_notice('Unable to auto-configure Amazon S3 ACLs.<br />Error code: <code>' . esc_html($amazon_s3_auto_configure_acls['code']) . '</code>. Error Message: <code>' . esc_html($amazon_s3_auto_configure_acls['message']) . '</code>', TRUE);
         }
     }
     include_once dirname(dirname(__FILE__)) . '/menu-pages/down-ops.inc.php';
     do_action('ws_plugin__s2member_after_down_ops_page', get_defined_vars());
 }
 /**
  * Defines several API Constants for s2Member.
  *
  * These are also duplicated into the JavaScript API for s2Member.
  * Except for a few that would pose a security issue. Such as the PayPal API Credentials;
  * those are NOT included in the JavaScript API.
  *
  * @package s2Member\API_Constants
  * @since 3.5
  *
  * @attaches-to ``add_action('init');``
  *
  * @return null
  */
 public static function constants()
 {
     do_action('ws_plugin__s2member_before_constants', get_defined_vars());
     $c = array();
     // Initialize configuration values array.
     $links = c_ws_plugin__s2member_cache::cached_page_links();
     $user = is_user_logged_in() && is_object($user = wp_get_current_user()) && $user->ID ? $user : FALSE;
     $level = c_ws_plugin__s2member_user_access::user_access_level($user);
     $file_downloads = c_ws_plugin__s2member_files::user_downloads($user);
     $login_redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url($user);
     $custom = $user ? get_user_option('s2member_custom', $user->ID) : '';
     $subscr_id = $user ? get_user_option('s2member_subscr_id', $user->ID) : '';
     $subscr_gateway = $user ? get_user_option('s2member_subscr_gateway', $user->ID) : '';
     $registration_ip = $user ? get_user_option('s2member_registration_ip', $user->ID) : '';
     $custom_fields = $user ? get_user_option('s2member_custom_fields', $user->ID) : array();
     $paid_registration_times = $user ? get_user_option('s2member_paid_registration_times', $user->ID) : array();
     $login_counter = $user ? (int) get_user_option('s2member_login_counter') : -1;
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_during_constants', get_defined_vars());
     unset($__refs, $__v);
     /**
      * Current version of s2Member.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_VERSION; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_VERSION" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_VERSION);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\WS_PLUGIN__S2MEMBER_VERSION
      */
     if (!defined('S2MEMBER_VERSION')) {
         define('S2MEMBER_VERSION', $c[] = (string) WS_PLUGIN__S2MEMBER_VERSION);
     }
     /**
      * The number of times the current User has logged into your site.
      *
      * Negative `-1` through number of times logged-in.
      * Negative `-1` indicates they are NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_LOGIN_COUNTER; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_LOGIN_COUNTER" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_LOGIN_COUNTER);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 110720
      *
      * @var int
      *
      * @see s2Member\API_Functions\get_user_field()
      * @see `get_user_field('s2member_login_counter')`
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined('S2MEMBER_CURRENT_USER_LOGIN_COUNTER')) {
         define('S2MEMBER_CURRENT_USER_LOGIN_COUNTER', $c[] = (int) $login_counter);
     }
     /**
      * Is the current User logged-in at all.
      *
      * True if the current User IS logged-in, else false.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php
      * if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN)
      *   echo 'You ARE logged in.';
      * !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2If constant(S2MEMBER_CURRENT_USER_IS_LOGGED_IN)]
      *   You ARE logged-in.
      * [/s2If]
      *
      * <script type="text/javascript">
      *   if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN)
      *      document.write('You ARE logged-in.');
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var bool
      *
      * @see s2Member\API_Functions\is_user_not_logged_in()
      * @see http://codex.wordpress.org/Function_Reference/is_user_logged_in is_user_logged_in()
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined('S2MEMBER_CURRENT_USER_IS_LOGGED_IN')) {
         define('S2MEMBER_CURRENT_USER_IS_LOGGED_IN', $c[] = $user ? TRUE : FALSE);
     }
     /**
      * Is the current User logged-in as a Member.
      *
      * True if the current User IS logged-in with a Membership Level greater than `0`, else false.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php
      * if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER)
      *   echo 'You ARE logged in at Level #1 or higher.';
      * !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2If constant(S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER)]
      *   You ARE logged in at Level #1 or higher.
      * [/s2If]
      *
      * <script type="text/javascript">
      *   if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER)
      *      document.write('You ARE logged in at Level #1 or higher.');
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var bool
      *
      * @see s2Member\API_Functions\is_user_not_logged_in()
      * @see http://codex.wordpress.org/Function_Reference/is_user_logged_in is_user_logged_in()
      *
      * @see s2Member\API_Functions\user_is()
      * @see s2Member\API_Functions\user_is_not()
      *
      * @see s2Member\API_Functions\current_user_is()
      * @see s2Member\API_Functions\current_user_is_not()
      * @see s2Member\API_Functions\current_user_is_for_blog()
      * @see s2Member\API_Functions\current_user_is_not_for_blog()
      *
      * @see s2Member\API_Functions\current_user_cannot()
      * @see s2Member\API_Functions\current_user_cannot_for_blog()
      * @see http://codex.wordpress.org/Function_Reference/user_can user_can()
      * @see http://codex.wordpress.org/Function_Reference/current_user_can current_user_can()
      * @see http://codex.wordpress.org/Function_Reference/current_user_can_for_blog current_user_can_for_blog()
      *
      * @see s2Member\API_Functions\get_user_field()
      * @see `get_user_field('s2member_access_role')`
      * @see `get_user_field('s2member_access_level')`
      * @see `get_user_field('s2member_access_label')`
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined('S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER')) {
         define('S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER', $c[] = $user && $level >= 1 ? TRUE : FALSE);
     }
     /**
      * The current User's Membership Access Level.
      *
      * Negative `-1` through max Membership Level number.
      * Negative `-1` indicates they are NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_ACCESS_LEVEL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_ACCESS_LEVEL" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_ACCESS_LEVEL);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see s2Member\API_Functions\get_user_field()
      * @see `get_user_field('s2member_access_role')`
      * @see `get_user_field('s2member_access_level')`
      * @see `get_user_field('s2member_access_label')`
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ACCESS_LABEL
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined('S2MEMBER_CURRENT_USER_ACCESS_LEVEL')) {
         define('S2MEMBER_CURRENT_USER_ACCESS_LEVEL', $c[] = (int) $level);
     }
     /**
      * The current User's Membership Access Label.
      *
      * As configured by the site owner. Each Membership Level is associated with a Membership Label
      * *(i.e., Bronze, Silver, Gold, Platinum)*, or whatever the site owner has configured.
      *
      * An empty string if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_ACCESS_LABEL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_ACCESS_LABEL" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_ACCESS_LABEL);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Functions\get_user_field()
      * @see `get_user_field('s2member_access_role')`
      * @see `get_user_field('s2member_access_level')`
      * @see `get_user_field('s2member_access_label')`
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ACCESS_LEVEL
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined('S2MEMBER_CURRENT_USER_ACCESS_LABEL')) {
         define('S2MEMBER_CURRENT_USER_ACCESS_LABEL', $c[] = (string) @$GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $level . '_label']);
     }
     /**
      * The current User's Paid Subscription ID (when applicable).
      *
      * An empty string if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_SUBSCR_ID; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_SUBSCR_ID" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_SUBSCR_ID);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Functions\get_user_field()
      * @see `get_user_field('s2member_subscr_id')`
      *
      * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
      * @see `get_user_option('s2member_subscr_id')`
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_CUSTOM
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined('S2MEMBER_CURRENT_USER_SUBSCR_ID')) {
         define('S2MEMBER_CURRENT_USER_SUBSCR_ID', $c[] = $user ? (string) $subscr_id : '');
     }
     /**
      * The current User's Paid Subscription ID (when applicable);
      * otherwise, this will contain their WordPress User ID.
      *
      * An empty string if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Functions\get_user_field()
      * @see `get_user_field('s2member_subscr_or_wp_id')`
      *
      * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
      * @see `get_user_option('s2member_subscr_id')`
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_CUSTOM
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_ID
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined('S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID')) {
         define('S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID', $c[] = $user ? $subscr_id ? (string) $subscr_id : (string) $user->ID : '');
     }
     /**
      * The current User's Paid Subscription Gateway Code (when applicable).
      *
      * Usually one of these values: `paypal`, `authnet`, `clickbank`, `google`, `ccbill`, `alipay`.
      *
      * An empty string if NOT logged-in, or if NOT a paying Member.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Functions\get_user_field()
      * @see `get_user_field('s2member_subscr_gateway')`
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_CUSTOM
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_ID
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
      *
      * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
      * @see `get_user_option('s2member_subscr_gateway')`
      */
     if (!defined('S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY')) {
         define('S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY', $c[] = $user ? (string) $subscr_gateway : '');
     }
     /**
      * The current User's Custom String, associated with their Profile.
      *
      * For paying Members, this should always start with the installation domain name.
      * This is taken from the `custom=""` Attribute in your Button/Form Shortcode.
      *
      * Other pipe delimited values may follow the installation domain name, if configured by the site owner.
      * For instance, this might be equal to something like: `www.example.com|cv1|cv2|cv3`.
      *
      * An empty string if NOT logged-in, or if NOT a paying Member.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_CUSTOM; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_CUSTOM" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_CUSTOM);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Functions\get_user_field()
      * @see `get_user_field('s2member_custom')`
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_ID
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
      *
      * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
      * @see `get_user_option('s2member_custom')`
      */
     if (!defined('S2MEMBER_CURRENT_USER_CUSTOM')) {
         define('S2MEMBER_CURRENT_USER_CUSTOM', $c[] = $user ? (string) $custom : '');
     }
     /**
      * The current User's Registration Time.
      *
      * The Registration Time, is the time at which the Username was created for the account, that's it.
      * There's nothing special about this. This simply returns a {@link http://en.wikipedia.org/wiki/Unix_time Unix Timestamp}.
      *
      * This will be equal to `0` if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_REGISTRATION_TIME; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_REGISTRATION_TIME" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_REGISTRATION_TIME);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see s2Member\API_Functions\s2member_registration_time()
      *
      * @see s2Member\API_Functions\s2member_paid_registration_time()
      * @see `s2member_paid_registration_time('level1')`
      *
      * @see s2Member\API_Functions\get_user_field()
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_DAYS
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS
      *
      * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
      */
     if (!defined('S2MEMBER_CURRENT_USER_REGISTRATION_TIME')) {
         define('S2MEMBER_CURRENT_USER_REGISTRATION_TIME', $c[] = $user && $user->user_registered ? (int) strtotime($user->user_registered) : 0);
     }
     /**
      * The current User's first Paid Registration Time; regardless of which paid Level they gained access to.
      *
      * **NOTE** A Paid Registration Time, is NOT necessarily related specifically to a Payment.
      * s2Member records a Paid Registration Time, anytime a User acquires paid Membership Level Access.
      *
      * In other words, if you create a new User inside your Dashboard at a Membership Level greater than Level #0,
      * s2Member will record a Paid Registration Time immediately, because Membership Levels > 0, are reserved for paying Members.
      * s2Member monitors changes to all User accounts, and records the first Paid Registration Time for each Member, at each paid Membership Level.
      * 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.
      *
      * If the current User has never been at a paid Membership Level, this will be equal to `0`.
      *
      * This will be equal to `0` if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME);
      * </script>
      * ```
      *
      * If you need to know the last time an actual payment was received, please use ``get_user_option ('s2member_last_payment_time')``.
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see s2Member\API_Functions\s2member_registration_time()
      *
      * @see s2Member\API_Functions\s2member_paid_registration_time()
      * @see `s2member_paid_registration_time('level1')`
      *
      * @see s2Member\API_Functions\get_user_field()
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_TIME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_DAYS
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS
      *
      * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
      */
     if (!defined('S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME')) {
         define('S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME', $c[] = $user && (int) $paid_registration_times['level'] ? (int) $paid_registration_times['level'] : 0);
     }
     /**
      * The number of days the current User has been a paid Member.
      *
      * **NOTE** This is calculated using the first Paid Registration Time.
      * A Paid Registration Time, is NOT necessarily related specifically to a Payment.
      * s2Member records a Paid Registration Time, anytime a User acquires paid Membership Level Access.
      *
      * In other words, if you create a new User inside your Dashboard at a Membership Level greater than Level #0,
      * s2Member will record a Paid Registration Time immediately, because Membership Levels > 0, are reserved for paying Members.
      * s2Member monitors changes to all User accounts, and records the first Paid Registration Time for each Member, at each paid Membership Level.
      * 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.
      *
      * If the current User has never been at a paid Membership Level, this will be equal to `0`.
      *
      * This will be equal to `0` if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS);
      * </script>
      * ```
      *
      * If you need to know the last time an actual payment was received, please use ``get_user_option ('s2member_last_payment_time')``.
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see s2Member\API_Functions\s2member_registration_time()
      *
      * @see s2Member\API_Functions\s2member_paid_registration_time()
      * @see `s2member_paid_registration_time('level1')`
      *
      * @see s2Member\API_Functions\get_user_field()
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_TIME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_DAYS
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME
      *
      * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
      */
     if (!defined('S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS')) {
         define('S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS', $c[] = $user && (int) $paid_registration_times['level'] ? (int) floor((strtotime('now') - (int) $paid_registration_times['level']) / 86400) : 0);
     }
     /**
      * The number of days the current User has had an account, period.
      *
      * **NOTE** This is calculated with Registration Time.
      * The Registration Time, is the time at which the Username was created for the account, that's it.
      *
      * This will be equal to `0` if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_REGISTRATION_DAYS; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_REGISTRATION_DAYS" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_REGISTRATION_DAYS);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see s2Member\API_Functions\s2member_registration_time()
      *
      * @see s2Member\API_Functions\s2member_paid_registration_time()
      * @see `s2member_paid_registration_time('level1')`
      *
      * @see s2Member\API_Functions\get_user_field()
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_TIME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS
      *
      * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
      */
     if (!defined('S2MEMBER_CURRENT_USER_REGISTRATION_DAYS')) {
         define('S2MEMBER_CURRENT_USER_REGISTRATION_DAYS', $c[] = $user && $user->user_registered ? (int) floor((strtotime('now') - strtotime($user->user_registered)) / 86400) : 0);
     }
     /**
      * The current User's Display Name.
      *
      * This is usually a name they prefer to be known by publicly.
      * Some Users/Members prefer to use their First Name as the Display Name, and keep their Last Name private.
      *
      * An empty string if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_DISPLAY_NAME; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_DISPLAY_NAME" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_DISPLAY_NAME);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Functions\get_user_field()
      * @see `get_user_field('display_name')`
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined('S2MEMBER_CURRENT_USER_DISPLAY_NAME')) {
         define('S2MEMBER_CURRENT_USER_DISPLAY_NAME', $c[] = $user ? (string) $user->display_name : '');
     }
     /**
      * The current User's First Name.
      *
      * An empty string if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_FIRST_NAME; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_FIRST_NAME" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_FIRST_NAME);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Functions\get_user_field()
      * @see `get_user_field('first_name')`
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined('S2MEMBER_CURRENT_USER_FIRST_NAME')) {
         define('S2MEMBER_CURRENT_USER_FIRST_NAME', $c[] = $user ? (string) $user->first_name : '');
     }
     /**
      * The current User's Last Name.
      *
      * An empty string if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_LAST_NAME; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_LAST_NAME" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_LAST_NAME);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Functions\get_user_field()
      * @see `get_user_field('last_name')`
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined('S2MEMBER_CURRENT_USER_LAST_NAME')) {
         define('S2MEMBER_CURRENT_USER_LAST_NAME', $c[] = $user ? (string) $user->last_name : '');
     }
     /**
      * The current User's Username.
      *
      * An empty string if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_LOGIN; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_LOGIN" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_LOGIN);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Functions\get_user_field()
      * @see `get_user_field('user_login')`
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined('S2MEMBER_CURRENT_USER_LOGIN')) {
         define('S2MEMBER_CURRENT_USER_LOGIN', $c[] = $user ? (string) $user->user_login : '');
     }
     /**
      * The current User's Email Address.
      *
      * An empty string if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_EMAIL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_EMAIL" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_EMAIL);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Functions\get_user_field()
      * @see `get_user_field('user_email')`
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined('S2MEMBER_CURRENT_USER_EMAIL')) {
         define('S2MEMBER_CURRENT_USER_EMAIL', $c[] = $user ? (string) $user->user_email : '');
     }
     /**
      * The current User's IP Address (even if/when NOT logged-in).
      *
      * This is the current IP Address, taken from ``$_SERVER['REMOTE_ADDR']``.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_IP; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_IP" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_IP);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Functions\get_user_field()
      * @see `get_user_field('s2member_registration_ip')`
      * @see `get_user_field('ip')`
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
      *
      * @see http://www.php.net/manual/en/reserved.variables.server.php Superglobal $_SERVER
      * @see `$_SERVER['REMOTE_ADDR']`
      */
     if (!defined('S2MEMBER_CURRENT_USER_IP')) {
         define('S2MEMBER_CURRENT_USER_IP', $c[] = (string) @$_SERVER['REMOTE_ADDR']);
     }
     /**
      * IP Address the current User had during registration.
      *
      * This is the IP Address the User had at the time they registered.
      * It's useful when you need to know the original IP Address they used.
      * For instance, this is needed by some affiliate tracking systems; such as iDevAffiliate.
      *
      * An empty string if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_REGISTRATION_IP; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_REGISTRATION_IP" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_REGISTRATION_IP);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Functions\get_user_field()
      * @see `get_user_field('s2member_registration_ip')`
      * @see `get_user_field('ip')`
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
      *
      * @see http://www.php.net/manual/en/reserved.variables.server.php Superglobal $_SERVER
      * @see `$_SERVER['REMOTE_ADDR']`
      */
     if (!defined('S2MEMBER_CURRENT_USER_REGISTRATION_IP')) {
         define('S2MEMBER_CURRENT_USER_REGISTRATION_IP', $c[] = $user ? (string) $registration_ip : '');
     }
     /**
      * The current User's WordPress User ID.
      *
      * This will be equal to `0` if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_ID; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_ID" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_ID);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see s2Member\API_Functions\get_user_field()
      * @see `get_user_field('id')`
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined('S2MEMBER_CURRENT_USER_ID')) {
         define('S2MEMBER_CURRENT_USER_ID', $c[] = $user ? (int) $user->ID : 0);
     }
     /**
      * The current User's fields, provided by s2Member.
      *
      * This holds a JSON-encoded array, containing these array keys:
      *
      * o `id` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID}
      * o `ip` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP}
      * o `reg_ip` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP}
      * o `email` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL}
      * o `login` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN}
      * o `first_name` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME}
      * o `last_name` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME}
      * o `display_name` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME}
      * o `subscr_id` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_ID}
      * o `subscr_or_wp_id` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID}
      * o `subscr_gateway` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY}
      * o `custom` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_CUSTOM}
      * o and any Custom Registration/Profile Fields configured by the site owner.
      *
      * This will be an empty JSON-encoded array if NOT logged-in.
      *
      * ———— Code Sample ( Using ``json_decode(JSON, true)`` ) ————
      * ```
      * <!php
      * $fields = json_decode(S2MEMBER_CURRENT_USER_FIELDS, true);
      * echo $fields['email']; # The current User's Email Address.
      * echo $fields['my_unique_field_id']; # A Custom Registration/Profile Field configured by the site owner.
      * !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get user_field="id" /]
      * [s2Get user_field="ip" /]
      * [s2Get user_field="reg_ip" /]
      * [s2Get user_field="email" /]
      * [s2Get user_field="login" /]
      * [s2Get user_field="first_name" /]
      * [s2Get user_field="last_name" /]
      * [s2Get user_field="display_name" /]
      * [s2Get user_field="s2member_subscr_id" /]
      * [s2Get user_field="s2member_subscr_wp_id" /]
      * [s2Get user_field="s2member_subscr_gateway" /]
      * [s2Get user_field="s2member_custom" /]
      * [s2Get user_field="my_custom_field_id" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_FIELDS.id);
      *   document.write(S2MEMBER_CURRENT_USER_FIELDS.display_name);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Functions\get_user_field()
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      */
     if (!defined('S2MEMBER_CURRENT_USER_FIELDS')) {
         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()));
     }
     /**
      * Indicates the number of unique Files the current User is allowed to download every X days.
      *
      * `0` means no access to File Downloads has been made available to the User.
      *
      * This will be equal to `0` if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see s2Member\API_Functions\s2member_user_downloads()
      * @see s2Member\API_Functions\s2member_total_downloads_of()
      * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
      * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
      *
      * @see `Dashboard ⥱ s2Member ⥱ Download Options`
      */
     if (!defined('S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED')) {
         define('S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED', $c[] = (int) $file_downloads['allowed']);
     }
     /**
      * Does the current User have access to unlimited File Downloads.
      *
      * A value of true means the current User's allowed downloads are >= `999999999`, and false means it is not.
      * This is useful if you are allowing unlimited ( i.e., `999999999+` ) Downloads on some Membership Levels.
      * You can display `Unlimited` instead of a numerical value.
      *
      * This will be false if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php
      * if(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED)
      *   echo 'You have access to unlimited downloads.';
      * !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2If constant(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED)]
      *   You have access to unlimited downloads.
      * [/s2If]
      *
      * <script type="text/javascript">
      *   if(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED)
      *      document.write('You have access to unlimited downloads.');
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var bool
      *
      * @see s2Member\API_Functions\s2member_user_downloads()
      * @see s2Member\API_Functions\s2member_total_downloads_of()
      * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
      * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
      *
      * @see `Dashboard ⥱ s2Member ⥱ Download Options`
      */
     if (!defined('S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED')) {
         define('S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED', $c[] = $file_downloads['allowed'] >= 999999999 ? TRUE : FALSE);
     }
     /**
      * Indicates the number of unique Files the current User has downloaded in the last X days.
      *
      * This will be equal to `0` if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @note This does NOT include File Downloads accessed with an Advanced File Download Key.
      *
      * @see s2Member\API_Functions\s2member_user_downloads()
      * @see s2Member\API_Functions\s2member_total_downloads_of()
      * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
      * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
      *
      * @see `Dashboard ⥱ s2Member ⥱ Download Options`
      */
     if (!defined('S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY')) {
         define('S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY', $c[] = (int) $file_downloads['currently']);
     }
     /**
      * Indicates the X number of days, configured by the site owner; for the current User.
      *
      * This will be equal to `0` if NOT logged-in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * You are allowed to download <!php echo S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED; !> files, every <!php echo S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS; !> days.
      * You've downloaded <!php echo S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY; !> files in the last <!php echo S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS; !> days.
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * You are allowed to download [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED" /] files, every [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS" /] days.
      * You've downloaded [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY" /] files in the last [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS" /] days.
      *
      * 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.
      * 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.
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see s2Member\API_Functions\s2member_user_downloads()
      * @see s2Member\API_Functions\s2member_total_downloads_of()
      * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
      * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
      *
      * @see `Dashboard ⥱ s2Member ⥱ Download Options`
      */
     if (!defined('S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS')) {
         define('S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS', $c[] = (int) $file_downloads['allowed_days']);
     }
     /**
      * The configured Page ID, for the Download Limit Exceeded Page.
      *
      * This will be equal to `0` if NOT yet configured.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see s2Member\API_Functions\s2member_user_downloads()
      * @see s2Member\API_Functions\s2member_total_downloads_of()
      * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
      *
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
      * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
      * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
      *
      * @see `Dashboard ⥱ s2Member ⥱ Download Options`
      */
     if (!defined('S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID')) {
         define('S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID', $c[] = (int) $GLOBALS['WS_PLUGIN__']['s2member']['o']['file_download_limit_exceeded_page']);
     }
     /**
      * The configured Page ID, for the Membership Options Page.
      *
      * This will be equal to `0` if NOT yet configured.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
      * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
      *
      * @see `Dashboard ⥱ s2Member ⥱ General Options ⥱ Membership Options Page`
      */
     if (!defined('S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID')) {
         define('S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID', $c[] = (int) $GLOBALS['WS_PLUGIN__']['s2member']['o']['membership_options_page']);
     }
     /**
      * The configured Page ID, for the Login Welcome Page.
      *
      * This will be equal to `0` if NOT yet configured.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_LOGIN_WELCOME_PAGE_ID; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_LOGIN_WELCOME_PAGE_ID" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_LOGIN_WELCOME_PAGE_ID);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
      * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
      *
      * @see `Dashboard ⥱ s2Member ⥱ General Options ⥱ Login Welcome Page`
      */
     if (!defined('S2MEMBER_LOGIN_WELCOME_PAGE_ID')) {
         define('S2MEMBER_LOGIN_WELCOME_PAGE_ID', $c[] = (int) $GLOBALS['WS_PLUGIN__']['s2member']['o']['login_welcome_page']);
     }
     /**
      * A URL, which leads to the Stand-Alone Profile Modification Page.
      *
      * This is always a reference to `/?s2member_profile=1` *(i.e., the Stand-Alone version)*.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
      * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see `Dashboard ⥱ s2Member ⥱ General Options ⥱ Profile Modifications`
      */
     if (!defined('S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL')) {
         define('S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL', $c[] = (string) home_url('/?s2member_profile=1'));
     }
     /**
      * A URL, which leads to the Download Limit Exceeded Page; as configured by the site owner.
      *
      * If the site owner has not yet configured a Download Limit Exceeded Page, this defaults to the Home Page.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Functions\s2member_user_downloads()
      * @see s2Member\API_Functions\s2member_total_downloads_of()
      * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
      *
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
      * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
      * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
      *
      * @see `Dashboard ⥱ s2Member ⥱ Download Options`
      */
     if (!defined('S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL')) {
         define('S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL', $c[] = (string) $links['file_download_limit_exceeded_page']);
     }
     /**
      * A URL, which leads to the Membership Options Page; as configured by the site owner.
      *
      * If the site owner has not yet configured a Membership Options Page, this defaults to the Home Page.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
      * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
      *
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
      *
      * @see `Dashboard ⥱ s2Member ⥱ General Options ⥱ Membership Options Page`
      */
     if (!defined('S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL')) {
         define('S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL', $c[] = (string) $links['membership_options_page']);
     }
     // Signup page.
     /**
      * The URL, which leads to the Login Welcome Page; as configured by the site owner.
      *
      * If the site owner has not yet configured a Login Welcome Page, this defaults to the Home Page.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_LOGIN_WELCOME_PAGE_URL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_LOGIN_WELCOME_PAGE_URL" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_LOGIN_WELCOME_PAGE_URL);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
      * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
      *
      * @see `Dashboard ⥱ s2Member ⥱ General Options ⥱ Login Welcome Page`
      */
     if (!defined('S2MEMBER_LOGIN_WELCOME_PAGE_URL')) {
         define('S2MEMBER_LOGIN_WELCOME_PAGE_URL', $c[] = $login_redirection_url ? (string) $login_redirection_url : (string) $links['login_welcome_page']);
     }
     /**
      * The URL, which logs the current User out of their account.
      *
      * This is the value provided by WordPress. It's the same as using ``wp_logout_url()``.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_LOGOUT_PAGE_URL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_LOGOUT_PAGE_URL" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_LOGOUT_PAGE_URL);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_logout_url wp_logout_url()
      */
     if (!defined('S2MEMBER_LOGOUT_PAGE_URL')) {
         define('S2MEMBER_LOGOUT_PAGE_URL', $c[] = (string) wp_logout_url());
     }
     // Triggers `wp_nonce_tick()`; watch out for dynamic changes.
     /**
      * The URL, where a User can log into their account.
      *
      * This is the value provided by WordPress. It's the same as using ``wp_login_url()``.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_LOGIN_PAGE_URL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_LOGIN_PAGE_URL" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_LOGIN_PAGE_URL);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_login_url wp_login_url()
      */
     if (!defined('S2MEMBER_LOGIN_PAGE_URL')) {
         define('S2MEMBER_LOGIN_PAGE_URL', $c[] = (string) wp_login_url());
     }
     /**
      * Each Membership Level (Label); as configured by the site owner.
      *
      * The defaults are as follows:
      * o Level #0 ``S2MEMBER_LEVEL0_LABEL`` = Free Subscriber
      * o Level #1 ``S2MEMBER_LEVEL1_LABEL`` = Bronze Member
      * o Level #2 ``S2MEMBER_LEVEL2_LABEL`` = Silver Member
      * o Level #3 ``S2MEMBER_LEVEL3_LABEL`` = Gold Member
      * o Level #4 ``S2MEMBER_LEVEL4_LABEL`` = Platinum Member
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_LEVEL0_LABEL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_LEVEL0_LABEL" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_LEVEL0_LABEL);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Functions\get_user_field()
      * @see `get_user_field('s2member_access_role')`
      * @see `get_user_field('s2member_access_level')`
      * @see `get_user_field('s2member_access_label')`
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ACCESS_LEVEL
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ACCESS_LABEL
      *
      * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
      *
      * @see `Dashboard ⥱ s2Member ⥱ General Options ⥱ Membership Level (Labels)`
      */
     for ($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++) {
         if (!defined($S2MEMBER_LEVELn_LABEL = 'S2MEMBER_LEVEL' . $n . '_LABEL')) {
             define($S2MEMBER_LEVELn_LABEL, $c[] = (string) $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_label']);
         }
     }
     /**
      * File Downloads allowed at each Membership Level; as configured by the site owner.
      *
      * The defaults are as follows:
      * o Level #0 ``S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED`` = `0`
      * o Level #1 ``S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED`` = `0`
      * o Level #2 ``S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED`` = `0`
      * o Level #3 ``S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED`` = `0`
      * o Level #4 ``S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED`` = `0`
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see s2Member\API_Functions\s2member_user_downloads()
      * @see s2Member\API_Functions\s2member_total_downloads_of()
      * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
      *
      * @see `Dashboard ⥱ s2Member ⥱ Download Options`
      */
     for ($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++) {
         if (!defined($S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED = 'S2MEMBER_LEVEL' . $n . '_FILE_DOWNLOADS_ALLOWED')) {
             define($S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED, $c[] = (int) $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_file_downloads_allowed']);
         }
     }
     /**
      * File Download days, at each Membership Level; as configured by the site owner.
      *
      * The defaults are as follows:
      * o Level #0 ``S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS`` = `0`
      * o Level #1 ``S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS`` = `0`
      * o Level #2 ``S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS`` = `0`
      * o Level #3 ``S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS`` = `0`
      * o Level #4 ``S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS`` = `0`
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * 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.
      * 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.
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * 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.
      * 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.
      *
      * 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.
      * 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.
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var int
      *
      * @see s2Member\API_Functions\s2member_user_downloads()
      * @see s2Member\API_Functions\s2member_total_downloads_of()
      * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
      *
      * @see `Dashboard ⥱ s2Member ⥱ Download Options`
      */
     for ($n = 0; $n <= $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']; $n++) {
         if (!defined($S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS = 'S2MEMBER_LEVEL' . $n . '_FILE_DOWNLOADS_ALLOWED_DAYS')) {
             define($S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS, $c[] = (int) $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $n . '_file_downloads_allowed_days']);
         }
     }
     /**
      * Inline File Download extensions; as configured by the site owner.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Functions\s2member_user_downloads()
      * @see s2Member\API_Functions\s2member_total_downloads_of()
      * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
      *
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
      * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
      *
      * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
      * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
      *
      * @see `Dashboard ⥱ s2Member ⥱ Download Options`
      */
     if (!defined('S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS')) {
         define('S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS', $c[] = (string) $GLOBALS['WS_PLUGIN__']['s2member']['o']['file_download_inline_extensions']);
     }
     /**
      * From: Name, for s2Member-specific emails; as configured by the site owner.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_REG_EMAIL_FROM_NAME; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_REG_EMAIL_FROM_NAME" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_REG_EMAIL_FROM_NAME);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Constants\S2MEMBER_REG_EMAIL_FROM_EMAIL
      *
      * @see `Dashboard ⥱ s2Member ⥱ General Options`
      */
     if (!defined('S2MEMBER_REG_EMAIL_FROM_NAME')) {
         define('S2MEMBER_REG_EMAIL_FROM_NAME', $c[] = (string) $GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_name']);
     }
     /**
      * From: Email Address, for s2Member-specific emails; as configured by the site owner.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_REG_EMAIL_FROM_EMAIL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_REG_EMAIL_FROM_EMAIL" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_REG_EMAIL_FROM_EMAIL);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Constants\S2MEMBER_REG_EMAIL_FROM_NAME
      *
      * @see `Dashboard ⥱ s2Member ⥱ General Options`
      */
     if (!defined('S2MEMBER_REG_EMAIL_FROM_EMAIL')) {
         define('S2MEMBER_REG_EMAIL_FROM_EMAIL', $c[] = (string) $GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_email']);
     }
     /**
      * Full URL to PayPal IPN handler, provided by s2Member.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_PAYPAL_NOTIFY_URL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_PAYPAL_NOTIFY_URL" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_PAYPAL_NOTIFY_URL);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Constants\S2MEMBER_PAYPAL_RETURN_URL
      * @see s2Member\API_Constants\S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN
      *
      * @see `Dashboard ⥱ s2Member ⥱ PayPal Options ⥱ IPN Integration`
      */
     if (!defined('S2MEMBER_PAYPAL_NOTIFY_URL')) {
         define('S2MEMBER_PAYPAL_NOTIFY_URL', $c[] = (string) home_url('/?s2member_paypal_notify=1'));
     }
     /**
      * Full URL to PayPal Auto-Return/PDT handler, provided by s2Member.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_PAYPAL_RETURN_URL; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_PAYPAL_RETURN_URL" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_PAYPAL_RETURN_URL);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Constants\S2MEMBER_PAYPAL_NOTIFY_URL
      * @see s2Member\API_Constants\S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN
      *
      * @see `Dashboard ⥱ s2Member ⥱ PayPal Options ⥱ Auto-Return/PDT Integration`
      */
     if (!defined('S2MEMBER_PAYPAL_RETURN_URL')) {
         define('S2MEMBER_PAYPAL_RETURN_URL', $c[] = (string) home_url('/?s2member_paypal_return=1'));
     }
     /**
      * PayPal Business Email Address; as configured by the site owner.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_PAYPAL_BUSINESS; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_PAYPAL_BUSINESS" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_PAYPAL_BUSINESS);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_USERNAME
      * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_PASSWORD
      * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_SIGNATURE
      *
      * @see `Dashboard ⥱ s2Member ⥱ PayPal Options ⥱ Account Details`
      */
     if (!defined('S2MEMBER_PAYPAL_BUSINESS')) {
         define('S2MEMBER_PAYPAL_BUSINESS', $c[] = (string) $GLOBALS['WS_PLUGIN__']['s2member']['o']['paypal_business']);
     }
     /**
      * PayPal endpoint domain (changes when Sandbox Mode is enabled).
      *
      * o In Sandbox Mode, this is: `www.sandbox.paypal.com`.
      * o In Production Mode, this is: `www.paypal.com`.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_PAYPAL_ENDPOINT; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_PAYPAL_ENDPOINT" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_PAYPAL_ENDPOINT);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_ENDPOINT
      *
      * @see `Dashboard ⥱ s2Member ⥱ PayPal Options ⥱ Account Details`
      */
     if (!defined('S2MEMBER_PAYPAL_ENDPOINT')) {
         define('S2MEMBER_PAYPAL_ENDPOINT', $c[] = $GLOBALS['WS_PLUGIN__']['s2member']['o']['paypal_sandbox'] ? 'www.sandbox.paypal.com' : 'www.paypal.com');
     }
     /**
      * PayPal API endpoint domain (changes when Sandbox Mode is enabled).
      *
      * o In Sandbox Mode, this is: `api-3t.sandbox.paypal.com`.
      * o In Production Mode, this is: `api-3t.paypal.com`.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_PAYPAL_API_ENDPOINT; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_PAYPAL_API_ENDPOINT" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_PAYPAL_API_ENDPOINT);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Constants\S2MEMBER_PAYPAL_ENDPOINT
      *
      * @see `Dashboard ⥱ s2Member ⥱ PayPal Options ⥱ Account Details`
      */
     if (!defined('S2MEMBER_PAYPAL_API_ENDPOINT')) {
         define('S2MEMBER_PAYPAL_API_ENDPOINT', $c[] = $GLOBALS['WS_PLUGIN__']['s2member']['o']['paypal_sandbox'] ? 'api-3t.sandbox.paypal.com' : 'api-3t.paypal.com');
     }
     /**
      * PayPal API Username; as configured by the site owner.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_PAYPAL_API_USERNAME; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_PAYPAL_API_USERNAME" /]
      *
      * NOTE: For security purposes,
      * this API Constant is NOT available as a JavaScript Global.
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Constants\S2MEMBER_PAYPAL_BUSINESS
      * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_PASSWORD
      * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_SIGNATURE
      *
      * @see `Dashboard ⥱ s2Member ⥱ PayPal Options ⥱ Account Details`
      */
     if (!defined('S2MEMBER_PAYPAL_API_USERNAME')) {
         define('S2MEMBER_PAYPAL_API_USERNAME', $c[] = (string) $GLOBALS['WS_PLUGIN__']['s2member']['o']['paypal_api_username']);
     }
     /**
      * PayPal API Password; as configured by the site owner.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_PAYPAL_API_PASSWORD; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_PAYPAL_API_PASSWORD" /]
      *
      * NOTE: For security purposes,
      * this API Constant is NOT available as a JavaScript Global.
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Constants\S2MEMBER_PAYPAL_BUSINESS
      * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_USERNAME
      * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_SIGNATURE
      *
      * @see `Dashboard ⥱ s2Member ⥱ PayPal Options ⥱ Account Details`
      */
     if (!defined('S2MEMBER_PAYPAL_API_PASSWORD')) {
         define('S2MEMBER_PAYPAL_API_PASSWORD', $c[] = (string) $GLOBALS['WS_PLUGIN__']['s2member']['o']['paypal_api_password']);
     }
     /**
      * PayPal API Signature; as configured by the site owner.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_PAYPAL_API_SIGNATURE; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_PAYPAL_API_SIGNATURE" /]
      *
      * NOTE: For security purposes,
      * this API Constant is NOT available as a JavaScript Global.
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Constants\S2MEMBER_PAYPAL_BUSINESS
      * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_USERNAME
      * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_PASSWORD
      *
      * @see `Dashboard ⥱ s2Member ⥱ PayPal Options ⥱ Account Details`
      */
     if (!defined('S2MEMBER_PAYPAL_API_SIGNATURE')) {
         define('S2MEMBER_PAYPAL_API_SIGNATURE', $c[] = (string) $GLOBALS['WS_PLUGIN__']['s2member']['o']['paypal_api_signature']);
     }
     /**
      * PayPal PDT Identity Token; as configured by the site owner.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN" /]
      *
      * NOTE: For security purposes,
      * this API Constant is NOT available as a JavaScript Global.
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Constants\S2MEMBER_PAYPAL_RETURN_URL
      * @see s2Member\API_Constants\S2MEMBER_PAYPAL_NOTIFY_URL
      *
      * @see `Dashboard ⥱ s2Member ⥱ PayPal Options ⥱ Auto-Return/PDT Integration`
      */
     if (!defined('S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN')) {
         define('S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN', $c[] = (string) $GLOBALS['WS_PLUGIN__']['s2member']['o']['paypal_identity_token']);
     }
     /**
      * PayPal value for Payment Buttons with input name: `invoice`.
      *
      * This can be used to auto-fill the `invoice` value in PayPal Button Codes, with a unique Code~IP combination.
      * 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.
      *
      * 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}.
      * It MUST be excluded, because the value of this particular API Constant will change too often *(i.e., it changes, depending on microtime)*.
      * So, when including this API Constant in the JavaScript API as a Global, care must be taken to build an Invoice, using JavaScript
      * to calculate the unique time-based code, with something like: `Math.round (new Date ().getTime ())`.
      *
      * These five API Constants are special.
      * o {@link s2Member\API_Constants\S2MEMBER_VALUE_FOR_PP_INV}
      * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
      * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
      * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
      * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
      *
      * They are used by the PayPal Button Generator for s2Member.
      *
      * The `INV` value can be used to auto-fill the `invoice` for PayPal Button Codes, with a unique Code~IP combination.
      * 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.
      *
      * The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
      * when they click a PayPal Modification Button that was generated for you by s2Member's Button Generator.
      *
      * Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
      * s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
      * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal Buttons,
      * you won't even see these, because they're added internally by the Shortcode processor.
      *
      * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal.
      *
      * Anyway, these five API Constants are just documented here for clarity;
      * you probably won't use any of these directly; the Button Generator pops them in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_VALUE_FOR_PP_INV; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_VALUE_FOR_PP_INV" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_VALUE_FOR_PP_INV);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 110720
      *
      * @var string
      *
      * @see s2Member\API_Functions\s2member_value_for_pp_inv()
      *
      * @see `Dashboard ⥱ s2Member ⥱ PayPal Buttons`
      */
     if (!defined('S2MEMBER_VALUE_FOR_PP_INV')) {
         define('S2MEMBER_VALUE_FOR_PP_INV', uniqid() . '~' . S2MEMBER_CURRENT_USER_IP);
     }
     /**
      * PayPal value for Payment Buttons with input name: `on0`.
      *
      * Used in PayPal Modification Buttons *(i.e., upgrades/downgrades)*.
      *
      * This auto-fills the `on0` value in PayPal Button Codes. If a Button Code is presented to a logged-in Member,
      * this will auto-fill the value for the `on0` input variable, with the string: "Referencing Customer ID".
      * Otherwise, it will be set to a default value of: "Originating Domain".
      *
      * These five API Constants are special.
      * o {@link s2Member\API_Constants\S2MEMBER_VALUE_FOR_PP_INV}
      * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
      * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
      * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
      * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
      *
      * They are used by the PayPal Button Generator for s2Member.
      *
      * The `INV` value can be used to auto-fill the `invoice` for PayPal Button Codes, with a unique Code~IP combination.
      * 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.
      *
      * The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
      * when they click a PayPal Modification Button that was generated for you by s2Member's Button Generator.
      *
      * Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
      * s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
      * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal Buttons,
      * you won't even see these, because they're added internally by the Shortcode processor.
      *
      * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal.
      *
      * Anyway, these five API Constants are just documented here for clarity;
      * you probably won't use any of these directly; the Button Generator pops them in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0
      *
      * @see `Dashboard ⥱ s2Member ⥱ PayPal Buttons`
      */
     if (!defined('S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0')) {
         define('S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0', $c[] = S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID ? 'Referencing Customer ID' : 'Originating Domain');
     }
     /**
      * PayPal value for Payment Buttons with input name: `os0`.
      *
      * Used in PayPal Modification Buttons *(i.e., upgrades/downgrades)*.
      *
      * This auto-fills the `os0` value in PayPal Button Codes. If a Button Code is presented to a logged-in Member,
      * 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}.
      * Otherwise, it will be set to a default value of ``$_SERVER['HTTP_HOST']`` *(the originating domain name)*.
      *
      * These five API Constants are special.
      * o {@link s2Member\API_Constants\S2MEMBER_VALUE_FOR_PP_INV}
      * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
      * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
      * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
      * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
      *
      * They are used by the PayPal Button Generator for s2Member.
      *
      * The `INV` value can be used to auto-fill the `invoice` for PayPal Button Codes, with a unique Code~IP combination.
      * 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.
      *
      * The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
      * when they click a PayPal Modification Button that was generated for you by s2Member's Button Generator.
      *
      * Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
      * s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
      * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal Buttons,
      * you won't even see these, because they're added internally by the Shortcode processor.
      *
      * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal.
      *
      * Anyway, these five API Constants are just documented here for clarity;
      * you probably won't use any of these directly; the Button Generator pops them in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0
      *
      * @see `Dashboard ⥱ s2Member ⥱ PayPal Buttons`
      */
     if (!defined('S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0')) {
         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']);
     }
     /**
      * PayPal value for Payment Buttons with input name: `on1`.
      *
      * This auto-fills the `on1` value in PayPal Button Codes.
      * This always contains the string: "Customer IP Address".
      *
      * These five API Constants are special.
      * o {@link s2Member\API_Constants\S2MEMBER_VALUE_FOR_PP_INV}
      * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
      * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
      * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
      * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
      *
      * They are used by the PayPal Button Generator for s2Member.
      *
      * The `INV` value can be used to auto-fill the `invoice` for PayPal Button Codes, with a unique Code~IP combination.
      * 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.
      *
      * The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
      * when they click a PayPal Modification Button that was generated for you by s2Member's Button Generator.
      *
      * Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
      * s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
      * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal Buttons,
      * you won't even see these, because they're added internally by the Shortcode processor.
      *
      * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal.
      *
      * Anyway, these five API Constants are just documented here for clarity;
      * you probably won't use any of these directly; the Button Generator pops them in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1
      *
      * @see `Dashboard ⥱ s2Member ⥱ PayPal Buttons`
      */
     if (!defined('S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1')) {
         define('S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1', $c[] = 'Customer IP Address');
     }
     /**
      * PayPal value for Payment Buttons with input name: `os1`.
      *
      * This auto-fills the `os1` value in PayPal Button Codes,
      * with the Customer's IP Address, via ``$_SERVER['REMOTE_ADDR']``.
      *
      * These five API Constants are special.
      * o {@link s2Member\API_Constants\S2MEMBER_VALUE_FOR_PP_INV}
      * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
      * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
      * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
      * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
      *
      * They are used by the PayPal Button Generator for s2Member.
      *
      * The `INV` value can be used to auto-fill the `invoice` for PayPal Button Codes, with a unique Code~IP combination.
      * 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.
      *
      * The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
      * when they click a PayPal Modification Button that was generated for you by s2Member's Button Generator.
      *
      * Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
      * s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
      * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal Buttons,
      * you won't even see these, because they're added internally by the Shortcode processor.
      *
      * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal.
      *
      * Anyway, these five API Constants are just documented here for clarity;
      * you probably won't use any of these directly; the Button Generator pops them in.
      *
      * ———— Quick PHP Code Sample ————
      * ```
      * <!php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1; !>
      * ```
      * ———— Shortcode & JavaScript Equivalents ————
      * ```
      * [s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1" /]
      *
      * <script type="text/javascript">
      *   document.write(S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1);
      * </script>
      * ```
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      *
      * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1
      *
      * @see `Dashboard ⥱ s2Member ⥱ PayPal Buttons`
      */
     if (!defined('S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1')) {
         define('S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1', $c[] = (string) @$_SERVER['REMOTE_ADDR']);
     }
     /*
     Allows other Constants to be calculated with their checksums included too.
     */
     $c = apply_filters('ws_plugin__s2member_during_constants_c', $c, get_defined_vars());
     /**
      * Used internally by s2Member to compare the value of all API Constants at once.
      *
      * @package s2Member\API_Constants
      * @since 3.5
      *
      * @var string
      */
     if (!defined('WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5')) {
         define('WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5', md5(serialize($c) . c_ws_plugin__s2member_utilities::ver_checksum()));
     }
     /*
     Calls the after Hook. Do NOT set Constants here.
     */
     do_action('ws_plugin__s2member_after_constants', get_defined_vars());
 }
 function s2member_total_unique_downloads_of($file = FALSE, $user_id = FALSE, $check_archives_too = TRUE)
 {
     return c_ws_plugin__s2member_files::total_unique_downloads_of($file, $user_id, $check_archives_too);
 }
Example #7
0
 /**
  * Writes no GZIP rules into root `.htaccess` file.
  *
  * @package s2Member\Files
  * @since 120212
  *
  * @return bool True if successfull, else false on any type of failure.
  */
 public static function write_no_gzip_into_root_htaccess()
 {
     if (c_ws_plugin__s2member_files::remove_no_gzip_from_root_htaccess()) {
         $start_line = '# BEGIN s2Member GZIP exclusions';
         // Beginning line for this entry.
         $end_line = '# END s2Member GZIP exclusions';
         // Identifying end line for this entry.
         $htaccess = ABSPATH . '.htaccess';
         // Location of this `.htaccess` file we need to write in.
         $ideally_position_before = '# BEGIN WordPress';
         // Ideally, we can position before this entry.
         $no_gzip = $start_line . "\n" . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS['WS_PLUGIN__']['s2member']['c']['files_no_gzip_htaccess']))) . "\n" . $end_line;
         if (file_exists($htaccess) && is_readable($htaccess) && is_writable($htaccess) && ($htaccess_contents = file_get_contents($htaccess)) !== FALSE && is_string($htaccess_contents = trim($htaccess_contents))) {
             if (stripos($htaccess_contents, $ideally_position_before) !== FALSE) {
                 $htaccess_contents = trim(str_ireplace($ideally_position_before, $no_gzip . "\n\n" . $ideally_position_before, $htaccess_contents));
             } else {
                 $htaccess_contents = trim($no_gzip . "\n\n" . $htaccess_contents);
             }
             // Else, let's put it at the very top of the file by default.
             return file_put_contents($htaccess, $htaccess_contents);
         } else {
             if (!file_exists($htaccess) && is_writable(dirname($htaccess))) {
                 return file_put_contents($htaccess, $no_gzip);
             }
         }
     }
     return FALSE;
     // Default return `FALSE`.
 }
Example #8
0
 /**
  * Writes no GZIP rules into root `.htaccess` file.
  *
  * @package s2Member\Files
  * @since 120212
  *
  * @return bool True if successfull, else false on any type of failure.
  */
 public static function write_no_gzip_into_root_htaccess()
 {
     if (c_ws_plugin__s2member_files::remove_no_gzip_from_root_htaccess()) {
         $start_line = "# BEGIN s2Member GZIP exclusions";
         $end_line = "# END s2Member GZIP exclusions";
         $htaccess = ABSPATH . ".htaccess";
         $ideally_position_before = "# BEGIN WordPress";
         $no_gzip = $start_line . "\n" . trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_no_gzip_htaccess"]))) . "\n" . $end_line;
         if (file_exists($htaccess) && is_readable($htaccess) && is_writable($htaccess) && ($htaccess_contents = file_get_contents($htaccess)) !== false && is_string($htaccess_contents = trim($htaccess_contents))) {
             if (stripos($htaccess_contents, $ideally_position_before) !== false) {
                 $htaccess_contents = trim(str_ireplace($ideally_position_before, $no_gzip . "\n\n" . $ideally_position_before, $htaccess_contents));
             } else {
                 // Else, let's put it at the very top of the file by default.
                 $htaccess_contents = trim($no_gzip . "\n\n" . $htaccess_contents);
             }
             return file_put_contents($htaccess, $htaccess_contents);
         } else {
             if (!file_exists($htaccess) && is_writable(dirname($htaccess))) {
                 return file_put_contents($htaccess, $no_gzip);
             }
         }
     }
     return false;
 }
 /**
  * Uninstall routines for s2Member.
  *
  * @package s2Member\Installation
  * @since 3.5
  */
 public static function uninstall()
 {
     global $wpdb;
     /** @var $wpdb wpdb */
     global $current_site, $current_blog;
     // Multisite.
     do_action('ws_plugin__s2member_before_uninstall', get_defined_vars());
     if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['run_uninstall_routines']) {
         c_ws_plugin__s2member_roles_caps::unlink_roles();
         c_ws_plugin__s2member_files::remove_no_gzip_from_root_htaccess();
         if (is_dir($files_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['files_dir'])) {
             if (file_exists($htaccess = $files_dir . '/.htaccess')) {
                 if (is_writable($htaccess)) {
                     unlink($htaccess);
                 }
             }
             @rmdir($files_dir) . @rmdir(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($files_dir));
         }
         if (is_dir($logs_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir'])) {
             foreach (scandir($logs_dir) as $log_file) {
                 if (is_file($log_file = $logs_dir . '/' . $log_file)) {
                     if (is_writable($log_file)) {
                         unlink($log_file);
                     }
                 }
             }
             @rmdir($logs_dir) . @rmdir(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($logs_dir));
         }
         delete_option('ws_plugin__s2member_cache');
         delete_option('ws_plugin__s2member_notices');
         delete_option('ws_plugin__s2member_options');
         delete_option('ws_plugin__s2member_configured');
         delete_option('ws_plugin__s2member_activated_levels');
         delete_option('ws_plugin__s2member_activated_version');
         delete_option('ws_plugin__s2member_activated_mms_version');
         if (is_multisite() && is_main_site()) {
             delete_site_option('ws_plugin__s2member_options');
         }
         $wpdb->query("DELETE FROM `" . $wpdb->postmeta . "` WHERE `meta_key` LIKE '" . esc_sql(c_ws_plugin__s2member_utils_strings::like_escape('s2m_')) . "%'");
         $wpdb->query("DELETE FROM `" . $wpdb->postmeta . "` WHERE `meta_key` LIKE '%" . esc_sql(c_ws_plugin__s2member_utils_strings::like_escape('_s2m_')) . "%'");
         $wpdb->query("DELETE FROM `" . $wpdb->postmeta . "` WHERE `meta_key` LIKE '%" . esc_sql(c_ws_plugin__s2member_utils_strings::like_escape('s2member_')) . "%'");
         $wpdb->query("DELETE FROM `" . $wpdb->usermeta . "` WHERE `meta_key` LIKE '" . esc_sql(c_ws_plugin__s2member_utils_strings::like_escape('s2m_')) . "%'");
         $wpdb->query("DELETE FROM `" . $wpdb->usermeta . "` WHERE `meta_key` LIKE '%" . esc_sql(c_ws_plugin__s2member_utils_strings::like_escape('_s2m_')) . "%'");
         $wpdb->query("DELETE FROM `" . $wpdb->usermeta . "` WHERE `meta_key` LIKE '%" . esc_sql(c_ws_plugin__s2member_utils_strings::like_escape('s2member_')) . "%'");
         $wpdb->query("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '" . esc_sql(c_ws_plugin__s2member_utils_strings::like_escape('s2m_')) . "%'");
         $wpdb->query("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '%" . esc_sql(c_ws_plugin__s2member_utils_strings::like_escape('_s2m_')) . "%'");
         $wpdb->query("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '%" . esc_sql(c_ws_plugin__s2member_utils_strings::like_escape('s2member_')) . "%'");
         do_action('ws_plugin__s2member_during_uninstall', get_defined_vars());
     }
     do_action('ws_plugin__s2member_after_uninstall', get_defined_vars());
 }
Example #10
0
 /**
  * Handles the Shortcode for: `[s2Stream /]`.
  *
  * @package s2Member\s2File
  * @since 130119
  *
  * @attaches-to ``add_shortcode('s2Stream');``
  *
  * @param array  $attr An array of Attributes.
  * @param string $content Content inside the Shortcode.
  * @param string $shortcode The actual Shortcode name itself.
  *
  * @return string HTML markup that produces an audio/video stream for a specific player.
  */
 public static function sc_get_stream($attr = array(), $content = '', $shortcode = '')
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_sc_get_stream', get_defined_vars());
     unset($__refs, $__v);
     // Housekeeping.
     $attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
     $attr = shortcode_atts(array('download' => '', 'file_download' => '', 'download_key' => '', 'stream' => 'yes', 'inline' => 'yes', 'storage' => '', 'remote' => '', 'ssl' => '', 'rewrite' => 'yes', 'rewrite_base' => '', 'skip_confirmation' => '', 'url_to_storage_source' => 'yes', 'count_against_user' => 'yes', 'check_user' => 'yes', 'player' => 'jwplayer-v6-rtmp', 'player_id' => 's2-stream-' . md5(uniqid('', TRUE)), 'player_path' => '/jwplayer/jwplayer.js', 'player_key' => '', 'player_title' => '', 'player_image' => '', 'player_mediaid' => '', 'player_description' => '', 'player_captions' => '', 'player_resolutions' => '', 'player_controls' => 'yes', 'player_skin' => '', 'player_stretching' => 'uniform', 'player_width' => '480', 'player_height' => '270', 'player_aspectratio' => '', 'player_autostart' => 'no', 'player_fallback' => 'yes', 'player_mute' => 'no', 'player_primary' => $attr['player'] === 'jw-player-v6' ? 'html5' : 'flash', 'player_repeat' => 'no', 'player_startparam' => '', 'player_option_blocks' => ''), $attr);
     $attr['download'] = !empty($attr['file_download']) ? $attr['file_download'] : $attr['download'];
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_sc_get_stream_after_shortcode_atts', get_defined_vars());
     unset($__refs, $__v);
     // Housekeeping.
     foreach ($attr as $key => $value) {
         // Now we need to go through and a `file_` prefix  to certain Attribute keys, for compatibility.
         if (strlen($value) && in_array($key, array('download', 'download_key', 'stream', 'inline', 'storage', 'remote', 'ssl', 'rewrite', 'rewrite_base'))) {
             $config['file_' . $key] = $value;
         } else {
             if (strlen($value) && !in_array($key, array('file_download', 'player')) && strpos($key, 'player_') !== 0) {
                 $config[$key] = $value;
             }
         }
     }
     unset($key, $value);
     // Ditch these now. We don't want these bleeding into Hooks/Filters anyway.
     if (!empty($config) && isset($config['file_download'])) {
         if ($attr['player_resolutions'] && c_ws_plugin__s2member_utils_conds::pro_is_installed()) {
             $file_download_extension = strtolower(ltrim((string) strrchr(basename($config['file_download']), '.'), '.'));
             $file_download_resolution_wo_extension = substr($config['file_download'], 0, -(strlen($file_download_extension) + 1));
             $file_download_wo_resolution_extension = preg_replace('/\\-r[0-9]+([^.]*)$/i', '', $file_download_resolution_wo_extension);
             // e.g., `r720p-HD` is removed here.
             $file_download_resolutions = array();
             // Initialize the array of resolutions.
             foreach (preg_split('/[,;\\s]+/', $attr['player_resolutions'], NULL, PREG_SPLIT_NO_EMPTY) as $_player_resolution) {
                 $_player_resolution = ltrim($_player_resolution, 'Rr');
                 // Remove R|r prefix.
                 $file_download_resolutions[$_player_resolution] = $file_download_wo_resolution_extension . '-r' . $_player_resolution . '.' . $file_download_extension;
             }
             unset($_player_resolution);
             // Housekeeping.
             $file_download_urls = array();
             // Initialize array of all file download urls.
             foreach ($file_download_resolutions as $_player_resolution => $_file_download_resolution) {
                 $_file_download_config = array_merge($config, array('file_download' => $_file_download_resolution));
                 if ($file_download_urls) {
                     // If this is a ANOTHER resolution, don't count it against the user.
                     $_file_download_config = array_merge($_file_download_config, array('check_user' => FALSE, 'count_against_user' => FALSE));
                 }
                 if (!($file_download_urls[str_replace(array('_', '-'), ' ', $_player_resolution)] = c_ws_plugin__s2member_files::create_file_download_url($_file_download_config, TRUE))) {
                     return apply_filters('ws_plugin__s2member_sc_get_stream', NULL, get_defined_vars());
                 }
                 // Failure.
             }
             unset($_player_resolution, $_file_download_resolution, $_file_download_config);
             // Housekeeping.
         } else {
             $file_download_urls = array(c_ws_plugin__s2member_files::create_file_download_url($config, TRUE));
         }
         // Default behavior.
         if ($file_download_urls && $attr['player'] && is_file($template = dirname(dirname(__FILE__)) . '/templates/players/' . $attr['player'] . '.php') && $attr['player_id'] && $attr['player_path']) {
             $template = is_file(TEMPLATEPATH . '/' . basename($template)) ? TEMPLATEPATH . '/' . basename($template) : $template;
             $template = is_file(get_stylesheet_directory() . '/' . basename($template)) ? get_stylesheet_directory() . '/' . basename($template) : $template;
             $template = is_file(WP_CONTENT_DIR . '/' . basename($template)) ? WP_CONTENT_DIR . '/' . basename($template) : $template;
             if (strpos($attr['player'], 'jwplayer-v6') === 0) {
                 $player = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($template)));
                 $_first_file_download_url = array();
                 // Holds the first one.
                 $_last_file_download_url = array();
                 // Holds the last one.
                 $_uses_rtmp_streamers = FALSE;
                 // Streamers use RTMP?
                 $_total_player_sources = count($file_download_urls);
                 // Total sources.
                 $_player_sources_counter = 1;
                 // Player sources counter; needed by the loop below.
                 $player_resolution_aspect_ratio_w = 16;
                 // Default aspect ratio width.
                 $player_resolution_aspect_ratio_h = 9;
                 // Default aspect ratio in height.
                 if ($attr['player_aspectratio'] && preg_match('/^[0-9]+\\:[0-9]+$/', $attr['player_aspectratio'])) {
                     list($player_resolution_aspect_ratio_w, $player_resolution_aspect_ratio_h) = explode(':', $attr['player_aspectratio']);
                 }
                 $player_resolution_aspect_ratio_w = (int) $player_resolution_aspect_ratio_w;
                 // Force integer value.
                 $player_resolution_aspect_ratio_h = (int) $player_resolution_aspect_ratio_h;
                 // Force integer value.
                 // See: <http://wsharks.com/1yzjAl6> and <http://wsharks.com/1yzkhea> regarging the SMIL bitrate hints given here.
                 $player_resolution_bitrates = array(2160 => '35000000', 1440 => '10000000', 1080 => '8000000', 720 => '5000000', 640 => '2500001', 480 => '2500000', 360 => '1000000', 320 => '999999', 240 => '500000', 180 => '300000');
                 $player_resolution_bitrates = apply_filters('ws_plugin__s2member_sc_get_stream_resolution_bitrates', $player_resolution_bitrates, get_defined_vars());
                 $player_resolution_sources_smil_file_id = md5(serialize($attr) . $_SERVER['REMOTE_ADDR']);
                 // Initialize SMIL ID.
                 $player_resolution_sources_smil_file_url = home_url('/s2member-rsf-file.smil?s2member_rsf_file=' . urlencode($player_resolution_sources_smil_file_id) . '&s2member_rsf_file_ip=' . urlencode($_SERVER['REMOTE_ADDR']));
                 $player_resolution_sources_smil_file_url = c_ws_plugin__s2member_utils_urls::add_s2member_sig($player_resolution_sources_smil_file_url);
                 $player_resolution_sources_smil_file_contents = '';
                 // Initialize player sources SMIL file contents.
                 $player_sources = '';
                 // Initialize player sources; empty string.
                 foreach ($file_download_urls as $_file_download_url_label => $_file_download_url) {
                     $_is_first_file_download_url = $_player_sources_counter <= 1;
                     $_is_last_file_download_url = $_player_sources_counter >= $_total_player_sources;
                     if ($_is_first_file_download_url) {
                         // We base this conditional on the first streamer.
                         $_uses_rtmp_streamers = stripos($_file_download_url['streamer'], 'rtmp') === 0;
                     }
                     switch ($attr['player']) {
                         case 'jwplayer-v6':
                             // Default w/ a direct URL (very simple).
                             $player_sources .= ',{';
                             // Open this source; JSON object properties.
                             $player_sources .= "'file': '" . c_ws_plugin__s2member_utils_strings::esc_js_sq($_file_download_url['url']) . "'";
                             if (is_string($_file_download_url_label)) {
                                 $player_sources .= ",'label': '" . c_ws_plugin__s2member_utils_strings::esc_js_sq($_file_download_url_label) . "'";
                             }
                             if ($_is_first_file_download_url) {
                                 $player_sources .= ",'default': 'true'";
                             }
                             $player_sources .= '}';
                             // Close this source.
                             break;
                             // Break switch loop.
                         // Break switch loop.
                         case 'jwplayer-v6-rtmp':
                             // RTMP w/ downloadable fallback (mobile compatibility).
                         // RTMP w/ downloadable fallback (mobile compatibility).
                         case 'jwplayer-v6-rtmp-only':
                             // RTMP streaming only (flash player only).
                             if ($attr['player_resolutions'] && $_total_player_sources > 1 && $_uses_rtmp_streamers) {
                                 if ($_is_first_file_download_url) {
                                     $player_sources .= ',{';
                                     // Open this source; JSON object properties.
                                     $player_sources .= "'file': '" . c_ws_plugin__s2member_utils_strings::esc_js_sq($player_resolution_sources_smil_file_url) . "'";
                                     if ($_is_first_file_download_url) {
                                         $player_sources .= ",'default': 'true'";
                                     }
                                     $player_sources .= '}';
                                     // Close this source.
                                 }
                                 $_file_download_url['smil']['height'] = (int) $_file_download_url_label;
                                 // e.g., `720p-HD` becomes `720`.
                                 if (!$_file_download_url['smil']['height']) {
                                     $_file_download_url['smil']['height'] = 720;
                                 }
                                 // Use a default height if invalid.
                                 $_file_download_url['smil']['width'] = ceil($_file_download_url['smil']['height'] / $player_resolution_aspect_ratio_h * $player_resolution_aspect_ratio_w);
                                 $_file_download_url['smil']['system-bitrate'] = '1';
                                 // Default value.
                                 if (!empty($player_resolution_bitrates[$_file_download_url['smil']['height']])) {
                                     $_file_download_url['smil']['system-bitrate'] = $player_resolution_bitrates[$_file_download_url['smil']['height']];
                                 }
                                 $player_resolution_sources_smil_file_contents .= '<video src="' . esc_attr($_file_download_url['file']) . '"' . ' width="' . esc_attr($_file_download_url['smil']['width']) . '"' . ' height="' . esc_attr($_file_download_url['smil']['height']) . '"' . ' system-bitrate="' . esc_attr($_file_download_url['smil']['system-bitrate']) . '" />';
                             } else {
                                 $player_sources .= ',{';
                                 // Open this source; JSON object properties.
                                 $player_sources .= "'file': '" . c_ws_plugin__s2member_utils_strings::esc_js_sq($_file_download_url['streamer'] . '/' . $_file_download_url['prefix'] . $_file_download_url['file']) . "'";
                                 if (is_string($_file_download_url_label)) {
                                     $player_sources .= ",'label': '" . c_ws_plugin__s2member_utils_strings::esc_js_sq($_file_download_url_label) . "'";
                                 }
                                 if ($_is_first_file_download_url) {
                                     $player_sources .= ",'default': 'true'";
                                 }
                                 $player_sources .= '}';
                                 // Close this source.
                             }
                             if ($_is_last_file_download_url && $attr['player'] === 'jwplayer-v6-rtmp') {
                                 $player_sources .= ',{';
                                 // Open this source; JSON object properties.
                                 $player_sources .= "'file': '" . c_ws_plugin__s2member_utils_strings::esc_js_sq($_file_download_url['url']) . "'";
                                 $player_sources .= '}';
                                 // Close this source.
                             }
                             break;
                             // Break switch loop.
                     }
                     if ($_is_first_file_download_url) {
                         $_first_file_download_url = $_file_download_url;
                         // Record for use later.
                         $player = preg_replace('/%%streamer%%/', $_file_download_url['streamer'], $player);
                         $player = preg_replace('/%%prefix%%/', $_file_download_url['prefix'], $player);
                         $player = preg_replace('/%%file%%/', $_file_download_url['file'], $player);
                         $player = preg_replace('/%%url%%/', $_file_download_url['url'], $player);
                     }
                     if ($_is_last_file_download_url) {
                         $_last_file_download_url = $_file_download_url;
                         // Record for use later.
                     }
                     $_player_sources_counter++;
                     // Increment the counter.
                 }
                 $player_sources = '[' . trim($player_sources, ',') . ']';
                 // Build array.
                 if ($player_resolution_sources_smil_file_contents && $_first_file_download_url) {
                     $player_resolution_sources_smil_file_contents = '<smil>' . ' <head><meta base="' . esc_attr($_first_file_download_url['streamer']) . '" /></head>' . ' <body><switch>' . $player_resolution_sources_smil_file_contents . '</switch></body>' . '</smil>';
                     set_transient('s2m_rsf_' . $player_resolution_sources_smil_file_id, $player_resolution_sources_smil_file_contents, 86400);
                 }
                 unset($_first_file_download_url, $_last_file_download_url, $_uses_rtmp_streamers, $_total_player_sources, $_player_sources_counter, $_is_first_file_download_url, $_is_last_file_download_url, $_file_download_url_label, $_file_download_url);
                 $player = preg_replace('/%%player_id%%/', $attr['player_id'], $player);
                 $player = preg_replace('/%%player_path%%/', $attr['player_path'], $player);
                 $player = preg_replace('/%%player_key%%/', $attr['player_key'], $player);
                 $player = preg_replace('/%%player_title%%/', $attr['player_title'], $player);
                 $player = preg_replace('/%%player_image%%/', $attr['player_image'], $player);
                 $player = preg_replace('/%%player_mediaid%%/', $attr['player_mediaid'], $player);
                 $player = preg_replace('/%%player_description%%/', $attr['player_description'], $player);
                 if ($attr['player_captions'] = c_ws_plugin__s2member_utils_strings::trim($attr['player_captions'], NULL, '[]')) {
                     $player = preg_replace('/%%player_captions%%/', '[' . (strpos($attr['player_captions'], ':') !== FALSE ? $attr['player_captions'] : base64_decode($attr['player_captions'])) . ']', $player);
                 } else {
                     $player = preg_replace('/%%player_captions%%/', '[]', $player);
                 }
                 $player = preg_replace('/%%player_sources%%/', $player_sources, $player);
                 // Sources are constructed dynamically.
                 $player = preg_replace('/%%player_controls%%/', filter_var($attr['player_controls'], FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false', $player);
                 $player = preg_replace('/%%player_width%%/', strpos($attr['player_width'], '%') !== FALSE ? "'" . $attr['player_width'] . "'" : (int) $attr['player_width'], $player);
                 $player = preg_replace('/%%player_height%%/', $attr['player_aspectratio'] ? "''" : (strpos($attr['player_height'], '%') !== FALSE ? "'" . $attr['player_height'] . "'" : (int) $attr['player_height']), $player);
                 $player = preg_replace('/%%player_aspectratio%%/', $attr['player_aspectratio'], $player);
                 $player = preg_replace('/%%player_stretching%%/', $attr['player_stretching'], $player);
                 $player = preg_replace('/%%player_skin%%/', $attr['player_skin'], $player);
                 $player = preg_replace('/%%player_autostart%%/', filter_var($attr['player_autostart'], FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false', $player);
                 $player = preg_replace('/%%player_fallback%%/', filter_var($attr['player_fallback'], FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false', $player);
                 $player = preg_replace('/%%player_mute%%/', filter_var($attr['player_mute'], FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false', $player);
                 $player = preg_replace('/%%player_repeat%%/', filter_var($attr['player_repeat'], FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false', $player);
                 $player = preg_replace('/%%player_startparam%%/', $attr['player_startparam'], $player);
                 $player = preg_replace('/%%player_primary%%/', $attr['player_primary'], $player);
                 $player = preg_replace('/%%player_option_blocks%%/', strpos($attr['player_option_blocks'], ':') !== FALSE ? $attr['player_option_blocks'] : base64_decode($attr['player_option_blocks']), $player);
             }
         }
     }
     return apply_filters('ws_plugin__s2member_sc_get_stream', isset($player) ? $player : NULL, get_defined_vars());
 }
Example #11
0
 /**
  * Checks a File Download Key for validity.
  *
  * @package s2Member\Files
  * @since 110926
  *
  * @param string $file Input File Download to validate.
  * @param string $key Input File Download Key to validate.
  *
  * @return bool True if valid, else false.
  */
 public static function check_file_download_key($file = '', $key = '')
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('_ws_plugin__s2member_before_check_file_download_key', get_defined_vars());
     unset($__refs, $__v);
     // Housekeeping.
     if ($file && is_string($file) && ($file = trim($file, '/')) && $key && is_string($key)) {
         if ($key === c_ws_plugin__s2member_files::file_download_key($file) || $key === c_ws_plugin__s2member_files::file_download_key('/' . $file)) {
             $valid = TRUE;
         } else {
             if ($key === c_ws_plugin__s2member_files::file_download_key($file, 'ip-forever') || $key === c_ws_plugin__s2member_files::file_download_key('/' . $file, 'ip-forever')) {
                 $valid = TRUE;
             } else {
                 if ($key === c_ws_plugin__s2member_files::file_download_key($file, 'universal') || $key === c_ws_plugin__s2member_files::file_download_key('/' . $file, 'universal')) {
                     $valid = TRUE;
                 }
             }
         }
         // File Download Key is valid.
     }
     return apply_filters('ws_plugin__s2member_check_file_download_key', isset($valid) && $valid ? TRUE : FALSE, get_defined_vars());
 }
Example #12
0
 /**
  * Handles the Shortcode for: `[s2Stream /]`.
  *
  * @package s2Member\s2File
  * @since 130119
  *
  * @attaches-to ``add_shortcode("s2Stream");``
  *
  * @param array $attr An array of Attributes.
  * @param str $content Content inside the Shortcode.
  * @param str $shortcode The actual Shortcode name itself.
  * @return str HTML markup that produces an audio/video stream for a specific player.
  */
 public static function sc_get_stream($attr = FALSE, $content = FALSE, $shortcode = FALSE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_sc_get_stream", get_defined_vars());
     unset($__refs, $__v);
     $attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
     $attr = shortcode_atts(array("download" => "", "download_key" => "", "stream" => "yes", "inline" => "yes", "storage" => "", "remote" => "", "ssl" => "", "rewrite" => "yes", "rewrite_base" => "", "skip_confirmation" => "", "url_to_storage_source" => "yes", "count_against_user" => "yes", "check_user" => "yes", "file_download" => "", "player" => "jwplayer-v6-rtmp", "player_id" => "s2-stream-" . md5(uniqid("", TRUE)), "player_path" => "/jwplayer/jwplayer.js", "player_key" => "", "player_title" => "", "player_image" => "", "player_mediaid" => "", "player_description" => "", "player_captions" => "", "player_controls" => "yes", "player_skin" => "", "player_stretching" => "uniform", "player_width" => "480", "player_height" => "270", "player_aspectratio" => "", "player_autostart" => "no", "player_fallback" => "yes", "player_mute" => "no", "player_primary" => $attr["player"] === "jw-player-v6" ? "html5" : "flash", "player_repeat" => "no", "player_startparam" => "", "player_option_blocks" => ""), $attr);
     $attr["download"] = !empty($attr["file_download"]) ? $attr["file_download"] : $attr["download"];
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_sc_get_stream_after_shortcode_atts", get_defined_vars());
     unset($__refs, $__v);
     foreach ($attr as $key => $value) {
         if (strlen($value) && in_array($key, array("download", "download_key", "stream", "inline", "storage", "remote", "ssl", "rewrite", "rewrite_base"))) {
             $config["file_" . $key] = $value;
         } else {
             if (strlen($value) && !in_array($key, array("file_download", "player")) && strpos($key, "player_") !== 0) {
                 $config[$key] = $value;
             }
         }
     }
     unset($key, $value);
     if (!empty($config) && isset($config["file_download"])) {
         $_get = c_ws_plugin__s2member_files::create_file_download_url($config, TRUE);
         if (is_array($_get) && !empty($_get) && $attr["player"] && file_exists($template = dirname(dirname(__FILE__)) . "/templates/players/" . $attr["player"] . ".php") && $attr["player_id"] && $attr["player_path"]) {
             $template = file_exists(TEMPLATEPATH . "/" . basename($template)) ? TEMPLATEPATH . "/" . basename($template) : $template;
             $template = file_exists(WP_CONTENT_DIR . "/" . basename($template)) ? WP_CONTENT_DIR . "/" . basename($template) : $template;
             if (strpos($attr["player"], "jwplayer-v6") === 0) {
                 $get = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($template)));
                 $get = preg_replace("/%%streamer%%/", $_get["streamer"], $get);
                 $get = preg_replace("/%%prefix%%/", $_get["prefix"], $get);
                 $get = preg_replace("/%%file%%/", $_get["file"], $get);
                 $get = preg_replace("/%%url%%/", $_get["url"], $get);
                 $get = preg_replace("/%%player_id%%/", $attr["player_id"], $get);
                 $get = preg_replace("/%%player_path%%/", $attr["player_path"], $get);
                 $get = preg_replace("/%%player_key%%/", $attr["player_key"], $get);
                 $get = preg_replace("/%%player_title%%/", $attr["player_title"], $get);
                 $get = preg_replace("/%%player_image%%/", $attr["player_image"], $get);
                 $get = preg_replace("/%%player_mediaid%%/", $attr["player_mediaid"], $get);
                 $get = preg_replace("/%%player_description%%/", $attr["player_description"], $get);
                 if ($attr["player_captions"] = c_ws_plugin__s2member_utils_strings::trim($attr["player_captions"], null, "[]")) {
                     $get = preg_replace("/%%player_captions%%/", "[" . (strpos($attr["player_captions"], ":") !== false ? $attr["player_captions"] : base64_decode($attr["player_captions"])) . "]", $get);
                 } else {
                     $get = preg_replace("/%%player_captions%%/", "[]", $get);
                 }
                 $get = preg_replace("/%%player_controls%%/", filter_var($attr["player_controls"], FILTER_VALIDATE_BOOLEAN) ? "true" : "false", $get);
                 $get = preg_replace("/%%player_width%%/", strpos($attr["player_width"], "%") !== FALSE ? "'" . $attr["player_width"] . "'" : (int) $attr["player_width"], $get);
                 $get = preg_replace("/%%player_height%%/", $attr["player_aspectratio"] ? "''" : (strpos($attr["player_height"], "%") !== FALSE ? "'" . $attr["player_height"] . "'" : (int) $attr["player_height"]), $get);
                 $get = preg_replace("/%%player_aspectratio%%/", $attr["player_aspectratio"], $get);
                 $get = preg_replace("/%%player_skin%%/", $attr["player_skin"], $get);
                 $get = preg_replace("/%%player_stretching%%/", $attr["player_stretching"], $get);
                 $get = preg_replace("/%%player_autostart%%/", filter_var($attr["player_autostart"], FILTER_VALIDATE_BOOLEAN) ? "true" : "false", $get);
                 $get = preg_replace("/%%player_fallback%%/", filter_var($attr["player_fallback"], FILTER_VALIDATE_BOOLEAN) ? "true" : "false", $get);
                 $get = preg_replace("/%%player_mute%%/", filter_var($attr["player_mute"], FILTER_VALIDATE_BOOLEAN) ? "true" : "false", $get);
                 $get = preg_replace("/%%player_primary%%/", $attr["player_primary"], $get);
                 $get = preg_replace("/%%player_repeat%%/", filter_var($attr["player_repeat"], FILTER_VALIDATE_BOOLEAN) ? "true" : "false", $get);
                 $get = preg_replace("/%%player_startparam%%/", $attr["player_startparam"], $get);
                 $get = preg_replace("/%%player_option_blocks%%/", strpos($attr["player_option_blocks"], ":") !== false ? $attr["player_option_blocks"] : base64_decode($attr["player_option_blocks"]), $get);
             }
         }
     }
     return apply_filters("ws_plugin__s2member_sc_get_stream", isset($get) ? $get : null, get_defined_vars());
 }
Example #13
0
 /**
  * Deactivation routines for s2Member.
  *
  * @package s2Member\Installation
  * @since 3.5
  *
  * @return null
  */
 public static function deactivate()
 {
     global $wpdb;
     global $current_site, $current_blog;
     do_action("ws_plugin__s2member_before_deactivation", get_defined_vars());
     if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["run_deactivation_routines"]) {
         c_ws_plugin__s2member_roles_caps::unlink_roles();
         c_ws_plugin__s2member_files::remove_no_gzip_from_root_htaccess();
         if (is_dir($files_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) {
             if (file_exists($htaccess = $files_dir . "/.htaccess")) {
                 if (is_writable($htaccess)) {
                     unlink($htaccess);
                 }
             }
             @rmdir($files_dir) . @rmdir(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($files_dir));
         }
         if (is_dir($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"])) {
             foreach (scandir($logs_dir) as $log_file) {
                 if (is_file($log_file = $logs_dir . "/" . $log_file)) {
                     if (is_writable($log_file)) {
                         unlink($log_file);
                     }
                 }
             }
             @rmdir($logs_dir) . @rmdir(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($logs_dir));
         }
         delete_option("ws_plugin__s2member_cache");
         delete_option("ws_plugin__s2member_notices");
         delete_option("ws_plugin__s2member_options");
         delete_option("ws_plugin__s2member_configured");
         delete_option("ws_plugin__s2member_activated_levels");
         delete_option("ws_plugin__s2member_activated_version");
         delete_option("ws_plugin__s2member_activated_mms_version");
         if (is_multisite() && is_main_site()) {
             delete_site_option("ws_plugin__s2member_options");
         }
         $wpdb->query("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '%" . esc_sql(like_escape("s2member_")) . "%'");
         $wpdb->query("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '" . esc_sql(like_escape("_transient_s2m_")) . "%'");
         $wpdb->query("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '" . esc_sql(like_escape("_transient_timeout_s2m_")) . "%'");
         $wpdb->query("DELETE FROM `" . $wpdb->postmeta . "` WHERE `meta_key` LIKE '%" . esc_sql(like_escape("s2member_")) . "%'");
         $wpdb->query("DELETE FROM `" . $wpdb->usermeta . "` WHERE `meta_key` LIKE '%" . esc_sql(like_escape("s2member_")) . "%'");
         do_action("ws_plugin__s2member_during_deactivation", get_defined_vars());
     }
     do_action("ws_plugin__s2member_after_deactivation", get_defined_vars());
     return;
 }
Example #14
0
 /**
  * Builds and handles the Download Options page.
  *
  * @package s2Member\Menu_Pages
  * @since 3.5
  *
  * @return null
  */
 public static function down_ops_page()
 {
     do_action("ws_plugin__s2member_before_down_ops_page", get_defined_vars());
     c_ws_plugin__s2member_menu_pages::update_all_options();
     $files_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"];
     $htaccess = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/.htaccess";
     $htaccess_contents = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir_htaccess"])));
     $no_gzip_htaccess = ABSPATH . ".htaccess";
     $no_gzip_htaccess_contents = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_no_gzip_htaccess"])));
     if (!c_ws_plugin__s2member_files::no_gzip_rules_in_root_htaccess()) {
         c_ws_plugin__s2member_files::write_no_gzip_into_root_htaccess() . clearstatcache();
     }
     if (!is_dir($files_dir) && is_writable(dirname(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($files_dir)))) {
         mkdir($files_dir, 0777, true) . clearstatcache();
     }
     if (is_dir($files_dir) && is_writable($files_dir) && !file_exists($htaccess)) {
         file_put_contents($htaccess, $htaccess_contents) . clearstatcache();
     }
     if (!c_ws_plugin__s2member_files::no_gzip_rules_in_root_htaccess()) {
         c_ws_plugin__s2member_admin_notices::display_admin_notice('Possible GZIP conflict on server. Unable to write GZIP exclusions into root .htaccess file (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($no_gzip_htaccess)) . '</code>). Please read the panel below: <strong>Preventing GZIP Conflicts</strong>, and add this section yourself:<br /><pre>' . esc_html($no_gzip_htaccess_contents) . '</pre>', true);
     }
     if (!is_dir($files_dir)) {
         c_ws_plugin__s2member_admin_notices::display_admin_notice('The security-enabled files directory (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($files_dir)) . '</code>) does not exist. Please create this directory manually.', true);
     }
     if (!file_exists($htaccess)) {
         c_ws_plugin__s2member_admin_notices::display_admin_notice('The .htaccess protection file (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($htaccess)) . '</code>) does not exist. Please create this file manually. Inside your .htaccess file, add this:<br /><pre>' . esc_html($htaccess_contents) . '</pre>', true);
     } else {
         if (!preg_match("/deny from all/i", file_get_contents($htaccess))) {
             c_ws_plugin__s2member_admin_notices::display_admin_notice('Unprotected. The .htaccess protection file (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($htaccess)) . '</code>) does not contain <code>deny from all</code>. Inside your .htaccess file, add this:<br /><pre>' . esc_html($htaccess_contents) . '</pre>', true);
         }
     }
     if (!empty($_POST["ws_plugin__s2member_amazon_cf_files_auto_configure_distros"]) && ($nonce = $_POST["ws_plugin__s2member_amazon_cf_files_auto_configure_distros"]) && wp_verify_nonce($nonce, "ws-plugin--s2member-amazon-cf-files-auto-configure-distros")) {
         if (($amazon_cf_auto_configure_distros = c_ws_plugin__s2member_files_in::amazon_cf_auto_configure_distros()) && $amazon_cf_auto_configure_distros["success"]) {
             c_ws_plugin__s2member_admin_notices::display_admin_notice('Amazon CloudFront Distributions auto-configured successfully. Please allow 30 minutes for propagation.' . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_cname"] ? '<br /><em>Downloads Distribution CNAME: <code>' . esc_html($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_cname"]) . ' &mdash;&raquo; ' . esc_html($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_dname"]) . '</code></em>' : '') . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_cname"] ? '<br /><em>Streaming Distribution CNAME: <code>' . esc_html($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_cname"]) . ' &mdash;&raquo; ' . esc_html($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_dname"]) . '</code></em>' : ''));
         } else {
             // Else there was an error. We need to report this back to the site owner so they can understand what's going on.
             (c_ws_plugin__s2member_menu_pages::$pre_display_errors["cf_files_auto_configure_distros"] = true) . c_ws_plugin__s2member_admin_notices::display_admin_notice('Unable to auto-configure Amazon CloudFront Distributions.<br />Error code: <code>' . esc_html($amazon_cf_auto_configure_distros["code"]) . '</code>. Error Message: <code>' . esc_html($amazon_cf_auto_configure_distros["message"]) . '</code>', true);
         }
     }
     if (!empty($_POST["ws_plugin__s2member_amazon_s3_files_auto_configure_acls"]) && ($nonce = $_POST["ws_plugin__s2member_amazon_s3_files_auto_configure_acls"]) && wp_verify_nonce($nonce, "ws-plugin--s2member-amazon-s3-files-auto-configure-acls")) {
         if (($amazon_s3_auto_configure_acls = c_ws_plugin__s2member_files_in::amazon_s3_auto_configure_acls()) && $amazon_s3_auto_configure_acls["success"]) {
             c_ws_plugin__s2member_admin_notices::display_admin_notice('Amazon S3 ACLs auto-configured successfully.');
         } else {
             // Else there was an error. We need to report this back to the site owner so they can understand what's going on.
             (c_ws_plugin__s2member_menu_pages::$pre_display_errors["s3_files_auto_configure_acls"] = true) . c_ws_plugin__s2member_admin_notices::display_admin_notice('Unable to auto-configure Amazon S3 ACLs.<br />Error code: <code>' . esc_html($amazon_s3_auto_configure_acls["code"]) . '</code>. Error Message: <code>' . esc_html($amazon_s3_auto_configure_acls["message"]) . '</code>', true);
         }
     }
     include_once dirname(dirname(__FILE__)) . "/menu-pages/down-ops.inc.php";
     do_action("ws_plugin__s2member_after_down_ops_page", get_defined_vars());
     return;
 }
 /**
  * Checks a File Download Key for validity.
  *
  * @package s2Member\Files
  * @since 110926
  *
  * @param str $file Input File Download to validate.
  * @param str $key Input File Download Key to validate.
  * @return bool True if valid, else false.
  */
 public static function check_file_download_key($file = FALSE, $key = FALSE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("_ws_plugin__s2member_before_check_file_download_key", get_defined_vars());
     unset($__refs, $__v);
     if ($file && is_string($file) && ($file = trim($file, "/")) && $key && is_string($key)) {
         if ($key === c_ws_plugin__s2member_files::file_download_key($file) || $key === c_ws_plugin__s2member_files::file_download_key("/" . $file)) {
             $valid = true;
         } else {
             if ($key === c_ws_plugin__s2member_files::file_download_key($file, "ip-forever") || $key === c_ws_plugin__s2member_files::file_download_key("/" . $file, "ip-forever")) {
                 $valid = true;
             } else {
                 if ($key === c_ws_plugin__s2member_files::file_download_key($file, "universal") || $key === c_ws_plugin__s2member_files::file_download_key("/" . $file, "universal")) {
                     $valid = true;
                 }
             }
         }
     }
     return apply_filters("ws_plugin__s2member_check_file_download_key", isset($valid) && $valid ? true : false, get_defined_vars());
 }