本文整理汇总了PHP中c_ws_plugin__s2member_utils_users::get_user_eot方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utils_users::get_user_eot方法的具体用法?PHP c_ws_plugin__s2member_utils_users::get_user_eot怎么用?PHP c_ws_plugin__s2member_utils_users::get_user_eot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c_ws_plugin__s2member_utils_users
的用法示例。
在下文中一共展示了c_ws_plugin__s2member_utils_users::get_user_eot方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: s2member_eot
function s2member_eot($user_id = 0, $check_gateway = true, $favor = 'fixed')
{
return c_ws_plugin__s2member_utils_users::get_user_eot($user_id, $check_gateway, $favor);
}
示例2: sc_eot_details
/**
* Handles the Shortcode for: `[s2Eot /]`.
*
* @package s2Member\s2Eot
* @since 150713
*
* @attaches-to ``add_shortcode('s2Eot');``
*
* @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 data.
*/
public static function sc_eot_details($attr = array(), $content = '', $shortcode = '')
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_before_sc_eot_details', get_defined_vars());
unset($__refs, $__v);
// Allow variables to be modified by reference.
c_ws_plugin__s2member_no_cache::no_cache_constants(true);
$mode = '';
// Initialize shortcode mode and validate.
if (!empty($attr['mode']) && in_array(strtolower($attr['mode']), array('fixed', 'next'), TRUE)) {
$mode = strtolower($attr['mode']);
}
// A specific mode; i.e., `fixed`, `next`.
if (empty($attr['user_id']) || !(int) $attr['user_id']) {
$attr['user_id'] = $user_id = get_current_user_id();
} else {
$user_id = (int) $attr['user_id'];
}
$subscr_gateway = get_user_option('s2member_subscr_gateway', $user_id);
$subscr_id = get_user_option('s2member_subscr_id', $user_id);
$subscr_cid = get_user_option('s2member_subscr_cid', $user_id);
$auto_eot_time = get_user_option('s2member_auto_eot_time', $user_id);
$attr = shortcode_atts(array('debug' => 'no', 'user_id' => '0', 'date_format' => 'M jS, Y, g:i a T', 'round_to' => '', 'offset' => '0', 'timezone' => '', 'future_format' => $mode ? '%%date%%' : '<strong class="s2member-sc-eot-label -future">' . _x('Access Expires:', 's2member-front', 's2member') . '</strong> <span class="s2member-sc-eot-date -future">%%date%%</span>', 'past_format' => $mode ? '%%date%%' : '<strong class="s2member-sc-eot-label -past">' . _x('Access Expired:', 's2member-front', 's2member') . '</strong> <span class="s2member-sc-eot-date -past">%%date%%</span>', 'next_format' => $mode ? '%%date%%' : '<strong class="s2member-sc-eot-label -next">' . _x('Next Payment:', 's2member-front', 's2member') . '</strong> <span class="s2member-sc-eot-date -next">%%date%%</span>', 'empty_format' => $mode ? in_array($subscr_gateway, array('stripe', 'paypal', 'clickbank'), TRUE) ? _x('N/A', 's2member-front', 's2member') : _x('—', 's2member-front', 's2member') : ''), c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr));
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_before_sc_eot_details_after_shortcode_atts', get_defined_vars());
unset($__refs, $__v);
// Allow variables to be modified by reference.
// Collect and cache the EOT for this user.
$prefix = 's2m_eot_';
// Transient prefix for this shortcode.
$hash_vars = $user_id . $subscr_gateway . $subscr_id . $subscr_cid . $auto_eot_time;
$transient = $prefix . md5('s2member_sc_eot_' . $mode . serialize($attr) . $hash_vars);
if (!is_array($eot = get_transient($transient))) {
$eot = c_ws_plugin__s2member_utils_users::get_user_eot($user_id, true, $mode);
set_transient($transient, $eot, DAY_IN_SECONDS / 2);
}
if ($eot['time'] && (int) $attr['offset']) {
$eot['time'] = $eot['time'] + (int) $attr['offset'];
}
// Initialize EOT details/output format.
if ($eot['type'] === 'fixed' && $eot['time'] && $eot['tense'] === 'past') {
$details = $attr['past_format'];
} else {
if ($eot['type'] === 'fixed' && $eot['time'] && $eot['tense'] === 'future') {
$details = $attr['future_format'];
} else {
if ($eot['type'] === 'next' && $eot['time'] && $eot['tense'] === 'future') {
$details = $attr['next_format'];
} else {
$details = $attr['empty_format'];
}
}
}
// Initialize EOT details/output date format.
$time = null;
// Initialize the time calculation.
if ($eot['time']) {
$time = new DateTime(date('Y-m-d H:i:s', $eot['time']));
if ($attr['timezone'] && strtoupper($attr['timezone']) !== 'UTC') {
$time->setTimezone(new DateTimeZone($attr['timezone']));
}
if ($attr['round_to']) {
$time->modify($attr['round_to']);
}
}
if ($time && $attr['date_format'] === 'timestamp') {
$date = (string) $time->getTimestamp();
} else {
if ($time && $attr['date_format'] === 'default') {
$date = $time->format(get_option('date_format'));
} else {
if ($time && $attr['date_format']) {
$date = $time->format($attr['date_format']);
} else {
if ($time) {
// Default date/time format.
$date = $time->format('M jS, Y, g:i a T');
} else {
$date = '';
}
}
}
//.........这里部分代码省略.........
示例3: remind
/**
* Remind.
*
* @since 151202 Reminders.
*
* @attaches-to ``add_action('ws_plugin__s2member_after_auto_eot_system');``
*
* @param array $vars Expects an array of defined variables.
*/
public static function remind($vars = array())
{
global $wpdb;
// WP database class.
$options =& $GLOBALS['WS_PLUGIN__']['s2member']['o'];
if (!$options['pro_eot_reminder_email_enable']) {
return;
// Nothing to do here.
}
if (!isset($options['pro_eot_reminder_email_days'][0])) {
return;
// Nothing to do here.
}
self::$now = time();
// Current UTC timestamp.
self::$recipients = json_decode($options['pro_eot_reminder_email_recipients']);
self::$subject = json_decode($options['pro_eot_reminder_email_subject']);
self::$message = json_decode($options['pro_eot_reminder_email_message']);
if (!is_object(self::$recipients) || !is_object(self::$subject) || !is_object(self::$message)) {
return;
// Not possible. Possible corruption in the DB.
}
if (!$GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_name'] || !$GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_email']) {
return;
// Not possible. Email configuration is incomplete.
}
$days = preg_split('/[;,\\s]+/', trim($options['pro_eot_reminder_email_days']), -1, PREG_SPLIT_NO_EMPTY);
$scan_time = apply_filters('ws_plugin__s2member_pro_eot_reminders_scan_time', strtotime('-1 day', self::$now), get_defined_vars());
$per_process = apply_filters('ws_plugin__s2member_pro_eot_reminders_per_process', $vars['per_process'], get_defined_vars());
$message_bytes_in_log = apply_filters('ws_plugin__s2member_pro_eot_reminder_email_message_bytes_in_log', 100);
$mail_from = '"' . str_replace('"', "'", $GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_name']) . '"' . ' <' . $GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_email'] . '>';
$user_ids_to_exclude = '
SELECT DISTINCT `user_id` AS `ID` FROM `' . $wpdb->usermeta . '`
WHERE
(`meta_key` = \'' . $wpdb->prefix . 's2member_last_reminder_scan\' AND `meta_value` >= \'' . esc_sql($scan_time) . '\')
OR (`meta_key` = \'' . $wpdb->prefix . 's2member_reminders_enable\' AND `meta_value` = \'0\')
';
$additional_user_ids_to_exclude = apply_filters('ws_plugin__s2member_pro_eot_reminders_exclude_user_ids', array(), get_defined_vars());
$sql = '
SELECT DISTINCT `user_id` AS `ID` FROM `' . $wpdb->usermeta . '`
WHERE `user_id` NOT IN(' . $user_ids_to_exclude . ')
' . ($additional_user_ids_to_exclude ? 'AND `user_id` NOT IN(\'' . implode("','", $additional_user_ids_to_exclude) . '\')' : '') . '
AND (
(`meta_key` = \'' . $wpdb->prefix . 's2member_subscr_gateway\' AND `meta_value` != \'\')
OR (`meta_key` = \'' . $wpdb->prefix . 's2member_auto_eot_time\' AND `meta_value` != \'\')
OR (`meta_key` = \'' . $wpdb->prefix . 's2member_last_auto_eot_time\' AND `meta_value` != \'\')
)
LIMIT ' . esc_sql($per_process) . '
';
if (!($user_ids = $wpdb->get_col($sql))) {
return;
// Nothing to do here.
}
$email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status();
c_ws_plugin__s2member_email_configs::email_config();
foreach ($user_ids as $_user_id) {
$_eot = $_day = $_recipients = $_subject = $_message = null;
if (!($_user = new WP_User($_user_id)) || !$_user->ID) {
continue;
// Possible DB corruption.
}
update_user_option($_user->ID, 's2member_last_reminder_scan', self::$now);
$_eot = c_ws_plugin__s2member_utils_users::get_user_eot($_user->ID);
if (!$_eot || !$_eot['type'] || !$_eot['time'] || !$_eot['tense']) {
continue;
// Nothing to do; i.e., no EOT or NPT time.
} elseif ($_eot['type'] === 'next' && !$options['pro_eot_reminder_email_on_npt_also']) {
continue;
// Nothing to do; i.e., not an EOT time and no NPTs.
} elseif (!($_day = self::calculate_day($_eot['time'])) && $_day !== '0') {
continue;
// Unable to calculate day.
} elseif (!in_array($_day, $days, true)) {
continue;
// Nothing on this day.
} elseif (!($_recipients = self::get_recipients_for_day($_day))) {
continue;
// No recipients.
} elseif (!($_subject = self::get_subject_for_day($_day))) {
continue;
// No subject.
} elseif (!($_message = self::get_message_for_day($_day))) {
continue;
// No message.
}
//
self::fill_replacement_codes($_user, $_eot, $_recipients, $_subject, $_message);
$_mail_from = apply_filters('ws_plugin__s2member_pro_eot_reminder_email_from', $mail_from, get_defined_vars());
$_recipients = apply_filters('ws_plugin__s2member_pro_eot_reminder_email_recipients', $_recipients, get_defined_vars());
$_subject = apply_filters('ws_plugin__s2member_pro_eot_reminder_email_subject', $_subject, get_defined_vars());
//.........这里部分代码省略.........